1 /* $NetBSD: resinfo_261.c,v 1.4 2026/01/29 18:37:53 christos Exp $ */ 2 3 /* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * SPDX-License-Identifier: MPL-2.0 7 * 8 * This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11 * 12 * See the COPYRIGHT file distributed with this work for additional 13 * information regarding copyright ownership. 14 */ 15 16 #ifndef RDATA_GENERIC_RESINFO_261_C 17 #define RDATA_GENERIC_RESINFO_261_C 18 19 #define RRTYPE_RESINFO_ATTRIBUTES (DNS_RDATATYPEATTR_SINGLETON) 20 21 static isc_result_t 22 fromtext_resinfo(ARGS_FROMTEXT) { 23 REQUIRE(type == dns_rdatatype_resinfo); 24 25 return generic_fromtext_txt(CALL_FROMTEXT); 26 } 27 28 static isc_result_t 29 totext_resinfo(ARGS_TOTEXT) { 30 REQUIRE(rdata != NULL); 31 REQUIRE(rdata->type == dns_rdatatype_resinfo); 32 33 return generic_totext_txt(CALL_TOTEXT); 34 } 35 36 static isc_result_t 37 fromwire_resinfo(ARGS_FROMWIRE) { 38 REQUIRE(type == dns_rdatatype_resinfo); 39 40 return generic_fromwire_txt(CALL_FROMWIRE); 41 } 42 43 static isc_result_t 44 towire_resinfo(ARGS_TOWIRE) { 45 REQUIRE(rdata->type == dns_rdatatype_resinfo); 46 47 UNUSED(cctx); 48 49 return mem_tobuffer(target, rdata->data, rdata->length); 50 } 51 52 static int 53 compare_resinfo(ARGS_COMPARE) { 54 isc_region_t r1; 55 isc_region_t r2; 56 57 REQUIRE(rdata1->type == rdata2->type); 58 REQUIRE(rdata1->rdclass == rdata2->rdclass); 59 REQUIRE(rdata1->type == dns_rdatatype_resinfo); 60 61 dns_rdata_toregion(rdata1, &r1); 62 dns_rdata_toregion(rdata2, &r2); 63 return isc_region_compare(&r1, &r2); 64 } 65 66 static isc_result_t 67 fromstruct_resinfo(ARGS_FROMSTRUCT) { 68 REQUIRE(type == dns_rdatatype_resinfo); 69 70 return generic_fromstruct_txt(CALL_FROMSTRUCT); 71 } 72 73 static isc_result_t 74 tostruct_resinfo(ARGS_TOSTRUCT) { 75 dns_rdata_resinfo_t *resinfo = target; 76 77 REQUIRE(resinfo != NULL); 78 REQUIRE(rdata != NULL); 79 REQUIRE(rdata->type == dns_rdatatype_resinfo); 80 81 DNS_RDATACOMMON_INIT(resinfo, rdata->type, rdata->rdclass); 82 83 return generic_tostruct_txt(CALL_TOSTRUCT); 84 } 85 86 static void 87 freestruct_resinfo(ARGS_FREESTRUCT) { 88 dns_rdata_resinfo_t *resinfo = source; 89 90 REQUIRE(resinfo != NULL); 91 REQUIRE(resinfo->common.rdtype == dns_rdatatype_resinfo); 92 93 generic_freestruct_txt(source); 94 } 95 96 static isc_result_t 97 additionaldata_resinfo(ARGS_ADDLDATA) { 98 REQUIRE(rdata->type == dns_rdatatype_resinfo); 99 100 UNUSED(rdata); 101 UNUSED(owner); 102 UNUSED(add); 103 UNUSED(arg); 104 105 return ISC_R_SUCCESS; 106 } 107 108 static isc_result_t 109 digest_resinfo(ARGS_DIGEST) { 110 isc_region_t r; 111 112 REQUIRE(rdata->type == dns_rdatatype_resinfo); 113 114 dns_rdata_toregion(rdata, &r); 115 116 return (digest)(arg, &r); 117 } 118 119 static bool 120 checkowner_resinfo(ARGS_CHECKOWNER) { 121 REQUIRE(type == dns_rdatatype_resinfo); 122 123 UNUSED(name); 124 UNUSED(type); 125 UNUSED(rdclass); 126 UNUSED(wildcard); 127 128 return true; 129 } 130 131 static bool 132 checknames_resinfo(ARGS_CHECKNAMES) { 133 REQUIRE(rdata->type == dns_rdatatype_resinfo); 134 135 UNUSED(rdata); 136 UNUSED(owner); 137 UNUSED(bad); 138 139 return true; 140 } 141 142 static int 143 casecompare_resinfo(ARGS_COMPARE) { 144 return compare_resinfo(rdata1, rdata2); 145 } 146 #endif /* RDATA_GENERIC_RESINFO_261_C */ 147