2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1998-2002 Internet Software Consortium.
5 * Permission to use, copy, modify, and 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.
18 /* $Id: null_10.c,v 1.35.2.1.10.4 2004/03/08 09:04:41 marka Exp $ */
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);
50 return (DNS_R_SYNTAX
);
53 static inline isc_result_t
54 fromwire_null(ARGS_FROMWIRE
) {
64 isc_buffer_activeregion(source
, &sr
);
65 isc_buffer_forward(source
, sr
.length
);
66 return (mem_tobuffer(target
, sr
.base
, sr
.length
));
69 static inline isc_result_t
70 towire_null(ARGS_TOWIRE
) {
71 REQUIRE(rdata
->type
== 10);
75 return (mem_tobuffer(target
, rdata
->data
, rdata
->length
));
79 compare_null(ARGS_COMPARE
) {
83 REQUIRE(rdata1
->type
== rdata2
->type
);
84 REQUIRE(rdata1
->rdclass
== rdata2
->rdclass
);
85 REQUIRE(rdata1
->type
== 10);
87 dns_rdata_toregion(rdata1
, &r1
);
88 dns_rdata_toregion(rdata2
, &r2
);
89 return (isc_region_compare(&r1
, &r2
));
92 static inline isc_result_t
93 fromstruct_null(ARGS_FROMSTRUCT
) {
94 dns_rdata_null_t
*null
= source
;
97 REQUIRE(source
!= NULL
);
98 REQUIRE(null
->common
.rdtype
== type
);
99 REQUIRE(null
->common
.rdclass
== rdclass
);
100 REQUIRE(null
->data
!= NULL
|| null
->length
== 0);
105 return (mem_tobuffer(target
, null
->data
, null
->length
));
108 static inline isc_result_t
109 tostruct_null(ARGS_TOSTRUCT
) {
110 dns_rdata_null_t
*null
= target
;
113 REQUIRE(rdata
->type
== 10);
114 REQUIRE(target
!= NULL
);
116 null
->common
.rdclass
= rdata
->rdclass
;
117 null
->common
.rdtype
= rdata
->type
;
118 ISC_LINK_INIT(&null
->common
, link
);
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
);
127 return (ISC_R_SUCCESS
);
131 freestruct_null(ARGS_FREESTRUCT
) {
132 dns_rdata_null_t
*null
= source
;
134 REQUIRE(source
!= NULL
);
135 REQUIRE(null
->common
.rdtype
== 10);
137 if (null
->mctx
== NULL
)
140 if (null
->data
!= NULL
)
141 isc_mem_free(null
->mctx
, null
->data
);
145 static inline isc_result_t
146 additionaldata_null(ARGS_ADDLDATA
) {
151 REQUIRE(rdata
->type
== 10);
153 return (ISC_R_SUCCESS
);
156 static inline isc_result_t
157 digest_null(ARGS_DIGEST
) {
160 REQUIRE(rdata
->type
== 10);
162 dns_rdata_toregion(rdata
, &r
);
164 return ((digest
)(arg
, &r
));
167 static inline isc_boolean_t
168 checkowner_null(ARGS_CHECKOWNER
) {
180 static inline isc_boolean_t
181 checknames_null(ARGS_CHECKNAMES
) {
183 REQUIRE(rdata
->type
== 10);
192 #endif /* RDATA_GENERIC_NULL_10_C */