2 * Copyright (C) 2004, 2007, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1998-2002 Internet Software Consortium.
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.
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.
20 /* Reviewed: Thu Mar 16 13:57:50 PST 2000 by explorer */
22 #ifndef RDATA_GENERIC_NULL_10_C
23 #define RDATA_GENERIC_NULL_10_C
25 #define RRTYPE_NULL_ATTRIBUTES (0)
27 static inline isc_result_t
28 fromtext_null(ARGS_FROMTEXT) {
39 return (DNS_R_SYNTAX);
42 static inline isc_result_t
43 totext_null(ARGS_TOTEXT) {
44 REQUIRE(rdata->type == 10);
46 return (unknown_totext(rdata, tctx, target));
49 static inline isc_result_t
50 fromwire_null(ARGS_FROMWIRE) {
60 isc_buffer_activeregion(source, &sr);
61 isc_buffer_forward(source, sr.length);
62 return (mem_tobuffer(target, sr.base, sr.length));
65 static inline isc_result_t
66 towire_null(ARGS_TOWIRE) {
67 REQUIRE(rdata->type == 10);
71 return (mem_tobuffer(target, rdata->data, rdata->length));
75 compare_null(ARGS_COMPARE) {
79 REQUIRE(rdata1->type == rdata2->type);
80 REQUIRE(rdata1->rdclass == rdata2->rdclass);
81 REQUIRE(rdata1->type == 10);
83 dns_rdata_toregion(rdata1, &r1);
84 dns_rdata_toregion(rdata2, &r2);
85 return (isc_region_compare(&r1, &r2));
88 static inline isc_result_t
89 fromstruct_null(ARGS_FROMSTRUCT) {
90 dns_rdata_null_t *null = source;
93 REQUIRE(source != NULL);
94 REQUIRE(null->common.rdtype == type);
95 REQUIRE(null->common.rdclass == rdclass);
96 REQUIRE(null->data != NULL || null->length == 0);
101 return (mem_tobuffer(target, null->data, null->length));
104 static inline isc_result_t
105 tostruct_null(ARGS_TOSTRUCT) {
106 dns_rdata_null_t *null = target;
109 REQUIRE(rdata->type == 10);
110 REQUIRE(target != NULL);
112 null->common.rdclass = rdata->rdclass;
113 null->common.rdtype = rdata->type;
114 ISC_LINK_INIT(&null->common, link);
116 dns_rdata_toregion(rdata, &r);
117 null->length = r.length;
118 null->data = mem_maybedup(mctx, r.base, r.length);
119 if (null->data == NULL)
120 return (ISC_R_NOMEMORY);
123 return (ISC_R_SUCCESS);
127 freestruct_null(ARGS_FREESTRUCT) {
128 dns_rdata_null_t *null = source;
130 REQUIRE(source != NULL);
131 REQUIRE(null->common.rdtype == 10);
133 if (null->mctx == NULL)
136 if (null->data != NULL)
137 isc_mem_free(null->mctx, null->data);
141 static inline isc_result_t
142 additionaldata_null(ARGS_ADDLDATA) {
147 REQUIRE(rdata->type == 10);
149 return (ISC_R_SUCCESS);
152 static inline isc_result_t
153 digest_null(ARGS_DIGEST) {
156 REQUIRE(rdata->type == 10);
158 dns_rdata_toregion(rdata, &r);
160 return ((digest)(arg, &r));
163 static inline isc_boolean_t
164 checkowner_null(ARGS_CHECKOWNER) {
176 static inline isc_boolean_t
177 checknames_null(ARGS_CHECKNAMES) {
179 REQUIRE(rdata->type == 10);
189 casecompare_null(ARGS_COMPARE) {
190 return (compare_null(rdata1, rdata2));
193 #endif /* RDATA_GENERIC_NULL_10_C */