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: hinfo_13.c,v 1.13 2020/09/14 08:40:43 florian Exp $ */
18
19 /*
20 * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley.
21 */
22
23 #ifndef RDATA_GENERIC_HINFO_13_C
24 #define RDATA_GENERIC_HINFO_13_C
25
26 static inline isc_result_t
totext_hinfo(ARGS_TOTEXT)27 totext_hinfo(ARGS_TOTEXT) {
28 isc_region_t region;
29
30 UNUSED(tctx);
31
32 REQUIRE(rdata->type == dns_rdatatype_hinfo);
33 REQUIRE(rdata->length != 0);
34
35 dns_rdata_toregion(rdata, ®ion);
36 RETERR(txt_totext(®ion, 1, target));
37 RETERR(isc_str_tobuffer(" ", target));
38 return (txt_totext(®ion, 1, target));
39 }
40
41 static inline isc_result_t
fromwire_hinfo(ARGS_FROMWIRE)42 fromwire_hinfo(ARGS_FROMWIRE) {
43
44 REQUIRE(type == dns_rdatatype_hinfo);
45
46 UNUSED(type);
47 UNUSED(dctx);
48 UNUSED(rdclass);
49 UNUSED(options);
50
51 RETERR(txt_fromwire(source, target));
52 return (txt_fromwire(source, target));
53 }
54
55 static inline isc_result_t
towire_hinfo(ARGS_TOWIRE)56 towire_hinfo(ARGS_TOWIRE) {
57
58 UNUSED(cctx);
59
60 REQUIRE(rdata->type == dns_rdatatype_hinfo);
61 REQUIRE(rdata->length != 0);
62
63 return (isc_mem_tobuffer(target, rdata->data, rdata->length));
64 }
65
66 #endif /* RDATA_GENERIC_HINFO_13_C */
67