1 /* $NetBSD: smimea_53.c,v 1.5 2020/05/24 19:46:24 christos Exp $ */ 2 3 /* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * This Source Code Form is subject to the terms of the Mozilla Public 7 * License, v. 2.0. If a copy of the MPL was not distributed with this 8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 * 10 * See the COPYRIGHT file distributed with this work for additional 11 * information regarding copyright ownership. 12 */ 13 14 #ifndef RDATA_GENERIC_SMIMEA_53_C 15 #define RDATA_GENERIC_SMIMEA_53_C 16 17 #define RRTYPE_SMIMEA_ATTRIBUTES 0 18 19 static inline isc_result_t 20 fromtext_smimea(ARGS_FROMTEXT) { 21 REQUIRE(type == dns_rdatatype_smimea); 22 23 return (generic_fromtext_tlsa(rdclass, type, lexer, origin, options, 24 target, callbacks)); 25 } 26 27 static inline isc_result_t 28 totext_smimea(ARGS_TOTEXT) { 29 REQUIRE(rdata->type == dns_rdatatype_smimea); 30 31 return (generic_totext_tlsa(rdata, tctx, target)); 32 } 33 34 static inline isc_result_t 35 fromwire_smimea(ARGS_FROMWIRE) { 36 REQUIRE(type == dns_rdatatype_smimea); 37 38 return (generic_fromwire_tlsa(rdclass, type, source, dctx, options, 39 target)); 40 } 41 42 static inline isc_result_t 43 towire_smimea(ARGS_TOWIRE) { 44 isc_region_t sr; 45 46 REQUIRE(rdata->type == dns_rdatatype_smimea); 47 REQUIRE(rdata->length != 0); 48 49 UNUSED(cctx); 50 51 dns_rdata_toregion(rdata, &sr); 52 return (mem_tobuffer(target, sr.base, sr.length)); 53 } 54 55 static inline int 56 compare_smimea(ARGS_COMPARE) { 57 isc_region_t r1; 58 isc_region_t r2; 59 60 REQUIRE(rdata1->type == rdata2->type); 61 REQUIRE(rdata1->rdclass == rdata2->rdclass); 62 REQUIRE(rdata1->type == dns_rdatatype_smimea); 63 REQUIRE(rdata1->length != 0); 64 REQUIRE(rdata2->length != 0); 65 66 dns_rdata_toregion(rdata1, &r1); 67 dns_rdata_toregion(rdata2, &r2); 68 return (isc_region_compare(&r1, &r2)); 69 } 70 71 static inline isc_result_t 72 fromstruct_smimea(ARGS_FROMSTRUCT) { 73 REQUIRE(type == dns_rdatatype_smimea); 74 75 return (generic_fromstruct_tlsa(rdclass, type, source, target)); 76 } 77 78 static inline isc_result_t 79 tostruct_smimea(ARGS_TOSTRUCT) { 80 dns_rdata_smimea_t *smimea = target; 81 82 REQUIRE(rdata != NULL); 83 REQUIRE(rdata->type == dns_rdatatype_smimea); 84 REQUIRE(smimea != NULL); 85 86 smimea->common.rdclass = rdata->rdclass; 87 smimea->common.rdtype = rdata->type; 88 ISC_LINK_INIT(&smimea->common, link); 89 90 return (generic_tostruct_tlsa(rdata, target, mctx)); 91 } 92 93 static inline void 94 freestruct_smimea(ARGS_FREESTRUCT) { 95 dns_rdata_smimea_t *smimea = source; 96 97 REQUIRE(smimea != NULL); 98 REQUIRE(smimea->common.rdtype == dns_rdatatype_smimea); 99 100 generic_freestruct_tlsa(source); 101 } 102 103 static inline isc_result_t 104 additionaldata_smimea(ARGS_ADDLDATA) { 105 REQUIRE(rdata->type == dns_rdatatype_smimea); 106 107 UNUSED(rdata); 108 UNUSED(add); 109 UNUSED(arg); 110 111 return (ISC_R_SUCCESS); 112 } 113 114 static inline isc_result_t 115 digest_smimea(ARGS_DIGEST) { 116 isc_region_t r; 117 118 REQUIRE(rdata->type == dns_rdatatype_smimea); 119 120 dns_rdata_toregion(rdata, &r); 121 122 return ((digest)(arg, &r)); 123 } 124 125 static inline bool 126 checkowner_smimea(ARGS_CHECKOWNER) { 127 REQUIRE(type == dns_rdatatype_smimea); 128 129 UNUSED(name); 130 UNUSED(type); 131 UNUSED(rdclass); 132 UNUSED(wildcard); 133 134 return (true); 135 } 136 137 static inline bool 138 checknames_smimea(ARGS_CHECKNAMES) { 139 REQUIRE(rdata->type == dns_rdatatype_smimea); 140 141 UNUSED(rdata); 142 UNUSED(owner); 143 UNUSED(bad); 144 145 return (true); 146 } 147 148 static inline int 149 casecompare_smimea(ARGS_COMPARE) { 150 return (compare_smimea(rdata1, rdata2)); 151 } 152 153 #endif /* RDATA_GENERIC_SMIMEA_53_C */ 154