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