1 /* $NetBSD: rdataset.h,v 1.13 2025/01/26 16:25:28 christos Exp $ */ 2 3 /* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * SPDX-License-Identifier: MPL-2.0 7 * 8 * This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11 * 12 * See the COPYRIGHT file distributed with this work for additional 13 * information regarding copyright ownership. 14 */ 15 16 #pragma once 17 18 /***** 19 ***** Module Info 20 *****/ 21 22 /*! \file dns/rdataset.h 23 * \brief 24 * A DNS rdataset is a handle that can be associated with a collection of 25 * rdata all having a common owner name, class, and type. 26 * 27 * The dns_rdataset_t type is like a "virtual class". To actually use 28 * rdatasets, an implementation of the method suite (e.g. "slabbed rdata") is 29 * required. 30 * 31 * XXX <more> XXX 32 * 33 * MP: 34 *\li Clients of this module must impose any required synchronization. 35 * 36 * Reliability: 37 *\li No anticipated impact. 38 * 39 * Resources: 40 *\li TBS 41 * 42 * Security: 43 *\li No anticipated impact. 44 * 45 * Standards: 46 *\li None. 47 */ 48 49 #include <inttypes.h> 50 #include <stdbool.h> 51 52 #include <isc/lang.h> 53 #include <isc/magic.h> 54 #include <isc/stdtime.h> 55 56 #include <dns/rdatastruct.h> 57 #include <dns/types.h> 58 59 /* Fixed RRSet helper macros */ 60 61 #define DNS_RDATASET_LENGTH 2; 62 63 #if DNS_RDATASET_FIXED 64 #define DNS_RDATASET_ORDER 2 65 #define DNS_RDATASET_COUNT (count * 4) 66 #else /* !DNS_RDATASET_FIXED */ 67 #define DNS_RDATASET_ORDER 0 68 #define DNS_RDATASET_COUNT 0 69 #endif /* DNS_RDATASET_FIXED */ 70 71 ISC_LANG_BEGINDECLS 72 73 typedef enum { 74 dns_rdatasetadditional_fromauth, 75 dns_rdatasetadditional_fromcache, 76 dns_rdatasetadditional_fromglue 77 } dns_rdatasetadditional_t; 78 79 typedef struct dns_rdatasetmethods { 80 void (*disassociate)(dns_rdataset_t *rdataset DNS__DB_FLARG); 81 isc_result_t (*first)(dns_rdataset_t *rdataset); 82 isc_result_t (*next)(dns_rdataset_t *rdataset); 83 void (*current)(dns_rdataset_t *rdataset, dns_rdata_t *rdata); 84 void (*clone)(dns_rdataset_t *source, 85 dns_rdataset_t *target DNS__DB_FLARG); 86 unsigned int (*count)(dns_rdataset_t *rdataset); 87 isc_result_t (*addnoqname)(dns_rdataset_t *rdataset, 88 const dns_name_t *name); 89 isc_result_t (*getnoqname)(dns_rdataset_t *rdataset, dns_name_t *name, 90 dns_rdataset_t *neg, 91 dns_rdataset_t *negsig DNS__DB_FLARG); 92 isc_result_t (*addclosest)(dns_rdataset_t *rdataset, 93 const dns_name_t *name); 94 isc_result_t (*getclosest)(dns_rdataset_t *rdataset, dns_name_t *name, 95 dns_rdataset_t *neg, 96 dns_rdataset_t *negsig DNS__DB_FLARG); 97 void (*settrust)(dns_rdataset_t *rdataset, dns_trust_t trust); 98 void (*expire)(dns_rdataset_t *rdataset DNS__DB_FLARG); 99 void (*clearprefetch)(dns_rdataset_t *rdataset); 100 void (*setownercase)(dns_rdataset_t *rdataset, const dns_name_t *name); 101 void (*getownercase)(const dns_rdataset_t *rdataset, dns_name_t *name); 102 isc_result_t (*addglue)(dns_rdataset_t *rdataset, 103 dns_dbversion_t *version, dns_message_t *msg); 104 } dns_rdatasetmethods_t; 105 106 #define DNS_RDATASET_MAGIC ISC_MAGIC('D', 'N', 'S', 'R') 107 #define DNS_RDATASET_VALID(set) ISC_MAGIC_VALID(set, DNS_RDATASET_MAGIC) 108 109 /*% 110 * Direct use of this structure by clients is strongly discouraged, except 111 * for the 'link' field which may be used however the client wishes. The 112 * 'private', 'current', and 'index' fields MUST NOT be changed by clients. 113 * rdataset implementations may change any of the fields. 114 */ 115 struct dns_rdataset { 116 unsigned int magic; 117 dns_rdatasetmethods_t *methods; 118 ISC_LINK(dns_rdataset_t) link; 119 120 /* 121 * XXX do we need these, or should they be retrieved by methods? 122 * Leaning towards the latter, since they are not frequently required 123 * once you have the rdataset. 124 */ 125 dns_rdataclass_t rdclass; 126 dns_rdatatype_t type; 127 dns_ttl_t ttl; 128 129 dns_trust_t trust; 130 dns_rdatatype_t covers; 131 132 /* 133 * attributes 134 */ 135 unsigned int attributes; 136 137 /*% 138 * the counter provides the starting point in the "cyclic" order. 139 * The value UINT32_MAX has a special meaning of "picking up a 140 * random value." in order to take care of databases that do not 141 * increment the counter. 142 */ 143 uint32_t count; 144 145 /* 146 * This RRSIG RRset should be re-generated around this time. 147 * Only valid if DNS_RDATASETATTR_RESIGN is set in attributes. 148 */ 149 isc_stdtime_t resign; 150 151 /*% 152 * Extra fields used by various rdataset implementations, that is, by 153 * the code referred to in the rdataset methods table. The names of 154 * the structures roughly correspond to the file containing the 155 * implementation, except that `rdlist` is used by `rdatalist.c`, 156 * `sdb.c`, and `sdlz.c`. 157 * 158 * Pointers in these structs use incomplete structure types, 159 * because the structure definitions and corresponding typedef 160 * names might not be in scope in this header. 161 */ 162 /*@}*/ 163 union { 164 struct { 165 struct dns_keynode *node; 166 dns_rdata_t *iter; 167 } keytable; 168 169 /* 170 * An ncache rdataset is a view of memory held elsewhere: 171 * raw can point to either a buffer on the stack or to an 172 * rdataslab, such as in an rbtdb database. 173 */ 174 struct { 175 unsigned char *raw; 176 unsigned char *iter_pos; 177 unsigned int iter_count; 178 } ncache; 179 180 /* 181 * A slab rdataset provides access to an rdataslab. In 182 * an rbtdb database, 'raw' will generally point to the 183 * memory immediately following a slabheader. (There 184 * is an exception in the case of rdatasets returned by 185 * the `getnoqname` and `getclosest` methods; see 186 * comments in rbtdb.c for details.) 187 */ 188 struct { 189 struct dns_db *db; 190 dns_dbnode_t *node; 191 unsigned char *raw; 192 unsigned char *iter_pos; 193 unsigned int iter_count; 194 dns_slabheader_proof_t *noqname, *closest; 195 } slab; 196 197 /* 198 * A simple rdatalist, plus an optional dbnode used by 199 * builtin and sdlz. 200 */ 201 struct { 202 struct dns_rdatalist *list; 203 struct dns_rdata *iter; 204 205 /* 206 * These refer to names passed in by the caller of 207 * dns_rdataset_addnoqname() and _addclosest() 208 */ 209 const struct dns_name *noqname, *closest; 210 dns_dbnode_t *node; 211 } rdlist; 212 213 #ifdef USE_DNSRPS 214 /* 215 * DNSRPS rdatasets. dns_rpsdb_t is defined in dnsrps.h. 216 */ 217 struct { 218 dns_rpsdb_t *db; 219 void *iter_pos; 220 unsigned int iter_count; 221 } rps; 222 #endif /* USE_DNSRPS */ 223 }; 224 }; 225 226 #define DNS_RDATASET_COUNT_UNDEFINED UINT32_MAX 227 228 #define DNS_RDATASET_INIT \ 229 { .magic = DNS_RDATASET_MAGIC, \ 230 .link = ISC_LINK_INITIALIZER, \ 231 .count = DNS_RDATASET_COUNT_UNDEFINED } 232 233 /*! 234 * \def DNS_RDATASETATTR_RENDERED 235 * Used by message.c to indicate that the rdataset was rendered. 236 * 237 * \def DNS_RDATASETATTR_TTLADJUSTED 238 * Used by message.c to indicate that the rdataset's rdata had differing 239 * TTL values, and the rdataset->ttl holds the smallest. 240 * 241 * \def DNS_RDATASETATTR_LOADORDER 242 * Output the RRset in load order. 243 * 244 * \def DNS_RDATASETATTR_STALE_ADDED 245 * Set on rdatasets that were added during a stale-answer-client-timeout 246 * lookup. In other words, the RRset was added during a lookup of stale 247 * data and does not necessarily mean that the rdataset itself is stale. 248 */ 249 250 #define DNS_RDATASETATTR_NONE 0x00000000 /*%< No ordering. */ 251 #define DNS_RDATASETATTR_QUESTION 0x00000001 252 #define DNS_RDATASETATTR_RENDERED 0x00000002 /*%< Used by message.c */ 253 #define DNS_RDATASETATTR_ANSWERED 0x00000004 /*%< Used by server. */ 254 #define DNS_RDATASETATTR_CACHE 0x00000008 /*%< Used by resolver. */ 255 #define DNS_RDATASETATTR_ANSWER 0x00000010 /*%< Used by resolver. */ 256 #define DNS_RDATASETATTR_ANSWERSIG 0x00000020 /*%< Used by resolver. */ 257 #define DNS_RDATASETATTR_EXTERNAL 0x00000040 /*%< Used by resolver. */ 258 #define DNS_RDATASETATTR_NCACHE 0x00000080 /*%< Used by resolver. */ 259 #define DNS_RDATASETATTR_CHAINING 0x00000100 /*%< Used by resolver. */ 260 #define DNS_RDATASETATTR_TTLADJUSTED 0x00000200 /*%< Used by message.c */ 261 #define DNS_RDATASETATTR_FIXEDORDER 0x00000400 /*%< Fixed ordering. */ 262 #define DNS_RDATASETATTR_RANDOMIZE 0x00000800 /*%< Random ordering. */ 263 #define DNS_RDATASETATTR_CHASE 0x00001000 /*%< Used by resolver. */ 264 #define DNS_RDATASETATTR_NXDOMAIN 0x00002000 265 #define DNS_RDATASETATTR_NOQNAME 0x00004000 266 #define DNS_RDATASETATTR_CHECKNAMES 0x00008000 /*%< Used by resolver. */ 267 #define DNS_RDATASETATTR_REQUIRED 0x00010000 268 #define DNS_RDATASETATTR_REQUIREDGLUE DNS_RDATASETATTR_REQUIRED 269 #define DNS_RDATASETATTR_LOADORDER 0x00020000 270 #define DNS_RDATASETATTR_RESIGN 0x00040000 271 #define DNS_RDATASETATTR_CLOSEST 0x00080000 272 #define DNS_RDATASETATTR_OPTOUT 0x00100000 /*%< OPTOUT proof */ 273 #define DNS_RDATASETATTR_NEGATIVE 0x00200000 274 #define DNS_RDATASETATTR_PREFETCH 0x00400000 275 #define DNS_RDATASETATTR_CYCLIC 0x00800000 /*%< Cyclic ordering. */ 276 #define DNS_RDATASETATTR_STALE 0x01000000 277 #define DNS_RDATASETATTR_ANCIENT 0x02000000 278 #define DNS_RDATASETATTR_STALE_WINDOW 0x04000000 279 #define DNS_RDATASETATTR_STALE_ADDED 0x08000000 280 #define DNS_RDATASETATTR_KEEPCASE 0x10000000 281 #define DNS_RDATASETATTR_STATICSTUB 0x20000000 282 283 /*% 284 * _OMITDNSSEC: 285 * Omit DNSSEC records when rendering ncache records. 286 */ 287 #define DNS_RDATASETTOWIRE_OMITDNSSEC 0x0001 288 289 void 290 dns_rdataset_init(dns_rdataset_t *rdataset); 291 /*%< 292 * Make 'rdataset' a valid, disassociated rdataset. 293 * 294 * Requires: 295 *\li 'rdataset' is not NULL. 296 * 297 * Ensures: 298 *\li 'rdataset' is a valid, disassociated rdataset. 299 */ 300 301 void 302 dns_rdataset_invalidate(dns_rdataset_t *rdataset); 303 /*%< 304 * Invalidate 'rdataset'. 305 * 306 * Requires: 307 *\li 'rdataset' is a valid, disassociated rdataset. 308 * 309 * Ensures: 310 *\li If assertion checking is enabled, future attempts to use 'rdataset' 311 * without initializing it will cause an assertion failure. 312 */ 313 314 #define dns_rdataset_disassociate(rdataset) \ 315 dns__rdataset_disassociate(rdataset DNS__DB_FILELINE) 316 void 317 dns__rdataset_disassociate(dns_rdataset_t *rdataset DNS__DB_FLARG); 318 /*%< 319 * Disassociate 'rdataset' from its rdata, allowing it to be reused. 320 * 321 * Notes: 322 *\li The client must ensure it has no references to rdata in the rdataset 323 * before disassociating. 324 * 325 * Requires: 326 *\li 'rdataset' is a valid, associated rdataset. 327 * 328 * Ensures: 329 *\li 'rdataset' is a valid, disassociated rdataset. 330 */ 331 332 bool 333 dns_rdataset_isassociated(dns_rdataset_t *rdataset); 334 /*%< 335 * Is 'rdataset' associated? 336 * 337 * Requires: 338 *\li 'rdataset' is a valid rdataset. 339 * 340 * Returns: 341 *\li #true 'rdataset' is associated. 342 *\li #false 'rdataset' is not associated. 343 */ 344 345 void 346 dns_rdataset_makequestion(dns_rdataset_t *rdataset, dns_rdataclass_t rdclass, 347 dns_rdatatype_t type); 348 /*%< 349 * Make 'rdataset' a valid, associated, question rdataset, with a 350 * question class of 'rdclass' and type 'type'. 351 * 352 * Notes: 353 *\li Question rdatasets have a class and type, but no rdata. 354 * 355 * Requires: 356 *\li 'rdataset' is a valid, disassociated rdataset. 357 * 358 * Ensures: 359 *\li 'rdataset' is a valid, associated, question rdataset. 360 */ 361 362 #define dns_rdataset_clone(source, target) \ 363 dns__rdataset_clone(source, target DNS__DB_FILELINE) 364 void 365 dns__rdataset_clone(dns_rdataset_t *source, 366 dns_rdataset_t *target DNS__DB_FLARG); 367 /*%< 368 * Make 'target' refer to the same rdataset as 'source'. 369 * 370 * Requires: 371 *\li 'source' is a valid, associated rdataset. 372 * 373 *\li 'target' is a valid, dissociated rdataset. 374 * 375 * Ensures: 376 *\li 'target' references the same rdataset as 'source'. 377 */ 378 379 unsigned int 380 dns_rdataset_count(dns_rdataset_t *rdataset); 381 /*%< 382 * Return the number of records in 'rdataset'. 383 * 384 * Requires: 385 *\li 'rdataset' is a valid, associated rdataset. 386 * 387 * Returns: 388 *\li The number of records in 'rdataset'. 389 */ 390 391 isc_result_t 392 dns_rdataset_first(dns_rdataset_t *rdataset); 393 /*%< 394 * Move the rdata cursor to the first rdata in the rdataset (if any). 395 * 396 * Requires: 397 *\li 'rdataset' is a valid, associated rdataset. 398 * 399 * Returns: 400 *\li #ISC_R_SUCCESS 401 *\li #ISC_R_NOMORE There are no rdata in the set. 402 */ 403 404 isc_result_t 405 dns_rdataset_next(dns_rdataset_t *rdataset); 406 /*%< 407 * Move the rdata cursor to the next rdata in the rdataset (if any). 408 * 409 * Requires: 410 *\li 'rdataset' is a valid, associated rdataset. 411 * 412 * Returns: 413 *\li #ISC_R_SUCCESS 414 *\li #ISC_R_NOMORE There are no more rdata in the set. 415 */ 416 417 void 418 dns_rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata); 419 /*%< 420 * Make 'rdata' refer to the current rdata. 421 * 422 * Notes: 423 * 424 *\li The data returned in 'rdata' is valid for the life of the 425 * rdataset; in particular, subsequent changes in the cursor position 426 * do not invalidate 'rdata'. 427 * 428 * Requires: 429 *\li 'rdataset' is a valid, associated rdataset. 430 * 431 *\li The rdata cursor of 'rdataset' is at a valid location (i.e. the 432 * result of last call to a cursor movement command was ISC_R_SUCCESS). 433 * 434 * Ensures: 435 *\li 'rdata' refers to the rdata at the rdata cursor location of 436 *\li 'rdataset'. 437 */ 438 439 isc_result_t 440 dns_rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name, 441 bool omit_final_dot, bool question, isc_buffer_t *target); 442 /*%< 443 * Convert 'rdataset' to text format, storing the result in 'target'. 444 * 445 * Notes: 446 *\li The rdata cursor position will be changed. 447 * 448 *\li The 'question' flag should normally be #false. If it is 449 * #true, the TTL and rdata fields are not printed. This is 450 * for use when printing an rdata representing a question section. 451 * 452 *\li This interface is deprecated; use dns_master_rdatasettottext() 453 * and/or dns_master_questiontotext() instead. 454 * 455 * Requires: 456 *\li 'rdataset' is a valid rdataset. 457 * 458 *\li 'rdataset' is not empty. 459 */ 460 461 isc_result_t 462 dns_rdataset_towire(dns_rdataset_t *rdataset, const dns_name_t *owner_name, 463 dns_compress_t *cctx, isc_buffer_t *target, 464 unsigned int options, unsigned int *countp); 465 /*%< 466 * Convert 'rdataset' to wire format, compressing names as specified 467 * in 'cctx', and storing the result in 'target'. 468 * 469 * Notes: 470 *\li The rdata cursor position will be changed. 471 * 472 *\li The number of RRs added to target will be added to *countp. 473 * 474 * Requires: 475 *\li 'rdataset' is a valid rdataset. 476 * 477 *\li 'rdataset' is not empty. 478 * 479 *\li 'countp' is a valid pointer. 480 * 481 * Ensures: 482 *\li On a return of ISC_R_SUCCESS, 'target' contains a wire format 483 * for the data contained in 'rdataset'. Any error return leaves 484 * the buffer unchanged. 485 * 486 *\li *countp has been incremented by the number of RRs added to 487 * target. 488 * 489 * Returns: 490 *\li #ISC_R_SUCCESS - all ok 491 *\li #ISC_R_NOSPACE - 'target' doesn't have enough room 492 * 493 *\li Any error returned by dns_rdata_towire(), dns_rdataset_next(), 494 * dns_name_towire(). 495 */ 496 497 isc_result_t 498 dns_rdataset_towiresorted(dns_rdataset_t *rdataset, 499 const dns_name_t *owner_name, dns_compress_t *cctx, 500 isc_buffer_t *target, dns_rdatasetorderfunc_t order, 501 const void *order_arg, unsigned int options, 502 unsigned int *countp); 503 /*%< 504 * Like dns_rdataset_towire(), but sorting the rdatasets according to 505 * the integer value returned by 'order' when called with the rdataset 506 * and 'order_arg' as arguments. 507 * 508 * Requires: 509 *\li All the requirements of dns_rdataset_towire(), and 510 * that order_arg is NULL if and only if order is NULL. 511 */ 512 513 isc_result_t 514 dns_rdataset_towirepartial(dns_rdataset_t *rdataset, 515 const dns_name_t *owner_name, dns_compress_t *cctx, 516 isc_buffer_t *target, dns_rdatasetorderfunc_t order, 517 const void *order_arg, unsigned int options, 518 unsigned int *countp, void **state); 519 /*%< 520 * Like dns_rdataset_towiresorted() except that a partial rdataset 521 * may be written. 522 * 523 * Requires: 524 *\li All the requirements of dns_rdataset_towiresorted(). 525 * If 'state' is non NULL then the current position in the 526 * rdataset will be remembered if the rdataset in not 527 * completely written and should be passed on on subsequent 528 * calls (NOT CURRENTLY IMPLEMENTED). 529 * 530 * Returns: 531 *\li #ISC_R_SUCCESS if all of the records were written. 532 *\li #ISC_R_NOSPACE if unable to fit in all of the records. *countp 533 * will be updated to reflect the number of records 534 * written. 535 */ 536 537 isc_result_t 538 dns_rdataset_additionaldata(dns_rdataset_t *rdataset, 539 const dns_name_t *owner_name, 540 dns_additionaldatafunc_t add, void *arg); 541 /*%< 542 * For each rdata in rdataset, call 'add' for each name and type in the 543 * rdata which is subject to additional section processing. 544 * 545 * Requires: 546 * 547 *\li 'rdataset' is a valid, non-question rdataset. 548 * 549 *\li 'add' is a valid dns_additionaldatafunc_t 550 * 551 * Ensures: 552 * 553 *\li If successful, dns_rdata_additionaldata() will have been called for 554 * each rdata in 'rdataset'. 555 * 556 *\li If a call to dns_rdata_additionaldata() is not successful, the 557 * result returned will be the result of dns_rdataset_additionaldata(). 558 * 559 * Returns: 560 * 561 *\li #ISC_R_SUCCESS 562 * 563 *\li Any error that dns_rdata_additionaldata() can return. 564 */ 565 566 #define dns_rdataset_getnoqname(rdataset, name, neg, negsig) \ 567 dns__rdataset_getnoqname(rdataset, name, neg, negsig DNS__DB_FILELINE) 568 isc_result_t 569 dns__rdataset_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, 570 dns_rdataset_t *neg, 571 dns_rdataset_t *negsig DNS__DB_FLARG); 572 /*%< 573 * Return the noqname proof for this record. 574 * 575 * Requires: 576 *\li 'rdataset' to be valid and #DNS_RDATASETATTR_NOQNAME to be set. 577 *\li 'name' to be valid. 578 *\li 'neg' and 'negsig' to be valid and not associated. 579 */ 580 581 isc_result_t 582 dns_rdataset_addnoqname(dns_rdataset_t *rdataset, dns_name_t *name); 583 /*%< 584 * Associate a noqname proof with this record. 585 * Sets #DNS_RDATASETATTR_NOQNAME if successful. 586 * Adjusts the 'rdataset->ttl' to minimum of the 'rdataset->ttl' and 587 * the 'nsec'/'nsec3' and 'rrsig(nsec)'/'rrsig(nsec3)' ttl. 588 * 589 * Requires: 590 *\li 'rdataset' to be valid and #DNS_RDATASETATTR_NOQNAME to be set. 591 *\li 'name' to be valid and have NSEC or NSEC3 and associated RRSIG 592 * rdatasets. 593 */ 594 595 #define dns_rdataset_getclosest(rdataset, name, nsec, nsecsig) \ 596 dns__rdataset_getclosest(rdataset, name, nsec, nsecsig DNS__DB_FILELINE) 597 isc_result_t 598 dns__rdataset_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, 599 dns_rdataset_t *nsec, 600 dns_rdataset_t *nsecsig DNS__DB_FLARG); 601 /*%< 602 * Return the closest encloser for this record. 603 * 604 * Requires: 605 *\li 'rdataset' to be valid and #DNS_RDATASETATTR_CLOSEST to be set. 606 *\li 'name' to be valid. 607 *\li 'nsec' and 'nsecsig' to be valid and not associated. 608 */ 609 610 isc_result_t 611 dns_rdataset_addclosest(dns_rdataset_t *rdataset, const dns_name_t *name); 612 /*%< 613 * Associate a closest encloset proof with this record. 614 * Sets #DNS_RDATASETATTR_CLOSEST if successful. 615 * Adjusts the 'rdataset->ttl' to minimum of the 'rdataset->ttl' and 616 * the 'nsec' and 'rrsig(nsec)' ttl. 617 * 618 * Requires: 619 *\li 'rdataset' to be valid and #DNS_RDATASETATTR_CLOSEST to be set. 620 *\li 'name' to be valid and have NSEC3 and RRSIG(NSEC3) rdatasets. 621 */ 622 623 void 624 dns_rdataset_settrust(dns_rdataset_t *rdataset, dns_trust_t trust); 625 /*%< 626 * Set the trust of the 'rdataset' to trust in any in the backing database. 627 * The local trust level of 'rdataset' is also set. 628 */ 629 630 #define dns_rdataset_expire(rdataset) \ 631 dns__rdataset_expire(rdataset DNS__DB_FILELINE) 632 void 633 dns__rdataset_expire(dns_rdataset_t *rdataset DNS__DB_FLARG); 634 /*%< 635 * Mark the rdataset to be expired in the backing database. 636 */ 637 638 void 639 dns_rdataset_clearprefetch(dns_rdataset_t *rdataset); 640 /*%< 641 * Clear the PREFETCH attribute for the given rdataset in the 642 * underlying database. 643 * 644 * In the cache database, this signals that the rdataset is not 645 * eligible to be prefetched when the TTL is close to expiring. 646 * It has no function in other databases. 647 */ 648 649 void 650 dns_rdataset_setownercase(dns_rdataset_t *rdataset, const dns_name_t *name); 651 /*%< 652 * Store the casing of 'name', the owner name of 'rdataset', into 653 * a bitfield so that the name can be capitalized the same when when 654 * the rdataset is used later. This sets the CASESET attribute. 655 */ 656 657 void 658 dns_rdataset_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name); 659 /*%< 660 * If the CASESET attribute is set, retrieve the case bitfield that was 661 * previously stored by dns_rdataset_getownername(), and capitalize 'name' 662 * according to it. If CASESET is not set, do nothing. 663 */ 664 665 void 666 dns_rdataset_trimttl(dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, 667 dns_rdata_rrsig_t *rrsig, isc_stdtime_t now, 668 bool acceptexpired); 669 /*%< 670 * Trim the ttl of 'rdataset' and 'sigrdataset' so that they will expire 671 * at or before 'rrsig->expiretime'. If 'acceptexpired' is true and the 672 * signature has expired or will expire in the next 120 seconds, limit 673 * the ttl to be no more than 120 seconds. 674 * 675 * The ttl is further limited by the original ttl as stored in 'rrsig' 676 * and the original ttl values of 'rdataset' and 'sigrdataset'. 677 * 678 * Requires: 679 * \li 'rdataset' is a valid rdataset. 680 * \li 'sigrdataset' is a valid rdataset. 681 * \li 'rrsig' is non NULL. 682 */ 683 684 const char * 685 dns_trust_totext(dns_trust_t trust); 686 /*%< 687 * Display trust in textual form. 688 */ 689 690 ISC_LANG_ENDDECLS 691