1 /* 2 * Copyright (c) 1983, 1987, 1989 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)resolv.h 5.14 (Berkeley) 03/03/91 8 */ 9 10 /* 11 * Resolver configuration file. 12 * Normally not present, but may contain the address of the 13 * inital name server(s) to query and the domain search list. 14 */ 15 16 #ifndef _PATH_RESCONF 17 #define _PATH_RESCONF "/etc/resolv.conf" 18 #endif 19 20 /* 21 * Global defines and variables for resolver stub. 22 */ 23 #define MAXNS 3 /* max # name servers we'll track */ 24 #define MAXDFLSRCH 3 /* # default domain levels to try */ 25 #define MAXDNSRCH 6 /* max # domains in search path */ 26 #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ 27 28 #define RES_TIMEOUT 5 /* min. seconds between retries */ 29 30 struct state { 31 int retrans; /* retransmition time interval */ 32 int retry; /* number of times to retransmit */ 33 long options; /* option flags - see below. */ 34 int nscount; /* number of name servers */ 35 struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ 36 #define nsaddr nsaddr_list[0] /* for backward compatibility */ 37 u_short id; /* current packet id */ 38 char defdname[MAXDNAME]; /* default domain */ 39 char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ 40 }; 41 42 /* 43 * Resolver options 44 */ 45 #define RES_INIT 0x0001 /* address initialized */ 46 #define RES_DEBUG 0x0002 /* print debug messages */ 47 #define RES_AAONLY 0x0004 /* authoritative answers only */ 48 #define RES_USEVC 0x0008 /* use virtual circuit */ 49 #define RES_PRIMARY 0x0010 /* query primary server only */ 50 #define RES_IGNTC 0x0020 /* ignore trucation errors */ 51 #define RES_RECURSE 0x0040 /* recursion desired */ 52 #define RES_DEFNAMES 0x0080 /* use default domain name */ 53 #define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ 54 #define RES_DNSRCH 0x0200 /* search up local domain tree */ 55 56 #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) 57 58 extern struct state _res; 59 60 #include <sys/cdefs.h> 61 #include <stdio.h> 62 63 /* Private routines shared between libc/net, named, nslookup and others. */ 64 #define dn_skipname __dn_skipname 65 #define fp_query __fp_query 66 #define hostalias __hostalias 67 #define putlong __putlong 68 #define putshort __putshort 69 #define p_class __p_class 70 #define p_time __p_time 71 #define p_type __p_type 72 __BEGIN_DECLS 73 int __dn_skipname __P((const u_char *, const u_char *)); 74 void __fp_query __P((char *, FILE *)); 75 char *__hostalias __P((const char *)); 76 void __putlong __P((u_long, u_char *)); 77 void __putshort __P((u_short, u_char *)); 78 char *__p_class __P((int)); 79 char *__p_time __P((u_long)); 80 char *__p_type __P((int)); 81 82 int dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **)); 83 int dn_expand __P((const u_char *, const u_char *, const u_char *, 84 u_char *, int)); 85 int res_init __P((void)); 86 int res_mkquery __P((int, const char *, int, int, const char *, int, 87 const struct rrec *, char *, int)); 88 int res_send __P((const char *, int, char *, int)); 89 __END_DECLS 90