Watt-32 tcp/ip  2.2 dev-rel.10
resolv.h
Go to the documentation of this file.
1 
5 /*-
6  * Copyright (c) 1983, 1987, 1989, 1993
7  * The Regents of the University of California. All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  * must display the following acknowledgement:
19  * This product includes software developed by the University of
20  * California, Berkeley and its contributors.
21  * 4. Neither the name of the University nor the names of its contributors
22  * may be used to endorse or promote products derived from this software
23  * without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  *
37  * -
38  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
39  *
40  * Permission to use, copy, modify, and distribute this software for any
41  * purpose with or without fee is hereby granted, provided that the above
42  * copyright notice and this permission notice appear in all copies, and that
43  * the name of Digital Equipment Corporation not be used in advertising or
44  * publicity pertaining to distribution of the document or software without
45  * specific, written prior permission.
46  *
47  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
48  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
49  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
50  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
51  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
52  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
53  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
54  * SOFTWARE.
55  * -
56  * --Copyright--
57  *
58  * @(#)resolv.h 8.1 (Berkeley) 6/2/93
59  * From Id: resolv.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp
60  * $Id: resolv.h,v 1.7 1996/08/29 20:00:58 peter Exp $
61  */
62 
63 #ifndef _RESOLV_H_
64 #define _RESOLV_H_
65 
66 #include <stdio.h>
67 
68 #ifndef __SYS_W32API_H
69 #include <sys/w32api.h>
70 #endif
71 
72 #ifndef __SYS_PARAM_H
73 #include <sys/param.h>
74 #endif
75 
76 #ifndef __SYS_WTYPES_H
77 #include <sys/wtypes.h>
78 #endif
79 
80 #ifndef __SYS_CDEFS_H
81 #include <sys/cdefs.h>
82 #endif
83 
84 
85 /*
86  * revision information. this is the release date in YYYYMMDD format.
87  * it can change every day so the right thing to do with it is use it
88  * in preprocessor commands such as "#if (__RES > 19931104)". do not
89  * compare for equality; rather, use it to determine whether your resolver
90  * is new enough to contain a certain feature.
91  */
92 
93 #define __RES 19960229
94 
95 /*
96  * Resolver configuration file.
97  * Normally not present, but may contain the address of the
98  * inital name server(s) to query and the domain search list.
99  */
100 
101 #ifndef _PATH_RESCONF
102 #define _PATH_RESCONF "/etc/resolv.conf"
103 #endif
104 
105 /*
106  * Global defines and variables for resolver stub.
107  */
108 #define MAXNS 3 /* max # name servers we'll track */
109 #define MAXDFLSRCH 3 /* # default domain levels to try */
110 #define MAXDNSRCH 6 /* max # domains in search path */
111 #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
112 
113 #define RES_TIMEOUT 5 /* min. seconds between retries */
114 #define MAXRESOLVSORT 10 /* number of net to sort on */
115 #define RES_MAXNDOTS 15 /* should reflect bit field size */
116 
117 struct __res_sort {
118  struct in_addr addr;
119  u_long mask;
120  };
121 
122 struct __res_state {
123  int retrans; /* retransmition time interval */
124  int retry; /* number of times to retransmit */
125  u_long options; /* option flags - see below. */
126  int nscount; /* number of name servers */
127  struct sockaddr_in
128  nsaddr_list[MAXNS]; /* address of name server */
129 #define nsaddr nsaddr_list[0] /* for backward compatibility */
130  u_short id; /* current packet id */
131  char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
132  char defdname[MAXDNAME]; /* default domain */
133  u_long pfcode; /* RES_PRF_ flags - see below. */
134  unsigned ndots : 4; /* threshold for initial abs. query */
135  unsigned nsort : 4; /* number of elements in sort_list[] */
136  char unused[3];
137  struct __res_sort sort_list [MAXRESOLVSORT];
138  char pad[72]; /* On an i386 this means 512b total. */
139  };
140 
141 /*
142  * Resolver options (keep these in synch with res_debug.c, please)
143  */
144 #define RES_INIT 0x00000001 /* address initialized */
145 #define RES_DEBUG 0x00000002 /* print debug messages */
146 #define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/
147 #define RES_USEVC 0x00000008 /* use virtual circuit */
148 #define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
149 #define RES_IGNTC 0x00000020 /* ignore truncation errors */
150 #define RES_RECURSE 0x00000040 /* recursion desired */
151 #define RES_DEFNAMES 0x00000080 /* use default domain name */
152 #define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
153 #define RES_DNSRCH 0x00000200 /* search up local domain tree */
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 
159 #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
160 
161 /*
162  * Resolver "pfcode" values. Used by dig.
163  */
164 #define RES_PRF_STATS 0x00000001
165 /* 0x00000002 */
166 #define RES_PRF_CLASS 0x00000004
167 #define RES_PRF_CMD 0x00000008
168 #define RES_PRF_QUES 0x00000010
169 #define RES_PRF_ANS 0x00000020
170 #define RES_PRF_AUTH 0x00000040
171 #define RES_PRF_ADD 0x00000080
172 #define RES_PRF_HEAD1 0x00000100
173 #define RES_PRF_HEAD2 0x00000200
174 #define RES_PRF_TTLID 0x00000400
175 #define RES_PRF_HEADX 0x00000800
176 #define RES_PRF_QUERY 0x00001000
177 #define RES_PRF_REPLY 0x00002000
178 #define RES_PRF_INIT 0x00004000
179 /* 0x00008000 */
180 
181 /* hooks are still experimental as of 4.9.2 */
182 typedef enum {
183  res_goahead,
184  res_nextns,
185  res_modified,
186  res_done,
187  res_error
188  } res_sendhookact;
189 
190 typedef res_sendhookact (W32_CALL *res_send_qhook) (
191  struct sockaddr_in * const *ns,
192  const u_char **query,
193  int *querylen,
194  u_char *ans,
195  int anssiz,
196  int *resplen);
197 
198 typedef res_sendhookact (W32_CALL *res_send_rhook) (
199  const struct sockaddr_in *ns,
200  const u_char *query,
201  int querylen,
202  u_char *ans,
203  int anssiz,
204  int *resplen);
205 
206 W32_DATA struct __res_state _res;
207 
208 W32_DATA int h_errno;
209 
210 
211 /* Private routines shared between libc/net, named, nslookup and others. */
212 #define res_hnok __res_hnok
213 #define res_ownok __res_ownok
214 #define res_mailok __res_mailok
215 #define res_dnok __res_dnok
216 #define loc_ntoa __loc_ntoa
217 #define loc_aton __loc_aton
218 #define dn_skipname __dn_skipname
219 #define fp_query __fp_query
220 #define fp_nquery __fp_nquery
221 #define hostalias __hostalias
222 #define putlong __putlong
223 #define putshort __putshort
224 #define p_class __p_class
225 #define p_time __p_time
226 #define p_type __p_type
227 #define p_cdnname __p_cdnname
228 #define p_cdname __p_cdname
229 #define p_fqname __p_fqname
230 #define p_rr __p_rr
231 #define p_option __p_option
232 #define res_randomid __res_randomid
233 #define res_isourserver __res_isourserver
234 #define res_nameinquery __res_nameinquery
235 #define res_queriesmatch __res_queriesmatch
236 
237 __BEGIN_DECLS
238 
239 W32_FUNC int W32_CALL __res_hnok (const char *);
240 W32_FUNC int W32_CALL __res_ownok (const char *);
241 W32_FUNC int W32_CALL __res_mailok (const char *);
242 W32_FUNC int W32_CALL __res_dnok (const char *);
243 W32_FUNC int W32_CALL __loc_aton (const char *ascii, u_char *binary);
244 W32_FUNC char * W32_CALL __loc_ntoa (const u_char *binary, char *ascii);
245 W32_FUNC int W32_CALL __dn_skipname(const u_char *, const u_char *);
246 W32_FUNC void W32_CALL __fp_resstat (struct __res_state *, FILE *);
247 W32_FUNC void W32_CALL __fp_query (const u_char *, FILE *);
248 W32_FUNC void W32_CALL __fp_nquery (const u_char *, int, FILE *);
249 W32_FUNC char *W32_CALL __hostalias (const char *);
250 W32_FUNC void W32_CALL __putlong (u_long, u_char *);
251 W32_FUNC void W32_CALL __putshort (u_short, u_char *);
252 W32_FUNC char *W32_CALL __p_time (u_long);
253 W32_FUNC void W32_CALL __p_query (const u_char *);
254 
255 W32_FUNC const u_char *W32_CALL __p_cdnname (const u_char *, const u_char *, int, FILE *);
256 W32_FUNC const u_char *W32_CALL __p_cdname (const u_char *, const u_char *, FILE *);
257 W32_FUNC const u_char *W32_CALL __p_fqname (const u_char *, const u_char *, FILE *);
258 W32_FUNC const u_char *W32_CALL __p_rr (const u_char *, const u_char *, FILE *);
259 W32_FUNC const char *W32_CALL __p_type (int);
260 W32_FUNC const char *W32_CALL __p_class (int);
261 W32_FUNC const char *W32_CALL __p_option (u_long option);
262 
263 W32_FUNC int W32_CALL dn_comp (const char *, u_char *, int, u_char **, u_char **);
264 W32_FUNC int W32_CALL dn_expand (const u_char *, const u_char *, const u_char *, char *, int);
265 
266 W32_FUNC int W32_CALL res_init (void);
267 W32_FUNC u_short W32_CALL res_randomid (void);
268 W32_FUNC int W32_CALL res_query (const char *, int, int, u_char *, int);
269 W32_FUNC int W32_CALL res_search (const char *, int, int, u_char *, int);
270 W32_FUNC int W32_CALL res_querydomain (const char *, const char *, int, int, u_char *, int);
271 W32_FUNC int W32_CALL res_mkquery (int, const char *, int, int, const u_char *, int, const u_char *, u_char *, int);
272 W32_FUNC int W32_CALL res_send (const u_char *, int, u_char *, int);
273 W32_FUNC int W32_CALL res_isourserver (const struct sockaddr_in *);
274 W32_FUNC int W32_CALL res_nameinquery (const char *, int, int, const u_char *, const u_char *);
275 W32_FUNC int W32_CALL res_queriesmatch (const u_char *, const u_char *, const u_char *, const u_char *);
276 
277 W32_FUNC void W32_CALL res_send_setqhook (res_send_qhook hook);
278 W32_FUNC void W32_CALL res_send_setrhook (res_send_rhook hook);
279 
280 __END_DECLS
281 
282 #endif /* !_RESOLV_H_ */
W32_FUNC int W32_CALL res_mkquery(int, const char *, int, int, const u_char *, int, const u_char *, u_char *, int)
Definition: res_mkqu.c:67
Definition: in.h:146