Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / lib / dns / rdata / generic / unspec_103.c
blob1688b235fc69f706c12e51000c2bca16a2cd93ca
1 /* $NetBSD: unspec_103.c,v 1.4 2014/12/10 04:37:59 christos Exp $ */
3 /*
4 * Copyright (C) 2004, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 1999-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: unspec_103.c,v 1.37 2009/12/04 22:06:37 tbox Exp */
22 #ifndef RDATA_GENERIC_UNSPEC_103_C
23 #define RDATA_GENERIC_UNSPEC_103_C
25 #define RRTYPE_UNSPEC_ATTRIBUTES (0)
27 static inline isc_result_t
28 fromtext_unspec(ARGS_FROMTEXT) {
30 REQUIRE(type == 103);
32 UNUSED(type);
33 UNUSED(rdclass);
34 UNUSED(origin);
35 UNUSED(options);
36 UNUSED(callbacks);
38 return (atob_tobuffer(lexer, target));
41 static inline isc_result_t
42 totext_unspec(ARGS_TOTEXT) {
44 REQUIRE(rdata->type == 103);
46 UNUSED(tctx);
48 return (btoa_totext(rdata->data, rdata->length, target));
51 static inline isc_result_t
52 fromwire_unspec(ARGS_FROMWIRE) {
53 isc_region_t sr;
55 REQUIRE(type == 103);
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_unspec(ARGS_TOWIRE) {
70 REQUIRE(rdata->type == 103);
72 UNUSED(cctx);
74 return (mem_tobuffer(target, rdata->data, rdata->length));
77 static inline int
78 compare_unspec(ARGS_COMPARE) {
79 isc_region_t r1;
80 isc_region_t r2;
82 REQUIRE(rdata1->type == rdata2->type);
83 REQUIRE(rdata1->rdclass == rdata2->rdclass);
84 REQUIRE(rdata1->type == 103);
86 dns_rdata_toregion(rdata1, &r1);
87 dns_rdata_toregion(rdata2, &r2);
88 return (isc_region_compare(&r1, &r2));
91 static inline isc_result_t
92 fromstruct_unspec(ARGS_FROMSTRUCT) {
93 dns_rdata_unspec_t *unspec = source;
95 REQUIRE(type == 103);
96 REQUIRE(source != NULL);
97 REQUIRE(unspec->common.rdtype == type);
98 REQUIRE(unspec->common.rdclass == rdclass);
99 REQUIRE(unspec->data != NULL || unspec->datalen == 0);
101 UNUSED(type);
102 UNUSED(rdclass);
104 return (mem_tobuffer(target, unspec->data, unspec->datalen));
107 static inline isc_result_t
108 tostruct_unspec(ARGS_TOSTRUCT) {
109 dns_rdata_unspec_t *unspec = target;
110 isc_region_t r;
112 REQUIRE(rdata->type == 103);
113 REQUIRE(target != NULL);
115 unspec->common.rdclass = rdata->rdclass;
116 unspec->common.rdtype = rdata->type;
117 ISC_LINK_INIT(&unspec->common, link);
119 dns_rdata_toregion(rdata, &r);
120 unspec->datalen = r.length;
121 unspec->data = mem_maybedup(mctx, r.base, r.length);
122 if (unspec->data == NULL)
123 return (ISC_R_NOMEMORY);
125 unspec->mctx = mctx;
126 return (ISC_R_SUCCESS);
129 static inline void
130 freestruct_unspec(ARGS_FREESTRUCT) {
131 dns_rdata_unspec_t *unspec = source;
133 REQUIRE(source != NULL);
134 REQUIRE(unspec->common.rdtype == 103);
136 if (unspec->mctx == NULL)
137 return;
139 if (unspec->data != NULL)
140 isc_mem_free(unspec->mctx, unspec->data);
141 unspec->mctx = NULL;
144 static inline isc_result_t
145 additionaldata_unspec(ARGS_ADDLDATA) {
146 REQUIRE(rdata->type == 103);
148 UNUSED(rdata);
149 UNUSED(add);
150 UNUSED(arg);
152 return (ISC_R_SUCCESS);
155 static inline isc_result_t
156 digest_unspec(ARGS_DIGEST) {
157 isc_region_t r;
159 REQUIRE(rdata->type == 103);
161 dns_rdata_toregion(rdata, &r);
163 return ((digest)(arg, &r));
166 static inline isc_boolean_t
167 checkowner_unspec(ARGS_CHECKOWNER) {
169 REQUIRE(type == 103);
171 UNUSED(name);
172 UNUSED(type);
173 UNUSED(rdclass);
174 UNUSED(wildcard);
176 return (ISC_TRUE);
179 static inline isc_boolean_t
180 checknames_unspec(ARGS_CHECKNAMES) {
182 REQUIRE(rdata->type == 103);
184 UNUSED(rdata);
185 UNUSED(owner);
186 UNUSED(bad);
188 return (ISC_TRUE);
191 static inline int
192 casecompare_unspec(ARGS_COMPARE) {
193 return (compare_unspec(rdata1, rdata2));
196 #endif /* RDATA_GENERIC_UNSPEC_103_C */