/src/bind9/lib/dns/rdata/generic/dlv_32769.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 | | /* RFC3658 */ |
15 | | |
16 | | #ifndef RDATA_GENERIC_DLV_32769_C |
17 | | #define RDATA_GENERIC_DLV_32769_C |
18 | | |
19 | 12.4k | #define RRTYPE_DLV_ATTRIBUTES 0 |
20 | | |
21 | | #include <dns/ds.h> |
22 | | |
23 | | static isc_result_t |
24 | 266 | fromtext_dlv(ARGS_FROMTEXT) { |
25 | 266 | REQUIRE(type == dns_rdatatype_dlv); |
26 | | |
27 | 266 | return generic_fromtext_ds(CALL_FROMTEXT); |
28 | 266 | } |
29 | | |
30 | | static isc_result_t |
31 | 692 | totext_dlv(ARGS_TOTEXT) { |
32 | 692 | REQUIRE(rdata != NULL); |
33 | 692 | REQUIRE(rdata->type == dns_rdatatype_dlv); |
34 | | |
35 | 692 | return generic_totext_ds(CALL_TOTEXT); |
36 | 692 | } |
37 | | |
38 | | static isc_result_t |
39 | 3.06k | fromwire_dlv(ARGS_FROMWIRE) { |
40 | 3.06k | REQUIRE(type == dns_rdatatype_dlv); |
41 | | |
42 | 3.06k | return generic_fromwire_ds(CALL_FROMWIRE); |
43 | 3.06k | } |
44 | | |
45 | | static isc_result_t |
46 | 351 | towire_dlv(ARGS_TOWIRE) { |
47 | 351 | isc_region_t sr; |
48 | | |
49 | 351 | REQUIRE(rdata->type == dns_rdatatype_dlv); |
50 | 351 | REQUIRE(rdata->length != 0); |
51 | | |
52 | 351 | UNUSED(cctx); |
53 | | |
54 | 351 | dns_rdata_toregion(rdata, &sr); |
55 | 351 | return mem_tobuffer(target, sr.base, sr.length); |
56 | 351 | } |
57 | | |
58 | | static int |
59 | 3.16k | compare_dlv(ARGS_COMPARE) { |
60 | 3.16k | isc_region_t r1; |
61 | 3.16k | isc_region_t r2; |
62 | | |
63 | 3.16k | REQUIRE(rdata1->type == rdata2->type); |
64 | 3.16k | REQUIRE(rdata1->rdclass == rdata2->rdclass); |
65 | 3.16k | REQUIRE(rdata1->type == dns_rdatatype_dlv); |
66 | 3.16k | REQUIRE(rdata1->length != 0); |
67 | 3.16k | REQUIRE(rdata2->length != 0); |
68 | | |
69 | 3.16k | dns_rdata_toregion(rdata1, &r1); |
70 | 3.16k | dns_rdata_toregion(rdata2, &r2); |
71 | 3.16k | return isc_region_compare(&r1, &r2); |
72 | 3.16k | } |
73 | | |
74 | | static isc_result_t |
75 | 0 | fromstruct_dlv(ARGS_FROMSTRUCT) { |
76 | 0 | REQUIRE(type == dns_rdatatype_dlv); |
77 | |
|
78 | 0 | return generic_fromstruct_ds(CALL_FROMSTRUCT); |
79 | 0 | } |
80 | | |
81 | | static isc_result_t |
82 | 0 | tostruct_dlv(ARGS_TOSTRUCT) { |
83 | 0 | dns_rdata_dlv_t *dlv = target; |
84 | |
|
85 | 0 | REQUIRE(rdata->type == dns_rdatatype_dlv); |
86 | 0 | REQUIRE(dlv != NULL); |
87 | |
|
88 | 0 | DNS_RDATACOMMON_INIT(dlv, rdata->type, rdata->rdclass); |
89 | |
|
90 | 0 | return generic_tostruct_ds(CALL_TOSTRUCT); |
91 | 0 | } |
92 | | |
93 | | static void |
94 | 0 | freestruct_dlv(ARGS_FREESTRUCT) { |
95 | 0 | dns_rdata_dlv_t *dlv = source; |
96 | |
|
97 | 0 | REQUIRE(dlv != NULL); |
98 | 0 | REQUIRE(dlv->common.rdtype == dns_rdatatype_dlv); |
99 | |
|
100 | 0 | if (dlv->mctx == NULL) { |
101 | 0 | return; |
102 | 0 | } |
103 | | |
104 | 0 | if (dlv->digest != NULL) { |
105 | 0 | isc_mem_free(dlv->mctx, dlv->digest); |
106 | 0 | } |
107 | 0 | dlv->mctx = NULL; |
108 | 0 | } |
109 | | |
110 | | static isc_result_t |
111 | 0 | additionaldata_dlv(ARGS_ADDLDATA) { |
112 | 0 | REQUIRE(rdata->type == dns_rdatatype_dlv); |
113 | |
|
114 | 0 | UNUSED(rdata); |
115 | 0 | UNUSED(owner); |
116 | 0 | UNUSED(add); |
117 | 0 | UNUSED(arg); |
118 | |
|
119 | 0 | return ISC_R_SUCCESS; |
120 | 0 | } |
121 | | |
122 | | static isc_result_t |
123 | 0 | digest_dlv(ARGS_DIGEST) { |
124 | 0 | isc_region_t r; |
125 | |
|
126 | 0 | REQUIRE(rdata->type == dns_rdatatype_dlv); |
127 | |
|
128 | 0 | dns_rdata_toregion(rdata, &r); |
129 | |
|
130 | 0 | return (digest)(arg, &r); |
131 | 0 | } |
132 | | |
133 | | static bool |
134 | 0 | checkowner_dlv(ARGS_CHECKOWNER) { |
135 | 0 | REQUIRE(type == dns_rdatatype_dlv); |
136 | |
|
137 | 0 | UNUSED(name); |
138 | 0 | UNUSED(type); |
139 | 0 | UNUSED(rdclass); |
140 | 0 | UNUSED(wildcard); |
141 | |
|
142 | 0 | return true; |
143 | 0 | } |
144 | | |
145 | | static bool |
146 | 0 | checknames_dlv(ARGS_CHECKNAMES) { |
147 | 0 | REQUIRE(rdata->type == dns_rdatatype_dlv); |
148 | |
|
149 | 0 | UNUSED(rdata); |
150 | 0 | UNUSED(owner); |
151 | 0 | UNUSED(bad); |
152 | |
|
153 | 0 | return true; |
154 | 0 | } |
155 | | |
156 | | static int |
157 | 0 | casecompare_dlv(ARGS_COMPARE) { |
158 | 0 | return compare_dlv(rdata1, rdata2); |
159 | 0 | } |
160 | | |
161 | | #endif /* RDATA_GENERIC_DLV_32769_C */ |