BSD 4_3_Net_2 release
[unix-history] / usr / src / include / resolv.h
CommitLineData
bb0cfa24 1/*
01b2928e 2 * Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
7ee32d6e
KB
3 * All rights reserved.
4 *
af359dea
C
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
bb0cfa24 20 *
af359dea
C
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)resolv.h 5.15 (Berkeley) 4/3/91
bb0cfa24
DF
34 */
35
d2b7358e
KB
36#ifndef _RESOLV_H_
37#define _RESOLV_H_
38
c363c908
MK
39/*
40 * Resolver configuration file.
41 * Normally not present, but may contain the address of the
42 * inital name server(s) to query and the domain search list.
43 */
44
45#ifndef _PATH_RESCONF
46#define _PATH_RESCONF "/etc/resolv.conf"
47#endif
48
a4b4ca70
RC
49/*
50 * Global defines and variables for resolver stub.
51 */
3dacec68
KB
52#define MAXNS 3 /* max # name servers we'll track */
53#define MAXDFLSRCH 3 /* # default domain levels to try */
54#define MAXDNSRCH 6 /* max # domains in search path */
55#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
8fa684c1 56
3dacec68 57#define RES_TIMEOUT 5 /* min. seconds between retries */
8fa684c1 58
a4b4ca70 59struct state {
8fa684c1 60 int retrans; /* retransmition time interval */
a4b4ca70 61 int retry; /* number of times to retransmit */
1ca41cc2 62 long options; /* option flags - see below. */
8fa684c1
KD
63 int nscount; /* number of name servers */
64 struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */
65#define nsaddr nsaddr_list[0] /* for backward compatibility */
a4b4ca70
RC
66 u_short id; /* current packet id */
67 char defdname[MAXDNAME]; /* default domain */
e0bab101 68 char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
a4b4ca70
RC
69};
70
71/*
72 * Resolver options
73 */
1ca41cc2
JB
74#define RES_INIT 0x0001 /* address initialized */
75#define RES_DEBUG 0x0002 /* print debug messages */
76#define RES_AAONLY 0x0004 /* authoritative answers only */
77#define RES_USEVC 0x0008 /* use virtual circuit */
78#define RES_PRIMARY 0x0010 /* query primary server only */
79#define RES_IGNTC 0x0020 /* ignore trucation errors */
80#define RES_RECURSE 0x0040 /* recursion desired */
81#define RES_DEFNAMES 0x0080 /* use default domain name */
82#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
e0bab101
MK
83#define RES_DNSRCH 0x0200 /* search up local domain tree */
84
85#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
a4b4ca70
RC
86
87extern struct state _res;
f0c2b1c5
DS
88
89#include <sys/cdefs.h>
542c04c0 90#include <stdio.h>
f0c2b1c5 91
542c04c0
KB
92/* Private routines shared between libc/net, named, nslookup and others. */
93#define dn_skipname __dn_skipname
94#define fp_query __fp_query
95#define hostalias __hostalias
96#define putlong __putlong
97#define putshort __putshort
98#define p_class __p_class
99#define p_time __p_time
100#define p_type __p_type
f0c2b1c5 101__BEGIN_DECLS
542c04c0
KB
102int __dn_skipname __P((const u_char *, const u_char *));
103void __fp_query __P((char *, FILE *));
104char *__hostalias __P((const char *));
105void __putlong __P((u_long, u_char *));
106void __putshort __P((u_short, u_char *));
107char *__p_class __P((int));
108char *__p_time __P((u_long));
109char *__p_type __P((int));
110
111int dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **));
112int dn_expand __P((const u_char *, const u_char *, const u_char *,
328da309 113 u_char *, int));
542c04c0
KB
114int res_init __P((void));
115int res_mkquery __P((int, const char *, int, int, const char *, int,
f0c2b1c5 116 const struct rrec *, char *, int));
542c04c0 117int res_send __P((const char *, int, char *, int));
f0c2b1c5 118__END_DECLS
d2b7358e
KB
119
120#endif /* !_RESOLV_H_ */