/src/bind9/lib/dns/rdata/generic/null_10.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_NULL_10_C |
15 | | #define RDATA_GENERIC_NULL_10_C |
16 | | |
17 | 148k | #define RRTYPE_NULL_ATTRIBUTES (0) |
18 | | |
19 | | static isc_result_t |
20 | 7 | fromtext_null(ARGS_FROMTEXT) { |
21 | 7 | REQUIRE(type == dns_rdatatype_null); |
22 | | |
23 | 7 | UNUSED(rdclass); |
24 | 7 | UNUSED(type); |
25 | 7 | UNUSED(lexer); |
26 | 7 | UNUSED(origin); |
27 | 7 | UNUSED(options); |
28 | 7 | UNUSED(target); |
29 | 7 | UNUSED(callbacks); |
30 | | |
31 | 7 | return DNS_R_SYNTAX; |
32 | 7 | } |
33 | | |
34 | | static isc_result_t |
35 | 5.33k | totext_null(ARGS_TOTEXT) { |
36 | 5.33k | REQUIRE(rdata->type == dns_rdatatype_null); |
37 | | |
38 | 5.33k | return unknown_totext(rdata, tctx, target); |
39 | 5.33k | } |
40 | | |
41 | | static isc_result_t |
42 | 72.0k | fromwire_null(ARGS_FROMWIRE) { |
43 | 72.0k | isc_region_t sr; |
44 | | |
45 | 72.0k | REQUIRE(type == dns_rdatatype_null); |
46 | | |
47 | 72.0k | UNUSED(type); |
48 | 72.0k | UNUSED(rdclass); |
49 | 72.0k | UNUSED(dctx); |
50 | | |
51 | 72.0k | isc_buffer_activeregion(source, &sr); |
52 | 72.0k | isc_buffer_forward(source, sr.length); |
53 | 72.0k | return mem_tobuffer(target, sr.base, sr.length); |
54 | 72.0k | } |
55 | | |
56 | | static int |
57 | 66.0k | compare_null(ARGS_COMPARE) { |
58 | 66.0k | isc_region_t r1; |
59 | 66.0k | isc_region_t r2; |
60 | | |
61 | 66.0k | REQUIRE(rdata1->type == rdata2->type); |
62 | 66.0k | REQUIRE(rdata1->rdclass == rdata2->rdclass); |
63 | 66.0k | REQUIRE(rdata1->type == dns_rdatatype_null); |
64 | | |
65 | 66.0k | dns_rdata_toregion(rdata1, &r1); |
66 | 66.0k | dns_rdata_toregion(rdata2, &r2); |
67 | 66.0k | return isc_region_compare(&r1, &r2); |
68 | 66.0k | } |
69 | | |
70 | | static isc_result_t |
71 | 0 | fromstruct_null(ARGS_FROMSTRUCT) { |
72 | 0 | dns_rdata_null_t *null = source; |
73 | |
|
74 | 0 | REQUIRE(type == dns_rdatatype_null); |
75 | 0 | REQUIRE(null != NULL); |
76 | 0 | REQUIRE(null->common.rdtype == type); |
77 | 0 | REQUIRE(null->common.rdclass == rdclass); |
78 | 0 | REQUIRE(null->data != NULL || null->length == 0); |
79 | |
|
80 | 0 | UNUSED(type); |
81 | 0 | UNUSED(rdclass); |
82 | |
|
83 | 0 | return mem_tobuffer(target, null->data, null->length); |
84 | 0 | } |
85 | | |
86 | | static isc_result_t |
87 | 0 | tostruct_null(ARGS_TOSTRUCT) { |
88 | 0 | dns_rdata_null_t *null = target; |
89 | 0 | isc_region_t r; |
90 | |
|
91 | 0 | REQUIRE(rdata->type == dns_rdatatype_null); |
92 | 0 | REQUIRE(null != NULL); |
93 | |
|
94 | 0 | DNS_RDATACOMMON_INIT(null, rdata->type, rdata->rdclass); |
95 | |
|
96 | 0 | dns_rdata_toregion(rdata, &r); |
97 | 0 | null->length = r.length; |
98 | 0 | null->data = r.base; |
99 | 0 | return ISC_R_SUCCESS; |
100 | 0 | } |
101 | | |
102 | | static isc_result_t |
103 | 0 | additionaldata_null(ARGS_ADDLDATA) { |
104 | 0 | REQUIRE(rdata->type == dns_rdatatype_null); |
105 | |
|
106 | 0 | UNUSED(rdata); |
107 | 0 | UNUSED(owner); |
108 | 0 | UNUSED(add); |
109 | 0 | UNUSED(arg); |
110 | |
|
111 | 0 | return ISC_R_SUCCESS; |
112 | 0 | } |
113 | | |
114 | | static isc_result_t |
115 | 0 | digest_null(ARGS_DIGEST) { |
116 | 0 | isc_region_t r; |
117 | |
|
118 | 0 | REQUIRE(rdata->type == dns_rdatatype_null); |
119 | |
|
120 | 0 | dns_rdata_toregion(rdata, &r); |
121 | |
|
122 | 0 | return (digest)(arg, &r); |
123 | 0 | } |
124 | | |
125 | | static bool |
126 | 0 | checkowner_null(ARGS_CHECKOWNER) { |
127 | 0 | REQUIRE(type == dns_rdatatype_null); |
128 | |
|
129 | 0 | UNUSED(name); |
130 | 0 | UNUSED(type); |
131 | 0 | UNUSED(rdclass); |
132 | 0 | UNUSED(wildcard); |
133 | |
|
134 | 0 | return true; |
135 | 0 | } |
136 | | |
137 | | static bool |
138 | 0 | checknames_null(ARGS_CHECKNAMES) { |
139 | 0 | REQUIRE(rdata->type == dns_rdatatype_null); |
140 | |
|
141 | 0 | UNUSED(rdata); |
142 | 0 | UNUSED(owner); |
143 | 0 | UNUSED(bad); |
144 | |
|
145 | 0 | return true; |
146 | 0 | } |
147 | | |
148 | | static int |
149 | 0 | casecompare_null(ARGS_COMPARE) { |
150 | 0 | return compare_null(rdata1, rdata2); |
151 | 0 | } |
152 | | |
153 | | #endif /* RDATA_GENERIC_NULL_10_C */ |