Lines Matching refs:header

97  * This is the map file header for RBTDB images.  It is populated, and then
99 * zeros in the header area initially) will ensure that the header is only
448 * If this is the top header for an rdataset, 'next' points
449 * to the top header for the next rdataset (i.e., the next type).
450 * Otherwise, it points up to the header whose down pointer points
451 * at this header.
456 * Points to the header for the next older version of
511 rdatasetheader_t *header;
529 #define EXISTS(header) \
530 (((header)->attributes & RDATASET_ATTR_NONEXISTENT) == 0)
531 #define NONEXISTENT(header) \
532 (((header)->attributes & RDATASET_ATTR_NONEXISTENT) != 0)
533 #define IGNORE(header) \
534 (((header)->attributes & RDATASET_ATTR_IGNORE) != 0)
535 #define RETAIN(header) \
536 (((header)->attributes & RDATASET_ATTR_RETAIN) != 0)
537 #define NXDOMAIN(header) \
538 (((header)->attributes & RDATASET_ATTR_NXDOMAIN) != 0)
539 #define STALE(header) \
540 (((header)->attributes & RDATASET_ATTR_STALE) != 0)
541 #define RESIGN(header) \
542 (((header)->attributes & RDATASET_ATTR_RESIGN) != 0)
543 #define OPTOUT(header) \
544 (((header)->attributes & RDATASET_ATTR_OPTOUT) != 0)
545 #define NEGATIVE(header) \
546 (((header)->attributes & RDATASET_ATTR_NEGATIVE) != 0)
547 #define PREFETCH(header) \
548 (((header)->attributes & RDATASET_ATTR_PREFETCH) != 0)
549 #define CASESET(header) \
550 (((header)->attributes & RDATASET_ATTR_CASESET) != 0)
551 #define ZEROTTL(header) \
552 (((header)->attributes & RDATASET_ATTR_ZEROTTL) != 0)
553 #define CASEFULLYLOWER(header) \
554 (((header)->attributes & RDATASET_ATTR_CASEFULLYLOWER) != 0)
557 #define ACTIVE(header, now) \
558 (((header)->rdh_ttl > (now)) || \
559 ((header)->rdh_ttl == (now) && ZEROTTL(header)))
790 static inline isc_boolean_t need_headerupdate(rdatasetheader_t *header,
792 static void update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header,
794 static void expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header,
801 rdatasetheader_t *header);
937 static void setownercase(rdatasetheader_t *header, const dns_name_t *name);
939 static isc_boolean_t match_header_version(rbtdb_file_header_t *header);
950 * Both init_count and header->count can be ISC_UINT32_MAX.
1056 update_rrsetstats(dns_rbtdb_t *rbtdb, rdatasetheader_t *header,
1066 if (NEGATIVE(header)) {
1067 if (NXDOMAIN(header))
1071 base = RBTDB_RDATATYPE_EXT(header->type);
1074 base = RBTDB_RDATATYPE_BASE(header->type);
1076 if (STALE(header))
1087 set_ttl(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, dns_ttl_t newttl) {
1094 header->rdh_ttl = newttl;
1098 oldttl = header->rdh_ttl;
1099 header->rdh_ttl = newttl;
1106 if (header->heap_index == 0 || newttl == oldttl)
1108 idx = header->node->locknum;
1114 isc_heap_increased(heap, header->heap_index);
1116 isc_heap_decreased(heap, header->heap_index);
1142 * This function sets the heap index into the header.
1601 free_acachearray(isc_mem_t *mctx, rdatasetheader_t *header,
1615 raw = (unsigned char *)header + sizeof(*header);
1654 fprintf(stderr, "initialized header: %p\n", h);
1697 fprintf(stderr, "allocated header: %p\n", h);
1747 rdatasetheader_t *header, *dcurrent;
1759 for (header = node->data; header != NULL; header = header->next) {
1760 if (header->serial == serial) {
1761 header->attributes |= RDATASET_ATTR_IGNORE;
1764 for (dcurrent = header->down;
1778 mark_stale_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header) {
1783 if ((header->attributes & RDATASET_ATTR_STALE) != 0)
1786 header->attributes |= RDATASET_ATTR_STALE;
1787 header->node->dirty = 1;
1792 if ((header->attributes & RDATASET_ATTR_STATCOUNT) == 0)
1795 if (EXISTS(header))
1796 update_rrsetstats(rbtdb, header, ISC_TRUE);
2562 rdatasetheader_t *header, *header_next;
2572 for (header = node->data;
2573 header != NULL;
2574 header = header_next) {
2575 header_next = header->next;
2577 if (header->serial <= version->serial &&
2578 !IGNORE(header)) {
2579 if (NONEXISTENT(header))
2580 header = NULL;
2583 header = header->down;
2584 } while (header != NULL);
2586 if (header != NULL &&
2587 (header->type == dns_rdatatype_nsec3param)) {
2591 raw = (unsigned char *)header + sizeof(*header);
2686 rdatasetheader_t *header;
2858 for (header = HEAD(resigned_list);
2859 header != NULL;
2860 header = HEAD(resigned_list)) {
2863 ISC_LIST_UNLINK(resigned_list, header, link);
2865 lock = &rbtdb->node_locks[header->node->locknum].lock;
2867 if (rollback && !IGNORE(header)) {
2869 result = resign_insert(rbtdb, header->node->locknum,
2870 header);
2875 "Unable to reinsert header to "
2879 decrement_reference(rbtdb, header->node, least_serial,
3135 rdatasetheader_t *header, *header_next;
3162 for (header = node->data; header != NULL; header = header_next) {
3163 header_next = header->next;
3164 if (header->type == dns_rdatatype_ns ||
3165 header->type == dns_rdatatype_dname ||
3166 header->type == RBTDB_RDATATYPE_SIGDNAME) {
3168 if (header->serial <= search->serial &&
3169 !IGNORE(header)) {
3174 if (NONEXISTENT(header))
3175 header = NULL;
3178 header = header->down;
3179 } while (header != NULL);
3180 if (header != NULL) {
3181 if (header->type == dns_rdatatype_dname)
3182 dname_header = header;
3183 else if (header->type ==
3185 sigdname_header = header;
3196 ns_header = header;
3278 rdatasetheader_t *header, isc_stdtime_t now,
3286 * the header count below. However, since the actual counter value
3300 rdataset->type = RBTDB_RDATATYPE_BASE(header->type);
3301 rdataset->covers = RBTDB_RDATATYPE_EXT(header->type);
3302 rdataset->ttl = header->rdh_ttl - now;
3303 rdataset->trust = header->trust;
3304 if (NEGATIVE(header))
3306 if (NXDOMAIN(header))
3308 if (OPTOUT(header))
3310 if (PREFETCH(header))
3314 raw = (unsigned char *)header + sizeof(*header);
3316 rdataset->count = header->count++;
3329 rdataset->private6 = header->noqname;
3332 rdataset->private7 = header->closest;
3339 if (RESIGN(header)) {
3341 rdataset->resign = (header->resign << 1) | header->resign_lsb;
3413 rdatasetheader_t *header;
3433 header = search->zonecut_rdataset;
3434 raw = (unsigned char *)header + sizeof(*header);
3481 rdatasetheader_t *header;
3500 for (header = node->data;
3501 header != NULL;
3502 header = header->next) {
3503 if (header->serial <= search->serial &&
3504 !IGNORE(header) && EXISTS(header))
3509 if (header != NULL)
3538 rdatasetheader_t *header;
3567 for (header = node->data;
3568 header != NULL;
3569 header = header->next) {
3570 if (header->serial <= search->serial &&
3571 !IGNORE(header) && EXISTS(header))
3576 if (header != NULL)
3594 for (header = node->data;
3595 header != NULL;
3596 header = header->next) {
3597 if (header->serial <= search->serial &&
3598 !IGNORE(header) && EXISTS(header))
3603 if (header != NULL)
3641 rdatasetheader_t *header;
3679 for (header = node->data;
3680 header != NULL;
3681 header = header->next) {
3682 if (header->serial <= search->serial &&
3683 !IGNORE(header) && EXISTS(header))
3686 if (header != NULL)
3739 for (header = wnode->data;
3740 header != NULL;
3741 header = header->next) {
3742 if (header->serial <= search->serial &&
3743 !IGNORE(header) && EXISTS(header))
3747 if (header != NULL ||
3792 matchparams(rdatasetheader_t *header, rbtdb_search_t *search)
3801 REQUIRE(header->type == dns_rdatatype_nsec3);
3803 raw = (unsigned char *)header + sizeof(*header);
3956 rdatasetheader_t *header, *header_next, *found, *foundsig;
3998 for (header = node->data;
3999 header != NULL;
4000 header = header_next) {
4001 header_next = header->next;
4006 if (header->serial <= search->serial &&
4007 !IGNORE(header)) {
4012 if (NONEXISTENT(header))
4013 header = NULL;
4016 header = header->down;
4017 } while (header != NULL);
4018 if (header != NULL) {
4024 if (header->type == type) {
4025 found = header;
4028 } else if (header->type == sigtype) {
4029 foundsig = header;
4150 rdatasetheader_t *header, *header_next, *found, *nsecheader;
4312 for (header = node->data; header != NULL; header = header_next) {
4313 header_next = header->next;
4318 if (header->serial <= search.serial &&
4319 !IGNORE(header)) {
4324 if (NONEXISTENT(header))
4325 header = NULL;
4328 header = header->down;
4329 } while (header != NULL);
4330 if (header != NULL) {
4341 header->type == dns_rdatatype_ns) {
4349 search.zonecut_rdataset = header;
4380 if (header->type == dns_rdatatype_nsec3 &&
4381 !matchparams(header, &search)) {
4389 if (header->type == type ||
4391 (header->type == dns_rdatatype_cname &&
4396 found = header;
4397 if (header->type == dns_rdatatype_cname &&
4418 } else if (header->type == sigtype) {
4423 foundsig = header;
4429 } else if (header->type == dns_rdatatype_nsec &&
4436 nsecheader = header;
4437 } else if (header->type == RBTDB_RDATATYPE_SIGNSEC &&
4443 nsecsig = header;
4445 header->type == RBTDB_RDATATYPE_SIGCNAME) {
4450 cnamesig = header;
4666 check_stale_header(dns_rbtnode_t *node, rdatasetheader_t *header,
4675 if (!ACTIVE(header, search->now)) {
4682 if ((header->rdh_ttl < search->now - RBTDB_VIRTUAL) &&
4700 * header->down can be non-NULL if the
4708 clean_stale_headers(search->rbtdb, mctx, header);
4710 (*header_prev)->next = header->next;
4712 node->data = header->next;
4713 free_rdataset(search->rbtdb, mctx, header);
4715 mark_stale_header(search->rbtdb, header);
4716 *header_prev = header;
4719 *header_prev = header;
4728 rdatasetheader_t *header, *header_prev, *header_next;
4753 for (header = node->data; header != NULL; header = header_next) {
4754 header_next = header->next;
4755 if (check_stale_header(node, header,
4759 } else if (header->type == dns_rdatatype_dname &&
4760 EXISTS(header)) {
4761 dname_header = header;
4762 header_prev = header;
4763 } else if (header->type == RBTDB_RDATATYPE_SIGDNAME &&
4764 EXISTS(header)) {
4765 sigdname_header = header;
4766 header_prev = header;
4768 header_prev = header;
4800 rdatasetheader_t *header, *header_prev, *header_next;
4827 for (header = node->data; header != NULL; header = header_next) {
4828 header_next = header->next;
4829 if (check_stale_header(node, header,
4833 } else if (EXISTS(header)) {
4838 if (header->type == dns_rdatatype_ns) {
4839 found = header;
4842 } else if (header->type ==
4844 foundsig = header;
4848 header_prev = header;
4850 header_prev = header;
4933 rdatasetheader_t *header, *header_next, *header_prev;
4964 for (header = node->data; header != NULL; header = header_next) {
4965 header_next = header->next;
4966 if (check_stale_header(node, header,
4971 if (NONEXISTENT(header) ||
4972 RBTDB_RDATATYPE_BASE(header->type) == 0) {
4973 header_prev = header;
4977 if (header->type == matchtype)
4978 found = header;
4979 else if (header->type == sigmatchtype)
4980 foundsig = header;
4981 header_prev = header;
5060 rdatasetheader_t *header, *header_prev, *header_next;
5149 for (header = node->data; header != NULL; header = header_next) {
5150 header_next = header->next;
5151 if (check_stale_header(node, header,
5155 } else if (EXISTS(header) && (!STALE(header))) {
5166 if (header->type == type ||
5168 RBTDB_RDATATYPE_BASE(header->type) != 0) ||
5169 (cname_ok && header->type ==
5174 found = header;
5175 if (header->type == dns_rdatatype_cname &&
5184 } else if (header->type == sigtype) {
5189 foundsig = header;
5190 } else if (header->type == RBTDB_RDATATYPE_NCACHEANY ||
5191 header->type == negtype) {
5195 found = header;
5196 } else if (header->type == dns_rdatatype_ns) {
5202 nsheader = header;
5203 } else if (header->type == RBTDB_RDATATYPE_SIGNS) {
5208 nssig = header;
5210 header->type == RBTDB_RDATATYPE_SIGCNAME) {
5215 cnamesig = header;
5217 header_prev = header;
5219 header_prev = header;
5371 rdatasetheader_t *header, *header_prev, *header_next;
5424 for (header = node->data; header != NULL; header = header_next) {
5425 header_next = header->next;
5426 if (check_stale_header(node, header,
5430 } else if (EXISTS(header)) {
5435 if (header->type == dns_rdatatype_ns) {
5441 found = header;
5442 } else if (header->type == RBTDB_RDATATYPE_SIGNS) {
5447 foundsig = header;
5449 header_prev = header;
5451 header_prev = header;
5574 rdatasetheader_t *header;
5625 for (header = rbtnode->data; header != NULL; header = header->next)
5626 if (header->rdh_ttl <= now - RBTDB_VIRTUAL) {
5633 mark_stale_header(rbtdb, header);
5639 if (! RETAIN(header)) {
5640 set_ttl(rbtdb, header, 0);
5641 mark_stale_header(rbtdb, header);
5763 rdatasetheader_t *header, *header_next, *found, *foundsig;
5791 for (header = rbtnode->data; header != NULL; header = header_next) {
5792 header_next = header->next;
5794 if (header->serial <= serial &&
5795 !IGNORE(header)) {
5800 if (NONEXISTENT(header))
5801 header = NULL;
5804 header = header->down;
5805 } while (header != NULL);
5806 if (header != NULL) {
5811 if (header->type == matchtype) {
5812 found = header;
5815 } else if (header->type == sigmatchtype) {
5816 foundsig = header;
5850 rdatasetheader_t *header, *header_next, *found, *foundsig;
5879 for (header = rbtnode->data; header != NULL; header = header_next) {
5880 header_next = header->next;
5881 if (!ACTIVE(header, now)) {
5882 if ((header->rdh_ttl < now - RBTDB_VIRTUAL) &&
5898 mark_stale_header(rbtdb, header);
5900 } else if (EXISTS(header) && (!STALE(header))) {
5901 if (header->type == matchtype)
5902 found = header;
5903 else if (header->type == RBTDB_RDATATYPE_NCACHEANY ||
5904 header->type == negtype)
5905 found = header;
5906 else if (header->type == sigmatchtype)
5907 foundsig = header;
5994 rdatasetheader_t *header, *header_next;
6007 for (header = node->data; header != NULL; header = header_next) {
6008 header_next = header->next;
6009 if (header->type == dns_rdatatype_cname) {
6014 if (header->serial <= serial &&
6015 !IGNORE(header)) {
6020 if (NONEXISTENT(header))
6021 header = NULL;
6024 header = header->down;
6025 } while (header != NULL);
6026 if (header != NULL)
6035 rdtype = RBTDB_RDATATYPE_BASE(header->type);
6044 if (header->serial <= serial &&
6045 !IGNORE(header)) {
6050 if (NONEXISTENT(header))
6051 header = NULL;
6054 header = header->down;
6055 } while (header != NULL);
6056 if (header != NULL)
6082 rdatasetheader_t *header)
6085 * Remove the old header from the heap
6087 if (header != NULL && header->heap_index != 0) {
6088 isc_heap_delete(rbtdb->heaps[header->node->locknum],
6089 header->heap_index);
6090 header->heap_index = 0;
6092 new_reference(rbtdb, header->node);
6093 ISC_LIST_APPEND(version->resigned_list, header, link);
6100 rdatasetheader_t *header)
6102 unsigned char *hdr = (unsigned char *)header;
6103 size_t hdrsize = sizeof (*header);
6120 rdatasetheader_t *topheader, *topheader_prev, *header, *sigheader;
6267 * If header isn't NULL, we've found the right type. There may be
6271 header = topheader;
6272 while (header != NULL && IGNORE(header))
6273 header = header->down;
6274 if (header != NULL) {
6275 header_nx = NONEXISTENT(header) ? ISC_TRUE : ISC_FALSE;
6289 if (rbtversion == NULL && trust < header->trust &&
6290 (ACTIVE(header, now) || header_nx)) {
6293 bind_rdataset(rbtdb, rbtnode, header, now,
6306 * that is the union of 'newheader' and 'header'.
6310 INSIST(rbtversion->serial >= header->serial);
6317 newheader->rdh_ttl != header->rdh_ttl)
6319 else if (newheader->rdh_ttl != header->rdh_ttl)
6323 (unsigned char *)header,
6328 (dns_rdatatype_t)header->type,
6332 * If 'header' has the same serial number as
6343 update_newheader(newheader, header);
6345 RESIGN(header) &&
6346 resign_sooner(header, newheader))
6348 newheader->resign = header->resign;
6350 header->resign_lsb;
6365 if (IS_CACHE(rbtdb) && ACTIVE(header, now) &&
6366 header->type == dns_rdatatype_ns &&
6368 header->trust >= newheader->trust &&
6369 dns_rdataslab_equalx((unsigned char *)header,
6373 (dns_rdatatype_t)header->type)) {
6378 if (header->rdh_ttl > newheader->rdh_ttl)
6379 set_ttl(rbtdb, header, newheader->rdh_ttl);
6380 if (header->noqname == NULL &&
6382 header->noqname = newheader->noqname;
6385 if (header->closest == NULL &&
6387 header->closest = newheader->closest;
6392 bind_rdataset(rbtdb, rbtnode, header, now,
6401 if (IS_CACHE(rbtdb) && ACTIVE(header, now) &&
6402 header->type == dns_rdatatype_ns &&
6404 header->trust <= newheader->trust) {
6405 if (newheader->rdh_ttl > header->rdh_ttl) {
6406 newheader->rdh_ttl = header->rdh_ttl;
6409 if (IS_CACHE(rbtdb) && ACTIVE(header, now) &&
6411 (header->type == dns_rdatatype_a ||
6412 header->type == dns_rdatatype_aaaa ||
6413 header->type == dns_rdatatype_ds ||
6414 header->type == RBTDB_RDATATYPE_SIGDDS) &&
6416 header->trust >= newheader->trust &&
6417 dns_rdataslab_equal((unsigned char *)header,
6424 if (header->rdh_ttl > newheader->rdh_ttl)
6425 set_ttl(rbtdb, header, newheader->rdh_ttl);
6426 if (header->noqname == NULL &&
6428 header->noqname = newheader->noqname;
6431 if (header->closest == NULL &&
6433 header->closest = newheader->closest;
6438 bind_rdataset(rbtdb, rbtnode, header, now,
6479 * There are no other references to 'header' when
6480 * loading, so we MAY clean up 'header' now.
6482 * loading, we MUST clean up 'header' now.
6493 header);
6497 free_rdataset(rbtdb, rbtdb->common.mctx, header);
6524 resign_delete(rbtdb, rbtversion, header);
6537 set_ttl(rbtdb, header, 0);
6538 mark_stale_header(rbtdb, header);
6548 header);
6588 resign_delete(rbtdb, rbtversion, header);
6772 rdatasetheader_t *header;
6917 header = isc_heap_element(rbtdb->heaps[rbtnode->locknum], 1);
6918 if (header && header->rdh_ttl < now - RBTDB_VIRTUAL)
6919 expire_header(rbtdb, header, tree_locked,
6979 rdatasetheader_t *topheader, *topheader_prev, *header, *newheader;
7045 * If header isn't NULL, we've found the right type. There may be
7049 header = topheader;
7050 while (header != NULL && IGNORE(header))
7051 header = header->down;
7052 if (header != NULL && EXISTS(header)) {
7058 if (newheader->rdh_ttl != header->rdh_ttl)
7063 (unsigned char *)header,
7068 (dns_rdatatype_t)header->type,
7074 update_newheader(newheader, header);
7075 if (RESIGN(header)) {
7077 newheader->resign = header->resign;
7078 newheader->resign_lsb = header->resign_lsb;
7091 * header, not newheader.
7105 * add a nonexistent header instead.
7138 update_recordsandbytes(ISC_FALSE, rbtversion, header);
7148 resign_delete(rbtdb, rbtversion, header);
7166 bind_rdataset(rbtdb, rbtnode, header, 0, newrdataset);
7477 rdatasetheader_t *header;
7485 for (header = rbtnode->data; header != NULL; header = header->next) {
7486 p = (unsigned char *) header;
7488 size = dns_rdataslab_size(p, sizeof(*header));
7489 count = dns_rdataslab_count(p, sizeof(*header));;
7494 hexdump("hashing header", p, sizeof(rdatasetheader_t));
7498 header->serial = 1;
7499 header->is_mmapped = 1;
7500 header->node = rbtnode;
7501 header->node_is_relative = 0;
7503 if (rbtdb != NULL && RESIGN(header) &&
7504 (header->resign != 0 || header->resign_lsb != 0))
7506 int idx = header->node->locknum;
7507 result = isc_heap_insert(rbtdb->heaps[idx], header);
7512 if (header->next != NULL) {
7514 if ((uintptr_t)header->next !=
7517 header->next = (rdatasetheader_t *)(p + cooked);
7518 header->next_is_relative = 0;
7519 if ((header->next < (rdatasetheader_t *) base) ||
7520 (header->next > (rdatasetheader_t *) limit))
7536 rbtdb_file_header_t *header;
7566 header = (rbtdb_file_header_t *)(base + offset);
7567 if (!match_header_version(header)) {
7572 if (header->tree != 0) {
7574 (off_t) header->tree,
7589 if (header->nsec != 0) {
7591 (off_t) header->nsec,
7600 if (header->nsec3 != 0) {
7602 (off_t) header->nsec3,
7744 rdatasetheader_t *header = (rdatasetheader_t *) data, *next;
7758 for (; header != NULL; header = next) {
7759 next = header->next;
7761 if (header->serial <= serial && !IGNORE(header)) {
7762 if (NONEXISTENT(header))
7763 header = NULL;
7766 header = header->down;
7767 } while (header != NULL);
7769 if (header == NULL)
7773 size = dns_rdataslab_size((unsigned char *) header,
7776 p = (unsigned char *) header;
7798 hexdump("writing header", (unsigned char *) &newheader,
7828 * Write out a zeroed header as a placeholder. Doing this ensures
7857 * Write the file header out, recording the locations of the three
7866 rbtdb_file_header_t header;
7871 memset(&header, 0, sizeof(rbtdb_file_header_t));
7872 memmove(header.version1, FILE_VERSION, sizeof(header.version1));
7873 memmove(header.version2, FILE_VERSION, sizeof(header.version2));
7874 header.ptrsize = (isc_uint32_t) sizeof(void *);
7875 header.bigendian = (1 == htonl(1)) ? 1 : 0;
7876 header.tree = (isc_uint64_t) tree_location;
7877 header.nsec = (isc_uint64_t) nsec_location;
7878 header.nsec3 = (isc_uint64_t) nsec3_location;
7879 result = isc_stdio_write(&header, 1, sizeof(rbtdb_file_header_t),
7887 match_header_version(rbtdb_file_header_t *header) {
7890 if (memcmp(header->version1, FILE_VERSION,
7891 sizeof(header->version1)) != 0 ||
7892 memcmp(header->version2, FILE_VERSION,
7893 sizeof(header->version1)) != 0)
7917 * first, write out a zeroed header to store rbtdb information
7922 * finally, write out the rbtdb header, storing the locations of the
8160 rdatasetheader_t *header, oldheader;
8166 header = rdataset->private3;
8167 header--;
8169 NODE_LOCK(&rbtdb->node_locks[header->node->locknum].lock,
8172 oldheader = *header;
8179 header->resign =
8181 header->resign_lsb = resign & 0x1;
8183 if (header->heap_index != 0) {
8184 INSIST(RESIGN(header));
8186 isc_heap_delete(rbtdb->heaps[header->node->locknum],
8187 header->heap_index);
8188 header->heap_index = 0;
8189 } else if (resign_sooner(header, &oldheader)) {
8190 isc_heap_increased(rbtdb->heaps[header->node->locknum],
8191 header->heap_index);
8192 } else if (resign_sooner(&oldheader, header)) {
8193 isc_heap_decreased(rbtdb->heaps[header->node->locknum],
8194 header->heap_index);
8197 header->attributes |= RDATASET_ATTR_RESIGN;
8198 result = resign_insert(rbtdb, header->node->locknum, header);
8200 NODE_UNLOCK(&rbtdb->node_locks[header->node->locknum].lock,
8210 rdatasetheader_t *header = NULL, *this;
8227 if (header == NULL)
8228 header = this;
8229 else if (resign_sooner(this, header)) {
8230 locknum = header->node->locknum;
8233 header = this;
8239 if (header == NULL)
8242 bind_rdataset(rbtdb, header->node, header, 0, rdataset);
8245 dns_rbt_fullnamefromnode(header->node, foundname);
8247 NODE_UNLOCK(&rbtdb->node_locks[header->node->locknum].lock,
8264 rdatasetheader_t *header;
8276 header = rdataset->private3;
8277 INSIST(header != NULL);
8278 header--;
8280 if (header->heap_index == 0)
8290 resign_delete(rbtdb, rbtversion, header);
9032 rdatasetheader_t *header = rdataset->private3;
9034 header--;
9037 header->trust = rdataset->trust = trust;
9046 rdatasetheader_t *header = rdataset->private3;
9048 header--;
9051 expire_header(rbtdb, header, ISC_FALSE, expire_flush);
9060 rdatasetheader_t *header = rdataset->private3;
9062 header--;
9065 header->attributes &= ~RDATASET_ATTR_PREFETCH;
9096 rdatasetheader_t *header, *top_next;
9111 for (header = rbtnode->data; header != NULL; header = top_next) {
9112 top_next = header->next;
9114 if (header->serial <= serial && !IGNORE(header)) {
9120 * check for now > header->rdh_ttl instead
9121 * of now >= header->rdh_ttl. This allows
9125 if (NONEXISTENT(header) ||
9126 (now != 0 && now > header->rdh_ttl))
9127 header = NULL;
9130 header = header->down;
9131 } while (header != NULL);
9132 if (header != NULL)
9139 rbtiterator->current = header;
9141 if (header == NULL)
9153 rdatasetheader_t *header, *top_next;
9159 header = rbtiterator->current;
9160 if (header == NULL)
9174 type = header->type;
9175 rdtype = RBTDB_RDATATYPE_BASE(header->type);
9176 if (NEGATIVE(header)) {
9177 covers = RBTDB_RDATATYPE_EXT(header->type);
9181 for (header = header->next; header != NULL; header = top_next) {
9182 top_next = header->next;
9186 if (header->type != type && header->type != negtype) {
9188 if (header->serial <= serial &&
9189 !IGNORE(header)) {
9195 * check for now > header->ttl instead
9196 * of now >= header->ttl. This allows
9200 if (NONEXISTENT(header) ||
9201 (now != 0 && now > header->rdh_ttl))
9202 header = NULL;
9205 header = header->down;
9206 } while (header != NULL);
9207 if (header != NULL)
9215 rbtiterator->current = header;
9217 if (header == NULL)
9228 rdatasetheader_t *header;
9230 header = rbtiterator->current;
9231 REQUIRE(header != NULL);
9236 bind_rdataset(rbtdb, rbtnode, header, rbtiterator->common.now,
9762 rdatasetheader_t *header;
9772 header = (struct rdatasetheader *)(raw - sizeof(*header));
9785 acarray = header->additional_auth;
9791 acarray = header->additional_glue;
9847 acarray = cbarg->header->additional_auth;
9850 acarray = cbarg->header->additional_glue;
9906 rdatasetheader_t *header;
9919 header = (struct rdatasetheader *)(raw - sizeof(*header));
9930 newcbarg->header = header;
9954 acarray = header->additional_auth;
9957 acarray = header->additional_glue;
9981 header->additional_auth = acarray;
9984 header->additional_glue = acarray;
10036 rdatasetheader_t *header;
10049 header = (struct rdatasetheader *)(raw - sizeof(*header));
10063 acarray = header->additional_auth;
10066 acarray = header->additional_glue;
10099 setownercase(rdatasetheader_t *header, const dns_name_t *name) {
10107 memset(header->upper, 0, sizeof(header->upper));
10111 header->upper[i/8] |= 1 << (i%8);
10114 header->attributes |= RDATASET_ATTR_CASESET;
10116 header->attributes |= RDATASET_ATTR_CASEFULLYLOWER;
10122 rdatasetheader_t *header;
10124 header = (struct rdatasetheader *)(raw - sizeof(*header));
10125 setownercase(header, name);
10201 const rdatasetheader_t *header;
10206 header = (const struct rdatasetheader *)(raw - sizeof(*header));
10208 if (!CASESET(header))
10221 (header->upper[i/8] & (1 << (i%8))) != 0)
10224 (header->upper[i/8] & (1 << (i%8))) == 0)
10228 if (ISC_LIKELY(CASEFULLYLOWER(header))) {
10255 bits = ~(header->upper[j]);
10272 bits = ~(header->upper[j]);
10307 need_headerupdate(rdatasetheader_t *header, isc_stdtime_t now) {
10308 if ((header->attributes &
10315 if (header->type == dns_rdatatype_ns ||
10316 (header->trust == dns_trust_glue &&
10317 (header->type == dns_rdatatype_a ||
10318 header->type == dns_rdatatype_aaaa))) {
10323 return (header->last_used + 60 <= now);
10327 return (header->last_used + 300 <= now);
10344 update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header,
10350 INSIST(ISC_LINK_LINKED(header, link));
10352 ISC_LIST_UNLINK(rbtdb->rdatasets[header->node->locknum], header, link);
10353 header->last_used = now;
10354 ISC_LIST_PREPEND(rbtdb->rdatasets[header->node->locknum], header, link);
10371 rdatasetheader_t *header, *header_prev;
10381 header = isc_heap_element(rbtdb->heaps[locknum], 1);
10382 if (header && header->rdh_ttl < now - RBTDB_VIRTUAL) {
10383 expire_header(rbtdb, header, tree_locked,
10388 for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]);
10389 header != NULL && purgecount > 0;
10390 header = header_prev) {
10391 header_prev = ISC_LIST_PREV(header, link);
10399 ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header,
10401 expire_header(rbtdb, header, tree_locked,
10412 expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header,
10415 set_ttl(rbtdb, header, 0);
10416 mark_stale_header(rbtdb, header);
10422 if (dns_rbtnode_refcurrent(header->node) == 0) {
10428 new_reference(rbtdb, header->node);
10429 decrement_reference(rbtdb, header->node, 0,