/src/bind9/lib/dns/rdata/generic/smimea_53.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_SMIMEA_53_C |
15 | | #define RDATA_GENERIC_SMIMEA_53_C |
16 | | |
17 | 12.3k | #define RRTYPE_SMIMEA_ATTRIBUTES 0 |
18 | | |
19 | | static isc_result_t |
20 | 467 | fromtext_smimea(ARGS_FROMTEXT) { |
21 | 467 | REQUIRE(type == dns_rdatatype_smimea); |
22 | | |
23 | 467 | return generic_fromtext_tlsa(CALL_FROMTEXT); |
24 | 467 | } |
25 | | |
26 | | static isc_result_t |
27 | 1.08k | totext_smimea(ARGS_TOTEXT) { |
28 | 1.08k | REQUIRE(rdata != NULL); |
29 | 1.08k | REQUIRE(rdata->type == dns_rdatatype_smimea); |
30 | | |
31 | 1.08k | return generic_totext_tlsa(CALL_TOTEXT); |
32 | 1.08k | } |
33 | | |
34 | | static isc_result_t |
35 | 2.49k | fromwire_smimea(ARGS_FROMWIRE) { |
36 | 2.49k | REQUIRE(type == dns_rdatatype_smimea); |
37 | | |
38 | 2.49k | return generic_fromwire_tlsa(CALL_FROMWIRE); |
39 | 2.49k | } |
40 | | |
41 | | static isc_result_t |
42 | 561 | towire_smimea(ARGS_TOWIRE) { |
43 | 561 | isc_region_t sr; |
44 | | |
45 | 561 | REQUIRE(rdata->type == dns_rdatatype_smimea); |
46 | 561 | REQUIRE(rdata->length != 0); |
47 | | |
48 | 561 | UNUSED(cctx); |
49 | | |
50 | 561 | dns_rdata_toregion(rdata, &sr); |
51 | 561 | return mem_tobuffer(target, sr.base, sr.length); |
52 | 561 | } |
53 | | |
54 | | static int |
55 | 1.88k | compare_smimea(ARGS_COMPARE) { |
56 | 1.88k | isc_region_t r1; |
57 | 1.88k | isc_region_t r2; |
58 | | |
59 | 1.88k | REQUIRE(rdata1->type == rdata2->type); |
60 | 1.88k | REQUIRE(rdata1->rdclass == rdata2->rdclass); |
61 | 1.88k | REQUIRE(rdata1->type == dns_rdatatype_smimea); |
62 | 1.88k | REQUIRE(rdata1->length != 0); |
63 | 1.88k | REQUIRE(rdata2->length != 0); |
64 | | |
65 | 1.88k | dns_rdata_toregion(rdata1, &r1); |
66 | 1.88k | dns_rdata_toregion(rdata2, &r2); |
67 | 1.88k | return isc_region_compare(&r1, &r2); |
68 | 1.88k | } |
69 | | |
70 | | static isc_result_t |
71 | 0 | fromstruct_smimea(ARGS_FROMSTRUCT) { |
72 | 0 | REQUIRE(type == dns_rdatatype_smimea); |
73 | |
|
74 | 0 | return generic_fromstruct_tlsa(CALL_FROMSTRUCT); |
75 | 0 | } |
76 | | |
77 | | static isc_result_t |
78 | 0 | tostruct_smimea(ARGS_TOSTRUCT) { |
79 | 0 | dns_rdata_smimea_t *smimea = target; |
80 | |
|
81 | 0 | REQUIRE(rdata != NULL); |
82 | 0 | REQUIRE(rdata->type == dns_rdatatype_smimea); |
83 | 0 | REQUIRE(smimea != NULL); |
84 | |
|
85 | 0 | DNS_RDATACOMMON_INIT(smimea, rdata->type, rdata->rdclass); |
86 | |
|
87 | 0 | return generic_tostruct_tlsa(CALL_TOSTRUCT); |
88 | 0 | } |
89 | | |
90 | | static void |
91 | 0 | freestruct_smimea(ARGS_FREESTRUCT) { |
92 | 0 | dns_rdata_smimea_t *smimea = source; |
93 | |
|
94 | 0 | REQUIRE(smimea != NULL); |
95 | 0 | REQUIRE(smimea->common.rdtype == dns_rdatatype_smimea); |
96 | |
|
97 | 0 | generic_freestruct_tlsa(source); |
98 | 0 | } |
99 | | |
100 | | static isc_result_t |
101 | 0 | additionaldata_smimea(ARGS_ADDLDATA) { |
102 | 0 | REQUIRE(rdata->type == dns_rdatatype_smimea); |
103 | |
|
104 | 0 | UNUSED(rdata); |
105 | 0 | UNUSED(owner); |
106 | 0 | UNUSED(add); |
107 | 0 | UNUSED(arg); |
108 | |
|
109 | 0 | return ISC_R_SUCCESS; |
110 | 0 | } |
111 | | |
112 | | static isc_result_t |
113 | 0 | digest_smimea(ARGS_DIGEST) { |
114 | 0 | isc_region_t r; |
115 | |
|
116 | 0 | REQUIRE(rdata->type == dns_rdatatype_smimea); |
117 | |
|
118 | 0 | dns_rdata_toregion(rdata, &r); |
119 | |
|
120 | 0 | return (digest)(arg, &r); |
121 | 0 | } |
122 | | |
123 | | static bool |
124 | 0 | checkowner_smimea(ARGS_CHECKOWNER) { |
125 | 0 | REQUIRE(type == dns_rdatatype_smimea); |
126 | |
|
127 | 0 | UNUSED(name); |
128 | 0 | UNUSED(type); |
129 | 0 | UNUSED(rdclass); |
130 | 0 | UNUSED(wildcard); |
131 | |
|
132 | 0 | return true; |
133 | 0 | } |
134 | | |
135 | | static bool |
136 | 0 | checknames_smimea(ARGS_CHECKNAMES) { |
137 | 0 | REQUIRE(rdata->type == dns_rdatatype_smimea); |
138 | |
|
139 | 0 | UNUSED(rdata); |
140 | 0 | UNUSED(owner); |
141 | 0 | UNUSED(bad); |
142 | |
|
143 | 0 | return true; |
144 | 0 | } |
145 | | |
146 | | static int |
147 | 0 | casecompare_smimea(ARGS_COMPARE) { |
148 | 0 | return compare_smimea(rdata1, rdata2); |
149 | 0 | } |
150 | | |
151 | | #endif /* RDATA_GENERIC_SMIMEA_53_C */ |