1 /* 2 * ++Copyright++ 1983, 1987, 1989, 1993 3 * - 4 * Copyright (c) 1983, 1987, 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by the University of 18 * California, Berkeley and its contributors. 19 * 4. Neither the name of the University nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * - 35 * Portions Copyright (c) 1993 by Digital Equipment Corporation. 36 * 37 * Permission to use, copy, modify, and distribute this software for any 38 * purpose with or without fee is hereby granted, provided that the above 39 * copyright notice and this permission notice appear in all copies, and that 40 * the name of Digital Equipment Corporation not be used in advertising or 41 * publicity pertaining to distribution of the document or software without 42 * specific, written prior permission. 43 * 44 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL 45 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES 46 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT 47 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 48 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 49 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 50 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 51 * SOFTWARE. 52 * - 53 * --Copyright-- 54 */ 55 56 /* 57 * @(#)resolv.h 8.1 (Berkeley) 6/2/93 58 * $Id: resolv_def.h,v 1.8 2004/03/15 18:19:54 chopin Exp $ 59 */ 60 61 /* 62 * Revision information. This is the release date in YYYYMMDD format. 63 * It can change every day so the right thing to do with it is use it 64 * in preprocessor commands such as "#if (__RES > 19931104)". Do not 65 * compare for equality; rather, use it to determine whether your resolver 66 * is new enough to contain a certain feature. 67 */ 68 69 #define __RES 19960801 70 71 /* 72 * Global defines and variables for resolver stub. 73 */ 74 #define MAXNS 3 /* max # name servers we'll track */ 75 #define MAXDFLSRCH 3 /* # default domain levels to try */ 76 #define MAXDNSRCH 6 /* max # domains in search path */ 77 #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ 78 79 #define RES_TIMEOUT 5 /* min. seconds between retries */ 80 #define MAXRESOLVSORT 10 /* number of net to sort on */ 81 #define RES_MAXNDOTS 15 /* should reflect bit field size */ 82 83 struct __res_state { 84 int retrans; /* retransmition time interval */ 85 int retry; /* number of times to retransmit */ 86 u_long options; /* option flags - see below. */ 87 int nscount; /* number of name servers */ 88 struct SOCKADDR_IN 89 nsaddr_list[MAXNS]; /* address of name server */ 90 #define nsaddr nsaddr_list[0] /* for backward compatibility */ 91 u_short id; /* current message id */ 92 char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ 93 char defdname[256]; /* default domain (deprecated) */ 94 u_long pfcode; /* RES_PRF_ flags - see below. */ 95 unsigned ndots:4; /* threshold for initial abs. query */ 96 unsigned nsort:4; /* number of elements in sort_list[] */ 97 char unused[3]; 98 struct { 99 struct in_addr addr; 100 u_int32_t mask; 101 } sort_list[MAXRESOLVSORT]; 102 char pad[72]; /* on an i386 this means 512b total */ 103 }; 104 105 /* 106 * Resolver options (keep these in synch with res_debug.c, please) 107 */ 108 #define RES_INIT 0x00000001 /* address initialized */ 109 #define RES_DEBUG 0x00000002 /* print debug messages */ 110 #define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ 111 #define RES_USEVC 0x00000008 /* use virtual circuit */ 112 #define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ 113 #define RES_IGNTC 0x00000020 /* ignore trucation errors */ 114 #define RES_RECURSE 0x00000040 /* recursion desired */ 115 #define RES_DEFNAMES 0x00000080 /* use default domain name */ 116 #define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ 117 #define RES_DNSRCH 0x00000200 /* search up local domain tree */ 118 #define RES_INSECURE1 0x00000400 /* type 1 security disabled */ 119 #define RES_INSECURE2 0x00000800 /* type 2 security disabled */ 120 #define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ 121 #ifndef HAVE_GETIPNODEBYNAME 122 #define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ 123 #endif 124 125 #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) 126 127 /* 128 * Resolver "pfcode" values. Used by dig. 129 */ 130 #define RES_PRF_STATS 0x00000001 131 /* 0x00000002 */ 132 #define RES_PRF_CLASS 0x00000004 133 #define RES_PRF_CMD 0x00000008 134 #define RES_PRF_QUES 0x00000010 135 #define RES_PRF_ANS 0x00000020 136 #define RES_PRF_AUTH 0x00000040 137 #define RES_PRF_ADD 0x00000080 138 #define RES_PRF_HEAD1 0x00000100 139 #define RES_PRF_HEAD2 0x00000200 140 #define RES_PRF_TTLID 0x00000400 141 #define RES_PRF_HEADX 0x00000800 142 #define RES_PRF_QUERY 0x00001000 143 #define RES_PRF_REPLY 0x00002000 144 #define RES_PRF_INIT 0x00004000 145 /* 0x00008000 */ 146 147 /* hooks are still experimental as of 4.9.2 */ 148 #if defined(INET6) && defined(__GNUC__) 149 150 #else 151 152 typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } 153 res_sendhookact; 154 155 typedef res_sendhookact (*res_send_qhook)(struct SOCKADDR_IN * const *ns, 156 const u_char **query, 157 int *querylen, 158 u_char *ans, 159 int anssiz, 160 int *resplen); 161 162 typedef res_sendhookact (*res_send_rhook)(const struct SOCKADDR_IN *ns, 163 const u_char *query, 164 int querylen, 165 u_char *ans, 166 int anssiz, 167 int *resplen); 168 #endif 169 170 struct res_sym { 171 int number; /* Identifying number, like T_MX */ 172 char * name; /* Its symbolic name, like "MX" */ 173 char * humanname; /* Its fun name, like "mail exchanger" */ 174 }; 175 176 /* Private routines shared between libc/net, named, nslookup and others. */ 177 #define res_hnok __res_hnok 178 #define res_ownok __res_ownok 179 #define res_mailok __res_mailok 180 #define res_dnok __res_dnok 181 #define sym_ston __sym_ston 182 #define sym_ntos __sym_ntos 183 #define sym_ntop __sym_ntop 184 #define b64_ntop __b64_ntop 185 #define b64_pton __b64_pton 186 #define loc_ntoa __loc_ntoa 187 #define loc_aton __loc_aton 188 #define dn_skipname __dn_skipname 189 #define fp_resstat __fp_resstat 190 #define fp_query __fp_query 191 #define fp_nquery __fp_nquery 192 #define hostalias __hostalias 193 #define putlong __putlong 194 #define putshort __putshort 195 #define p_class __p_class 196 #define p_time __p_time 197 #define p_type __p_type 198 #define p_query __p_query 199 #define p_cdnname __p_cdnname 200 #define p_cdname __p_cdname 201 #define p_fqnname __p_fqnname 202 #define p_fqname __p_fqname 203 #define p_rr __p_rr 204 #define p_option __p_option 205 #define p_secstodate __p_secstodate 206 #define dn_count_labels __dn_count_labels 207 #define dn_comp __dn_comp 208 #define res_randomid __res_randomid 209 #define res_isourserver __res_isourserver 210 #define res_nameinquery __res_nameinquery 211 #define res_queriesmatch __res_queriesmatch 212 #define res_close __res_close 213 214 #ifdef BIND_RES_POSIX3 215 #define dn_expand __dn_expand 216 #define res_init __res_init 217 #define res_query __res_query 218 #define res_search __res_search 219 #define res_querydomain __res_querydomain 220 #define res_mkquery __res_mkquery 221 #define res_send __res_send 222 #endif 223