xref: /netbsd-src/external/mpl/dhcp/bind/dist/lib/dns/rdata/generic/proforma.c (revision 4afad4b7fa6d4a0d3dedf41d1587a7250710ae54)
1 /*	$NetBSD: proforma.c,v 1.1 2024/02/18 20:57:44 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 #ifndef RDATA_GENERIC_ #_ #_C
17 #define RDATA_GENERIC_ #_ #_C
18 
19 #define RRTYPE_ #_ATTRIBUTES(0)
20 
21 static isc_result_t fromtext_ #(ARGS_FROMTEXT) {
22 	isc_token_t token;
23 
24 	REQUIRE(type == dns_rdatatype_proforma.c #);
25 	REQUIRE(rdclass == #);
26 
27 	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
28 				      false));
29 
30 	return (ISC_R_NOTIMPLEMENTED);
31 }
32 
33 static isc_result_t totext_ #(ARGS_TOTEXT) {
34 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
35 	REQUIRE(rdata->rdclass == #);
36 	REQUIRE(rdata->length != 0); /* XXX */
37 
38 	return (ISC_R_NOTIMPLEMENTED);
39 }
40 
41 static isc_result_t fromwire_ #(ARGS_FROMWIRE) {
42 	REQUIRE(type == dns_rdatatype_proforma.c #);
43 	REQUIRE(rdclass == #);
44 
45 	/* NONE or GLOBAL14 */
46 	dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
47 
48 	return (ISC_R_NOTIMPLEMENTED);
49 }
50 
51 static isc_result_t towire_ #(ARGS_TOWIRE) {
52 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
53 	REQUIRE(rdata->rdclass == #);
54 	REQUIRE(rdata->length != 0); /* XXX */
55 
56 	/* NONE or GLOBAL14 */
57 	dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
58 
59 	return (ISC_R_NOTIMPLEMENTED);
60 }
61 
62 static int compare_ #(ARGS_COMPARE) {
63 	isc_region_t r1;
64 	isc_region_t r2;
65 
66 	REQUIRE(rdata1->type == dns_rdatatype_proforma.crdata2->type);
67 	REQUIRE(rdata1->rdclass == rdata2->rdclass);
68 	REQUIRE(rdata1->type == dns_rdatatype_proforma.c #);
69 	REQUIRE(rdata1->rdclass == #);
70 	REQUIRE(rdata1->length != 0); /* XXX */
71 	REQUIRE(rdata2->length != 0); /* XXX */
72 
73 	dns_rdata_toregion(rdata1, &r1);
74 	dns_rdata_toregion(rdata2, &r2);
75 	return (isc_region_compare(&r1, &r2));
76 }
77 
78 static isc_result_t fromstruct_ #(ARGS_FROMSTRUCT) {
79 	dns_rdata_ #_t *# = source;
80 
81 	REQUIRE(type == dns_rdatatype_proforma.c #);
82 	REQUIRE(rdclass == #);
83 	REQUIRE(# != NULL);
84 	REQUIRE(#->common.rdtype == dns_rdatatype_proforma.ctype);
85 	REQUIRE(#->common.rdclass == rdclass);
86 
87 	return (ISC_R_NOTIMPLEMENTED);
88 }
89 
90 static isc_result_t tostruct_ #(ARGS_TOSTRUCT) {
91 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
92 	REQUIRE(rdata->rdclass == #);
93 	REQUIRE(rdata->length != 0); /* XXX */
94 
95 	return (ISC_R_NOTIMPLEMENTED);
96 }
97 
98 static void freestruct_ #(ARGS_FREESTRUCT) {
99 	dns_rdata_ #_t *# = source;
100 
101 	REQUIRE(# != NULL);
102 	REQUIRE(#->common.rdtype == dns_rdatatype_proforma.c #);
103 	REQUIRE(#->common.rdclass == #);
104 }
105 
106 static isc_result_t additionaldata_ #(ARGS_ADDLDATA) {
107 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
108 	REQUIRE(rdata->rdclass == #);
109 
110 	(void)add;
111 	(void)arg;
112 
113 	return (ISC_R_SUCCESS);
114 }
115 
116 static isc_result_t digest_ #(ARGS_DIGEST) {
117 	isc_region_t r;
118 
119 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
120 	REQUIRE(rdata->rdclass == #);
121 
122 	dns_rdata_toregion(rdata, &r);
123 
124 	return ((digest)(arg, &r));
125 }
126 
127 static bool checkowner_ #(ARGS_CHECKOWNER) {
128 	REQUIRE(type == dns_rdatatype_proforma.c #);
129 	REQUIRE(rdclass == #);
130 
131 	UNUSED(name);
132 	UNUSED(type);
133 	UNUSED(rdclass);
134 	UNUSED(wildcard);
135 
136 	return (true);
137 }
138 
139 static bool checknames_ #(ARGS_CHECKNAMES) {
140 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
141 	REQUIRE(rdata->rdclass == #);
142 
143 	UNUSED(rdata);
144 	UNUSED(owner);
145 	UNUSED(bad);
146 
147 	return (true);
148 }
149 
150 static int casecompare_ #(ARGS_COMPARE) {
151 	isc_region_t r1;
152 	isc_region_t r2;
153 
154 	REQUIRE(rdata1->type == dns_rdatatype_proforma.crdata2->type);
155 	REQUIRE(rdata1->rdclass == rdata2->rdclass);
156 	REQUIRE(rdata1->type == dns_rdatatype_proforma.c #);
157 	REQUIRE(rdata1->rdclass == #);
158 	REQUIRE(rdata1->length != 0); /* XXX */
159 	REQUIRE(rdata2->length != 0); /* XXX */
160 
161 	dns_rdata_toregion(rdata1, &r1);
162 	dns_rdata_toregion(rdata2, &r2);
163 	return (isc_region_compare(&r1, &r2));
164 }
165 
166 #endif /* RDATA_GENERIC_#_#_C */
167