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