null_10.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004, 2007, 2009, 2011, 2012  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1998-2002  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id$ */
00019 
00020 /* Reviewed: Thu Mar 16 13:57:50 PST 2000 by explorer */
00021 
00022 #ifndef RDATA_GENERIC_NULL_10_C
00023 #define RDATA_GENERIC_NULL_10_C
00024 
00025 #define RRTYPE_NULL_ATTRIBUTES (0)
00026 
00027 static inline isc_result_t
00028 fromtext_null(ARGS_FROMTEXT) {
00029         REQUIRE(type == 10);
00030 
00031         UNUSED(rdclass);
00032         UNUSED(type);
00033         UNUSED(lexer);
00034         UNUSED(origin);
00035         UNUSED(options);
00036         UNUSED(target);
00037         UNUSED(callbacks);
00038 
00039         return (DNS_R_SYNTAX);
00040 }
00041 
00042 static inline isc_result_t
00043 totext_null(ARGS_TOTEXT) {
00044         REQUIRE(rdata->type == 10);
00045 
00046         return (unknown_totext(rdata, tctx, target));
00047 }
00048 
00049 static inline isc_result_t
00050 fromwire_null(ARGS_FROMWIRE) {
00051         isc_region_t sr;
00052 
00053         REQUIRE(type == 10);
00054 
00055         UNUSED(type);
00056         UNUSED(rdclass);
00057         UNUSED(dctx);
00058         UNUSED(options);
00059 
00060         isc_buffer_activeregion(source, &sr);
00061         isc_buffer_forward(source, sr.length);
00062         return (mem_tobuffer(target, sr.base, sr.length));
00063 }
00064 
00065 static inline isc_result_t
00066 towire_null(ARGS_TOWIRE) {
00067         REQUIRE(rdata->type == 10);
00068 
00069         UNUSED(cctx);
00070 
00071         return (mem_tobuffer(target, rdata->data, rdata->length));
00072 }
00073 
00074 static inline int
00075 compare_null(ARGS_COMPARE) {
00076         isc_region_t r1;
00077         isc_region_t r2;
00078 
00079         REQUIRE(rdata1->type == rdata2->type);
00080         REQUIRE(rdata1->rdclass == rdata2->rdclass);
00081         REQUIRE(rdata1->type == 10);
00082 
00083         dns_rdata_toregion(rdata1, &r1);
00084         dns_rdata_toregion(rdata2, &r2);
00085         return (isc_region_compare(&r1, &r2));
00086 }
00087 
00088 static inline isc_result_t
00089 fromstruct_null(ARGS_FROMSTRUCT) {
00090         dns_rdata_null_t *null = source;
00091 
00092         REQUIRE(type == 10);
00093         REQUIRE(source != NULL);
00094         REQUIRE(null->common.rdtype == type);
00095         REQUIRE(null->common.rdclass == rdclass);
00096         REQUIRE(null->data != NULL || null->length == 0);
00097 
00098         UNUSED(type);
00099         UNUSED(rdclass);
00100 
00101         return (mem_tobuffer(target, null->data, null->length));
00102 }
00103 
00104 static inline isc_result_t
00105 tostruct_null(ARGS_TOSTRUCT) {
00106         dns_rdata_null_t *null = target;
00107         isc_region_t r;
00108 
00109         REQUIRE(rdata->type == 10);
00110         REQUIRE(target != NULL);
00111 
00112         null->common.rdclass = rdata->rdclass;
00113         null->common.rdtype = rdata->type;
00114         ISC_LINK_INIT(&null->common, link);
00115 
00116         dns_rdata_toregion(rdata, &r);
00117         null->length = r.length;
00118         null->data = mem_maybedup(mctx, r.base, r.length);
00119         if (null->data == NULL)
00120                 return (ISC_R_NOMEMORY);
00121 
00122         null->mctx = mctx;
00123         return (ISC_R_SUCCESS);
00124 }
00125 
00126 static inline void
00127 freestruct_null(ARGS_FREESTRUCT) {
00128         dns_rdata_null_t *null = source;
00129 
00130         REQUIRE(source != NULL);
00131         REQUIRE(null->common.rdtype == 10);
00132 
00133         if (null->mctx == NULL)
00134                 return;
00135 
00136         if (null->data != NULL)
00137                 isc_mem_free(null->mctx, null->data);
00138         null->mctx = NULL;
00139 }
00140 
00141 static inline isc_result_t
00142 additionaldata_null(ARGS_ADDLDATA) {
00143         UNUSED(rdata);
00144         UNUSED(add);
00145         UNUSED(arg);
00146 
00147         REQUIRE(rdata->type == 10);
00148 
00149         return (ISC_R_SUCCESS);
00150 }
00151 
00152 static inline isc_result_t
00153 digest_null(ARGS_DIGEST) {
00154         isc_region_t r;
00155 
00156         REQUIRE(rdata->type == 10);
00157 
00158         dns_rdata_toregion(rdata, &r);
00159 
00160         return ((digest)(arg, &r));
00161 }
00162 
00163 static inline isc_boolean_t
00164 checkowner_null(ARGS_CHECKOWNER) {
00165 
00166         REQUIRE(type == 10);
00167 
00168         UNUSED(name);
00169         UNUSED(type);
00170         UNUSED(rdclass);
00171         UNUSED(wildcard);
00172 
00173         return (ISC_TRUE);
00174 }
00175 
00176 static inline isc_boolean_t
00177 checknames_null(ARGS_CHECKNAMES) {
00178 
00179         REQUIRE(rdata->type == 10);
00180 
00181         UNUSED(rdata);
00182         UNUSED(owner);
00183         UNUSED(bad);
00184 
00185         return (ISC_TRUE);
00186 }
00187 
00188 static inline int
00189 casecompare_null(ARGS_COMPARE) {
00190         return (compare_null(rdata1, rdata2));
00191 }
00192 
00193 #endif  /* RDATA_GENERIC_NULL_10_C */

Generated on Tue Apr 28 17:41:00 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha