Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / lib / dns / rdata / generic / null_10.c
blob6b0bda82636ea465180b070af0e2579445e2d9e3
1 /* $NetBSD: null_10.c,v 1.4 2014/12/10 04:37:59 christos Exp $ */
3 /*
4 * Copyright (C) 2004, 2007, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 1998-2002 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id */
22 /* Reviewed: Thu Mar 16 13:57:50 PST 2000 by explorer */
24 #ifndef RDATA_GENERIC_NULL_10_C
25 #define RDATA_GENERIC_NULL_10_C
27 #define RRTYPE_NULL_ATTRIBUTES (0)
29 static inline isc_result_t
30 fromtext_null(ARGS_FROMTEXT) {
31 REQUIRE(type == 10);
33 UNUSED(rdclass);
34 UNUSED(type);
35 UNUSED(lexer);
36 UNUSED(origin);
37 UNUSED(options);
38 UNUSED(target);
39 UNUSED(callbacks);
41 return (DNS_R_SYNTAX);
44 static inline isc_result_t
45 totext_null(ARGS_TOTEXT) {
46 REQUIRE(rdata->type == 10);
48 return (unknown_totext(rdata, tctx, target));
51 static inline isc_result_t
52 fromwire_null(ARGS_FROMWIRE) {
53 isc_region_t sr;
55 REQUIRE(type == 10);
57 UNUSED(type);
58 UNUSED(rdclass);
59 UNUSED(dctx);
60 UNUSED(options);
62 isc_buffer_activeregion(source, &sr);
63 isc_buffer_forward(source, sr.length);
64 return (mem_tobuffer(target, sr.base, sr.length));
67 static inline isc_result_t
68 towire_null(ARGS_TOWIRE) {
69 REQUIRE(rdata->type == 10);
71 UNUSED(cctx);
73 return (mem_tobuffer(target, rdata->data, rdata->length));
76 static inline int
77 compare_null(ARGS_COMPARE) {
78 isc_region_t r1;
79 isc_region_t r2;
81 REQUIRE(rdata1->type == rdata2->type);
82 REQUIRE(rdata1->rdclass == rdata2->rdclass);
83 REQUIRE(rdata1->type == 10);
85 dns_rdata_toregion(rdata1, &r1);
86 dns_rdata_toregion(rdata2, &r2);
87 return (isc_region_compare(&r1, &r2));
90 static inline isc_result_t
91 fromstruct_null(ARGS_FROMSTRUCT) {
92 dns_rdata_null_t *null = source;
94 REQUIRE(type == 10);
95 REQUIRE(source != NULL);
96 REQUIRE(null->common.rdtype == type);
97 REQUIRE(null->common.rdclass == rdclass);
98 REQUIRE(null->data != NULL || null->length == 0);
100 UNUSED(type);
101 UNUSED(rdclass);
103 return (mem_tobuffer(target, null->data, null->length));
106 static inline isc_result_t
107 tostruct_null(ARGS_TOSTRUCT) {
108 dns_rdata_null_t *null = target;
109 isc_region_t r;
111 REQUIRE(rdata->type == 10);
112 REQUIRE(target != NULL);
114 null->common.rdclass = rdata->rdclass;
115 null->common.rdtype = rdata->type;
116 ISC_LINK_INIT(&null->common, link);
118 dns_rdata_toregion(rdata, &r);
119 null->length = r.length;
120 null->data = mem_maybedup(mctx, r.base, r.length);
121 if (null->data == NULL)
122 return (ISC_R_NOMEMORY);
124 null->mctx = mctx;
125 return (ISC_R_SUCCESS);
128 static inline void
129 freestruct_null(ARGS_FREESTRUCT) {
130 dns_rdata_null_t *null = source;
132 REQUIRE(source != NULL);
133 REQUIRE(null->common.rdtype == 10);
135 if (null->mctx == NULL)
136 return;
138 if (null->data != NULL)
139 isc_mem_free(null->mctx, null->data);
140 null->mctx = NULL;
143 static inline isc_result_t
144 additionaldata_null(ARGS_ADDLDATA) {
145 UNUSED(rdata);
146 UNUSED(add);
147 UNUSED(arg);
149 REQUIRE(rdata->type == 10);
151 return (ISC_R_SUCCESS);
154 static inline isc_result_t
155 digest_null(ARGS_DIGEST) {
156 isc_region_t r;
158 REQUIRE(rdata->type == 10);
160 dns_rdata_toregion(rdata, &r);
162 return ((digest)(arg, &r));
165 static inline isc_boolean_t
166 checkowner_null(ARGS_CHECKOWNER) {
168 REQUIRE(type == 10);
170 UNUSED(name);
171 UNUSED(type);
172 UNUSED(rdclass);
173 UNUSED(wildcard);
175 return (ISC_TRUE);
178 static inline isc_boolean_t
179 checknames_null(ARGS_CHECKNAMES) {
181 REQUIRE(rdata->type == 10);
183 UNUSED(rdata);
184 UNUSED(owner);
185 UNUSED(bad);
187 return (ISC_TRUE);
190 static inline int
191 casecompare_null(ARGS_COMPARE) {
192 return (compare_null(rdata1, rdata2));
195 #endif /* RDATA_GENERIC_NULL_10_C */