xref: /original-bsd/include/resolv.h (revision 21439bbc)
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.13 (Berkeley) 02/24/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 
62 __BEGIN_DECLS
63 int	dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **));
64 int	dn_expand __P((const u_char *, const u_char *, const u_char *,
65 		u_char *, int));
66 int	res_init __P((void));
67 int	res_mkquery __P((int, const char *, int, int, const char *, int,
68 		const struct rrec *, char *, int));
69 int	res_send __P((const char *, int, char *, int));
70 __END_DECLS
71