From: Michał Kępień Date: Tue, 3 Jul 2018 06:44:05 +0000 (+0200) Subject: Remove dns_rdataslab_tordataset() and its related dns_rdatasetmethods_t callbacks X-Git-Tag: v9.13.2~2^2~1 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=b2f65ddbf0146d592c3da6af87595fbd402f1a70;p=thirdparty%2Fbind9.git Remove dns_rdataslab_tordataset() and its related dns_rdatasetmethods_t callbacks Since BIND libraries are no longer considered public and dns_rdataslab_tordataset() is not used anywhere in the tree, remove the latter and its associated dns_rdatasetmethods_t callbacks from lib/dns/rdataslab.c. --- diff --git a/lib/dns/include/dns/rdataslab.h b/lib/dns/include/dns/rdataslab.h index 575bc99d54a..f5b8f37f5ad 100644 --- a/lib/dns/include/dns/rdataslab.h +++ b/lib/dns/include/dns/rdataslab.h @@ -82,22 +82,6 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, *\li XXX others */ -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); -/*%< - * Construct an rdataset from a slab. - * - * Requires: - *\li 'slab' points to a slab. - *\li 'rdataset' is disassociated. - * - * Ensures: - *\li 'rdataset' is associated and points to a valid rdataest. - */ - unsigned int dns_rdataslab_size(unsigned char *slab, unsigned int reservelen); /*%< diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c index a442fe9d299..33a7f94d8c3 100644 --- a/lib/dns/rdataslab.c +++ b/lib/dns/rdataslab.c @@ -59,8 +59,6 @@ * 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. * @@ -343,154 +341,6 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, 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; diff --git a/lib/dns/win32/libdns.def.in b/lib/dns/win32/libdns.def.in index 8d166679b23..0784b0359ff 100644 --- a/lib/dns/win32/libdns.def.in +++ b/lib/dns/win32/libdns.def.in @@ -826,7 +826,6 @@ dns_rdataslab_fromrdataset dns_rdataslab_merge dns_rdataslab_size dns_rdataslab_subtract -dns_rdataslab_tordataset dns_rdatatype_atparent dns_rdatatype_attributes dns_rdatatype_format