| 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)
|
|---|
| 48 | extern "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)
|
|---|
| 99 | struct 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)
|
|---|
| 115 | struct __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 |
|
|---|
| 166 | extern 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
|
|---|
|
|---|