"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/dns/rdata/generic/null_10.c" (7 Sep 2020, 3959 Bytes) of package /linux/misc/dns/bind9/9.11.23/bind-9.11.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "null_10.c" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 #ifndef RDATA_GENERIC_NULL_10_C
   13 #define RDATA_GENERIC_NULL_10_C
   14 
   15 #define RRTYPE_NULL_ATTRIBUTES (0)
   16 
   17 static inline isc_result_t
   18 fromtext_null(ARGS_FROMTEXT) {
   19     REQUIRE(type == dns_rdatatype_null);
   20 
   21     UNUSED(rdclass);
   22     UNUSED(type);
   23     UNUSED(lexer);
   24     UNUSED(origin);
   25     UNUSED(options);
   26     UNUSED(target);
   27     UNUSED(callbacks);
   28 
   29     return (DNS_R_SYNTAX);
   30 }
   31 
   32 static inline isc_result_t
   33 totext_null(ARGS_TOTEXT) {
   34     REQUIRE(rdata->type == dns_rdatatype_null);
   35 
   36     return (unknown_totext(rdata, tctx, target));
   37 }
   38 
   39 static inline isc_result_t
   40 fromwire_null(ARGS_FROMWIRE) {
   41     isc_region_t sr;
   42 
   43     REQUIRE(type == dns_rdatatype_null);
   44 
   45     UNUSED(type);
   46     UNUSED(rdclass);
   47     UNUSED(dctx);
   48     UNUSED(options);
   49 
   50     isc_buffer_activeregion(source, &sr);
   51     isc_buffer_forward(source, sr.length);
   52     return (mem_tobuffer(target, sr.base, sr.length));
   53 }
   54 
   55 static inline isc_result_t
   56 towire_null(ARGS_TOWIRE) {
   57     REQUIRE(rdata->type == dns_rdatatype_null);
   58 
   59     UNUSED(cctx);
   60 
   61     return (mem_tobuffer(target, rdata->data, rdata->length));
   62 }
   63 
   64 static inline int
   65 compare_null(ARGS_COMPARE) {
   66     isc_region_t r1;
   67     isc_region_t r2;
   68 
   69     REQUIRE(rdata1->type == rdata2->type);
   70     REQUIRE(rdata1->rdclass == rdata2->rdclass);
   71     REQUIRE(rdata1->type == dns_rdatatype_null);
   72 
   73     dns_rdata_toregion(rdata1, &r1);
   74     dns_rdata_toregion(rdata2, &r2);
   75     return (isc_region_compare(&r1, &r2));
   76 }
   77 
   78 static inline isc_result_t
   79 fromstruct_null(ARGS_FROMSTRUCT) {
   80     dns_rdata_null_t *null;
   81 
   82     REQUIRE(type == dns_rdatatype_null);
   83     REQUIRE(((dns_rdata_null_t *)source) != NULL);
   84     REQUIRE(((dns_rdata_null_t *)source)->common.rdtype == type);
   85     REQUIRE(((dns_rdata_null_t *)source)->common.rdclass == rdclass);
   86     REQUIRE(((dns_rdata_null_t *)source)->data != NULL ||
   87         ((dns_rdata_null_t *)source)->length == 0);
   88 
   89     null = source;
   90 
   91     UNUSED(type);
   92     UNUSED(rdclass);
   93 
   94     return (mem_tobuffer(target, null->data, null->length));
   95 }
   96 
   97 static inline isc_result_t
   98 tostruct_null(ARGS_TOSTRUCT) {
   99     dns_rdata_null_t *null;
  100     isc_region_t r;
  101 
  102     REQUIRE(rdata->type == dns_rdatatype_null);
  103     REQUIRE(((dns_rdata_null_t *)target) != NULL);
  104 
  105     null = target;
  106 
  107     null->common.rdclass = rdata->rdclass;
  108     null->common.rdtype = rdata->type;
  109     ISC_LINK_INIT(&null->common, link);
  110 
  111     dns_rdata_toregion(rdata, &r);
  112     null->length = r.length;
  113     null->data = mem_maybedup(mctx, r.base, r.length);
  114     if (null->data == NULL)
  115         return (ISC_R_NOMEMORY);
  116 
  117     null->mctx = mctx;
  118     return (ISC_R_SUCCESS);
  119 }
  120 
  121 static inline void
  122 freestruct_null(ARGS_FREESTRUCT) {
  123     dns_rdata_null_t *null;
  124 
  125     REQUIRE(((dns_rdata_null_t *)source) != NULL);
  126     REQUIRE(((dns_rdata_null_t *)source)->common.rdtype ==
  127         dns_rdatatype_null);
  128 
  129     null = source;
  130 
  131     if (null->mctx == NULL)
  132         return;
  133 
  134     if (null->data != NULL)
  135         isc_mem_free(null->mctx, null->data);
  136     null->mctx = NULL;
  137 }
  138 
  139 static inline isc_result_t
  140 additionaldata_null(ARGS_ADDLDATA) {
  141     UNUSED(rdata);
  142     UNUSED(add);
  143     UNUSED(arg);
  144 
  145     REQUIRE(rdata->type == dns_rdatatype_null);
  146 
  147     return (ISC_R_SUCCESS);
  148 }
  149 
  150 static inline isc_result_t
  151 digest_null(ARGS_DIGEST) {
  152     isc_region_t r;
  153 
  154     REQUIRE(rdata->type == dns_rdatatype_null);
  155 
  156     dns_rdata_toregion(rdata, &r);
  157 
  158     return ((digest)(arg, &r));
  159 }
  160 
  161 static inline bool
  162 checkowner_null(ARGS_CHECKOWNER) {
  163 
  164     REQUIRE(type == dns_rdatatype_null);
  165 
  166     UNUSED(name);
  167     UNUSED(type);
  168     UNUSED(rdclass);
  169     UNUSED(wildcard);
  170 
  171     return (true);
  172 }
  173 
  174 static inline bool
  175 checknames_null(ARGS_CHECKNAMES) {
  176 
  177     REQUIRE(rdata->type == dns_rdatatype_null);
  178 
  179     UNUSED(rdata);
  180     UNUSED(owner);
  181     UNUSED(bad);
  182 
  183     return (true);
  184 }
  185 
  186 static inline int
  187 casecompare_null(ARGS_COMPARE) {
  188     return (compare_null(rdata1, rdata2));
  189 }
  190 
  191 #endif  /* RDATA_GENERIC_NULL_10_C */