00001 /* 00002 * Copyright (C) 2004-2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 1999-2003 Internet Software Consortium. 00004 * 00005 * Permission to use, copy, modify, and/or distribute this software for any 00006 * purpose with or without fee is hereby granted, provided that the above 00007 * copyright notice and this permission notice appear in all copies. 00008 * 00009 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00010 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00011 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00012 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00013 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00014 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00015 * PERFORMANCE OF THIS SOFTWARE. 00016 */ 00017 00018 #ifndef DNS_RDATASET_H 00019 #define DNS_RDATASET_H 1 00020 00021 /***** 00022 ***** Module Info 00023 *****/ 00024 00025 /*! \file dns/rdataset.h 00026 * \brief 00027 * A DNS rdataset is a handle that can be associated with a collection of 00028 * rdata all having a common owner name, class, and type. 00029 * 00030 * The dns_rdataset_t type is like a "virtual class". To actually use 00031 * rdatasets, an implementation of the method suite (e.g. "slabbed rdata") is 00032 * required. 00033 * 00034 * XXX <more> XXX 00035 * 00036 * MP: 00037 *\li Clients of this module must impose any required synchronization. 00038 * 00039 * Reliability: 00040 *\li No anticipated impact. 00041 * 00042 * Resources: 00043 *\li TBS 00044 * 00045 * Security: 00046 *\li No anticipated impact. 00047 * 00048 * Standards: 00049 *\li None. 00050 */ 00051 00052 #include <isc/lang.h> 00053 #include <isc/magic.h> 00054 #include <isc/stdtime.h> 00055 00056 #include <dns/types.h> 00057 #include <dns/rdatastruct.h> 00058 00059 ISC_LANG_BEGINDECLS 00060 00061 typedef enum { 00062 dns_rdatasetadditional_fromauth, 00063 dns_rdatasetadditional_fromcache, 00064 dns_rdatasetadditional_fromglue 00065 } dns_rdatasetadditional_t; 00066 00067 typedef struct dns_rdatasetmethods { 00068 void (*disassociate)(dns_rdataset_t *rdataset); 00069 isc_result_t (*first)(dns_rdataset_t *rdataset); 00070 isc_result_t (*next)(dns_rdataset_t *rdataset); 00071 void (*current)(dns_rdataset_t *rdataset, 00072 dns_rdata_t *rdata); 00073 void (*clone)(dns_rdataset_t *source, 00074 dns_rdataset_t *target); 00075 unsigned int (*count)(dns_rdataset_t *rdataset); 00076 isc_result_t (*addnoqname)(dns_rdataset_t *rdataset, 00077 dns_name_t *name); 00078 isc_result_t (*getnoqname)(dns_rdataset_t *rdataset, 00079 dns_name_t *name, 00080 dns_rdataset_t *neg, 00081 dns_rdataset_t *negsig); 00082 isc_result_t (*addclosest)(dns_rdataset_t *rdataset, 00083 dns_name_t *name); 00084 isc_result_t (*getclosest)(dns_rdataset_t *rdataset, 00085 dns_name_t *name, 00086 dns_rdataset_t *neg, 00087 dns_rdataset_t *negsig); 00088 isc_result_t (*getadditional)(dns_rdataset_t *rdataset, 00089 dns_rdatasetadditional_t type, 00090 dns_rdatatype_t qtype, 00091 dns_acache_t *acache, 00092 dns_zone_t **zonep, 00093 dns_db_t **dbp, 00094 dns_dbversion_t **versionp, 00095 dns_dbnode_t **nodep, 00096 dns_name_t *fname, 00097 dns_message_t *msg, 00098 isc_stdtime_t now); 00099 isc_result_t (*setadditional)(dns_rdataset_t *rdataset, 00100 dns_rdatasetadditional_t type, 00101 dns_rdatatype_t qtype, 00102 dns_acache_t *acache, 00103 dns_zone_t *zone, 00104 dns_db_t *db, 00105 dns_dbversion_t *version, 00106 dns_dbnode_t *node, 00107 dns_name_t *fname); 00108 isc_result_t (*putadditional)(dns_acache_t *acache, 00109 dns_rdataset_t *rdataset, 00110 dns_rdatasetadditional_t type, 00111 dns_rdatatype_t qtype); 00112 void (*settrust)(dns_rdataset_t *rdataset, 00113 dns_trust_t trust); 00114 void (*expire)(dns_rdataset_t *rdataset); 00115 void (*clearprefetch)(dns_rdataset_t *rdataset); 00116 void (*setownercase)(dns_rdataset_t *rdataset, 00117 const dns_name_t *name); 00118 void (*getownercase)(const dns_rdataset_t *rdataset, dns_name_t *name); 00119 } dns_rdatasetmethods_t; 00120 00121 #define DNS_RDATASET_MAGIC ISC_MAGIC('D','N','S','R') 00122 #define DNS_RDATASET_VALID(set) ISC_MAGIC_VALID(set, DNS_RDATASET_MAGIC) 00123 00124 /*% 00125 * Direct use of this structure by clients is strongly discouraged, except 00126 * for the 'link' field which may be used however the client wishes. The 00127 * 'private', 'current', and 'index' fields MUST NOT be changed by clients. 00128 * rdataset implementations may change any of the fields. 00129 */ 00130 struct dns_rdataset { 00131 unsigned int magic; /* XXX ? */ 00132 dns_rdatasetmethods_t * methods; 00133 ISC_LINK(dns_rdataset_t) link; 00134 /* 00135 * XXX do we need these, or should they be retrieved by methods? 00136 * Leaning towards the latter, since they are not frequently required 00137 * once you have the rdataset. 00138 */ 00139 dns_rdataclass_t rdclass; 00140 dns_rdatatype_t type; 00141 dns_ttl_t ttl; 00142 dns_trust_t trust; 00143 dns_rdatatype_t covers; 00144 /* 00145 * attributes 00146 */ 00147 unsigned int attributes; 00148 /*% 00149 * the counter provides the starting point in the "cyclic" order. 00150 * The value ISC_UINT32_MAX has a special meaning of "picking up a 00151 * random value." in order to take care of databases that do not 00152 * increment the counter. 00153 */ 00154 isc_uint32_t count; 00155 /* 00156 * This RRSIG RRset should be re-generated around this time. 00157 * Only valid if DNS_RDATASETATTR_RESIGN is set in attributes. 00158 */ 00159 isc_stdtime_t resign; 00160 /*@{*/ 00161 /*% 00162 * These are for use by the rdataset implementation, and MUST NOT 00163 * be changed by clients. 00164 */ 00165 void * private1; 00166 void * private2; 00167 void * private3; 00168 unsigned int privateuint4; 00169 void * private5; 00170 void * private6; 00171 void * private7; 00172 /*@}*/ 00173 00174 }; 00175 00176 /*! 00177 * \def DNS_RDATASETATTR_RENDERED 00178 * Used by message.c to indicate that the rdataset was rendered. 00179 * 00180 * \def DNS_RDATASETATTR_TTLADJUSTED 00181 * Used by message.c to indicate that the rdataset's rdata had differing 00182 * TTL values, and the rdataset->ttl holds the smallest. 00183 * 00184 * \def DNS_RDATASETATTR_LOADORDER 00185 * Output the RRset in load order. 00186 */ 00187 00188 #define DNS_RDATASETATTR_QUESTION 0x00000001 00189 #define DNS_RDATASETATTR_RENDERED 0x00000002 /*%< Used by message.c */ 00190 #define DNS_RDATASETATTR_ANSWERED 0x00000004 /*%< Used by server. */ 00191 #define DNS_RDATASETATTR_CACHE 0x00000008 /*%< Used by resolver. */ 00192 #define DNS_RDATASETATTR_ANSWER 0x00000010 /*%< Used by resolver. */ 00193 #define DNS_RDATASETATTR_ANSWERSIG 0x00000020 /*%< Used by resolver. */ 00194 #define DNS_RDATASETATTR_EXTERNAL 0x00000040 /*%< Used by resolver. */ 00195 #define DNS_RDATASETATTR_NCACHE 0x00000080 /*%< Used by resolver. */ 00196 #define DNS_RDATASETATTR_CHAINING 0x00000100 /*%< Used by resolver. */ 00197 #define DNS_RDATASETATTR_TTLADJUSTED 0x00000200 /*%< Used by message.c */ 00198 #define DNS_RDATASETATTR_FIXEDORDER 0x00000400 00199 #define DNS_RDATASETATTR_RANDOMIZE 0x00000800 00200 #define DNS_RDATASETATTR_CHASE 0x00001000 /*%< Used by resolver. */ 00201 #define DNS_RDATASETATTR_NXDOMAIN 0x00002000 00202 #define DNS_RDATASETATTR_NOQNAME 0x00004000 00203 #define DNS_RDATASETATTR_CHECKNAMES 0x00008000 /*%< Used by resolver. */ 00204 #define DNS_RDATASETATTR_REQUIRED 0x00010000 00205 #define DNS_RDATASETATTR_REQUIREDGLUE DNS_RDATASETATTR_REQUIRED 00206 #define DNS_RDATASETATTR_LOADORDER 0x00020000 00207 #define DNS_RDATASETATTR_RESIGN 0x00040000 00208 #define DNS_RDATASETATTR_CLOSEST 0x00080000 00209 #define DNS_RDATASETATTR_OPTOUT 0x00100000 /*%< OPTOUT proof */ 00210 #define DNS_RDATASETATTR_NEGATIVE 0x00200000 00211 #define DNS_RDATASETATTR_PREFETCH 0x00400000 00212 00213 /*% 00214 * _OMITDNSSEC: 00215 * Omit DNSSEC records when rendering ncache records. 00216 */ 00217 #define DNS_RDATASETTOWIRE_OMITDNSSEC 0x0001 00218 00219 void 00220 dns_rdataset_init(dns_rdataset_t *rdataset); 00221 /*%< 00222 * Make 'rdataset' a valid, disassociated rdataset. 00223 * 00224 * Requires: 00225 *\li 'rdataset' is not NULL. 00226 * 00227 * Ensures: 00228 *\li 'rdataset' is a valid, disassociated rdataset. 00229 */ 00230 00231 void 00232 dns_rdataset_invalidate(dns_rdataset_t *rdataset); 00233 /*%< 00234 * Invalidate 'rdataset'. 00235 * 00236 * Requires: 00237 *\li 'rdataset' is a valid, disassociated rdataset. 00238 * 00239 * Ensures: 00240 *\li If assertion checking is enabled, future attempts to use 'rdataset' 00241 * without initializing it will cause an assertion failure. 00242 */ 00243 00244 void 00245 dns_rdataset_disassociate(dns_rdataset_t *rdataset); 00246 /*%< 00247 * Disassociate 'rdataset' from its rdata, allowing it to be reused. 00248 * 00249 * Notes: 00250 *\li The client must ensure it has no references to rdata in the rdataset 00251 * before disassociating. 00252 * 00253 * Requires: 00254 *\li 'rdataset' is a valid, associated rdataset. 00255 * 00256 * Ensures: 00257 *\li 'rdataset' is a valid, disassociated rdataset. 00258 */ 00259 00260 isc_boolean_t 00261 dns_rdataset_isassociated(dns_rdataset_t *rdataset); 00262 /*%< 00263 * Is 'rdataset' associated? 00264 * 00265 * Requires: 00266 *\li 'rdataset' is a valid rdataset. 00267 * 00268 * Returns: 00269 *\li #ISC_TRUE 'rdataset' is associated. 00270 *\li #ISC_FALSE 'rdataset' is not associated. 00271 */ 00272 00273 void 00274 dns_rdataset_makequestion(dns_rdataset_t *rdataset, dns_rdataclass_t rdclass, 00275 dns_rdatatype_t type); 00276 /*%< 00277 * Make 'rdataset' a valid, associated, question rdataset, with a 00278 * question class of 'rdclass' and type 'type'. 00279 * 00280 * Notes: 00281 *\li Question rdatasets have a class and type, but no rdata. 00282 * 00283 * Requires: 00284 *\li 'rdataset' is a valid, disassociated rdataset. 00285 * 00286 * Ensures: 00287 *\li 'rdataset' is a valid, associated, question rdataset. 00288 */ 00289 00290 void 00291 dns_rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target); 00292 /*%< 00293 * Make 'target' refer to the same rdataset as 'source'. 00294 * 00295 * Requires: 00296 *\li 'source' is a valid, associated rdataset. 00297 * 00298 *\li 'target' is a valid, dissociated rdataset. 00299 * 00300 * Ensures: 00301 *\li 'target' references the same rdataset as 'source'. 00302 */ 00303 00304 unsigned int 00305 dns_rdataset_count(dns_rdataset_t *rdataset); 00306 /*%< 00307 * Return the number of records in 'rdataset'. 00308 * 00309 * Requires: 00310 *\li 'rdataset' is a valid, associated rdataset. 00311 * 00312 * Returns: 00313 *\li The number of records in 'rdataset'. 00314 */ 00315 00316 isc_result_t 00317 dns_rdataset_first(dns_rdataset_t *rdataset); 00318 /*%< 00319 * Move the rdata cursor to the first rdata in the rdataset (if any). 00320 * 00321 * Requires: 00322 *\li 'rdataset' is a valid, associated rdataset. 00323 * 00324 * Returns: 00325 *\li #ISC_R_SUCCESS 00326 *\li #ISC_R_NOMORE There are no rdata in the set. 00327 */ 00328 00329 isc_result_t 00330 dns_rdataset_next(dns_rdataset_t *rdataset); 00331 /*%< 00332 * Move the rdata cursor to the next rdata in the rdataset (if any). 00333 * 00334 * Requires: 00335 *\li 'rdataset' is a valid, associated rdataset. 00336 * 00337 * Returns: 00338 *\li #ISC_R_SUCCESS 00339 *\li #ISC_R_NOMORE There are no more rdata in the set. 00340 */ 00341 00342 void 00343 dns_rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata); 00344 /*%< 00345 * Make 'rdata' refer to the current rdata. 00346 * 00347 * Notes: 00348 * 00349 *\li The data returned in 'rdata' is valid for the life of the 00350 * rdataset; in particular, subsequent changes in the cursor position 00351 * do not invalidate 'rdata'. 00352 * 00353 * Requires: 00354 *\li 'rdataset' is a valid, associated rdataset. 00355 * 00356 *\li The rdata cursor of 'rdataset' is at a valid location (i.e. the 00357 * result of last call to a cursor movement command was ISC_R_SUCCESS). 00358 * 00359 * Ensures: 00360 *\li 'rdata' refers to the rdata at the rdata cursor location of 00361 *\li 'rdataset'. 00362 */ 00363 00364 isc_result_t 00365 dns_rdataset_totext(dns_rdataset_t *rdataset, 00366 dns_name_t *owner_name, 00367 isc_boolean_t omit_final_dot, 00368 isc_boolean_t question, 00369 isc_buffer_t *target); 00370 /*%< 00371 * Convert 'rdataset' to text format, storing the result in 'target'. 00372 * 00373 * Notes: 00374 *\li The rdata cursor position will be changed. 00375 * 00376 *\li The 'question' flag should normally be #ISC_FALSE. If it is 00377 * #ISC_TRUE, the TTL and rdata fields are not printed. This is 00378 * for use when printing an rdata representing a question section. 00379 * 00380 *\li This interface is deprecated; use dns_master_rdatasettottext() 00381 * and/or dns_master_questiontotext() instead. 00382 * 00383 * Requires: 00384 *\li 'rdataset' is a valid rdataset. 00385 * 00386 *\li 'rdataset' is not empty. 00387 */ 00388 00389 isc_result_t 00390 dns_rdataset_towire(dns_rdataset_t *rdataset, 00391 dns_name_t *owner_name, 00392 dns_compress_t *cctx, 00393 isc_buffer_t *target, 00394 unsigned int options, 00395 unsigned int *countp); 00396 /*%< 00397 * Convert 'rdataset' to wire format, compressing names as specified 00398 * in 'cctx', and storing the result in 'target'. 00399 * 00400 * Notes: 00401 *\li The rdata cursor position will be changed. 00402 * 00403 *\li The number of RRs added to target will be added to *countp. 00404 * 00405 * Requires: 00406 *\li 'rdataset' is a valid rdataset. 00407 * 00408 *\li 'rdataset' is not empty. 00409 * 00410 *\li 'countp' is a valid pointer. 00411 * 00412 * Ensures: 00413 *\li On a return of ISC_R_SUCCESS, 'target' contains a wire format 00414 * for the data contained in 'rdataset'. Any error return leaves 00415 * the buffer unchanged. 00416 * 00417 *\li *countp has been incremented by the number of RRs added to 00418 * target. 00419 * 00420 * Returns: 00421 *\li #ISC_R_SUCCESS - all ok 00422 *\li #ISC_R_NOSPACE - 'target' doesn't have enough room 00423 * 00424 *\li Any error returned by dns_rdata_towire(), dns_rdataset_next(), 00425 * dns_name_towire(). 00426 */ 00427 00428 isc_result_t 00429 dns_rdataset_towiresorted(dns_rdataset_t *rdataset, 00430 const dns_name_t *owner_name, 00431 dns_compress_t *cctx, 00432 isc_buffer_t *target, 00433 dns_rdatasetorderfunc_t order, 00434 const void *order_arg, 00435 unsigned int options, 00436 unsigned int *countp); 00437 /*%< 00438 * Like dns_rdataset_towire(), but sorting the rdatasets according to 00439 * the integer value returned by 'order' when called with the rdataset 00440 * and 'order_arg' as arguments. 00441 * 00442 * Requires: 00443 *\li All the requirements of dns_rdataset_towire(), and 00444 * that order_arg is NULL if and only if order is NULL. 00445 */ 00446 00447 isc_result_t 00448 dns_rdataset_towirepartial(dns_rdataset_t *rdataset, 00449 const dns_name_t *owner_name, 00450 dns_compress_t *cctx, 00451 isc_buffer_t *target, 00452 dns_rdatasetorderfunc_t order, 00453 const void *order_arg, 00454 unsigned int options, 00455 unsigned int *countp, 00456 void **state); 00457 /*%< 00458 * Like dns_rdataset_towiresorted() except that a partial rdataset 00459 * may be written. 00460 * 00461 * Requires: 00462 *\li All the requirements of dns_rdataset_towiresorted(). 00463 * If 'state' is non NULL then the current position in the 00464 * rdataset will be remembered if the rdataset in not 00465 * completely written and should be passed on on subsequent 00466 * calls (NOT CURRENTLY IMPLEMENTED). 00467 * 00468 * Returns: 00469 *\li #ISC_R_SUCCESS if all of the records were written. 00470 *\li #ISC_R_NOSPACE if unable to fit in all of the records. *countp 00471 * will be updated to reflect the number of records 00472 * written. 00473 */ 00474 00475 isc_result_t 00476 dns_rdataset_additionaldata(dns_rdataset_t *rdataset, 00477 dns_additionaldatafunc_t add, void *arg); 00478 /*%< 00479 * For each rdata in rdataset, call 'add' for each name and type in the 00480 * rdata which is subject to additional section processing. 00481 * 00482 * Requires: 00483 * 00484 *\li 'rdataset' is a valid, non-question rdataset. 00485 * 00486 *\li 'add' is a valid dns_additionaldatafunc_t 00487 * 00488 * Ensures: 00489 * 00490 *\li If successful, dns_rdata_additionaldata() will have been called for 00491 * each rdata in 'rdataset'. 00492 * 00493 *\li If a call to dns_rdata_additionaldata() is not successful, the 00494 * result returned will be the result of dns_rdataset_additionaldata(). 00495 * 00496 * Returns: 00497 * 00498 *\li #ISC_R_SUCCESS 00499 * 00500 *\li Any error that dns_rdata_additionaldata() can return. 00501 */ 00502 00503 isc_result_t 00504 dns_rdataset_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, 00505 dns_rdataset_t *neg, dns_rdataset_t *negsig); 00506 /*%< 00507 * Return the noqname proof for this record. 00508 * 00509 * Requires: 00510 *\li 'rdataset' to be valid and #DNS_RDATASETATTR_NOQNAME to be set. 00511 *\li 'name' to be valid. 00512 *\li 'neg' and 'negsig' to be valid and not associated. 00513 */ 00514 00515 isc_result_t 00516 dns_rdataset_addnoqname(dns_rdataset_t *rdataset, dns_name_t *name); 00517 /*%< 00518 * Associate a noqname proof with this record. 00519 * Sets #DNS_RDATASETATTR_NOQNAME if successful. 00520 * Adjusts the 'rdataset->ttl' to minimum of the 'rdataset->ttl' and 00521 * the 'nsec'/'nsec3' and 'rrsig(nsec)'/'rrsig(nsec3)' ttl. 00522 * 00523 * Requires: 00524 *\li 'rdataset' to be valid and #DNS_RDATASETATTR_NOQNAME to be set. 00525 *\li 'name' to be valid and have NSEC or NSEC3 and associated RRSIG 00526 * rdatasets. 00527 */ 00528 00529 isc_result_t 00530 dns_rdataset_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, 00531 dns_rdataset_t *nsec, dns_rdataset_t *nsecsig); 00532 /*%< 00533 * Return the closest encloser for this record. 00534 * 00535 * Requires: 00536 *\li 'rdataset' to be valid and #DNS_RDATASETATTR_CLOSEST to be set. 00537 *\li 'name' to be valid. 00538 *\li 'nsec' and 'nsecsig' to be valid and not associated. 00539 */ 00540 00541 isc_result_t 00542 dns_rdataset_addclosest(dns_rdataset_t *rdataset, dns_name_t *name); 00543 /*%< 00544 * Associate a closest encloset proof with this record. 00545 * Sets #DNS_RDATASETATTR_CLOSEST if successful. 00546 * Adjusts the 'rdataset->ttl' to minimum of the 'rdataset->ttl' and 00547 * the 'nsec' and 'rrsig(nsec)' ttl. 00548 * 00549 * Requires: 00550 *\li 'rdataset' to be valid and #DNS_RDATASETATTR_CLOSEST to be set. 00551 *\li 'name' to be valid and have NSEC3 and RRSIG(NSEC3) rdatasets. 00552 */ 00553 00554 isc_result_t 00555 dns_rdataset_getadditional(dns_rdataset_t *rdataset, 00556 dns_rdatasetadditional_t type, 00557 dns_rdatatype_t qtype, 00558 dns_acache_t *acache, 00559 dns_zone_t **zonep, 00560 dns_db_t **dbp, 00561 dns_dbversion_t **versionp, 00562 dns_dbnode_t **nodep, 00563 dns_name_t *fname, 00564 dns_message_t *msg, 00565 isc_stdtime_t now); 00566 /*%< 00567 * Get cached additional information from the DB node for a particular 00568 * 'rdataset.' 'type' is one of dns_rdatasetadditional_fromauth, 00569 * dns_rdatasetadditional_fromcache, and dns_rdatasetadditional_fromglue, 00570 * which specifies the origin of the information. 'qtype' is intended to 00571 * be used for specifying a particular rdata type in the cached information. 00572 * 00573 * Requires: 00574 * \li 'rdataset' is a valid rdataset. 00575 * \li 'acache' can be NULL, in which case this function will simply return 00576 * ISC_R_FAILURE. 00577 * \li For the other pointers, see dns_acache_getentry(). 00578 * 00579 * Ensures: 00580 * \li See dns_acache_getentry(). 00581 * 00582 * Returns: 00583 * \li #ISC_R_SUCCESS 00584 * \li #ISC_R_FAILURE - additional information caching is not supported. 00585 * \li #ISC_R_NOTFOUND - the corresponding DB node has not cached additional 00586 * information for 'rdataset.' 00587 * \li Any error that dns_acache_getentry() can return. 00588 */ 00589 00590 isc_result_t 00591 dns_rdataset_setadditional(dns_rdataset_t *rdataset, 00592 dns_rdatasetadditional_t type, 00593 dns_rdatatype_t qtype, 00594 dns_acache_t *acache, 00595 dns_zone_t *zone, 00596 dns_db_t *db, 00597 dns_dbversion_t *version, 00598 dns_dbnode_t *node, 00599 dns_name_t *fname); 00600 /*%< 00601 * Set cached additional information to the DB node for a particular 00602 * 'rdataset.' See dns_rdataset_getadditional for the semantics of 'type' 00603 * and 'qtype'. 00604 * 00605 * Requires: 00606 * \li 'rdataset' is a valid rdataset. 00607 * \li 'acache' can be NULL, in which case this function will simply return 00608 * ISC_R_FAILURE. 00609 * \li For the other pointers, see dns_acache_setentry(). 00610 * 00611 * Ensures: 00612 * \li See dns_acache_setentry(). 00613 * 00614 * Returns: 00615 * \li #ISC_R_SUCCESS 00616 * \li #ISC_R_FAILURE - additional information caching is not supported. 00617 * \li #ISC_R_NOMEMORY 00618 * \li Any error that dns_acache_setentry() can return. 00619 */ 00620 00621 isc_result_t 00622 dns_rdataset_putadditional(dns_acache_t *acache, 00623 dns_rdataset_t *rdataset, 00624 dns_rdatasetadditional_t type, 00625 dns_rdatatype_t qtype); 00626 /*%< 00627 * Discard cached additional information stored in the DB node for a particular 00628 * 'rdataset.' See dns_rdataset_getadditional for the semantics of 'type' 00629 * and 'qtype'. 00630 * 00631 * Requires: 00632 * \li 'rdataset' is a valid rdataset. 00633 * \li 'acache' can be NULL, in which case this function will simply return 00634 * ISC_R_FAILURE. 00635 * 00636 * Ensures: 00637 * \li See dns_acache_cancelentry(). 00638 * 00639 * Returns: 00640 * \li #ISC_R_SUCCESS 00641 * \li #ISC_R_FAILURE - additional information caching is not supported. 00642 * \li #ISC_R_NOTFOUND - the corresponding DB node has not cached additional 00643 * information for 'rdataset.' 00644 */ 00645 00646 void 00647 dns_rdataset_settrust(dns_rdataset_t *rdataset, dns_trust_t trust); 00648 /*%< 00649 * Set the trust of the 'rdataset' to trust in any in the backing database. 00650 * The local trust level of 'rdataset' is also set. 00651 */ 00652 00653 void 00654 dns_rdataset_expire(dns_rdataset_t *rdataset); 00655 /*%< 00656 * Mark the rdataset to be expired in the backing database. 00657 */ 00658 00659 void 00660 dns_rdataset_clearprefetch(dns_rdataset_t *rdataset); 00661 /*%< 00662 * Clear the PREFETCH attribute for the given rdataset in the 00663 * underlying database. 00664 * 00665 * In the cache database, this signals that the rdataset is not 00666 * eligible to be prefetched when the TTL is close to expiring. 00667 * It has no function in other databases. 00668 */ 00669 00670 void 00671 dns_rdataset_setownercase(dns_rdataset_t *rdataset, const dns_name_t *name); 00672 /*%< 00673 * Store the casing of 'name', the owner name of 'rdataset', into 00674 * a bitfield so that the name can be capitalized the same when when 00675 * the rdataset is used later. This sets the CASESET attribute. 00676 */ 00677 00678 void 00679 dns_rdataset_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name); 00680 /*%< 00681 * If the CASESET attribute is set, retrieve the case bitfield that was 00682 * previously stored by dns_rdataset_getownername(), and capitalize 'name' 00683 * according to it. If CASESET is not set, do nothing. 00684 */ 00685 00686 void 00687 dns_rdataset_trimttl(dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, 00688 dns_rdata_rrsig_t *rrsig, isc_stdtime_t now, 00689 isc_boolean_t acceptexpired); 00690 /*%< 00691 * Trim the ttl of 'rdataset' and 'sigrdataset' so that they will expire 00692 * at or before 'rrsig->expiretime'. If 'acceptexpired' is true and the 00693 * signature has expired or will expire in the next 120 seconds, limit 00694 * the ttl to be no more than 120 seconds. 00695 * 00696 * The ttl is further limited by the original ttl as stored in 'rrsig' 00697 * and the original ttl values of 'rdataset' and 'sigrdataset'. 00698 * 00699 * Requires: 00700 * \li 'rdataset' is a valid rdataset. 00701 * \li 'sigrdataset' is a valid rdataset. 00702 * \li 'rrsig' is non NULL. 00703 */ 00704 00705 const char * 00706 dns_trust_totext(dns_trust_t trust); 00707 /*%< 00708 * Display trust in textual form. 00709 */ 00710 00711 ISC_LANG_ENDDECLS 00712 00713 #endif /* DNS_RDATASET_H */