1 
2 #ifndef ARES_NAMESER_H
3 #define ARES_NAMESER_H
4 
5 /* header file provided by liren@vivisimo.com */
6 
7 #ifndef HAVE_ARPA_NAMESER_H
8 
9 #define NS_PACKETSZ     512   /* maximum packet size */
10 #define NS_MAXDNAME     256   /* maximum domain name */
11 #define NS_MAXCDNAME    255   /* maximum compressed domain name */
12 #define NS_MAXLABEL     63
13 #define NS_HFIXEDSZ     12    /* #/bytes of fixed data in header */
14 #define NS_QFIXEDSZ     4     /* #/bytes of fixed data in query */
15 #define NS_RRFIXEDSZ    10    /* #/bytes of fixed data in r record */
16 #define NS_INT16SZ      2
17 #define NS_INADDRSZ     4
18 #define NS_IN6ADDRSZ    16
19 #define NS_CMPRSFLGS    0xc0  /* Flag bits indicating name compression. */
20 #define NS_DEFAULTPORT  53    /* For both TCP and UDP. */
21 
22 typedef enum __ns_class {
23     ns_c_invalid = 0,       /* Cookie. */
24     ns_c_in = 1,            /* Internet. */
25     ns_c_2 = 2,             /* unallocated/unsupported. */
26     ns_c_chaos = 3,         /* MIT Chaos-net. */
27     ns_c_hs = 4,            /* MIT Hesiod. */
28     /* Query class values which do not appear in resource records */
29     ns_c_none = 254,        /* for prereq. sections in update requests */
30     ns_c_any = 255,         /* Wildcard match. */
31     ns_c_max = 65536
32 } ns_class;
33 
34 typedef enum __ns_type {
35     ns_t_invalid = 0,       /* Cookie. */
36     ns_t_a = 1,             /* Host address. */
37     ns_t_ns = 2,            /* Authoritative server. */
38     ns_t_md = 3,            /* Mail destination. */
39     ns_t_mf = 4,            /* Mail forwarder. */
40     ns_t_cname = 5,         /* Canonical name. */
41     ns_t_soa = 6,           /* Start of authority zone. */
42     ns_t_mb = 7,            /* Mailbox domain name. */
43     ns_t_mg = 8,            /* Mail group member. */
44     ns_t_mr = 9,            /* Mail rename name. */
45     ns_t_null = 10,         /* Null resource record. */
46     ns_t_wks = 11,          /* Well known service. */
47     ns_t_ptr = 12,          /* Domain name pointer. */
48     ns_t_hinfo = 13,        /* Host information. */
49     ns_t_minfo = 14,        /* Mailbox information. */
50     ns_t_mx = 15,           /* Mail routing information. */
51     ns_t_txt = 16,          /* Text strings. */
52     ns_t_rp = 17,           /* Responsible person. */
53     ns_t_afsdb = 18,        /* AFS cell database. */
54     ns_t_x25 = 19,          /* X_25 calling address. */
55     ns_t_isdn = 20,         /* ISDN calling address. */
56     ns_t_rt = 21,           /* Router. */
57     ns_t_nsap = 22,         /* NSAP address. */
58     ns_t_nsap_ptr = 23,     /* Reverse NSAP lookup (deprecated). */
59     ns_t_sig = 24,          /* Security signature. */
60     ns_t_key = 25,          /* Security key. */
61     ns_t_px = 26,           /* X.400 mail mapping. */
62     ns_t_gpos = 27,         /* Geographical position (withdrawn). */
63     ns_t_aaaa = 28,         /* Ip6 Address. */
64     ns_t_loc = 29,          /* Location Information. */
65     ns_t_nxt = 30,          /* Next domain (security). */
66     ns_t_eid = 31,          /* Endpoint identifier. */
67     ns_t_nimloc = 32,       /* Nimrod Locator. */
68     ns_t_srv = 33,          /* Server Selection. */
69     ns_t_atma = 34,         /* ATM Address */
70     ns_t_naptr = 35,        /* Naming Authority PoinTeR */
71     ns_t_kx = 36,           /* Key Exchange */
72     ns_t_cert = 37,         /* Certification record */
73     ns_t_a6 = 38,           /* IPv6 address (deprecates AAAA) */
74     ns_t_dname = 39,        /* Non-terminal DNAME (for IPv6) */
75     ns_t_sink = 40,         /* Kitchen sink (experimentatl) */
76     ns_t_opt = 41,          /* EDNS0 option (meta-RR) */
77     ns_t_apl = 42,          /* Address prefix list (RFC3123) */
78     ns_t_ds = 43,           /* Delegation Signer (RFC4034) */
79     ns_t_sshfp = 44,        /* SSH Key Fingerprint (RFC4255) */
80     ns_t_rrsig = 46,        /* Resource Record Signature (RFC4034) */
81     ns_t_nsec = 47,         /* Next Secure (RFC4034) */
82     ns_t_dnskey = 48,       /* DNS Public Key (RFC4034) */
83     ns_t_tkey = 249,        /* Transaction key */
84     ns_t_tsig = 250,        /* Transaction signature. */
85     ns_t_ixfr = 251,        /* Incremental zone transfer. */
86     ns_t_axfr = 252,        /* Transfer zone of authority. */
87     ns_t_mailb = 253,       /* Transfer mailbox records. */
88     ns_t_maila = 254,       /* Transfer mail agent records. */
89     ns_t_any = 255,         /* Wildcard match. */
90     ns_t_zxfr = 256,        /* BIND-specific, nonstandard. */
91     ns_t_max = 65536
92 } ns_type;
93 
94 typedef enum __ns_opcode {
95     ns_o_query = 0,         /* Standard query. */
96     ns_o_iquery = 1,        /* Inverse query (deprecated/unsupported). */
97     ns_o_status = 2,        /* Name server status query (unsupported). */
98                                 /* Opcode 3 is undefined/reserved. */
99     ns_o_notify = 4,        /* Zone change notification. */
100     ns_o_update = 5,        /* Zone update message. */
101     ns_o_max = 6
102 } ns_opcode;
103 
104 typedef enum __ns_rcode {
105     ns_r_noerror = 0,       /* No error occurred. */
106     ns_r_formerr = 1,       /* Format error. */
107     ns_r_servfail = 2,      /* Server failure. */
108     ns_r_nxdomain = 3,      /* Name error. */
109     ns_r_notimpl = 4,       /* Unimplemented. */
110     ns_r_refused = 5,       /* Operation refused. */
111     /* these are for BIND_UPDATE */
112     ns_r_yxdomain = 6,      /* Name exists */
113     ns_r_yxrrset = 7,       /* RRset exists */
114     ns_r_nxrrset = 8,       /* RRset does not exist */
115     ns_r_notauth = 9,       /* Not authoritative for zone */
116     ns_r_notzone = 10,      /* Zone of record different from zone section */
117     ns_r_max = 11,
118     /* The following are TSIG extended errors */
119     ns_r_badsig = 16,
120     ns_r_badkey = 17,
121     ns_r_badtime = 18
122 } ns_rcode;
123 
124 #endif /* HAVE_ARPA_NAMESER_H */
125 
126 #ifndef HAVE_ARPA_NAMESER_COMPAT_H
127 
128 #define PACKETSZ         NS_PACKETSZ
129 #define MAXDNAME         NS_MAXDNAME
130 #define MAXCDNAME        NS_MAXCDNAME
131 #define MAXLABEL         NS_MAXLABEL
132 #define HFIXEDSZ         NS_HFIXEDSZ
133 #define QFIXEDSZ         NS_QFIXEDSZ
134 #define RRFIXEDSZ        NS_RRFIXEDSZ
135 #define INDIR_MASK       NS_CMPRSFLGS
136 #define NAMESERVER_PORT  NS_DEFAULTPORT
137 
138 #define QUERY           ns_o_query
139 
140 #define SERVFAIL        ns_r_servfail
141 #define NOTIMP          ns_r_notimpl
142 #define REFUSED         ns_r_refused
143 #undef NOERROR /* it seems this is already defined in winerror.h */
144 #define NOERROR         ns_r_noerror
145 #define FORMERR         ns_r_formerr
146 #define NXDOMAIN        ns_r_nxdomain
147 
148 #define C_IN            ns_c_in
149 #define C_CHAOS         ns_c_chaos
150 #define C_HS            ns_c_hs
151 #define C_NONE          ns_c_none
152 #define C_ANY           ns_c_any
153 
154 #define T_A             ns_t_a
155 #define T_NS            ns_t_ns
156 #define T_MD            ns_t_md
157 #define T_MF            ns_t_mf
158 #define T_CNAME         ns_t_cname
159 #define T_SOA           ns_t_soa
160 #define T_MB            ns_t_mb
161 #define T_MG            ns_t_mg
162 #define T_MR            ns_t_mr
163 #define T_NULL          ns_t_null
164 #define T_WKS           ns_t_wks
165 #define T_PTR           ns_t_ptr
166 #define T_HINFO         ns_t_hinfo
167 #define T_MINFO         ns_t_minfo
168 #define T_MX            ns_t_mx
169 #define T_TXT           ns_t_txt
170 #define T_RP            ns_t_rp
171 #define T_AFSDB         ns_t_afsdb
172 #define T_X25           ns_t_x25
173 #define T_ISDN          ns_t_isdn
174 #define T_RT            ns_t_rt
175 #define T_NSAP          ns_t_nsap
176 #define T_NSAP_PTR      ns_t_nsap_ptr
177 #define T_SIG           ns_t_sig
178 #define T_KEY           ns_t_key
179 #define T_PX            ns_t_px
180 #define T_GPOS          ns_t_gpos
181 #define T_AAAA          ns_t_aaaa
182 #define T_LOC           ns_t_loc
183 #define T_NXT           ns_t_nxt
184 #define T_EID           ns_t_eid
185 #define T_NIMLOC        ns_t_nimloc
186 #define T_SRV           ns_t_srv
187 #define T_ATMA          ns_t_atma
188 #define T_NAPTR         ns_t_naptr
189 #define T_DS            ns_t_ds
190 #define T_SSHFP         ns_t_sshfp
191 #define T_RRSIG         ns_t_rrsig
192 #define T_NSEC          ns_t_nsec
193 #define T_DNSKEY        ns_t_dnskey
194 #define T_TSIG          ns_t_tsig
195 #define T_IXFR          ns_t_ixfr
196 #define T_AXFR          ns_t_axfr
197 #define T_MAILB         ns_t_mailb
198 #define T_MAILA         ns_t_maila
199 #define T_ANY           ns_t_any
200 
201 #endif /* HAVE_ARPA_NAMESER_COMPAT_H */
202 
203 #endif /* ARES_NAMESER_H */
204