Commit b2f65ddb authored by Michał Kępień's avatar Michał Kępień
Browse files

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.
parent a511c8cc
......@@ -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);
/*%<
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment