2014-06-19 00:35:11 -07:00
|
|
|
/*
|
2015-01-30 23:45:24 +00:00
|
|
|
* Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
|
2014-06-19 00:35:11 -07:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
|
|
|
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
|
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
|
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
|
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* draft-ietf-dnsop-delegation-trust-maintainance-14 */
|
|
|
|
|
|
|
|
#ifndef RDATA_GENERIC_CDNSKEY_60_C
|
|
|
|
#define RDATA_GENERIC_CDNSKEY_60_C
|
|
|
|
|
|
|
|
#include <dst/dst.h>
|
|
|
|
|
2015-01-30 21:48:28 +11:00
|
|
|
#define RRTYPE_CDNSKEY_ATTRIBUTES 0
|
2014-06-19 00:35:11 -07:00
|
|
|
|
|
|
|
static inline isc_result_t
|
|
|
|
fromtext_cdnskey(ARGS_FROMTEXT) {
|
|
|
|
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
return (generic_fromtext_key(rdclass, type, lexer, origin,
|
|
|
|
options, target, callbacks));
|
2014-06-19 00:35:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline isc_result_t
|
|
|
|
totext_cdnskey(ARGS_TOTEXT) {
|
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
REQUIRE(rdata != NULL);
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(rdata->type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
return (generic_totext_key(rdata, tctx, target));
|
2014-06-19 00:35:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline isc_result_t
|
|
|
|
fromwire_cdnskey(ARGS_FROMWIRE) {
|
|
|
|
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
return (generic_fromwire_key(rdclass, type, source, dctx,
|
|
|
|
options, target));
|
2014-06-19 00:35:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline isc_result_t
|
|
|
|
towire_cdnskey(ARGS_TOWIRE) {
|
|
|
|
isc_region_t sr;
|
|
|
|
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(rdata->type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
REQUIRE(rdata->length != 0);
|
|
|
|
|
|
|
|
UNUSED(cctx);
|
|
|
|
|
|
|
|
dns_rdata_toregion(rdata, &sr);
|
|
|
|
return (mem_tobuffer(target, sr.base, sr.length));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
compare_cdnskey(ARGS_COMPARE) {
|
|
|
|
isc_region_t r1;
|
|
|
|
isc_region_t r2;
|
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
REQUIRE(rdata1 != NULL);
|
|
|
|
REQUIRE(rdata2 != NULL);
|
2014-06-19 00:35:11 -07:00
|
|
|
REQUIRE(rdata1->type == rdata2->type);
|
|
|
|
REQUIRE(rdata1->rdclass == rdata2->rdclass);
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(rdata1->type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
REQUIRE(rdata1->length != 0);
|
|
|
|
REQUIRE(rdata2->length != 0);
|
|
|
|
|
|
|
|
dns_rdata_toregion(rdata1, &r1);
|
|
|
|
dns_rdata_toregion(rdata2, &r2);
|
|
|
|
return (isc_region_compare(&r1, &r2));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline isc_result_t
|
|
|
|
fromstruct_cdnskey(ARGS_FROMSTRUCT) {
|
|
|
|
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
return (generic_fromstruct_key(rdclass, type, source, target));
|
2014-06-19 00:35:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline isc_result_t
|
|
|
|
tostruct_cdnskey(ARGS_TOSTRUCT) {
|
|
|
|
dns_rdata_cdnskey_t *dnskey = target;
|
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
REQUIRE(dnskey != NULL);
|
|
|
|
REQUIRE(rdata != NULL);
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(rdata->type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
|
|
|
dnskey->common.rdclass = rdata->rdclass;
|
|
|
|
dnskey->common.rdtype = rdata->type;
|
|
|
|
ISC_LINK_INIT(&dnskey->common, link);
|
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
return (generic_tostruct_key(rdata, target, mctx));
|
2014-06-19 00:35:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
freestruct_cdnskey(ARGS_FREESTRUCT) {
|
|
|
|
dns_rdata_cdnskey_t *dnskey = (dns_rdata_cdnskey_t *) source;
|
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
REQUIRE(dnskey != NULL);
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(dnskey->common.rdtype == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
generic_freestruct_key(source);
|
2014-06-19 00:35:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline isc_result_t
|
|
|
|
additionaldata_cdnskey(ARGS_ADDLDATA) {
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(rdata->type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
|
|
|
UNUSED(rdata);
|
|
|
|
UNUSED(add);
|
|
|
|
UNUSED(arg);
|
|
|
|
|
|
|
|
return (ISC_R_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline isc_result_t
|
|
|
|
digest_cdnskey(ARGS_DIGEST) {
|
|
|
|
isc_region_t r;
|
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
REQUIRE(rdata != NULL);
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(rdata->type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
|
|
|
dns_rdata_toregion(rdata, &r);
|
|
|
|
|
|
|
|
return ((digest)(arg, &r));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline isc_boolean_t
|
|
|
|
checkowner_cdnskey(ARGS_CHECKOWNER) {
|
|
|
|
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
|
|
|
UNUSED(name);
|
|
|
|
UNUSED(type);
|
|
|
|
UNUSED(rdclass);
|
|
|
|
UNUSED(wildcard);
|
|
|
|
|
|
|
|
return (ISC_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline isc_boolean_t
|
|
|
|
checknames_cdnskey(ARGS_CHECKNAMES) {
|
|
|
|
|
2015-09-10 14:50:20 +10:00
|
|
|
REQUIRE(rdata != NULL);
|
2015-08-17 12:23:35 +05:30
|
|
|
REQUIRE(rdata->type == dns_rdatatype_cdnskey);
|
2014-06-19 00:35:11 -07:00
|
|
|
|
|
|
|
UNUSED(rdata);
|
|
|
|
UNUSED(owner);
|
|
|
|
UNUSED(bad);
|
|
|
|
|
|
|
|
return (ISC_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
casecompare_cdnskey(ARGS_COMPARE) {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Treat ALG 253 (private DNS) subtype name case sensistively.
|
|
|
|
*/
|
|
|
|
return (compare_cdnskey(rdata1, rdata2));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* RDATA_GENERIC_CDNSKEY_60_C */
|