2 * Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 * PERFORMANCE OF THIS SOFTWARE.
20 * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley.
25 #ifndef RDATA_GENERIC_CDNSKEY_60_C
26 #define RDATA_GENERIC_CDNSKEY_60_C
30 #define RRTYPE_CDNSKEY_ATTRIBUTES 0
32 static inline isc_result_t
33 fromtext_cdnskey(ARGS_FROMTEXT) {
35 REQUIRE(type == dns_rdatatype_cdnskey);
37 return (generic_fromtext_key(rdclass, type, lexer, origin,
38 options, target, callbacks));
41 static inline isc_result_t
42 totext_cdnskey(ARGS_TOTEXT) {
44 REQUIRE(rdata != NULL);
45 REQUIRE(rdata->type == dns_rdatatype_cdnskey);
47 return (generic_totext_key(rdata, tctx, target));
50 static inline isc_result_t
51 fromwire_cdnskey(ARGS_FROMWIRE) {
53 REQUIRE(type == dns_rdatatype_cdnskey);
55 return (generic_fromwire_key(rdclass, type, source, dctx,
59 static inline isc_result_t
60 towire_cdnskey(ARGS_TOWIRE) {
63 REQUIRE(rdata->type == dns_rdatatype_cdnskey);
64 REQUIRE(rdata->length != 0);
68 dns_rdata_toregion(rdata, &sr);
69 return (mem_tobuffer(target, sr.base, sr.length));
73 compare_cdnskey(ARGS_COMPARE) {
77 REQUIRE(rdata1 != NULL);
78 REQUIRE(rdata2 != NULL);
79 REQUIRE(rdata1->type == rdata2->type);
80 REQUIRE(rdata1->rdclass == rdata2->rdclass);
81 REQUIRE(rdata1->type == dns_rdatatype_cdnskey);
82 REQUIRE(rdata1->length != 0);
83 REQUIRE(rdata2->length != 0);
85 dns_rdata_toregion(rdata1, &r1);
86 dns_rdata_toregion(rdata2, &r2);
87 return (isc_region_compare(&r1, &r2));
90 static inline isc_result_t
91 fromstruct_cdnskey(ARGS_FROMSTRUCT) {
93 REQUIRE(type == dns_rdatatype_cdnskey);
95 return (generic_fromstruct_key(rdclass, type, source, target));
98 static inline isc_result_t
99 tostruct_cdnskey(ARGS_TOSTRUCT) {
100 dns_rdata_cdnskey_t *dnskey = target;
102 REQUIRE(dnskey != NULL);
103 REQUIRE(rdata != NULL);
104 REQUIRE(rdata->type == dns_rdatatype_cdnskey);
106 dnskey->common.rdclass = rdata->rdclass;
107 dnskey->common.rdtype = rdata->type;
108 ISC_LINK_INIT(&dnskey->common, link);
110 return (generic_tostruct_key(rdata, target, mctx));
114 freestruct_cdnskey(ARGS_FREESTRUCT) {
115 dns_rdata_cdnskey_t *dnskey = (dns_rdata_cdnskey_t *) source;
117 REQUIRE(dnskey != NULL);
118 REQUIRE(dnskey->common.rdtype == dns_rdatatype_cdnskey);
120 generic_freestruct_key(source);
123 static inline isc_result_t
124 additionaldata_cdnskey(ARGS_ADDLDATA) {
125 REQUIRE(rdata->type == dns_rdatatype_cdnskey);
131 return (ISC_R_SUCCESS);
134 static inline isc_result_t
135 digest_cdnskey(ARGS_DIGEST) {
138 REQUIRE(rdata != NULL);
139 REQUIRE(rdata->type == dns_rdatatype_cdnskey);
141 dns_rdata_toregion(rdata, &r);
143 return ((digest)(arg, &r));
146 static inline isc_boolean_t
147 checkowner_cdnskey(ARGS_CHECKOWNER) {
149 REQUIRE(type == dns_rdatatype_cdnskey);
159 static inline isc_boolean_t
160 checknames_cdnskey(ARGS_CHECKNAMES) {
162 REQUIRE(rdata != NULL);
163 REQUIRE(rdata->type == dns_rdatatype_cdnskey);
173 casecompare_cdnskey(ARGS_COMPARE) {
176 * Treat ALG 253 (private DNS) subtype name case sensistively.
178 return (compare_cdnskey(rdata1, rdata2));
181 #endif /* RDATA_GENERIC_CDNSKEY_60_C */