1 /* $NetBSD: adb.h,v 1.6 2014/12/10 04:37:58 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2004-2008, 2011, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") 5 * Copyright (C) 1999-2003 Internet Software Consortium. 6 * 7 * Permission to use, copy, modify, and/or distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /* Id: adb.h,v 1.88 2011/12/05 17:10:51 each Exp */ 21 22 #ifndef DNS_ADB_H 23 #define DNS_ADB_H 1 24 25 /***** 26 ***** Module Info 27 *****/ 28 29 /*! \file dns/adb.h 30 *\brief 31 * DNS Address Database 32 * 33 * This module implements an address database (ADB) for mapping a name 34 * to an isc_sockaddr_t. It also provides statistical information on 35 * how good that address might be. 36 * 37 * A client will pass in a dns_name_t, and the ADB will walk through 38 * the rdataset looking up addresses associated with the name. If it 39 * is found on the internal lists, a structure is filled in with the 40 * address information and stats for found addresses. 41 * 42 * If the name cannot be found on the internal lists, a new entry will 43 * be created for a name if all the information needed can be found 44 * in the zone table or cache. This new address will then be returned. 45 * 46 * If a request must be made to remote servers to satisfy a name lookup, 47 * this module will start fetches to try to complete these addresses. When 48 * at least one more completes, an event is sent to the caller. If none of 49 * them resolve before the fetch times out, an event indicating this is 50 * sent instead. 51 * 52 * Records are stored internally until a timer expires. The timer is the 53 * smaller of the TTL or signature validity period. 54 * 55 * Lameness is stored per <qname,qtype> tuple, and this data hangs off each 56 * address field. When an address is marked lame for a given tuple the address 57 * will not be returned to a caller. 58 * 59 * 60 * MP: 61 * 62 *\li The ADB takes care of all necessary locking. 63 * 64 *\li Only the task which initiated the name lookup can cancel the lookup. 65 * 66 * 67 * Security: 68 * 69 *\li None, since all data stored is required to be pre-filtered. 70 * (Cache needs to be sane, fetches return bounds-checked and sanity- 71 * checked data, caller passes a good dns_name_t for the zone, etc) 72 */ 73 74 /*** 75 *** Imports 76 ***/ 77 78 #include <isc/lang.h> 79 #include <isc/magic.h> 80 #include <isc/mem.h> 81 #include <isc/sockaddr.h> 82 83 #include <dns/types.h> 84 #include <dns/view.h> 85 86 ISC_LANG_BEGINDECLS 87 88 /*** 89 *** Magic number checks 90 ***/ 91 92 #define DNS_ADBFIND_MAGIC ISC_MAGIC('a','d','b','H') 93 #define DNS_ADBFIND_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBFIND_MAGIC) 94 #define DNS_ADBADDRINFO_MAGIC ISC_MAGIC('a','d','A','I') 95 #define DNS_ADBADDRINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBADDRINFO_MAGIC) 96 97 98 /*** 99 *** TYPES 100 ***/ 101 102 typedef struct dns_adbname dns_adbname_t; 103 104 /*! 105 *\brief 106 * Represents a lookup for a single name. 107 * 108 * On return, the client can safely use "list", and can reorder the list. 109 * Items may not be _deleted_ from this list, however, or added to it 110 * other than by using the dns_adb_*() API. 111 */ 112 struct dns_adbfind { 113 /* Public */ 114 unsigned int magic; /*%< RO: magic */ 115 dns_adbaddrinfolist_t list; /*%< RO: list of addrs */ 116 unsigned int query_pending; /*%< RO: partial list */ 117 unsigned int partial_result; /*%< RO: addrs missing */ 118 unsigned int options; /*%< RO: options */ 119 isc_result_t result_v4; /*%< RO: v4 result */ 120 isc_result_t result_v6; /*%< RO: v6 result */ 121 ISC_LINK(dns_adbfind_t) publink; /*%< RW: client use */ 122 123 /* Private */ 124 isc_mutex_t lock; /* locks all below */ 125 in_port_t port; 126 int name_bucket; 127 unsigned int flags; 128 dns_adbname_t *adbname; 129 dns_adb_t *adb; 130 isc_event_t event; 131 ISC_LINK(dns_adbfind_t) plink; 132 }; 133 134 /* 135 * _INET: 136 * _INET6: 137 * return addresses of that type. 138 * 139 * _EMPTYEVENT: 140 * Only schedule an event if no addresses are known. 141 * Must set _WANTEVENT for this to be meaningful. 142 * 143 * _WANTEVENT: 144 * An event is desired. Check this bit in the returned find to see 145 * if one will actually be generated. 146 * 147 * _AVOIDFETCHES: 148 * If set, fetches will not be generated unless no addresses are 149 * available in any of the address families requested. 150 * 151 * _STARTATZONE: 152 * Fetches will start using the closest zone data or use the root servers. 153 * This is useful for reestablishing glue that has expired. 154 * 155 * _GLUEOK: 156 * _HINTOK: 157 * Glue or hints are ok. These are used when matching names already 158 * in the adb, and when dns databases are searched. 159 * 160 * _RETURNLAME: 161 * Return lame servers in a find, so that all addresses are returned. 162 * 163 * _LAMEPRUNED: 164 * At least one address was omitted from the list because it was lame. 165 * This bit will NEVER be set if _RETURNLAME is set in the createfind(). 166 */ 167 /*% Return addresses of type INET. */ 168 #define DNS_ADBFIND_INET 0x00000001 169 /*% Return addresses of type INET6. */ 170 #define DNS_ADBFIND_INET6 0x00000002 171 #define DNS_ADBFIND_ADDRESSMASK 0x00000003 172 /*% 173 * Only schedule an event if no addresses are known. 174 * Must set _WANTEVENT for this to be meaningful. 175 */ 176 #define DNS_ADBFIND_EMPTYEVENT 0x00000004 177 /*% 178 * An event is desired. Check this bit in the returned find to see 179 * if one will actually be generated. 180 */ 181 #define DNS_ADBFIND_WANTEVENT 0x00000008 182 /*% 183 * If set, fetches will not be generated unless no addresses are 184 * available in any of the address families requested. 185 */ 186 #define DNS_ADBFIND_AVOIDFETCHES 0x00000010 187 /*% 188 * Fetches will start using the closest zone data or use the root servers. 189 * This is useful for reestablishing glue that has expired. 190 */ 191 #define DNS_ADBFIND_STARTATZONE 0x00000020 192 /*% 193 * Glue or hints are ok. These are used when matching names already 194 * in the adb, and when dns databases are searched. 195 */ 196 #define DNS_ADBFIND_GLUEOK 0x00000040 197 /*% 198 * Glue or hints are ok. These are used when matching names already 199 * in the adb, and when dns databases are searched. 200 */ 201 #define DNS_ADBFIND_HINTOK 0x00000080 202 /*% 203 * Return lame servers in a find, so that all addresses are returned. 204 */ 205 #define DNS_ADBFIND_RETURNLAME 0x00000100 206 /*% 207 * Only schedule an event if no addresses are known. 208 * Must set _WANTEVENT for this to be meaningful. 209 */ 210 #define DNS_ADBFIND_LAMEPRUNED 0x00000200 211 212 /*% 213 * The answers to queries come back as a list of these. 214 */ 215 struct dns_adbaddrinfo { 216 unsigned int magic; /*%< private */ 217 218 isc_sockaddr_t sockaddr; /*%< [rw] */ 219 unsigned int srtt; /*%< [rw] microsecs */ 220 isc_dscp_t dscp; 221 222 unsigned int flags; /*%< [rw] */ 223 dns_adbentry_t *entry; /*%< private */ 224 ISC_LINK(dns_adbaddrinfo_t) publink; 225 }; 226 227 /*!< 228 * The event sent to the caller task is just a plain old isc_event_t. It 229 * contains no data other than a simple status, passed in the "type" field 230 * to indicate that another address resolved, or all partially resolved 231 * addresses have failed to resolve. 232 * 233 * "sender" is the dns_adbfind_t used to issue this query. 234 * 235 * This is simply a standard event, with the "type" set to: 236 * 237 *\li #DNS_EVENT_ADBMOREADDRESSES -- another address resolved. 238 *\li #DNS_EVENT_ADBNOMOREADDRESSES -- all pending addresses failed, 239 * were canceled, or otherwise will 240 * not be usable. 241 *\li #DNS_EVENT_ADBCANCELED -- The request was canceled by a 242 * 3rd party. 243 *\li #DNS_EVENT_ADBNAMEDELETED -- The name was deleted, so this request 244 * was canceled. 245 * 246 * In each of these cases, the addresses returned by the initial call 247 * to dns_adb_createfind() can still be used until they are no longer needed. 248 */ 249 250 /**** 251 **** FUNCTIONS 252 ****/ 253 254 255 isc_result_t 256 dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *tmgr, 257 isc_taskmgr_t *taskmgr, dns_adb_t **newadb); 258 /*%< 259 * Create a new ADB. 260 * 261 * Notes: 262 * 263 *\li Generally, applications should not create an ADB directly, but 264 * should instead call dns_view_createresolver(). 265 * 266 * Requires: 267 * 268 *\li 'mem' must be a valid memory context. 269 * 270 *\li 'view' be a pointer to a valid view. 271 * 272 *\li 'tmgr' be a pointer to a valid timer manager. 273 * 274 *\li 'taskmgr' be a pointer to a valid task manager. 275 * 276 *\li 'newadb' != NULL && '*newadb' == NULL. 277 * 278 * Returns: 279 * 280 *\li #ISC_R_SUCCESS after happiness. 281 *\li #ISC_R_NOMEMORY after resource allocation failure. 282 */ 283 284 void 285 dns_adb_attach(dns_adb_t *adb, dns_adb_t **adbp); 286 /*% 287 * Attach to an 'adb' to 'adbp'. 288 * 289 * Requires: 290 *\li 'adb' to be a valid dns_adb_t, created via dns_adb_create(). 291 *\li 'adbp' to be a valid pointer to a *dns_adb_t which is initialized 292 * to NULL. 293 */ 294 295 void 296 dns_adb_detach(dns_adb_t **adb); 297 /*% 298 * Delete the ADB. Sets *ADB to NULL. Cancels any outstanding requests. 299 * 300 * Requires: 301 * 302 *\li 'adb' be non-NULL and '*adb' be a valid dns_adb_t, created via 303 * dns_adb_create(). 304 */ 305 306 void 307 dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp); 308 /*% 309 * Send '*eventp' to 'task' when 'adb' has shutdown. 310 * 311 * Requires: 312 * 313 *\li '*adb' is a valid dns_adb_t. 314 * 315 *\li eventp != NULL && *eventp is a valid event. 316 * 317 * Ensures: 318 * 319 *\li *eventp == NULL 320 * 321 *\li The event's sender field is set to the value of adb when the event 322 * is sent. 323 */ 324 325 void 326 dns_adb_shutdown(dns_adb_t *adb); 327 /*%< 328 * Shutdown 'adb'. 329 * 330 * Requires: 331 * 332 * \li '*adb' is a valid dns_adb_t. 333 */ 334 335 isc_result_t 336 dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, 337 void *arg, dns_name_t *name, dns_name_t *qname, 338 dns_rdatatype_t qtype, unsigned int options, 339 isc_stdtime_t now, dns_name_t *target, 340 in_port_t port, dns_adbfind_t **find); 341 isc_result_t 342 dns_adb_createfind2(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, 343 void *arg, dns_name_t *name, dns_name_t *qname, 344 dns_rdatatype_t qtype, unsigned int options, 345 isc_stdtime_t now, dns_name_t *target, in_port_t port, 346 unsigned int depth, isc_counter_t *qc, 347 dns_adbfind_t **find); 348 /*%< 349 * Main interface for clients. The adb will look up the name given in 350 * "name" and will build up a list of found addresses, and perhaps start 351 * internal fetches to resolve names that are unknown currently. 352 * 353 * If other addresses resolve after this call completes, an event will 354 * be sent to the <task, taskaction, arg> with the sender of that event 355 * set to a pointer to the dns_adbfind_t returned by this function. 356 * 357 * If no events will be generated, the *find->result_v4 and/or result_v6 358 * members may be examined for address lookup status. The usual #ISC_R_SUCCESS, 359 * #ISC_R_FAILURE, #DNS_R_NXDOMAIN, and #DNS_R_NXRRSET are returned, along with 360 * #ISC_R_NOTFOUND meaning the ADB has not _yet_ found the values. In this 361 * latter case, retrying may produce more addresses. 362 * 363 * If events will be returned, the result_v[46] members are only valid 364 * when that event is actually returned. 365 * 366 * The list of addresses returned is unordered. The caller must impose 367 * any ordering required. The list will not contain "known bad" addresses, 368 * however. For instance, it will not return hosts that are known to be 369 * lame for the zone in question. 370 * 371 * The caller cannot (directly) modify the contents of the address list's 372 * fields other than the "link" field. All values can be read at any 373 * time, however. 374 * 375 * The "now" parameter is used only for determining which entries that 376 * have a specific time to live or expire time should be removed from 377 * the running database. If specified as zero, the current time will 378 * be retrieved and used. 379 * 380 * If 'target' is not NULL and 'name' is an alias (i.e. the name is 381 * CNAME'd or DNAME'd to another name), then 'target' will be updated with 382 * the domain name that 'name' is aliased to. 383 * 384 * All addresses returned will have the sockaddr's port set to 'port.' 385 * The caller may change them directly in the dns_adbaddrinfo_t since 386 * they are copies of the internal address only. 387 * 388 * XXXMLG Document options, especially the flags which control how 389 * events are sent. 390 * 391 * Requires: 392 * 393 *\li *adb be a valid isc_adb_t object. 394 * 395 *\li If events are to be sent, *task be a valid task, 396 * and isc_taskaction_t != NULL. 397 * 398 *\li *name is a valid dns_name_t. 399 * 400 *\li qname != NULL and *qname be a valid dns_name_t. 401 * 402 *\li target == NULL or target is a valid name with a buffer. 403 * 404 *\li find != NULL && *find == NULL. 405 * 406 * Returns: 407 * 408 *\li #ISC_R_SUCCESS Addresses might have been returned, and events will be 409 * delivered for unresolved addresses. 410 *\li #ISC_R_NOMORE Addresses might have been returned, but no events 411 * will ever be posted for this context. This is only 412 * returned if task != NULL. 413 *\li #ISC_R_NOMEMORY insufficient resources 414 *\li #DNS_R_ALIAS 'name' is an alias for another name. 415 * 416 * Calls, and returns error codes from: 417 * 418 *\li isc_stdtime_get() 419 * 420 * Notes: 421 * 422 *\li No internal reference to "name" exists after this function 423 * returns. 424 */ 425 426 void 427 dns_adb_cancelfind(dns_adbfind_t *find); 428 /*%< 429 * Cancels the find, and sends the event off to the caller. 430 * 431 * It is an error to call dns_adb_cancelfind() on a find where 432 * no event is wanted, or will ever be sent. 433 * 434 * Note: 435 * 436 *\li It is possible that the real completion event was posted just 437 * before the dns_adb_cancelfind() call was made. In this case, 438 * dns_adb_cancelfind() will do nothing. The event callback needs 439 * to be prepared to find this situation (i.e. result is valid but 440 * the caller expects it to be canceled). 441 * 442 * Requires: 443 * 444 *\li 'find' be a valid dns_adbfind_t pointer. 445 * 446 *\li events would have been posted to the task. This can be checked 447 * with (find->options & DNS_ADBFIND_WANTEVENT). 448 * 449 * Ensures: 450 * 451 *\li The event was posted to the task. 452 */ 453 454 void 455 dns_adb_destroyfind(dns_adbfind_t **find); 456 /*%< 457 * Destroys the find reference. 458 * 459 * Note: 460 * 461 *\li This can only be called after the event was delivered for a 462 * find. Additionally, the event MUST have been freed via 463 * isc_event_free() BEFORE this function is called. 464 * 465 * Requires: 466 * 467 *\li 'find' != NULL and *find be valid dns_adbfind_t pointer. 468 * 469 * Ensures: 470 * 471 *\li No "address found" events will be posted to the originating task 472 * after this function returns. 473 */ 474 475 void 476 dns_adb_dump(dns_adb_t *adb, FILE *f); 477 /*%< 478 * This function is only used for debugging. It will dump as much of the 479 * state of the running system as possible. 480 * 481 * Requires: 482 * 483 *\li adb be valid. 484 * 485 *\li f != NULL, and is a file open for writing. 486 */ 487 488 void 489 dns_adb_dumpfind(dns_adbfind_t *find, FILE *f); 490 /*%< 491 * This function is only used for debugging. Dump the data associated 492 * with a find. 493 * 494 * Requires: 495 * 496 *\li find is valid. 497 * 498 * \li f != NULL, and is a file open for writing. 499 */ 500 501 isc_result_t 502 dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *qname, 503 dns_rdatatype_t type, isc_stdtime_t expire_time); 504 /*%< 505 * Mark the given address as lame for the <qname,qtype>. expire_time should 506 * be set to the time when the entry should expire. That is, if it is to 507 * expire 10 minutes in the future, it should set it to (now + 10 * 60). 508 * 509 * Requires: 510 * 511 *\li adb be valid. 512 * 513 *\li addr be valid. 514 * 515 *\li qname be the qname used in the dns_adb_createfind() call. 516 * 517 * Returns: 518 * 519 *\li #ISC_R_SUCCESS -- all is well. 520 *\li #ISC_R_NOMEMORY -- could not mark address as lame. 521 */ 522 523 /* 524 * Reasonable defaults for RTT adjustments 525 * 526 * (Note: these values function both as scaling factors and as 527 * indicators of the type of RTT adjustment operation taking place. 528 * Adjusting the scaling factors is fine, as long as they all remain 529 * unique values.) 530 */ 531 #define DNS_ADB_RTTADJDEFAULT 7 /*%< default scale */ 532 #define DNS_ADB_RTTADJREPLACE 0 /*%< replace with our rtt */ 533 #define DNS_ADB_RTTADJAGE 10 /*%< age this rtt */ 534 535 void 536 dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, 537 unsigned int rtt, unsigned int factor); 538 /*%< 539 * Mix the round trip time into the existing smoothed rtt. 540 * 541 * Requires: 542 * 543 *\li adb be valid. 544 * 545 *\li addr be valid. 546 * 547 *\li 0 <= factor <= 10 548 * 549 * Note: 550 * 551 *\li The srtt in addr will be updated to reflect the new global 552 * srtt value. This may include changes made by others. 553 */ 554 555 void 556 dns_adb_agesrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, isc_stdtime_t now); 557 /* 558 * dns_adb_agesrtt is equivalent to dns_adb_adjustsrtt with factor 559 * equal to DNS_ADB_RTTADJAGE and the current time passed in. 560 * 561 * Requires: 562 * 563 *\li adb be valid. 564 * 565 *\li addr be valid. 566 * 567 * Note: 568 * 569 *\li The srtt in addr will be updated to reflect the new global 570 * srtt value. This may include changes made by others. 571 */ 572 573 void 574 dns_adb_changeflags(dns_adb_t *adb, dns_adbaddrinfo_t *addr, 575 unsigned int bits, unsigned int mask); 576 /*% 577 * Change Flags. 578 * 579 * Set the flags as given by: 580 * 581 *\li newflags = (oldflags & ~mask) | (bits & mask); 582 * 583 * Requires: 584 * 585 *\li adb be valid. 586 * 587 *\li addr be valid. 588 */ 589 590 void 591 dns_adb_setudpsize(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size); 592 /*% 593 * Update seen UDP response size. The largest seen will be returned by 594 * dns_adb_getudpsize(). 595 * 596 * Requires: 597 * 598 *\li adb be valid. 599 * 600 *\li addr be valid. 601 */ 602 603 unsigned int 604 dns_adb_getudpsize(dns_adb_t *adb, dns_adbaddrinfo_t *addr); 605 /*% 606 * Return the largest seen UDP response size. 607 * 608 * Requires: 609 * 610 *\li adb be valid. 611 * 612 *\li addr be valid. 613 */ 614 615 unsigned int 616 dns_adb_probesize(dns_adb_t *adb, dns_adbaddrinfo_t *addr); 617 unsigned int 618 dns_adb_probesize2(dns_adb_t *adb, dns_adbaddrinfo_t *addr, int lookups); 619 /*% 620 * Return suggested EDNS UDP size based on observed responses / failures. 621 * 'lookups' is the number of times the current lookup has been attempted. 622 * 623 * Requires: 624 * 625 *\li adb be valid. 626 * 627 *\li addr be valid. 628 */ 629 630 void 631 dns_adb_plainresponse(dns_adb_t *adb, dns_adbaddrinfo_t *addr); 632 /*% 633 * Record a successful plain DNS response. 634 * 635 * Requires: 636 * 637 *\li adb be valid. 638 * 639 *\li addr be valid. 640 */ 641 642 void 643 dns_adb_timeout(dns_adb_t *adb, dns_adbaddrinfo_t *addr); 644 /*% 645 * Record a plain DNS UDP query failed. 646 * 647 * Requires: 648 * 649 *\li adb be valid. 650 * 651 *\li addr be valid. 652 */ 653 654 void 655 dns_adb_ednsto(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size); 656 /*% 657 * Record a failed EDNS UDP response and the advertised EDNS UDP buffer size 658 * used. 659 * 660 * Requires: 661 * 662 *\li adb be valid. 663 * 664 *\li addr be valid. 665 */ 666 667 isc_boolean_t 668 dns_adb_noedns(dns_adb_t *adb, dns_adbaddrinfo_t *addr); 669 /*% 670 * Return whether EDNS should be disabled for this server. 671 * 672 * Requires: 673 * 674 *\li adb be valid. 675 * 676 *\li addr be valid. 677 */ 678 679 680 isc_result_t 681 dns_adb_findaddrinfo(dns_adb_t *adb, isc_sockaddr_t *sa, 682 dns_adbaddrinfo_t **addrp, isc_stdtime_t now); 683 /*%< 684 * Return a dns_adbaddrinfo_t that is associated with address 'sa'. 685 * 686 * Requires: 687 * 688 *\li adb is valid. 689 * 690 *\li sa is valid. 691 * 692 *\li addrp != NULL && *addrp == NULL 693 * 694 * Returns: 695 *\li #ISC_R_SUCCESS 696 *\li #ISC_R_NOMEMORY 697 *\li #ISC_R_SHUTTINGDOWN 698 */ 699 700 void 701 dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp); 702 /*%< 703 * Free a dns_adbaddrinfo_t allocated by dns_adb_findaddrinfo(). 704 * 705 * Requires: 706 * 707 *\li adb is valid. 708 * 709 *\li *addrp is a valid dns_adbaddrinfo_t *. 710 */ 711 712 void 713 dns_adb_flush(dns_adb_t *adb); 714 /*%< 715 * Flushes all cached data from the adb. 716 * 717 * Requires: 718 *\li adb is valid. 719 */ 720 721 void 722 dns_adb_setadbsize(dns_adb_t *adb, size_t size); 723 /*%< 724 * Set a target memory size. If memory usage exceeds the target 725 * size entries will be removed before they would have expired on 726 * a random basis. 727 * 728 * If 'size' is 0 then memory usage is unlimited. 729 * 730 * Requires: 731 *\li 'adb' is valid. 732 */ 733 734 void 735 dns_adb_flushname(dns_adb_t *adb, dns_name_t *name); 736 /*%< 737 * Flush 'name' from the adb cache. 738 * 739 * Requires: 740 *\li 'adb' is valid. 741 *\li 'name' is valid. 742 */ 743 744 void 745 dns_adb_flushnames(dns_adb_t *adb, dns_name_t *name); 746 /*%< 747 * Flush 'name' and all subdomains from the adb cache. 748 * 749 * Requires: 750 *\li 'adb' is valid. 751 *\li 'name' is valid. 752 */ 753 754 void 755 dns_adb_setsit(dns_adb_t *adb, dns_adbaddrinfo_t *addr, 756 const unsigned char *sit, size_t len); 757 /*%< 758 * Record the Source Identity Token (SIT) associated with this addresss. If 759 * sit is NULL or len is zero. The recorded SIT is cleared. 760 * 761 * Requires: 762 *\li 'adb' is valid. 763 *\li 'addr' is valid. 764 */ 765 766 size_t 767 dns_adb_getsit(dns_adb_t *adb, dns_adbaddrinfo_t *addr, 768 unsigned char *sit, size_t len); 769 /* 770 * Retieve the saved SIT value and store it in 'sit' which has size 'len'. 771 * 772 * Requires: 773 *\li 'adb' is valid. 774 *\li 'addr' is valid. 775 * 776 * Returns: 777 * The size of the sit token or zero if it doesn't fit in the buffer 778 * or it doesn't exist. 779 */ 780 781 ISC_LANG_ENDDECLS 782 783 #endif /* DNS_ADB_H */ 784