/src/bind9/lib/dns/rdata/generic/rkey_57.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) Internet Systems Consortium, Inc. ("ISC") |
3 | | * |
4 | | * SPDX-License-Identifier: MPL-2.0 |
5 | | * |
6 | | * This Source Code Form is subject to the terms of the Mozilla Public |
7 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
8 | | * file, you can obtain one at https://mozilla.org/MPL/2.0/. |
9 | | * |
10 | | * See the COPYRIGHT file distributed with this work for additional |
11 | | * information regarding copyright ownership. |
12 | | */ |
13 | | |
14 | | #ifndef RDATA_GENERIC_RKEY_57_C |
15 | | #define RDATA_GENERIC_RKEY_57_C |
16 | | |
17 | 12.1k | #define RRTYPE_RKEY_ATTRIBUTES 0 |
18 | | |
19 | | static isc_result_t |
20 | 386 | fromtext_rkey(ARGS_FROMTEXT) { |
21 | 386 | REQUIRE(type == dns_rdatatype_rkey); |
22 | | |
23 | 386 | return generic_fromtext_key(CALL_FROMTEXT); |
24 | 386 | } |
25 | | |
26 | | static isc_result_t |
27 | 1.67k | totext_rkey(ARGS_TOTEXT) { |
28 | 1.67k | REQUIRE(rdata != NULL); |
29 | 1.67k | REQUIRE(rdata->type == dns_rdatatype_rkey); |
30 | | |
31 | 1.67k | return generic_totext_key(CALL_TOTEXT); |
32 | 1.67k | } |
33 | | |
34 | | static isc_result_t |
35 | 1.96k | fromwire_rkey(ARGS_FROMWIRE) { |
36 | 1.96k | REQUIRE(type == dns_rdatatype_rkey); |
37 | | |
38 | 1.96k | return generic_fromwire_key(CALL_FROMWIRE); |
39 | 1.96k | } |
40 | | |
41 | | static isc_result_t |
42 | 857 | towire_rkey(ARGS_TOWIRE) { |
43 | 857 | isc_region_t sr; |
44 | | |
45 | 857 | REQUIRE(rdata != NULL); |
46 | 857 | REQUIRE(rdata->type == dns_rdatatype_rkey); |
47 | 857 | REQUIRE(rdata->length != 0); |
48 | | |
49 | 857 | UNUSED(cctx); |
50 | | |
51 | 857 | dns_rdata_toregion(rdata, &sr); |
52 | 857 | return mem_tobuffer(target, sr.base, sr.length); |
53 | 857 | } |
54 | | |
55 | | static int |
56 | 1.97k | compare_rkey(ARGS_COMPARE) { |
57 | 1.97k | isc_region_t r1; |
58 | 1.97k | isc_region_t r2; |
59 | | |
60 | 1.97k | REQUIRE(rdata1 != NULL); |
61 | 1.97k | REQUIRE(rdata2 != NULL); |
62 | 1.97k | REQUIRE(rdata1->type == rdata2->type); |
63 | 1.97k | REQUIRE(rdata1->rdclass == rdata2->rdclass); |
64 | 1.97k | REQUIRE(rdata1->type == dns_rdatatype_rkey); |
65 | 1.97k | REQUIRE(rdata1->length != 0); |
66 | 1.97k | REQUIRE(rdata2->length != 0); |
67 | | |
68 | 1.97k | dns_rdata_toregion(rdata1, &r1); |
69 | 1.97k | dns_rdata_toregion(rdata2, &r2); |
70 | 1.97k | return isc_region_compare(&r1, &r2); |
71 | 1.97k | } |
72 | | |
73 | | static isc_result_t |
74 | 0 | fromstruct_rkey(ARGS_FROMSTRUCT) { |
75 | 0 | REQUIRE(type == dns_rdatatype_rkey); |
76 | |
|
77 | 0 | return generic_fromstruct_key(CALL_FROMSTRUCT); |
78 | 0 | } |
79 | | |
80 | | static isc_result_t |
81 | 0 | tostruct_rkey(ARGS_TOSTRUCT) { |
82 | 0 | dns_rdata_rkey_t *rkey = target; |
83 | |
|
84 | 0 | REQUIRE(rkey != NULL); |
85 | 0 | REQUIRE(rdata != NULL); |
86 | 0 | REQUIRE(rdata->type == dns_rdatatype_rkey); |
87 | |
|
88 | 0 | DNS_RDATACOMMON_INIT(rkey, rdata->type, rdata->rdclass); |
89 | |
|
90 | 0 | return generic_tostruct_key(CALL_TOSTRUCT); |
91 | 0 | } |
92 | | |
93 | | static void |
94 | 0 | freestruct_rkey(ARGS_FREESTRUCT) { |
95 | 0 | dns_rdata_rkey_t *rkey = (dns_rdata_rkey_t *)source; |
96 | |
|
97 | 0 | REQUIRE(rkey != NULL); |
98 | 0 | REQUIRE(rkey->common.rdtype == dns_rdatatype_rkey); |
99 | |
|
100 | 0 | generic_freestruct_key(source); |
101 | 0 | } |
102 | | |
103 | | static isc_result_t |
104 | 0 | additionaldata_rkey(ARGS_ADDLDATA) { |
105 | 0 | REQUIRE(rdata->type == dns_rdatatype_rkey); |
106 | |
|
107 | 0 | UNUSED(rdata); |
108 | 0 | UNUSED(owner); |
109 | 0 | UNUSED(add); |
110 | 0 | UNUSED(arg); |
111 | |
|
112 | 0 | return ISC_R_SUCCESS; |
113 | 0 | } |
114 | | |
115 | | static isc_result_t |
116 | 0 | digest_rkey(ARGS_DIGEST) { |
117 | 0 | isc_region_t r; |
118 | |
|
119 | 0 | REQUIRE(rdata != NULL); |
120 | 0 | REQUIRE(rdata->type == dns_rdatatype_rkey); |
121 | |
|
122 | 0 | dns_rdata_toregion(rdata, &r); |
123 | |
|
124 | 0 | return (digest)(arg, &r); |
125 | 0 | } |
126 | | |
127 | | static bool |
128 | 0 | checkowner_rkey(ARGS_CHECKOWNER) { |
129 | 0 | REQUIRE(type == dns_rdatatype_rkey); |
130 | |
|
131 | 0 | UNUSED(name); |
132 | 0 | UNUSED(type); |
133 | 0 | UNUSED(rdclass); |
134 | 0 | UNUSED(wildcard); |
135 | |
|
136 | 0 | return true; |
137 | 0 | } |
138 | | |
139 | | static bool |
140 | 0 | checknames_rkey(ARGS_CHECKNAMES) { |
141 | 0 | REQUIRE(rdata != NULL); |
142 | 0 | REQUIRE(rdata->type == dns_rdatatype_rkey); |
143 | |
|
144 | 0 | UNUSED(rdata); |
145 | 0 | UNUSED(owner); |
146 | 0 | UNUSED(bad); |
147 | |
|
148 | 0 | return true; |
149 | 0 | } |
150 | | |
151 | | static int |
152 | 0 | casecompare_rkey(ARGS_COMPARE) { |
153 | | /* |
154 | | * Treat ALG 253 (private DNS) subtype name case sensitively. |
155 | | */ |
156 | 0 | return compare_rkey(rdata1, rdata2); |
157 | 0 | } |
158 | | |
159 | | #endif /* RDATA_GENERIC_RKEY_57_C */ |