Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / bind / dist / lib / dns / rdata / generic / null_10.c
blobe95b7ccbef11ed898ca76398c09fac156fc76dd5
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2004, 2007, 2009 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: null_10.c,v 1.44 2009/12/04 22:06:37 tbox Exp */
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 UNUSED(rdata);
49 UNUSED(tctx);
50 UNUSED(target);
52 return (DNS_R_SYNTAX);
55 static inline isc_result_t
56 fromwire_null(ARGS_FROMWIRE) {
57 isc_region_t sr;
59 REQUIRE(type == 10);
61 UNUSED(type);
62 UNUSED(rdclass);
63 UNUSED(dctx);
64 UNUSED(options);
66 isc_buffer_activeregion(source, &sr);
67 isc_buffer_forward(source, sr.length);
68 return (mem_tobuffer(target, sr.base, sr.length));
71 static inline isc_result_t
72 towire_null(ARGS_TOWIRE) {
73 REQUIRE(rdata->type == 10);
75 UNUSED(cctx);
77 return (mem_tobuffer(target, rdata->data, rdata->length));
80 static inline int
81 compare_null(ARGS_COMPARE) {
82 isc_region_t r1;
83 isc_region_t r2;
85 REQUIRE(rdata1->type == rdata2->type);
86 REQUIRE(rdata1->rdclass == rdata2->rdclass);
87 REQUIRE(rdata1->type == 10);
89 dns_rdata_toregion(rdata1, &r1);
90 dns_rdata_toregion(rdata2, &r2);
91 return (isc_region_compare(&r1, &r2));
94 static inline isc_result_t
95 fromstruct_null(ARGS_FROMSTRUCT) {
96 dns_rdata_null_t *null = source;
98 REQUIRE(type == 10);
99 REQUIRE(source != NULL);
100 REQUIRE(null->common.rdtype == type);
101 REQUIRE(null->common.rdclass == rdclass);
102 REQUIRE(null->data != NULL || null->length == 0);
104 UNUSED(type);
105 UNUSED(rdclass);
107 return (mem_tobuffer(target, null->data, null->length));
110 static inline isc_result_t
111 tostruct_null(ARGS_TOSTRUCT) {
112 dns_rdata_null_t *null = target;
113 isc_region_t r;
115 REQUIRE(rdata->type == 10);
116 REQUIRE(target != NULL);
118 null->common.rdclass = rdata->rdclass;
119 null->common.rdtype = rdata->type;
120 ISC_LINK_INIT(&null->common, link);
122 dns_rdata_toregion(rdata, &r);
123 null->length = r.length;
124 null->data = mem_maybedup(mctx, r.base, r.length);
125 if (null->data == NULL)
126 return (ISC_R_NOMEMORY);
128 null->mctx = mctx;
129 return (ISC_R_SUCCESS);
132 static inline void
133 freestruct_null(ARGS_FREESTRUCT) {
134 dns_rdata_null_t *null = source;
136 REQUIRE(source != NULL);
137 REQUIRE(null->common.rdtype == 10);
139 if (null->mctx == NULL)
140 return;
142 if (null->data != NULL)
143 isc_mem_free(null->mctx, null->data);
144 null->mctx = NULL;
147 static inline isc_result_t
148 additionaldata_null(ARGS_ADDLDATA) {
149 UNUSED(rdata);
150 UNUSED(add);
151 UNUSED(arg);
153 REQUIRE(rdata->type == 10);
155 return (ISC_R_SUCCESS);
158 static inline isc_result_t
159 digest_null(ARGS_DIGEST) {
160 isc_region_t r;
162 REQUIRE(rdata->type == 10);
164 dns_rdata_toregion(rdata, &r);
166 return ((digest)(arg, &r));
169 static inline isc_boolean_t
170 checkowner_null(ARGS_CHECKOWNER) {
172 REQUIRE(type == 10);
174 UNUSED(name);
175 UNUSED(type);
176 UNUSED(rdclass);
177 UNUSED(wildcard);
179 return (ISC_TRUE);
182 static inline isc_boolean_t
183 checknames_null(ARGS_CHECKNAMES) {
185 REQUIRE(rdata->type == 10);
187 UNUSED(rdata);
188 UNUSED(owner);
189 UNUSED(bad);
191 return (ISC_TRUE);
194 static inline int
195 casecompare_null(ARGS_COMPARE) {
196 return (compare_null(rdata1, rdata2));
199 #endif /* RDATA_GENERIC_NULL_10_C */