source: trunk/src/emx/include/resolv.h@ 1508

Last change on this file since 1508 was 1506, checked in by bird, 21 years ago

@unixroot. header reviews. ++

  • Property cvs2svn:cvs-rev set to 1.5
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 12.9 KB
Line 
1/* resolv.h,v 1.5 2004/09/14 22:27:35 bird Exp */
2/** @file
3 * BSD
4 * @changed EM: For EMX by hv 1994,1996
5 * @changed bird: For IGCC.
6 */
7/*
8 * Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * from: @(#)resolv.h 5.15 (Berkeley) 4/3/91
40 * resolv.h,v 1.5 2004/09/14 22:27:35 bird Exp
41 */
42
43#ifndef _RESOLV_H_
44#define _RESOLV_H_
45
46
47#if defined (__cplusplus)
48extern "C" {
49#endif
50
51/* toolkit includes a bunch of headers */
52#ifndef TCPV40HDRS
53#include <sys/param.h>
54#include <types.h>
55#include <sys/cdefs.h>
56#include <stdio.h>
57
58
59/*
60 * Revision information. This is the release date in YYYYMMDD format.
61 * It can change every day so the right thing to do with it is use it
62 * in preprocessor commands such as "#if (__RES > 19931104)". Do not
63 * compare for equality; rather, use it to determine whether your resolver
64 * is new enough to contain a certain feature.
65 */
66
67#define __RES 19960801
68
69/*
70 * Resolver configuration file.
71 * Normally not present, but may contain the address of the
72 * inital name server(s) to query and the domain search list.
73 */
74
75#ifndef _PATH_RESCONF
76#define _PATH_RESCONF "/@unixroot/etc/resolv.conf"
77#endif
78#endif /* TCPV40HDRS */
79
80/*
81 * Global defines and variables for resolver stub.
82 */
83#define MAXNS 3 /* max # name servers we'll track */
84#define MAXDFLSRCH 3 /* # default domain levels to try */
85#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
86#define RES_TIMEOUT 4 /* min. seconds between retries */
87#ifdef TCPV40HDRS
88#define MAXDNSRCH 3 /* max # domains in search path */
89#else
90#define MAXDNSRCH 6 /* max # domains in search path */
91#define MAXRESOLVSORT 10 /* number of net to sort on */
92#define RES_MAXNDOTS 15 /* should reflect bit field size */
93#endif
94
95
96#ifdef TCPV40HDRS
97
98#pragma pack(4)
99struct state {
100 int retrans; /* retransmition time interval */
101 int retry; /* number of times to retransmit */
102 long options; /* option flags - see below. */
103 int nscount; /* number of name servers */
104 struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */
105#define nsaddr nsaddr_list[0] /* for backward compatibility */
106 u_short id; /* current packet id */
107 char defdname[MAXDNAME]; /* default domain */
108 char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
109};
110#pragma pack()
111
112#else
113
114#pragma pack(4)
115struct __res_state {
116 int retrans; /* retransmition time interval */
117 int retry; /* number of times to retransmit */
118 u_long options; /* option flags - see below. */
119 int nscount; /* number of name servers */
120 struct sockaddr_in
121 nsaddr_list[MAXNS]; /* address of name server */
122#define nsaddr nsaddr_list[0] /* for backward compatibility */
123 u_short id; /* current message id */
124 char defdname[256]; /* default domain (deprecated) */
125 char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
126 u_long pfcode; /* RES_PRF_ flags - see below. */
127 unsigned ndots:4; /* threshold for initial abs. query */
128 unsigned nsort:4; /* number of elements in sort_list[] */
129 char unused[3];
130 struct {
131 struct in_addr addr;
132 u_int32_t mask;
133 } sort_list[MAXRESOLVSORT];
134 char pad[72]; /* on an i386 this means 512b total */
135};
136#pragma pack()
137
138#endif
139
140/*
141 * Resolver options
142 */
143#define RES_INIT 0x0001 /* address initialized */
144#define RES_DEBUG 0x0002 /* print debug messages */
145#define RES_AAONLY 0x0004 /* authoritative answers only */
146#define RES_USEVC 0x0008 /* use virtual circuit */
147#define RES_PRIMARY 0x0010 /* query primary server only */
148#define RES_IGNTC 0x0020 /* ignore trucation errors */
149#define RES_RECURSE 0x0040 /* recursion desired */
150#define RES_DEFNAMES 0x0080 /* use default domain name */
151#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
152#define RES_DNSRCH 0x0200 /* search up local domain tree */
153#ifndef TCPV40HDRS
154#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
155#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
156#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
157#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */
158#endif
159
160#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
161
162
163
164#ifdef TCPV40HDRS
165
166extern struct state _res;
167
168#else /* !TCPV40HDRS: */
169
170/*
171 * Resolver "pfcode" values. Used by dig.
172 */
173#define RES_PRF_STATS 0x00000001
174/* 0x00000002 */
175#define RES_PRF_CLASS 0x00000004
176#define RES_PRF_CMD 0x00000008
177#define RES_PRF_QUES 0x00000010
178#define RES_PRF_ANS 0x00000020
179#define RES_PRF_AUTH 0x00000040
180#define RES_PRF_ADD 0x00000080
181#define RES_PRF_HEAD1 0x00000100
182#define RES_PRF_HEAD2 0x00000200
183#define RES_PRF_TTLID 0x00000400
184#define RES_PRF_HEADX 0x00000800
185#define RES_PRF_QUERY 0x00001000
186#define RES_PRF_REPLY 0x00002000
187#define RES_PRF_INIT 0x00004000
188/* 0x00008000 */
189
190/* hooks are still experimental as of 4.9.2 */
191typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
192 res_sendhookact;
193
194#ifndef TCPCALL
195#define TCPCALL _System
196#endif
197
198typedef res_sendhookact (* TCPCALL res_send_qhook)(struct sockaddr_in * const *ns,
199 const u_char **query,
200 int *querylen,
201 u_char *ans,
202 int anssiz,
203 int *resplen);
204
205typedef res_sendhookact (* TCPCALL res_send_rhook)(const struct sockaddr_in *ns,
206 const u_char *query,
207 int querylen,
208 u_char *ans,
209 int anssiz,
210 int *resplen);
211
212#pragma pack(4)
213struct res_sym {
214 int number; /* Identifying number, like T_MX */
215 char * name; /* Its symbolic name, like "MX" */
216 char * humanname; /* Its fun name, like "mail exchanger" */
217};
218#pragma pack()
219
220extern struct __res_state _ress[2];
221extern const struct res_sym __p_class_syms[];
222extern const struct res_sym __p_type_syms[];
223#define _res (_ress[0])
224
225/* Private routines shared between libc/net, named, nslookup and others. */
226#define res_hnok __res_hnok
227#define res_ownok __res_ownok
228#define res_mailok __res_mailok
229#define res_dnok __res_dnok
230#define sym_ston __sym_ston
231#define sym_ntos __sym_ntos
232#define sym_ntop __sym_ntop
233#define b64_ntop __b64_ntop
234#define b64_pton __b64_pton
235#define loc_ntoa __loc_ntoa
236#define loc_aton __loc_aton
237#define dn_skipname __dn_skipname
238#define fp_resstat __fp_resstat
239#define fp_query __fp_query
240#define fp_nquery __fp_nquery
241#define hostalias __hostalias
242#define putlong __putlong
243#define putshort __putshort
244#define p_class __p_class
245#define p_time __p_time
246#define p_type __p_type
247#define p_query __p_query
248#define p_cdnname __p_cdnname
249#define p_cdname __p_cdname
250#define p_fqnname __p_fqnname
251#define p_fqname __p_fqname
252#define p_rr __p_rr
253#define p_option __p_option
254#define p_secstodate __p_secstodate
255#define dn_count_labels __dn_count_labels
256#define dn_comp __dn_comp
257#define dn_expand __dn_expand
258#define res_init __res_init
259#define res_randomid __res_randomid
260#define res_query __res_query
261#define res_search __res_search
262#define res_querydomain __res_querydomain
263#define res_mkquery __res_mkquery
264#define res_send __res_send
265#define res_isourserver __res_isourserver
266#define res_nameinquery __res_nameinquery
267#define res_queriesmatch __res_queriesmatch
268#define res_close __res_close
269
270int TCPCALL res_hnok(const char *);
271int TCPCALL res_ownok(const char *);
272int TCPCALL res_mailok(const char *);
273int TCPCALL res_dnok(const char *);
274int TCPCALL sym_ston(const struct res_sym *, char *, int *);
275const char * TCPCALL sym_ntos(const struct res_sym *, int, int *);
276const char * TCPCALL sym_ntop(const struct res_sym *, int, int *);
277int TCPCALL b64_ntop(u_char const *, size_t, char *, size_t);
278int TCPCALL b64_pton(char const *, u_char *, size_t);
279int TCPCALL loc_aton(const char *, u_char *);
280const char * TCPCALL loc_ntoa(const u_char *, char *);
281int TCPCALL dn_skipname(const u_char *, const u_char *);
282void TCPCALL fp_resstat(struct __res_state *, int);
283void TCPCALL fp_query(const u_char *, int);
284void TCPCALL fp_nquery(const u_char *, int, int);
285const char * TCPCALL hostalias(const char *);
286void TCPCALL putlong(u_int32_t, u_char *);
287void TCPCALL putshort(u_int16_t, u_char *);
288const char * TCPCALL p_class(int);
289const char * TCPCALL p_time(u_int32_t);
290const char * TCPCALL p_type(int);
291void TCPCALL p_query(const u_char *);
292const u_char * TCPCALL p_cdnname(const u_char *, const u_char *, int, int);
293const u_char * TCPCALL p_cdname(const u_char *, const u_char *, int);
294const u_char * TCPCALL p_fqnname(const u_char *cp, const u_char *msg,
295 int, char *, int);
296const u_char * TCPCALL p_fqname(const u_char *, const u_char *, int);
297const u_char * TCPCALL p_rr(const u_char *, const u_char *, int);
298const char * TCPCALL p_option(u_long option);
299char * TCPCALL p_secstodate(u_long);
300int TCPCALL dn_count_labels(char *);
301int TCPCALL dn_comp(const char *, u_char *, int,
302 u_char **, u_char **);
303int TCPCALL dn_expand(const u_char *, const u_char *, const u_char *,
304 char *, int);
305int TCPCALL res_init(void);
306u_int TCPCALL res_randomid(void);
307int TCPCALL res_query(const char *, int, int, u_char *, int);
308int TCPCALL res_search(const char *, int, int, u_char *, int);
309int TCPCALL res_querydomain(const char *, const char *, int, int, u_char *, int);
310int TCPCALL res_mkquery(int, const char *, int, int, const u_char *, int,
311 const u_char *, u_char *, int);
312int TCPCALL res_send(const u_char *, int, u_char *, int);
313int TCPCALL res_isourserver(const struct sockaddr_in *);
314int TCPCALL res_nameinquery(const char *, int, int,
315 const u_char *, const u_char *);
316int TCPCALL res_queriesmatch(const u_char *, const u_char *,
317 const u_char *, const u_char *);
318void TCPCALL res_close(void);
319int TCPCALL dn_find(u_char *exp_dn, u_char *msg,
320 u_char **dnptrs, u_char **lastdnptr);
321#endif /* !TCPV40HDRS */
322
323
324#if defined (__cplusplus)
325}
326#endif
327
328#endif /* !_RESOLV_H_ */
Note: See TracBrowser for help on using the repository browser.