* The order is stored with record to allow for efficient reconstruction
* of the offset table following a merge or subtraction.
*
- * The iterator methods here currently only support DNSSEC order iteration.
- *
* The iterator methods in rbtdb support both load order and DNSSEC order
* iteration.
*
return (result);
}
-static void
-rdataset_disassociate(dns_rdataset_t *rdataset) {
- UNUSED(rdataset);
-}
-
-static isc_result_t
-rdataset_first(dns_rdataset_t *rdataset) {
- unsigned char *raw = rdataset->private3;
- unsigned int count;
-
- count = raw[0] * 256 + raw[1];
- if (count == 0) {
- rdataset->private5 = NULL;
- return (ISC_R_NOMORE);
- }
-#if DNS_RDATASET_FIXED
- raw += 2 + (4 * count);
-#else
- raw += 2;
-#endif
- /*
- * The privateuint4 field is the number of rdata beyond the cursor
- * position, so we decrement the total count by one before storing
- * it.
- */
- count--;
- rdataset->privateuint4 = count;
- rdataset->private5 = raw;
-
- return (ISC_R_SUCCESS);
-}
-
-static isc_result_t
-rdataset_next(dns_rdataset_t *rdataset) {
- unsigned int count;
- unsigned int length;
- unsigned char *raw;
-
- count = rdataset->privateuint4;
- if (count == 0)
- return (ISC_R_NOMORE);
- count--;
- rdataset->privateuint4 = count;
- raw = rdataset->private5;
- length = raw[0] * 256 + raw[1];
-#if DNS_RDATASET_FIXED
- raw += length + 4;
-#else
- raw += length + 2;
-#endif
- rdataset->private5 = raw;
-
- return (ISC_R_SUCCESS);
-}
-
-static void
-rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata) {
- unsigned char *raw = rdataset->private5;
- isc_region_t r;
- unsigned int length;
- unsigned int flags = 0;
-
- REQUIRE(raw != NULL);
-
- length = raw[0] * 256 + raw[1];
-#if DNS_RDATASET_FIXED
- raw += 4;
-#else
- raw += 2;
-#endif
- if (rdataset->type == dns_rdatatype_rrsig) {
- if (*raw & DNS_RDATASLAB_OFFLINE)
- flags |= DNS_RDATA_OFFLINE;
- length--;
- raw++;
- }
- r.length = length;
- r.base = raw;
- dns_rdata_fromregion(rdata, rdataset->rdclass, rdataset->type, &r);
- rdata->flags |= flags;
-}
-
-static void
-rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) {
- *target = *source;
-
- /*
- * Reset iterator state.
- */
- target->privateuint4 = 0;
- target->private5 = NULL;
-}
-
-static unsigned int
-rdataset_count(dns_rdataset_t *rdataset) {
- unsigned char *raw = rdataset->private3;
- unsigned int count;
-
- count = raw[0] * 256 + raw[1];
-
- return (count);
-}
-
-static dns_rdatasetmethods_t rdataset_methods = {
- rdataset_disassociate,
- rdataset_first,
- rdataset_next,
- rdataset_current,
- rdataset_clone,
- rdataset_count,
- NULL, /* addnoqname */
- NULL, /* getnoqname */
- NULL, /* addclosest */
- NULL, /* getclosest */
- NULL, /* settrust */
- NULL, /* expire */
- NULL, /* clearprefetch */
- NULL, /* setownercase */
- NULL, /* getownercase */
- NULL /* addglue */
-};
-
-void
-dns_rdataslab_tordataset(unsigned char *slab, unsigned int reservelen,
- dns_rdataclass_t rdclass, dns_rdatatype_t rdtype,
- dns_rdatatype_t covers, dns_ttl_t ttl,
- dns_rdataset_t *rdataset)
-{
- REQUIRE(slab != NULL);
- REQUIRE(!dns_rdataset_isassociated(rdataset));
-
- rdataset->methods = &rdataset_methods;
- rdataset->rdclass = rdclass;
- rdataset->type = rdtype;
- rdataset->covers = covers;
- rdataset->ttl = ttl;
- rdataset->trust = 0;
- rdataset->private1 = NULL;
- rdataset->private2 = NULL;
- rdataset->private3 = slab + reservelen;
-
- /*
- * Reset iterator state.
- */
- rdataset->privateuint4 = 0;
- rdataset->private5 = NULL;
-}
-
unsigned int
dns_rdataslab_size(unsigned char *slab, unsigned int reservelen) {
unsigned int count, length;