new: usr: Added WALLET type
Add the new record type WALLET (262). This provides a mapping from a domain name to a cryptographic currency wallet. Multiple mappings can exist if multiple records exist. Closes #4947 Merge branch '4947-add-wallet-type-to-named' into 'main' See merge request isc-projects/bind9!9521
This commit is contained in:
@@ -2665,6 +2665,10 @@ unspec01.example. 3600 IN UNSPEC \# 1 04
|
||||
uri01.example. 3600 IN URI 10 20 "https://www.isc.org/"
|
||||
uri02.example. 3600 IN URI 30 40 "https://www.isc.org/HolyCowThisSureIsAVeryLongURIRecordIDontEvenKnowWhatSomeoneWouldEverWantWithSuchAThingButTheSpecificationRequiresThatWesupportItSoHereWeGoTestingItLaLaLaLaLaLaLaSeriouslyThoughWhyWouldYouEvenConsiderUsingAURIThisLongItSeemsLikeASillyIdeaButEnhWhatAreYouGonnaDo/"
|
||||
uri03.example. 3600 IN URI 30 40 ""
|
||||
wallet.example. 3600 IN WALLET "currency-identifer" "wallet-identifier"
|
||||
wallet-multiple.example. 3600 IN WALLET "currency-identifer1" "wallet-identifier1"
|
||||
wallet-multiple.example. 3600 IN WALLET "currency-identifer1" "wallet-identifier2"
|
||||
wallet-multiple.example. 3600 IN WALLET "currency-identifer2" "wallet-identifier3"
|
||||
wks01.example. 3600 IN WKS 10.0.0.1 6 0 1 2 21 23
|
||||
wks02.example. 3600 IN WKS 10.0.0.1 17 0 1 2 53
|
||||
wks03.example. 3600 IN WKS 10.0.0.2 6 65535
|
||||
|
||||
@@ -2665,6 +2665,10 @@ unspec01.example8. 3600 IN UNSPEC \# 1 04
|
||||
uri01.example8. 3600 IN URI 10 20 "https://www.isc.org/"
|
||||
uri02.example8. 3600 IN URI 30 40 "https://www.isc.org/HolyCowThisSureIsAVeryLongURIRecordIDontEvenKnowWhatSomeoneWouldEverWantWithSuchAThingButTheSpecificationRequiresThatWesupportItSoHereWeGoTestingItLaLaLaLaLaLaLaSeriouslyThoughWhyWouldYouEvenConsiderUsingAURIThisLongItSeemsLikeASillyIdeaButEnhWhatAreYouGonnaDo/"
|
||||
uri03.example8. 3600 IN URI 30 40 ""
|
||||
wallet.example8. 3600 IN WALLET "currency-identifer" "wallet-identifier"
|
||||
wallet-multiple.example8. 3600 IN WALLET "currency-identifer1" "wallet-identifier1"
|
||||
wallet-multiple.example8. 3600 IN WALLET "currency-identifer1" "wallet-identifier2"
|
||||
wallet-multiple.example8. 3600 IN WALLET "currency-identifer2" "wallet-identifier3"
|
||||
wks01.example8. 3600 IN WKS 10.0.0.1 6 0 1 2 21 23
|
||||
wks02.example8. 3600 IN WKS 10.0.0.1 17 0 1 2 53
|
||||
wks03.example8. 3600 IN WKS 10.0.0.2 6 65535
|
||||
|
||||
@@ -481,7 +481,13 @@ amtrelay06 AMTRELAY \# 2 0004
|
||||
; type 261
|
||||
resinfo RESINFO qnamemin exterr=15,16,17 infourl=https://resolver.example.com/guide
|
||||
|
||||
; type 262 -- 32767 (unassigned)
|
||||
; type 262
|
||||
wallet WALLET currency-identifer wallet-identifier
|
||||
wallet-multiple WALLET currency-identifer1 wallet-identifier1
|
||||
wallet-multiple WALLET currency-identifer1 wallet-identifier2
|
||||
wallet-multiple WALLET currency-identifer2 wallet-identifier3
|
||||
|
||||
; type 265 -- 32767 (unassigned)
|
||||
|
||||
; type 32768
|
||||
ta TA 30795 1 1 (
|
||||
|
||||
@@ -101,6 +101,7 @@ import pytest
|
||||
"UINFO",
|
||||
"UNSPEC",
|
||||
"URI",
|
||||
"WALLET",
|
||||
"WKS",
|
||||
"X25",
|
||||
"ZONEMD",
|
||||
|
||||
@@ -167,6 +167,10 @@ unspec01.example. 3600 IN UNSPEC \# 1 04
|
||||
uri01.example. 3600 IN URI 10 20 "https://www.isc.org/"
|
||||
uri02.example. 3600 IN URI 30 40 "https://www.isc.org/HolyCowThisSureIsAVeryLongURIRecordIDontEvenKnowWhatSomeoneWouldEverWantWithSuchAThingButTheSpecificationRequiresThatWesupportItSoHereWeGoTestingItLaLaLaLaLaLaLaSeriouslyThoughWhyWouldYouEvenConsiderUsingAURIThisLongItSeemsLikeASillyIdeaButEnhWhatAreYouGonnaDo/"
|
||||
uri03.example. 3600 IN URI 30 40 ""
|
||||
wallet.example. 3600 IN WALLET "currency-identifer" "wallet-identifier"
|
||||
wallet-multiple.example. 3600 IN WALLET "currency-identifer1" "wallet-identifier1"
|
||||
wallet-multiple.example. 3600 IN WALLET "currency-identifer1" "wallet-identifier2"
|
||||
wallet-multiple.example. 3600 IN WALLET "currency-identifer2" "wallet-identifier3"
|
||||
wks01.example. 3600 IN WKS 10.0.0.1 6 0 1 2 21 23
|
||||
wks02.example. 3600 IN WKS 10.0.0.1 17 0 1 2 53
|
||||
wks03.example. 3600 IN WKS 10.0.0.2 6 65535
|
||||
|
||||
@@ -167,6 +167,10 @@ unspec01.example. 3600 IN UNSPEC \# 1 04
|
||||
uri01.example. 3600 IN URI 10 20 "https://www.isc.org/"
|
||||
uri02.example. 3600 IN URI 30 40 "https://www.isc.org/HolyCowThisSureIsAVeryLongURIRecordIDontEvenKnowWhatSomeoneWouldEverWantWithSuchAThingButTheSpecificationRequiresThatWesupportItSoHereWeGoTestingItLaLaLaLaLaLaLaSeriouslyThoughWhyWouldYouEvenConsiderUsingAURIThisLongItSeemsLikeASillyIdeaButEnhWhatAreYouGonnaDo/"
|
||||
uri03.example. 3600 IN URI 30 40 ""
|
||||
wallet.example. 3600 IN WALLET "currency-identifer" "wallet-identifier"
|
||||
wallet-multiple.example. 3600 IN WALLET "currency-identifer1" "wallet-identifier1"
|
||||
wallet-multiple.example. 3600 IN WALLET "currency-identifer1" "wallet-identifier2"
|
||||
wallet-multiple.example. 3600 IN WALLET "currency-identifer2" "wallet-identifier3"
|
||||
wks01.example. 3600 IN WKS 10.0.0.1 6 0 1 2 21 23
|
||||
wks02.example. 3600 IN WKS 10.0.0.1 17 0 1 2 53
|
||||
wks03.example. 3600 IN WKS 10.0.0.2 6 65535
|
||||
|
||||
170
lib/dns/rdata/generic/wallet_262.c
Normal file
170
lib/dns/rdata/generic/wallet_262.c
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#ifndef RDATA_GENERIC_WALLET_262_C
|
||||
#define RDATA_GENERIC_WALLET_262_C
|
||||
|
||||
#define RRTYPE_WALLET_ATTRIBUTES (0)
|
||||
|
||||
static isc_result_t
|
||||
fromtext_wallet(ARGS_FROMTEXT) {
|
||||
REQUIRE(type == dns_rdatatype_wallet);
|
||||
|
||||
return (generic_fromtext_txt(CALL_FROMTEXT));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
totext_wallet(ARGS_TOTEXT) {
|
||||
REQUIRE(rdata != NULL);
|
||||
REQUIRE(rdata->type == dns_rdatatype_wallet);
|
||||
|
||||
return (generic_totext_txt(CALL_TOTEXT));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
fromwire_wallet(ARGS_FROMWIRE) {
|
||||
REQUIRE(type == dns_rdatatype_wallet);
|
||||
|
||||
return (generic_fromwire_txt(CALL_FROMWIRE));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
towire_wallet(ARGS_TOWIRE) {
|
||||
REQUIRE(rdata->type == dns_rdatatype_wallet);
|
||||
|
||||
UNUSED(cctx);
|
||||
|
||||
return (mem_tobuffer(target, rdata->data, rdata->length));
|
||||
}
|
||||
|
||||
static int
|
||||
compare_wallet(ARGS_COMPARE) {
|
||||
isc_region_t r1;
|
||||
isc_region_t r2;
|
||||
|
||||
REQUIRE(rdata1->type == rdata2->type);
|
||||
REQUIRE(rdata1->rdclass == rdata2->rdclass);
|
||||
REQUIRE(rdata1->type == dns_rdatatype_wallet);
|
||||
|
||||
dns_rdata_toregion(rdata1, &r1);
|
||||
dns_rdata_toregion(rdata2, &r2);
|
||||
return (isc_region_compare(&r1, &r2));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
fromstruct_wallet(ARGS_FROMSTRUCT) {
|
||||
REQUIRE(type == dns_rdatatype_wallet);
|
||||
|
||||
return (generic_fromstruct_txt(CALL_FROMSTRUCT));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
tostruct_wallet(ARGS_TOSTRUCT) {
|
||||
dns_rdata_wallet_t *wallet = target;
|
||||
|
||||
REQUIRE(rdata->type == dns_rdatatype_wallet);
|
||||
REQUIRE(wallet != NULL);
|
||||
|
||||
wallet->common.rdclass = rdata->rdclass;
|
||||
wallet->common.rdtype = rdata->type;
|
||||
ISC_LINK_INIT(&wallet->common, link);
|
||||
|
||||
return (generic_tostruct_txt(CALL_TOSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
freestruct_wallet(ARGS_FREESTRUCT) {
|
||||
dns_rdata_wallet_t *wallet = source;
|
||||
|
||||
REQUIRE(wallet != NULL);
|
||||
REQUIRE(wallet->common.rdtype == dns_rdatatype_wallet);
|
||||
|
||||
generic_freestruct_txt(source);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
additionaldata_wallet(ARGS_ADDLDATA) {
|
||||
REQUIRE(rdata->type == dns_rdatatype_wallet);
|
||||
|
||||
UNUSED(rdata);
|
||||
UNUSED(owner);
|
||||
UNUSED(add);
|
||||
UNUSED(arg);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
digest_wallet(ARGS_DIGEST) {
|
||||
isc_region_t r;
|
||||
|
||||
REQUIRE(rdata->type == dns_rdatatype_wallet);
|
||||
|
||||
dns_rdata_toregion(rdata, &r);
|
||||
|
||||
return ((digest)(arg, &r));
|
||||
}
|
||||
|
||||
static bool
|
||||
checkowner_wallet(ARGS_CHECKOWNER) {
|
||||
REQUIRE(type == dns_rdatatype_wallet);
|
||||
|
||||
UNUSED(name);
|
||||
UNUSED(type);
|
||||
UNUSED(rdclass);
|
||||
UNUSED(wildcard);
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
static bool
|
||||
checknames_wallet(ARGS_CHECKNAMES) {
|
||||
REQUIRE(rdata->type == dns_rdatatype_wallet);
|
||||
|
||||
UNUSED(rdata);
|
||||
UNUSED(owner);
|
||||
UNUSED(bad);
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
static int
|
||||
casecompare_wallet(ARGS_COMPARE) {
|
||||
return (compare_wallet(rdata1, rdata2));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_rdata_wallet_first(dns_rdata_wallet_t *wallet) {
|
||||
REQUIRE(wallet != NULL);
|
||||
REQUIRE(wallet->common.rdtype == dns_rdatatype_wallet);
|
||||
|
||||
return (generic_txt_first(wallet));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_rdata_wallet_next(dns_rdata_wallet_t *wallet) {
|
||||
REQUIRE(wallet != NULL);
|
||||
REQUIRE(wallet->common.rdtype == dns_rdatatype_wallet);
|
||||
|
||||
return (generic_txt_next(wallet));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_rdata_wallet_current(dns_rdata_wallet_t *wallet,
|
||||
dns_rdata_wallet_string_t *string) {
|
||||
REQUIRE(wallet != NULL);
|
||||
REQUIRE(wallet->common.rdtype == dns_rdatatype_wallet);
|
||||
|
||||
return (generic_txt_current(wallet, string));
|
||||
}
|
||||
#endif /* RDATA_GENERIC_WALLET_262_C */
|
||||
33
lib/dns/rdata/generic/wallet_262.h
Normal file
33
lib/dns/rdata/generic/wallet_262.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/* */
|
||||
#pragma once
|
||||
|
||||
typedef struct dns_rdata_txt_string dns_rdata_wallet_string_t;
|
||||
|
||||
typedef struct dns_rdata_txt dns_rdata_wallet_t;
|
||||
|
||||
/*
|
||||
* ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done
|
||||
* via rdatastructpre.h and rdatastructsuf.h.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_rdata_wallet_first(dns_rdata_wallet_t *);
|
||||
|
||||
isc_result_t
|
||||
dns_rdata_wallet_next(dns_rdata_wallet_t *);
|
||||
|
||||
isc_result_t
|
||||
dns_rdata_wallet_current(dns_rdata_wallet_t *, dns_rdata_wallet_string_t *);
|
||||
@@ -2449,6 +2449,18 @@ ISC_RUN_TEST_IMPL(sshfp) {
|
||||
dns_rdatatype_sshfp, sizeof(dns_rdata_sshfp_t));
|
||||
}
|
||||
|
||||
ISC_RUN_TEST_IMPL(wallet) {
|
||||
text_ok_t text_ok[] = { TEXT_VALID_CHANGED("cid-example wid-example",
|
||||
"\"cid-example\" "
|
||||
"\"wid-example\""),
|
||||
/*
|
||||
* Sentinel.
|
||||
*/
|
||||
TEXT_SENTINEL() };
|
||||
check_rdata(text_ok, NULL, NULL, false, dns_rdataclass_in,
|
||||
dns_rdatatype_wallet, sizeof(dns_rdata_rkey_t));
|
||||
}
|
||||
|
||||
/*
|
||||
* WKS tests.
|
||||
*
|
||||
@@ -3153,6 +3165,7 @@ ISC_TEST_ENTRY(nxt)
|
||||
ISC_TEST_ENTRY(rkey)
|
||||
ISC_TEST_ENTRY(resinfo)
|
||||
ISC_TEST_ENTRY(sshfp)
|
||||
ISC_TEST_ENTRY(wallet)
|
||||
ISC_TEST_ENTRY(wks)
|
||||
ISC_TEST_ENTRY(zonemd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user