"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.16.7/lib/dns/rdata/generic/cdnskey_60.c" (4 Sep 2020, 3657 Bytes) of package /linux/misc/dns/bind9/9.16.7/bind-9.16.7.tar.xz:


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