xref: /titanic_50/usr/src/lib/libresolv/resolv.h (revision c77a61a72b5ecdc507d6cf104142edd371a16c84)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1989 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 /*
31  * Portions of this source code were derived from Berkeley 4.3 BSD
32  * under license from the Regents of the University of California.
33  */
34 
35 /*
36  * Global defines and variables for resolver stub.
37  */
38 
39 #ifndef	_RESOLV_H
40 #define	_RESOLV_H
41 
42 #pragma ident	"%Z%%M%	%I%	%E% SMI"
43 
44 #include <stdio.h>
45 
46 #ifdef	__cplusplus
47 extern "C" {
48 #endif
49 
50 /*
51  * Resolver configuration file.
52  * Normally not present, but may contain the address of the
53  * inital name server(s) to query and the domain search list.
54  */
55 
56 #ifndef	_PATH_RESCONF
57 #define	_PATH_RESCONF	"/etc/resolv.conf"
58 #endif
59 
60 #define	ADDRSORT	1		/* enable the address-sorting option */
61 #define	MAXADDR		10		/* max # addresses to sort by */
62 
63 #define	MAXNS		3		/* max # name servers we'll track */
64 #define	MAXDFLSRCH	3		/* # default domain levels to try */
65 #define	MAXDNSRCH	6		/* max # default domain levels to try */
66 #define	LOCALDOMAINPARTS 2		/* min levels in name that is "local" */
67 
68 #define	RES_TIMEOUT	6		/* seconds between retries */
69 
70 struct state {
71 	int	retrans;		/* retransmition time interval */
72 	int	retry;			/* number of times to retransmit */
73 	long	options;		/* option flags - see below. */
74 	int	nscount;		/* number of name servers */
75 	struct	sockaddr_in nsaddr_list[MAXNS];	/* address of name server */
76 #define	nsaddr	nsaddr_list[0]		/* for backward compatibility */
77 	u_short	id;			/* current packet id */
78 	char	defdname[MAXDNAME];	/* default domain */
79 	char	*dnsrch[MAXDNSRCH+1];	/* components of domain to search */
80 	int	ascount;		/* number of addresses */
81 	struct  in_addr sort_list[MAXADDR]; /* address sorting list */
82 };
83 
84 /*
85  * Resolver options
86  */
87 #define	RES_INIT	0x0001		/* address initialized */
88 #define	RES_DEBUG	0x0002		/* print debug messages */
89 #define	RES_AAONLY	0x0004		/* authoritative answers only */
90 #define	RES_USEVC	0x0008		/* use virtual circuit */
91 #define	RES_PRIMARY	0x0010		/* query primary server only */
92 #define	RES_IGNTC	0x0020		/* ignore trucation errors */
93 #define	RES_RECURSE	0x0040		/* recursion desired */
94 #define	RES_DEFNAMES	0x0080		/* use default domain name */
95 #define	RES_STAYOPEN	0x0100		/* Keep TCP socket open */
96 #define	RES_DNSRCH	0x0200		/* search up local domain tree */
97 
98 #define	RES_DEFAULT	(RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
99 
100 extern struct state _res;
101 
102 #ifdef __STDC__
103 extern char *p_cdname(char *, char *, FILE *);
104 extern char *p_rr(char *, char *, FILE *);
105 extern char *p_type(int);
106 extern char *p_class(int);
107 extern char *p_time(unsigned long);
108 #else
109 extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time();
110 #endif	/* __STDC__ */
111 
112 #ifdef	__cplusplus
113 }
114 #endif
115 
116 #endif	/* _RESOLV_H */
117