1 /* 2 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 13 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 * PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 /* $Id: x25_19.c,v 1.12 2020/09/14 08:40:43 florian Exp $ */ 18 19 /* Reviewed: Thu Mar 16 16:15:57 PST 2000 by bwelling */ 20 21 /* RFC1183 */ 22 23 #ifndef RDATA_GENERIC_X25_19_C 24 #define RDATA_GENERIC_X25_19_C 25 26 static inline isc_result_t 27 totext_x25(ARGS_TOTEXT) { 28 isc_region_t region; 29 30 UNUSED(tctx); 31 32 REQUIRE(rdata->type == dns_rdatatype_x25); 33 REQUIRE(rdata->length != 0); 34 35 dns_rdata_toregion(rdata, ®ion); 36 return (txt_totext(®ion, 1, target)); 37 } 38 39 static inline isc_result_t 40 fromwire_x25(ARGS_FROMWIRE) { 41 isc_region_t sr; 42 43 REQUIRE(type == dns_rdatatype_x25); 44 45 UNUSED(type); 46 UNUSED(dctx); 47 UNUSED(rdclass); 48 UNUSED(options); 49 50 isc_buffer_activeregion(source, &sr); 51 if (sr.length < 5) 52 return (DNS_R_FORMERR); 53 return (txt_fromwire(source, target)); 54 } 55 56 static inline isc_result_t 57 towire_x25(ARGS_TOWIRE) { 58 UNUSED(cctx); 59 60 REQUIRE(rdata->type == dns_rdatatype_x25); 61 REQUIRE(rdata->length != 0); 62 63 return (isc_mem_tobuffer(target, rdata->data, rdata->length)); 64 } 65 66 #endif /* RDATA_GENERIC_X25_19_C */ 67