mirror of
https://github.com/openbsd/src.git
synced 2024-12-21 23:18:00 -08:00
Implement RESINFO (RFC 9606)
This is more or less a copy of txt_16.c. OK caspar
This commit is contained in:
parent
6b76ac2e55
commit
407e22462b
@ -150,6 +150,7 @@ enum {
|
||||
dns_rdatatype_caa = 257,
|
||||
dns_rdatatype_avc = 258,
|
||||
dns_rdatatype_doa = 259,
|
||||
dns_rdatatype_resinfo = 261,
|
||||
dns_rdatatype_ta = 32768,
|
||||
dns_rdatatype_dlv = 32769,
|
||||
dns_rdatatype_keydata = 65533,
|
||||
|
@ -14,7 +14,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: rdata.c,v 1.36 2024/04/23 13:34:50 jsg Exp $ */
|
||||
/* $Id: rdata.c,v 1.37 2024/12/09 12:24:01 florian Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@ -811,6 +811,7 @@ dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source) {
|
||||
{"ptr", 12},
|
||||
{"px", 26},
|
||||
{"reserved0", 0},
|
||||
{"resinfo", 261},
|
||||
{"rkey", 57},
|
||||
{"rp", 17},
|
||||
{"rrsig", 46},
|
||||
@ -1055,6 +1056,8 @@ dns_rdatatype_totext(dns_rdatatype_t type, isc_buffer_t *target) {
|
||||
return (isc_str_tobuffer("AVC", target));
|
||||
case 259:
|
||||
return (isc_str_tobuffer("DOA", target));
|
||||
case 261:
|
||||
return (isc_str_tobuffer("RESINFO", target));
|
||||
case 32768:
|
||||
return (isc_str_tobuffer("TA", target));
|
||||
case 32769:
|
||||
|
83
usr.bin/dig/lib/dns/rdata/generic/resinfo_261.c
Normal file
83
usr.bin/dig/lib/dns/rdata/generic/resinfo_261.c
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* RFC 9606, based on txt_16.c */
|
||||
|
||||
#ifndef RDATA_GENERIC_RESINFO_261_C
|
||||
#define RDATA_GENERIC_RESINFO_261_C
|
||||
|
||||
static inline isc_result_t
|
||||
generic_totext_resinfo(ARGS_TOTEXT) {
|
||||
isc_region_t region;
|
||||
|
||||
UNUSED(tctx);
|
||||
|
||||
dns_rdata_toregion(rdata, ®ion);
|
||||
|
||||
while (region.length > 0) {
|
||||
RETERR(txt_totext(®ion, 1, target));
|
||||
if (region.length > 0)
|
||||
RETERR(isc_str_tobuffer(" ", target));
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
generic_fromwire_resinfo(ARGS_FROMWIRE) {
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(type);
|
||||
UNUSED(dctx);
|
||||
UNUSED(rdclass);
|
||||
UNUSED(options);
|
||||
|
||||
do {
|
||||
result = txt_fromwire(source, target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
} while (!buffer_empty(source));
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
totext_resinfo(ARGS_TOTEXT) {
|
||||
|
||||
REQUIRE(rdata->type == dns_rdatatype_resinfo);
|
||||
|
||||
return (generic_totext_resinfo(rdata, tctx, target));
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
fromwire_resinfo(ARGS_FROMWIRE) {
|
||||
|
||||
REQUIRE(type == dns_rdatatype_resinfo);
|
||||
|
||||
return (generic_fromwire_resinfo(rdclass, type, source, dctx, options,
|
||||
target));
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
towire_resinfo(ARGS_TOWIRE) {
|
||||
|
||||
REQUIRE(rdata->type == dns_rdatatype_resinfo);
|
||||
|
||||
UNUSED(cctx);
|
||||
|
||||
return (isc_mem_tobuffer(target, rdata->data, rdata->length));
|
||||
}
|
||||
|
||||
#endif /* RDATA_GENERIC_RESINFO_261_C */
|
Loading…
Reference in New Issue
Block a user