Detect FPU by checking CPUID features.
[dragonfly.git] / contrib / bind-9.5.2 / lib / dns / rdata / generic / null_10.c
1 /*
2  * Copyright (C) 2004, 2007  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1998-2002  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15  * PERFORMANCE OF THIS SOFTWARE.
16  */
17
18 /* $Id: null_10.c,v 1.42 2007/06/19 23:47:17 tbox Exp $ */
19
20 /* Reviewed: Thu Mar 16 13:57:50 PST 2000 by explorer */
21
22 #ifndef RDATA_GENERIC_NULL_10_C
23 #define RDATA_GENERIC_NULL_10_C
24
25 #define RRTYPE_NULL_ATTRIBUTES (0)
26
27 static inline isc_result_t
28 fromtext_null(ARGS_FROMTEXT) {
29         REQUIRE(type == 10);
30
31         UNUSED(rdclass);
32         UNUSED(type);
33         UNUSED(lexer);
34         UNUSED(origin);
35         UNUSED(options);
36         UNUSED(target);
37         UNUSED(callbacks);
38
39         return (DNS_R_SYNTAX);
40 }
41
42 static inline isc_result_t
43 totext_null(ARGS_TOTEXT) {
44         REQUIRE(rdata->type == 10);
45
46         UNUSED(rdata);
47         UNUSED(tctx);
48         UNUSED(target);
49
50         return (DNS_R_SYNTAX);
51 }
52
53 static inline isc_result_t
54 fromwire_null(ARGS_FROMWIRE) {
55         isc_region_t sr;
56
57         REQUIRE(type == 10);
58
59         UNUSED(type);
60         UNUSED(rdclass);
61         UNUSED(dctx);
62         UNUSED(options);
63
64         isc_buffer_activeregion(source, &sr);
65         isc_buffer_forward(source, sr.length);
66         return (mem_tobuffer(target, sr.base, sr.length));
67 }
68
69 static inline isc_result_t
70 towire_null(ARGS_TOWIRE) {
71         REQUIRE(rdata->type == 10);
72
73         UNUSED(cctx);
74
75         return (mem_tobuffer(target, rdata->data, rdata->length));
76 }
77
78 static inline int
79 compare_null(ARGS_COMPARE) {
80         isc_region_t r1;
81         isc_region_t r2;
82
83         REQUIRE(rdata1->type == rdata2->type);
84         REQUIRE(rdata1->rdclass == rdata2->rdclass);
85         REQUIRE(rdata1->type == 10);
86
87         dns_rdata_toregion(rdata1, &r1);
88         dns_rdata_toregion(rdata2, &r2);
89         return (isc_region_compare(&r1, &r2));
90 }
91
92 static inline isc_result_t
93 fromstruct_null(ARGS_FROMSTRUCT) {
94         dns_rdata_null_t *null = source;
95
96         REQUIRE(type == 10);
97         REQUIRE(source != NULL);
98         REQUIRE(null->common.rdtype == type);
99         REQUIRE(null->common.rdclass == rdclass);
100         REQUIRE(null->data != NULL || null->length == 0);
101
102         UNUSED(type);
103         UNUSED(rdclass);
104
105         return (mem_tobuffer(target, null->data, null->length));
106 }
107
108 static inline isc_result_t
109 tostruct_null(ARGS_TOSTRUCT) {
110         dns_rdata_null_t *null = target;
111         isc_region_t r;
112
113         REQUIRE(rdata->type == 10);
114         REQUIRE(target != NULL);
115
116         null->common.rdclass = rdata->rdclass;
117         null->common.rdtype = rdata->type;
118         ISC_LINK_INIT(&null->common, link);
119
120         dns_rdata_toregion(rdata, &r);
121         null->length = r.length;
122         null->data = mem_maybedup(mctx, r.base, r.length);
123         if (null->data == NULL)
124                 return (ISC_R_NOMEMORY);
125
126         null->mctx = mctx;
127         return (ISC_R_SUCCESS);
128 }
129
130 static inline void
131 freestruct_null(ARGS_FREESTRUCT) {
132         dns_rdata_null_t *null = source;
133
134         REQUIRE(source != NULL);
135         REQUIRE(null->common.rdtype == 10);
136
137         if (null->mctx == NULL)
138                 return;
139
140         if (null->data != NULL)
141                 isc_mem_free(null->mctx, null->data);
142         null->mctx = NULL;
143 }
144
145 static inline isc_result_t
146 additionaldata_null(ARGS_ADDLDATA) {
147         UNUSED(rdata);
148         UNUSED(add);
149         UNUSED(arg);
150
151         REQUIRE(rdata->type == 10);
152
153         return (ISC_R_SUCCESS);
154 }
155
156 static inline isc_result_t
157 digest_null(ARGS_DIGEST) {
158         isc_region_t r;
159
160         REQUIRE(rdata->type == 10);
161
162         dns_rdata_toregion(rdata, &r);
163
164         return ((digest)(arg, &r));
165 }
166
167 static inline isc_boolean_t
168 checkowner_null(ARGS_CHECKOWNER) {
169
170         REQUIRE(type == 10);
171
172         UNUSED(name);
173         UNUSED(type);
174         UNUSED(rdclass);
175         UNUSED(wildcard);
176
177         return (ISC_TRUE);
178 }
179
180 static inline isc_boolean_t
181 checknames_null(ARGS_CHECKNAMES) {
182
183         REQUIRE(rdata->type == 10);
184
185         UNUSED(rdata);
186         UNUSED(owner);
187         UNUSED(bad);
188
189         return (ISC_TRUE);
190 }
191
192 #endif  /* RDATA_GENERIC_NULL_10_C */