"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/dns/rdata/generic/cdnskey_60.c" (7 Sep 2020, 3688 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 "cdnskey_60.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 /* draft-ietf-dnsop-delegation-trust-maintainance-14 */
   13 
   14 #ifndef RDATA_GENERIC_CDNSKEY_60_C
   15 #define RDATA_GENERIC_CDNSKEY_60_C
   16 
   17 #include <dst/dst.h>
   18 
   19 #define RRTYPE_CDNSKEY_ATTRIBUTES 0
   20 
   21 static inline isc_result_t
   22 fromtext_cdnskey(ARGS_FROMTEXT) {
   23 
   24     REQUIRE(type == dns_rdatatype_cdnskey);
   25 
   26     return (generic_fromtext_key(rdclass, type, lexer, origin,
   27                      options, target, callbacks));
   28 }
   29 
   30 static inline isc_result_t
   31 totext_cdnskey(ARGS_TOTEXT) {
   32 
   33     REQUIRE(rdata != NULL);
   34     REQUIRE(rdata->type == dns_rdatatype_cdnskey);
   35 
   36     return (generic_totext_key(rdata, tctx, target));
   37 }
   38 
   39 static inline isc_result_t
   40 fromwire_cdnskey(ARGS_FROMWIRE) {
   41 
   42     REQUIRE(type == dns_rdatatype_cdnskey);
   43 
   44     return (generic_fromwire_key(rdclass, type, source, dctx,
   45                      options, target));
   46 }
   47 
   48 static inline isc_result_t
   49 towire_cdnskey(ARGS_TOWIRE) {
   50     isc_region_t sr;
   51 
   52     REQUIRE(rdata->type == dns_rdatatype_cdnskey);
   53     REQUIRE(rdata->length != 0);
   54 
   55     UNUSED(cctx);
   56 
   57     dns_rdata_toregion(rdata, &sr);
   58     return (mem_tobuffer(target, sr.base, sr.length));
   59 }
   60 
   61 static inline int
   62 compare_cdnskey(ARGS_COMPARE) {
   63     isc_region_t r1;
   64     isc_region_t r2;
   65 
   66     REQUIRE(rdata1 != NULL);
   67     REQUIRE(rdata2 != NULL);
   68     REQUIRE(rdata1->type == rdata2->type);
   69     REQUIRE(rdata1->rdclass == rdata2->rdclass);
   70     REQUIRE(rdata1->type == dns_rdatatype_cdnskey);
   71     REQUIRE(rdata1->length != 0);
   72     REQUIRE(rdata2->length != 0);
   73 
   74     dns_rdata_toregion(rdata1, &r1);
   75     dns_rdata_toregion(rdata2, &r2);
   76     return (isc_region_compare(&r1, &r2));
   77 }
   78 
   79 static inline isc_result_t
   80 fromstruct_cdnskey(ARGS_FROMSTRUCT) {
   81 
   82     REQUIRE(type == dns_rdatatype_cdnskey);
   83 
   84     return (generic_fromstruct_key(rdclass, type, source, target));
   85 }
   86 
   87 static inline isc_result_t
   88 tostruct_cdnskey(ARGS_TOSTRUCT) {
   89     dns_rdata_cdnskey_t *dnskey;
   90 
   91     REQUIRE(((dns_rdata_cdnskey_t *)target) != NULL);
   92     REQUIRE(rdata != NULL);
   93     REQUIRE(rdata->type == dns_rdatatype_cdnskey);
   94 
   95     dnskey = target;
   96 
   97     dnskey->common.rdclass = rdata->rdclass;
   98     dnskey->common.rdtype = rdata->type;
   99     ISC_LINK_INIT(&dnskey->common, link);
  100 
  101     return (generic_tostruct_key(rdata, target, mctx));
  102 }
  103 
  104 static inline void
  105 freestruct_cdnskey(ARGS_FREESTRUCT) {
  106     REQUIRE(((dns_rdata_cdnskey_t *)source) != NULL);
  107     REQUIRE(((dns_rdata_cdnskey_t *)source)->common.rdtype ==
  108         dns_rdatatype_cdnskey);
  109 
  110     generic_freestruct_key(source);
  111 }
  112 
  113 static inline isc_result_t
  114 additionaldata_cdnskey(ARGS_ADDLDATA) {
  115     REQUIRE(rdata->type == dns_rdatatype_cdnskey);
  116 
  117     UNUSED(rdata);
  118     UNUSED(add);
  119     UNUSED(arg);
  120 
  121     return (ISC_R_SUCCESS);
  122 }
  123 
  124 static inline isc_result_t
  125 digest_cdnskey(ARGS_DIGEST) {
  126     isc_region_t r;
  127 
  128     REQUIRE(rdata != NULL);
  129     REQUIRE(rdata->type == dns_rdatatype_cdnskey);
  130 
  131     dns_rdata_toregion(rdata, &r);
  132 
  133     return ((digest)(arg, &r));
  134 }
  135 
  136 static inline bool
  137 checkowner_cdnskey(ARGS_CHECKOWNER) {
  138 
  139     REQUIRE(type == dns_rdatatype_cdnskey);
  140 
  141     UNUSED(name);
  142     UNUSED(type);
  143     UNUSED(rdclass);
  144     UNUSED(wildcard);
  145 
  146     return (true);
  147 }
  148 
  149 static inline bool
  150 checknames_cdnskey(ARGS_CHECKNAMES) {
  151 
  152     REQUIRE(rdata != NULL);
  153     REQUIRE(rdata->type == dns_rdatatype_cdnskey);
  154 
  155     UNUSED(rdata);
  156     UNUSED(owner);
  157     UNUSED(bad);
  158 
  159     return (true);
  160 }
  161 
  162 static inline int
  163 casecompare_cdnskey(ARGS_COMPARE) {
  164 
  165     /*
  166      * Treat ALG 253 (private DNS) subtype name case sensitively.
  167      */
  168     return (compare_cdnskey(rdata1, rdata2));
  169 }
  170 
  171 #endif  /* RDATA_GENERIC_CDNSKEY_60_C */