/src/bind9/lib/dns/rdata/generic/ta_32768.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 | | /* http://www.watson.org/~weiler/INI1999-19.pdf */ |
15 | | |
16 | | #ifndef RDATA_GENERIC_TA_32768_C |
17 | | #define RDATA_GENERIC_TA_32768_C |
18 | | |
19 | 13.8k | #define RRTYPE_TA_ATTRIBUTES 0 |
20 | | |
21 | | static isc_result_t |
22 | 462 | fromtext_ta(ARGS_FROMTEXT) { |
23 | 462 | REQUIRE(type == dns_rdatatype_ta); |
24 | | |
25 | 462 | return generic_fromtext_ds(CALL_FROMTEXT); |
26 | 462 | } |
27 | | |
28 | | static isc_result_t |
29 | 841 | totext_ta(ARGS_TOTEXT) { |
30 | 841 | REQUIRE(rdata->type == dns_rdatatype_ta); |
31 | | |
32 | 841 | return generic_totext_ds(CALL_TOTEXT); |
33 | 841 | } |
34 | | |
35 | | static isc_result_t |
36 | 2.65k | fromwire_ta(ARGS_FROMWIRE) { |
37 | 2.65k | REQUIRE(type == dns_rdatatype_ta); |
38 | | |
39 | 2.65k | return generic_fromwire_ds(CALL_FROMWIRE); |
40 | 2.65k | } |
41 | | |
42 | | static isc_result_t |
43 | 423 | towire_ta(ARGS_TOWIRE) { |
44 | 423 | isc_region_t sr; |
45 | | |
46 | 423 | REQUIRE(rdata->type == dns_rdatatype_ta); |
47 | 423 | REQUIRE(rdata->length != 0); |
48 | | |
49 | 423 | UNUSED(cctx); |
50 | | |
51 | 423 | dns_rdata_toregion(rdata, &sr); |
52 | 423 | return mem_tobuffer(target, sr.base, sr.length); |
53 | 423 | } |
54 | | |
55 | | static int |
56 | 1.86k | compare_ta(ARGS_COMPARE) { |
57 | 1.86k | isc_region_t r1; |
58 | 1.86k | isc_region_t r2; |
59 | | |
60 | 1.86k | REQUIRE(rdata1->type == rdata2->type); |
61 | 1.86k | REQUIRE(rdata1->rdclass == rdata2->rdclass); |
62 | 1.86k | REQUIRE(rdata1->type == dns_rdatatype_ta); |
63 | 1.86k | REQUIRE(rdata1->length != 0); |
64 | 1.86k | REQUIRE(rdata2->length != 0); |
65 | | |
66 | 1.86k | dns_rdata_toregion(rdata1, &r1); |
67 | 1.86k | dns_rdata_toregion(rdata2, &r2); |
68 | 1.86k | return isc_region_compare(&r1, &r2); |
69 | 1.86k | } |
70 | | |
71 | | static isc_result_t |
72 | 0 | fromstruct_ta(ARGS_FROMSTRUCT) { |
73 | 0 | REQUIRE(type == dns_rdatatype_ta); |
74 | |
|
75 | 0 | return generic_fromstruct_ds(CALL_FROMSTRUCT); |
76 | 0 | } |
77 | | |
78 | | static isc_result_t |
79 | 0 | tostruct_ta(ARGS_TOSTRUCT) { |
80 | 0 | dns_rdata_ds_t *ds = target; |
81 | |
|
82 | 0 | REQUIRE(rdata->type == dns_rdatatype_ta); |
83 | 0 | REQUIRE(ds != NULL); |
84 | | |
85 | | /* |
86 | | * Checked by generic_tostruct_ds(). |
87 | | */ |
88 | 0 | DNS_RDATACOMMON_INIT(ds, rdata->type, rdata->rdclass); |
89 | |
|
90 | 0 | return generic_tostruct_ds(CALL_TOSTRUCT); |
91 | 0 | } |
92 | | |
93 | | static void |
94 | 0 | freestruct_ta(ARGS_FREESTRUCT) { |
95 | 0 | dns_rdata_ta_t *ds = source; |
96 | |
|
97 | 0 | REQUIRE(ds != NULL); |
98 | 0 | REQUIRE(ds->common.rdtype == dns_rdatatype_ta); |
99 | |
|
100 | 0 | if (ds->mctx == NULL) { |
101 | 0 | return; |
102 | 0 | } |
103 | | |
104 | 0 | if (ds->digest != NULL) { |
105 | 0 | isc_mem_free(ds->mctx, ds->digest); |
106 | 0 | } |
107 | 0 | ds->mctx = NULL; |
108 | 0 | } |
109 | | |
110 | | static isc_result_t |
111 | 0 | additionaldata_ta(ARGS_ADDLDATA) { |
112 | 0 | REQUIRE(rdata->type == dns_rdatatype_ta); |
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_ta(ARGS_DIGEST) { |
124 | 0 | isc_region_t r; |
125 | |
|
126 | 0 | REQUIRE(rdata->type == dns_rdatatype_ta); |
127 | |
|
128 | 0 | dns_rdata_toregion(rdata, &r); |
129 | |
|
130 | 0 | return (digest)(arg, &r); |
131 | 0 | } |
132 | | |
133 | | static bool |
134 | 0 | checkowner_ta(ARGS_CHECKOWNER) { |
135 | 0 | REQUIRE(type == dns_rdatatype_ta); |
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_ta(ARGS_CHECKNAMES) { |
147 | 0 | REQUIRE(rdata->type == dns_rdatatype_ta); |
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_ta(ARGS_COMPARE) { |
158 | 0 | return compare_ta(rdata1, rdata2); |
159 | 0 | } |
160 | | |
161 | | #endif /* RDATA_GENERIC_TA_32768_C */ |