1 /*	$OpenBSD: asr_debug.c,v 1.25 2018/04/28 15:16:49 schwarze Exp $	*/
2 /*
3  * Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #include "includes.h"
19 
20 #include <arpa/nameser.h>
21 #ifdef HAVE_ARPA_NAMESER_COMPAT_H
22 #include <arpa/nameser_compat.h>
23 #endif
24 
25 #include "asr_compat.h"
26 
27 #ifndef HAVE___P_CLASS
28 const char *
__p_class(int c)29 __p_class(int c)
30 {
31 	switch(c) {
32 	case C_IN:	return "IN";
33 	case C_CHAOS:	return "CHAOS";
34 	case C_HS:	return "HESIOD";
35 	case C_ANY:	return "ANY";
36 	default:	return "?";
37 	}
38 };
39 #endif /* !HAVE___P_CLASS */
40 
41 #ifndef HAVE___P_TYPE
42 const char *
__p_type(int t)43 __p_type(int t)
44 {
45 	switch(t) {
46 	case T_A:	return "A";
47 	case T_NS:	return "NS";
48 	case T_MD:	return "MD";
49 	case T_MF:	return "MF";
50 	case T_CNAME:	return "CNAME";
51 	case T_SOA:	return "SOA";
52 	case T_MB:	return "MB";
53 	case T_MG:	return "MG";
54 	case T_MR:	return "MR";
55 	case T_NULL:	return "NULL";
56 	case T_WKS:	return "WKS";
57 	case T_PTR:	return "PTR";
58 	case T_HINFO:	return "HINFO";
59 	case T_MINFO:	return "MINFO";
60 	case T_MX:	return "MX";
61 	case T_TXT:	return "TXT";
62 	case T_RP:	return "RP";
63 	case T_AFSDB:	return "AFSDB";
64 	case T_X25:	return "X25";
65 	case T_ISDN:	return "ISDN";
66 	case T_RT:	return "RT";
67 	case T_NSAP:	return "NSAP";
68 	case T_NSAP_PTR:return"NSAP_PTR";
69 	case T_SIG:	return "SIG";
70 	case T_KEY:	return "KEY";
71 	case T_PX:	return "PX";
72 	case T_GPOS:	return "GPOS";
73 	case T_AAAA:	return "AAAA";
74 	case T_LOC:	return "LOC";
75 	case T_NXT:	return "NXT";
76 	case T_EID:	return "EID";
77 	case T_NIMLOC:	return "NIMLOC";
78 	case T_SRV:	return "SRV";
79 	case T_ATMA:	return "ATMA";
80 	case T_OPT:	return "OPT";
81 	case T_IXFR:	return "IXFR";
82 	case T_AXFR:	return "AXFR";
83 	case T_MAILB:	return "MAILB";
84 	case T_MAILA:	return "MAILA";
85 #ifdef T_UINFO
86 	case T_UINFO:	return "UINFO";
87 #endif
88 #ifdef T_UID
89 	case T_UID:	return "UID";
90 #endif
91 #ifdef T_GID
92 	case T_GID:	return "GID";
93 #endif
94 	case T_NAPTR:	return "NAPTR";
95 #ifdef T_UNSPEC
96 	case T_UNSPEC:	return "UNSPEC";
97 #endif
98 	case T_ANY:	return "ANY";
99 	default:	return "?";
100 	}
101 }
102 #endif /* !HAVE___P_TYPE */
103