xref: /openbsd-src/usr.bin/dig/lib/dns/rdata/generic/unspec_103.c (revision 637d8eb612a8d36569ff681fc1140eb404d28207)
15185a700Sflorian /*
25185a700Sflorian  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
35185a700Sflorian  *
45185a700Sflorian  * Permission to use, copy, modify, and/or distribute this software for any
55185a700Sflorian  * purpose with or without fee is hereby granted, provided that the above
65185a700Sflorian  * copyright notice and this permission notice appear in all copies.
75185a700Sflorian  *
85185a700Sflorian  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
95185a700Sflorian  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
105185a700Sflorian  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
115185a700Sflorian  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
125185a700Sflorian  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
135185a700Sflorian  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
145185a700Sflorian  * PERFORMANCE OF THIS SOFTWARE.
155185a700Sflorian  */
165185a700Sflorian 
17*637d8eb6Sflorian /* $Id: unspec_103.c,v 1.11 2020/02/26 18:47:25 florian Exp $ */
185185a700Sflorian 
195185a700Sflorian #ifndef RDATA_GENERIC_UNSPEC_103_C
205185a700Sflorian #define RDATA_GENERIC_UNSPEC_103_C
215185a700Sflorian 
225185a700Sflorian static inline isc_result_t
totext_unspec(ARGS_TOTEXT)235185a700Sflorian totext_unspec(ARGS_TOTEXT) {
245185a700Sflorian 
255185a700Sflorian 	REQUIRE(rdata->type == dns_rdatatype_unspec);
265185a700Sflorian 
275185a700Sflorian 	UNUSED(tctx);
285185a700Sflorian 
295185a700Sflorian 	return (btoa_totext(rdata->data, rdata->length, target));
305185a700Sflorian }
315185a700Sflorian 
325185a700Sflorian static inline isc_result_t
fromwire_unspec(ARGS_FROMWIRE)335185a700Sflorian fromwire_unspec(ARGS_FROMWIRE) {
345185a700Sflorian 	isc_region_t sr;
355185a700Sflorian 
365185a700Sflorian 	REQUIRE(type == dns_rdatatype_unspec);
375185a700Sflorian 
385185a700Sflorian 	UNUSED(type);
395185a700Sflorian 	UNUSED(rdclass);
405185a700Sflorian 	UNUSED(dctx);
415185a700Sflorian 	UNUSED(options);
425185a700Sflorian 
435185a700Sflorian 	isc_buffer_activeregion(source, &sr);
445185a700Sflorian 	isc_buffer_forward(source, sr.length);
45*637d8eb6Sflorian 	return (isc_mem_tobuffer(target, sr.base, sr.length));
465185a700Sflorian }
475185a700Sflorian 
485185a700Sflorian static inline isc_result_t
towire_unspec(ARGS_TOWIRE)495185a700Sflorian towire_unspec(ARGS_TOWIRE) {
505185a700Sflorian 
515185a700Sflorian 	REQUIRE(rdata->type == dns_rdatatype_unspec);
525185a700Sflorian 
535185a700Sflorian 	UNUSED(cctx);
545185a700Sflorian 
55*637d8eb6Sflorian 	return (isc_mem_tobuffer(target, rdata->data, rdata->length));
565185a700Sflorian }
575185a700Sflorian 
585185a700Sflorian #endif	/* RDATA_GENERIC_UNSPEC_103_C */
59