4199. [protocol] Add support for NINFO, RKEY, TA.

[RT #40545] [RT #40547] [RT #40563]

(cherry picked from commit 3dd63ba00f)
This commit is contained in:
Mark Andrews
2015-09-10 17:58:29 +10:00
parent c6501326e7
commit 5b15652954
14 changed files with 325 additions and 417 deletions

View File

@@ -31,13 +31,11 @@
#include <dns/ds.h>
static inline isc_result_t
fromtext_ds(ARGS_FROMTEXT) {
generic_fromtext_ds(ARGS_FROMTEXT) {
isc_token_t token;
unsigned char c;
int length;
REQUIRE(type == dns_rdatatype_ds);
UNUSED(type);
UNUSED(rdclass);
UNUSED(origin);
@@ -95,12 +93,20 @@ fromtext_ds(ARGS_FROMTEXT) {
}
static inline isc_result_t
totext_ds(ARGS_TOTEXT) {
fromtext_ds(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_ds);
return (generic_fromtext_ds(rdclass, type, lexer, origin, options,
target, callbacks));
}
static inline isc_result_t
generic_totext_ds(ARGS_TOTEXT) {
isc_region_t sr;
char buf[sizeof("64000 ")];
unsigned int n;
REQUIRE(rdata->type == dns_rdatatype_ds);
REQUIRE(rdata->length != 0);
UNUSED(tctx);
@@ -148,10 +154,16 @@ totext_ds(ARGS_TOTEXT) {
}
static inline isc_result_t
fromwire_ds(ARGS_FROMWIRE) {
isc_region_t sr;
totext_ds(ARGS_TOTEXT) {
REQUIRE(type == dns_rdatatype_ds);
REQUIRE(rdata->type == dns_rdatatype_ds);
return (generic_totext_ds(rdata, tctx, target));
}
static inline isc_result_t
generic_fromwire_ds(ARGS_FROMWIRE) {
isc_region_t sr;
UNUSED(type);
UNUSED(rdclass);
@@ -192,6 +204,15 @@ fromwire_ds(ARGS_FROMWIRE) {
return (mem_tobuffer(target, sr.base, sr.length));
}
static inline isc_result_t
fromwire_ds(ARGS_FROMWIRE) {
REQUIRE(type == dns_rdatatype_ds);
return (generic_fromwire_ds(rdclass, type, source, dctx, options,
target));
}
static inline isc_result_t
towire_ds(ARGS_TOWIRE) {
isc_region_t sr;
@@ -222,13 +243,16 @@ compare_ds(ARGS_COMPARE) {
}
static inline isc_result_t
fromstruct_ds(ARGS_FROMSTRUCT) {
generic_fromstruct_ds(ARGS_FROMSTRUCT) {
dns_rdata_ds_t *ds = source;
REQUIRE(type == dns_rdatatype_ds);
REQUIRE(source != NULL);
REQUIRE(ds->common.rdtype == type);
REQUIRE(ds->common.rdclass == rdclass);
UNUSED(type);
UNUSED(rdclass);
switch (ds->digest_type) {
case DNS_DSDIGEST_SHA1:
REQUIRE(ds->length == ISC_SHA1_DIGESTLENGTH);
@@ -244,9 +268,6 @@ fromstruct_ds(ARGS_FROMSTRUCT) {
break;
}
UNUSED(type);
UNUSED(rdclass);
RETERR(uint16_tobuffer(ds->key_tag, target));
RETERR(uint8_tobuffer(ds->algorithm, target));
RETERR(uint8_tobuffer(ds->digest_type, target));
@@ -255,17 +276,23 @@ fromstruct_ds(ARGS_FROMSTRUCT) {
}
static inline isc_result_t
tostruct_ds(ARGS_TOSTRUCT) {
fromstruct_ds(ARGS_FROMSTRUCT) {
REQUIRE(type == dns_rdatatype_ds);
return (generic_fromstruct_ds(rdclass, type, source, target));
}
static inline isc_result_t
generic_tostruct_ds(ARGS_TOSTRUCT) {
dns_rdata_ds_t *ds = target;
isc_region_t region;
REQUIRE(rdata->type == dns_rdatatype_ds);
REQUIRE(target != NULL);
REQUIRE(rdata->length != 0);
ds->common.rdclass = rdata->rdclass;
ds->common.rdtype = rdata->type;
ISC_LINK_INIT(&ds->common, link);
REQUIRE(ds->common.rdtype == rdata->type);
REQUIRE(ds->common.rdclass == rdata->rdclass);
REQUIRE(!ISC_LINK_LINKED(&ds->common, link));
dns_rdata_toregion(rdata, &region);
@@ -285,6 +312,20 @@ tostruct_ds(ARGS_TOSTRUCT) {
return (ISC_R_SUCCESS);
}
static inline isc_result_t
tostruct_ds(ARGS_TOSTRUCT) {
dns_rdata_ds_t *ds = target;
REQUIRE(rdata->type == dns_rdatatype_ds);
REQUIRE(target != NULL);
ds->common.rdclass = rdata->rdclass;
ds->common.rdtype = rdata->type;
ISC_LINK_INIT(&ds->common, link);
return (generic_tostruct_ds(rdata, target, mctx));
}
static inline void
freestruct_ds(ARGS_FREESTRUCT) {
dns_rdata_ds_t *ds = source;