isdn_20.c revision 1.8
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: isdn_20.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */
18
19/* Reviewed: Wed Mar 15 16:53:11 PST 2000 by bwelling */
20
21/* RFC1183 */
22
23#ifndef RDATA_GENERIC_ISDN_20_C
24#define RDATA_GENERIC_ISDN_20_C
25
26#define RRTYPE_ISDN_ATTRIBUTES (0)
27
28static inline isc_result_t
29totext_isdn(ARGS_TOTEXT) {
30	isc_region_t region;
31
32	REQUIRE(rdata->type == dns_rdatatype_isdn);
33	REQUIRE(rdata->length != 0);
34
35	UNUSED(tctx);
36
37	dns_rdata_toregion(rdata, &region);
38	RETERR(txt_totext(&region, ISC_TRUE, target));
39	if (region.length == 0)
40		return (ISC_R_SUCCESS);
41	RETERR(str_totext(" ", target));
42	return (txt_totext(&region, ISC_TRUE, target));
43}
44
45static inline isc_result_t
46fromwire_isdn(ARGS_FROMWIRE) {
47	REQUIRE(type == dns_rdatatype_isdn);
48
49	UNUSED(type);
50	UNUSED(dctx);
51	UNUSED(rdclass);
52	UNUSED(options);
53
54	RETERR(txt_fromwire(source, target));
55	if (buffer_empty(source))
56		return (ISC_R_SUCCESS);
57	return (txt_fromwire(source, target));
58}
59
60static inline isc_result_t
61towire_isdn(ARGS_TOWIRE) {
62	UNUSED(cctx);
63
64	REQUIRE(rdata->type == dns_rdatatype_isdn);
65	REQUIRE(rdata->length != 0);
66
67	return (mem_tobuffer(target, rdata->data, rdata->length));
68}
69
70
71
72
73
74
75
76#endif	/* RDATA_GENERIC_ISDN_20_C */
77