1 /* 2 * Copyright 1997 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 7 /* All Rights Reserved */ 8 9 /* 10 * Copyright (c) 1983, 1987 Regents of the University of California. 11 * All rights reserved. The Berkeley software License Agreement 12 * specifies the terms and conditions for redistribution. 13 */ 14 15 /* 16 * Global defines and variables for resolver stub. 17 */ 18 19 #ifndef _RESOLV_H 20 #define _RESOLV_H 21 22 #pragma ident "%Z%%M% %I% %E% SMI" 23 24 #include <sys/types.h> 25 #include <netinet/in.h> 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 #define ADDRSORT 1 /* enable the address-sorting option */ 32 #define MAXADDR 10 /* max # addresses to sort by */ 33 34 #define MAXDNAME 256 35 #define MAXNS 3 /* max # name servers we'll track */ 36 #define MAXDNSRCH 3 /* max # default domain levels to try */ 37 #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ 38 39 #define RES_TIMEOUT 6 /* seconds between retries */ 40 41 struct state { 42 int retrans; /* retransmition time interval */ 43 int retry; /* number of times to retransmit */ 44 int options; /* option flags - see below. */ 45 int nscount; /* number of name servers */ 46 struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ 47 #define nsaddr nsaddr_list[0] /* for backward compatibility */ 48 ushort_t id; /* current packet id */ 49 char defdname[MAXDNAME]; /* default domain */ 50 char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ 51 int ascount; /* number of addresses */ 52 struct in_addr sort_list[MAXADDR]; /* address sorting list */ 53 }; 54 55 /* 56 * Resolver options 57 */ 58 #define RES_INIT 0x0001 /* address initialized */ 59 #define RES_DEBUG 0x0002 /* print debug messages */ 60 #define RES_AAONLY 0x0004 /* authoritative answers only */ 61 #define RES_USEVC 0x0008 /* use virtual circuit */ 62 #define RES_PRIMARY 0x0010 /* query primary server only */ 63 #define RES_IGNTC 0x0020 /* ignore trucation errors */ 64 #define RES_RECURSE 0x0040 /* recursion desired */ 65 #define RES_DEFNAMES 0x0080 /* use default domain name */ 66 #define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ 67 #define RES_DNSRCH 0x0200 /* search up local domain tree */ 68 69 #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) 70 71 extern struct state _res; 72 extern char *p_cdname(), *p_rr(), *p_type(), *p_class(); 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 #endif /* _RESOLV_H */ 79 80