Home | History | Annotate | Line # | Download | only in generic
      1  1.1  christos /*	$NetBSD: wallet_262.c,v 1.3 2026/01/29 18:37:53 christos Exp $	*/
      2  1.1  christos 
      3  1.1  christos /*
      4  1.1  christos  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      5  1.1  christos  *
      6  1.1  christos  * SPDX-License-Identifier: MPL-2.0
      7  1.1  christos  *
      8  1.1  christos  * This Source Code Form is subject to the terms of the Mozilla Public
      9  1.1  christos  * License, v. 2.0. If a copy of the MPL was not distributed with this
     10  1.1  christos  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
     11  1.1  christos  *
     12  1.1  christos  * See the COPYRIGHT file distributed with this work for additional
     13  1.1  christos  * information regarding copyright ownership.
     14  1.1  christos  */
     15  1.1  christos 
     16  1.1  christos #ifndef RDATA_GENERIC_WALLET_262_C
     17  1.1  christos #define RDATA_GENERIC_WALLET_262_C
     18  1.1  christos 
     19  1.1  christos #define RRTYPE_WALLET_ATTRIBUTES (0)
     20  1.1  christos 
     21  1.1  christos static isc_result_t
     22  1.1  christos fromtext_wallet(ARGS_FROMTEXT) {
     23  1.1  christos 	REQUIRE(type == dns_rdatatype_wallet);
     24  1.1  christos 
     25  1.1  christos 	return generic_fromtext_txt(CALL_FROMTEXT);
     26  1.1  christos }
     27  1.1  christos 
     28  1.1  christos static isc_result_t
     29  1.1  christos totext_wallet(ARGS_TOTEXT) {
     30  1.1  christos 	REQUIRE(rdata != NULL);
     31  1.1  christos 	REQUIRE(rdata->type == dns_rdatatype_wallet);
     32  1.1  christos 
     33  1.1  christos 	return generic_totext_txt(CALL_TOTEXT);
     34  1.1  christos }
     35  1.1  christos 
     36  1.1  christos static isc_result_t
     37  1.1  christos fromwire_wallet(ARGS_FROMWIRE) {
     38  1.1  christos 	REQUIRE(type == dns_rdatatype_wallet);
     39  1.1  christos 
     40  1.1  christos 	return generic_fromwire_txt(CALL_FROMWIRE);
     41  1.1  christos }
     42  1.1  christos 
     43  1.1  christos static isc_result_t
     44  1.1  christos towire_wallet(ARGS_TOWIRE) {
     45  1.1  christos 	REQUIRE(rdata->type == dns_rdatatype_wallet);
     46  1.1  christos 
     47  1.1  christos 	UNUSED(cctx);
     48  1.1  christos 
     49  1.1  christos 	return mem_tobuffer(target, rdata->data, rdata->length);
     50  1.1  christos }
     51  1.1  christos 
     52  1.1  christos static int
     53  1.1  christos compare_wallet(ARGS_COMPARE) {
     54  1.1  christos 	isc_region_t r1;
     55  1.1  christos 	isc_region_t r2;
     56  1.1  christos 
     57  1.1  christos 	REQUIRE(rdata1->type == rdata2->type);
     58  1.1  christos 	REQUIRE(rdata1->rdclass == rdata2->rdclass);
     59  1.1  christos 	REQUIRE(rdata1->type == dns_rdatatype_wallet);
     60  1.1  christos 
     61  1.1  christos 	dns_rdata_toregion(rdata1, &r1);
     62  1.1  christos 	dns_rdata_toregion(rdata2, &r2);
     63  1.1  christos 	return isc_region_compare(&r1, &r2);
     64  1.1  christos }
     65  1.1  christos 
     66  1.1  christos static isc_result_t
     67  1.1  christos fromstruct_wallet(ARGS_FROMSTRUCT) {
     68  1.1  christos 	REQUIRE(type == dns_rdatatype_wallet);
     69  1.1  christos 
     70  1.1  christos 	return generic_fromstruct_txt(CALL_FROMSTRUCT);
     71  1.1  christos }
     72  1.1  christos 
     73  1.1  christos static isc_result_t
     74  1.1  christos tostruct_wallet(ARGS_TOSTRUCT) {
     75  1.1  christos 	dns_rdata_wallet_t *wallet = target;
     76  1.1  christos 
     77  1.1  christos 	REQUIRE(rdata->type == dns_rdatatype_wallet);
     78  1.1  christos 	REQUIRE(wallet != NULL);
     79  1.1  christos 
     80  1.3  christos 	DNS_RDATACOMMON_INIT(wallet, rdata->type, rdata->rdclass);
     81  1.1  christos 
     82  1.1  christos 	return generic_tostruct_txt(CALL_TOSTRUCT);
     83  1.1  christos }
     84  1.1  christos 
     85  1.1  christos static void
     86  1.1  christos freestruct_wallet(ARGS_FREESTRUCT) {
     87  1.1  christos 	dns_rdata_wallet_t *wallet = source;
     88  1.1  christos 
     89  1.1  christos 	REQUIRE(wallet != NULL);
     90  1.1  christos 	REQUIRE(wallet->common.rdtype == dns_rdatatype_wallet);
     91  1.1  christos 
     92  1.1  christos 	generic_freestruct_txt(source);
     93  1.1  christos }
     94  1.1  christos 
     95  1.1  christos static isc_result_t
     96  1.1  christos additionaldata_wallet(ARGS_ADDLDATA) {
     97  1.1  christos 	REQUIRE(rdata->type == dns_rdatatype_wallet);
     98  1.1  christos 
     99  1.1  christos 	UNUSED(rdata);
    100  1.1  christos 	UNUSED(owner);
    101  1.1  christos 	UNUSED(add);
    102  1.1  christos 	UNUSED(arg);
    103  1.1  christos 
    104  1.1  christos 	return ISC_R_SUCCESS;
    105  1.1  christos }
    106  1.1  christos 
    107  1.1  christos static isc_result_t
    108  1.1  christos digest_wallet(ARGS_DIGEST) {
    109  1.1  christos 	isc_region_t r;
    110  1.1  christos 
    111  1.1  christos 	REQUIRE(rdata->type == dns_rdatatype_wallet);
    112  1.1  christos 
    113  1.1  christos 	dns_rdata_toregion(rdata, &r);
    114  1.1  christos 
    115  1.1  christos 	return (digest)(arg, &r);
    116  1.1  christos }
    117  1.1  christos 
    118  1.1  christos static bool
    119  1.1  christos checkowner_wallet(ARGS_CHECKOWNER) {
    120  1.1  christos 	REQUIRE(type == dns_rdatatype_wallet);
    121  1.1  christos 
    122  1.1  christos 	UNUSED(name);
    123  1.1  christos 	UNUSED(type);
    124  1.1  christos 	UNUSED(rdclass);
    125  1.1  christos 	UNUSED(wildcard);
    126  1.1  christos 
    127  1.1  christos 	return true;
    128  1.1  christos }
    129  1.1  christos 
    130  1.1  christos static bool
    131  1.1  christos checknames_wallet(ARGS_CHECKNAMES) {
    132  1.1  christos 	REQUIRE(rdata->type == dns_rdatatype_wallet);
    133  1.1  christos 
    134  1.1  christos 	UNUSED(rdata);
    135  1.1  christos 	UNUSED(owner);
    136  1.1  christos 	UNUSED(bad);
    137  1.1  christos 
    138  1.1  christos 	return true;
    139  1.1  christos }
    140  1.1  christos 
    141  1.1  christos static int
    142  1.1  christos casecompare_wallet(ARGS_COMPARE) {
    143  1.1  christos 	return compare_wallet(rdata1, rdata2);
    144  1.1  christos }
    145  1.1  christos 
    146  1.1  christos isc_result_t
    147  1.1  christos dns_rdata_wallet_first(dns_rdata_wallet_t *wallet) {
    148  1.1  christos 	REQUIRE(wallet != NULL);
    149  1.1  christos 	REQUIRE(wallet->common.rdtype == dns_rdatatype_wallet);
    150  1.1  christos 
    151  1.1  christos 	return generic_txt_first(wallet);
    152  1.1  christos }
    153  1.1  christos 
    154  1.1  christos isc_result_t
    155  1.1  christos dns_rdata_wallet_next(dns_rdata_wallet_t *wallet) {
    156  1.1  christos 	REQUIRE(wallet != NULL);
    157  1.1  christos 	REQUIRE(wallet->common.rdtype == dns_rdatatype_wallet);
    158  1.1  christos 
    159  1.1  christos 	return generic_txt_next(wallet);
    160  1.1  christos }
    161  1.1  christos 
    162  1.1  christos isc_result_t
    163  1.1  christos dns_rdata_wallet_current(dns_rdata_wallet_t *wallet,
    164  1.1  christos 			 dns_rdata_wallet_string_t *string) {
    165  1.1  christos 	REQUIRE(wallet != NULL);
    166  1.1  christos 	REQUIRE(wallet->common.rdtype == dns_rdatatype_wallet);
    167  1.1  christos 
    168  1.1  christos 	return generic_txt_current(wallet, string);
    169  1.1  christos }
    170  1.1  christos #endif /* RDATA_GENERIC_WALLET_262_C */
    171