1 /*- 2 * Copyright (c) 1983, 1987, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)resolv.h 8.1 (Berkeley) 06/02/93 8 * $Id: resolv.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp $ 9 * - 10 * Portions Copyright (c) 1993 by Digital Equipment Corporation. 11 * 12 * Permission to use, copy, modify, and distribute this software for any 13 * purpose with or without fee is hereby granted, provided that the above 14 * copyright notice and this permission notice appear in all copies, and that 15 * the name of Digital Equipment Corporation not be used in advertising or 16 * publicity pertaining to distribution of the document or software without 17 * specific, written prior permission. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL 20 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES 21 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT 22 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 23 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 24 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 25 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 26 * SOFTWARE. 27 * - 28 * --Copyright-- 29 */ 30 31 #ifndef _RESOLV_H_ 32 #define _RESOLV_H_ 33 34 #include <sys/types.h> 35 /* 36 * Resolver configuration file. 37 * Normally not present, but may contain the address of the 38 * inital name server(s) to query and the domain search list. 39 */ 40 41 #ifndef _PATH_RESCONF 42 #define _PATH_RESCONF "/etc/resolv.conf" 43 #endif 44 45 /* 46 * Global defines and variables for resolver stub. 47 */ 48 #define MAXNS 3 /* max # name servers we'll track */ 49 #define MAXDFLSRCH 3 /* # default domain levels to try */ 50 #define MAXDNSRCH 6 /* max # domains in search path */ 51 #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ 52 53 #define RES_TIMEOUT 5 /* min. seconds between retries */ 54 55 struct __res_state { 56 int retrans; /* retransmition time interval */ 57 int retry; /* number of times to retransmit */ 58 long options; /* option flags - see below. */ 59 int nscount; /* number of name servers */ 60 struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ 61 #define nsaddr nsaddr_list[0] /* for backward compatibility */ 62 u_short id; /* current packet id */ 63 char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ 64 char defdname[MAXDNAME]; /* default domain */ 65 long pfcode; /* RES_PRF_ flags - see below. */ 66 }; 67 68 /* 69 * Resolver options (keep these in synch with res_debug.c, please) 70 */ 71 #define RES_INIT 0x0001 /* address initialized */ 72 #define RES_DEBUG 0x0002 /* print debug messages */ 73 #define RES_AAONLY 0x0004 /* authoritative answers only */ 74 #define RES_USEVC 0x0008 /* use virtual circuit */ 75 #define RES_PRIMARY 0x0010 /* query primary server only */ 76 #define RES_IGNTC 0x0020 /* ignore trucation errors */ 77 #define RES_RECURSE 0x0040 /* recursion desired */ 78 #define RES_DEFNAMES 0x0080 /* use default domain name */ 79 #define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ 80 #define RES_DNSRCH 0x0200 /* search up local domain tree */ 81 82 #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) 83 84 /* 85 * Resolver "pfcode" values. Used by dig. 86 */ 87 #define RES_PRF_STATS 0x0001 88 /* 0x0002 */ 89 #define RES_PRF_CLASS 0x0004 90 #define RES_PRF_CMD 0x0008 91 #define RES_PRF_QUES 0x0010 92 #define RES_PRF_ANS 0x0020 93 #define RES_PRF_AUTH 0x0040 94 #define RES_PRF_ADD 0x0080 95 #define RES_PRF_HEAD1 0x0100 96 #define RES_PRF_HEAD2 0x0200 97 #define RES_PRF_TTLID 0x0400 98 #define RES_PRF_HEADX 0x0800 99 #define RES_PRF_QUERY 0x1000 100 #define RES_PRF_REPLY 0x2000 101 #define RES_PRF_INIT 0x4000 102 /* 0x8000 */ 103 104 #include <sys/cdefs.h> 105 #include <stdio.h> 106 107 extern struct __res_state _res; 108 109 /* Private routines shared between libc/net, named, nslookup and others. */ 110 #define dn_skipname __dn_skipname 111 #define fp_query __fp_query 112 #define hostalias __hostalias 113 #define putlong __putlong 114 #define putshort __putshort 115 #define p_class __p_class 116 #define p_time __p_time 117 #define p_type __p_type 118 __BEGIN_DECLS 119 int __dn_skipname __P((const u_char *, const u_char *)); 120 void __fp_resstat __P((struct __res_state *, FILE *)); 121 void __fp_query __P((char *, FILE *)); 122 char *__hostalias __P((const char *)); 123 void __putlong __P((u_int32_t, u_char *)); 124 void __putshort __P((u_short, u_char *)); 125 char *__p_class __P((int)); 126 char *__p_time __P((u_int32_t)); 127 char *__p_type __P((int)); 128 129 int dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **)); 130 int dn_expand __P((const u_char *, const u_char *, const u_char *, 131 u_char *, int)); 132 int res_init __P((void)); 133 int res_mkquery __P((int, const char *, int, int, const char *, int, 134 const char *, char *, int)); 135 int res_send __P((const char *, int, char *, int)); 136 __END_DECLS 137 138 #endif /* !_RESOLV_H_ */ 139