1*407e2246Sflorian /* 2*407e2246Sflorian * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 3*407e2246Sflorian * 4*407e2246Sflorian * Permission to use, copy, modify, and/or distribute this software for any 5*407e2246Sflorian * purpose with or without fee is hereby granted, provided that the above 6*407e2246Sflorian * copyright notice and this permission notice appear in all copies. 7*407e2246Sflorian * 8*407e2246Sflorian * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 9*407e2246Sflorian * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10*407e2246Sflorian * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 11*407e2246Sflorian * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12*407e2246Sflorian * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 13*407e2246Sflorian * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14*407e2246Sflorian * PERFORMANCE OF THIS SOFTWARE. 15*407e2246Sflorian */ 16*407e2246Sflorian 17*407e2246Sflorian /* RFC 9606, based on txt_16.c */ 18*407e2246Sflorian 19*407e2246Sflorian #ifndef RDATA_GENERIC_RESINFO_261_C 20*407e2246Sflorian #define RDATA_GENERIC_RESINFO_261_C 21*407e2246Sflorian 22*407e2246Sflorian static inline isc_result_t 23*407e2246Sflorian generic_totext_resinfo(ARGS_TOTEXT) { 24*407e2246Sflorian isc_region_t region; 25*407e2246Sflorian 26*407e2246Sflorian UNUSED(tctx); 27*407e2246Sflorian 28*407e2246Sflorian dns_rdata_toregion(rdata, ®ion); 29*407e2246Sflorian 30*407e2246Sflorian while (region.length > 0) { 31*407e2246Sflorian RETERR(txt_totext(®ion, 1, target)); 32*407e2246Sflorian if (region.length > 0) 33*407e2246Sflorian RETERR(isc_str_tobuffer(" ", target)); 34*407e2246Sflorian } 35*407e2246Sflorian 36*407e2246Sflorian return (ISC_R_SUCCESS); 37*407e2246Sflorian } 38*407e2246Sflorian 39*407e2246Sflorian static inline isc_result_t 40*407e2246Sflorian generic_fromwire_resinfo(ARGS_FROMWIRE) { 41*407e2246Sflorian isc_result_t result; 42*407e2246Sflorian 43*407e2246Sflorian UNUSED(type); 44*407e2246Sflorian UNUSED(dctx); 45*407e2246Sflorian UNUSED(rdclass); 46*407e2246Sflorian UNUSED(options); 47*407e2246Sflorian 48*407e2246Sflorian do { 49*407e2246Sflorian result = txt_fromwire(source, target); 50*407e2246Sflorian if (result != ISC_R_SUCCESS) 51*407e2246Sflorian return (result); 52*407e2246Sflorian } while (!buffer_empty(source)); 53*407e2246Sflorian return (ISC_R_SUCCESS); 54*407e2246Sflorian } 55*407e2246Sflorian 56*407e2246Sflorian static inline isc_result_t 57*407e2246Sflorian totext_resinfo(ARGS_TOTEXT) { 58*407e2246Sflorian 59*407e2246Sflorian REQUIRE(rdata->type == dns_rdatatype_resinfo); 60*407e2246Sflorian 61*407e2246Sflorian return (generic_totext_resinfo(rdata, tctx, target)); 62*407e2246Sflorian } 63*407e2246Sflorian 64*407e2246Sflorian static inline isc_result_t 65*407e2246Sflorian fromwire_resinfo(ARGS_FROMWIRE) { 66*407e2246Sflorian 67*407e2246Sflorian REQUIRE(type == dns_rdatatype_resinfo); 68*407e2246Sflorian 69*407e2246Sflorian return (generic_fromwire_resinfo(rdclass, type, source, dctx, options, 70*407e2246Sflorian target)); 71*407e2246Sflorian } 72*407e2246Sflorian 73*407e2246Sflorian static inline isc_result_t 74*407e2246Sflorian towire_resinfo(ARGS_TOWIRE) { 75*407e2246Sflorian 76*407e2246Sflorian REQUIRE(rdata->type == dns_rdatatype_resinfo); 77*407e2246Sflorian 78*407e2246Sflorian UNUSED(cctx); 79*407e2246Sflorian 80*407e2246Sflorian return (isc_mem_tobuffer(target, rdata->data, rdata->length)); 81*407e2246Sflorian } 82*407e2246Sflorian 83*407e2246Sflorian #endif /* RDATA_GENERIC_RESINFO_261_C */ 84