BSD 4_4 release
[unix-history] / usr / src / include / resolv.h
index ec5ff75..cf8fe76 100644 (file)
@@ -1,21 +1,84 @@
-
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+/*-
+ * Copyright (c) 1983, 1987, 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)resolv.h    5.4 (Berkeley) 2/22/86
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)resolv.h    8.1 (Berkeley) 6/2/93
+ *     $Id: resolv.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp $
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ * 
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * --Copyright--
  */
 
  */
 
+#ifndef _RESOLV_H_
+#define        _RESOLV_H_
+
+#include <sys/types.h>
 /*
 /*
- * Global defines and variables for resolver stub.
+ * Resolver configuration file.
+ * Normally not present, but may contain the address of the
+ * inital name server(s) to query and the domain search list.
  */
 
  */
 
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF        "/etc/resolv.conf"
+#endif
 
 
-#define        MAXNS           3               /* max # name servers we'll track */
+/*
+ * Global defines and variables for resolver stub.
+ */
+#define        MAXNS                   3       /* max # name servers we'll track */
+#define        MAXDFLSRCH              3       /* # default domain levels to try */
+#define        MAXDNSRCH               6       /* max # domains in search path */
+#define        LOCALDOMAINPARTS        2       /* min levels in name that is "local" */
 
 
+#define        RES_TIMEOUT             5       /* min. seconds between retries */
 
 
-struct state {
+struct __res_state {
        int     retrans;                /* retransmition time interval */
        int     retry;                  /* number of times to retransmit */
        long    options;                /* option flags - see below. */
        int     retrans;                /* retransmition time interval */
        int     retry;                  /* number of times to retransmit */
        long    options;                /* option flags - see below. */
@@ -23,11 +86,13 @@ struct state {
        struct  sockaddr_in nsaddr_list[MAXNS]; /* address of name server */
 #define        nsaddr  nsaddr_list[0]          /* for backward compatibility */
        u_short id;                     /* current packet id */
        struct  sockaddr_in nsaddr_list[MAXNS]; /* address of name server */
 #define        nsaddr  nsaddr_list[0]          /* for backward compatibility */
        u_short id;                     /* current packet id */
+       char    *dnsrch[MAXDNSRCH+1];   /* components of domain to search */
        char    defdname[MAXDNAME];     /* default domain */
        char    defdname[MAXDNAME];     /* default domain */
+       long    pfcode;                 /* RES_PRF_ flags - see below. */
 };
 
 /*
 };
 
 /*
- * Resolver options
+ * Resolver options (keep these in synch with res_debug.c, please)
  */
 #define RES_INIT       0x0001          /* address initialized */
 #define RES_DEBUG      0x0002          /* print debug messages */
  */
 #define RES_INIT       0x0001          /* address initialized */
 #define RES_DEBUG      0x0002          /* print debug messages */
@@ -38,6 +103,62 @@ struct state {
 #define RES_RECURSE    0x0040          /* recursion desired */
 #define RES_DEFNAMES   0x0080          /* use default domain name */
 #define RES_STAYOPEN   0x0100          /* Keep TCP socket open */
 #define RES_RECURSE    0x0040          /* recursion desired */
 #define RES_DEFNAMES   0x0080          /* use default domain name */
 #define RES_STAYOPEN   0x0100          /* Keep TCP socket open */
+#define RES_DNSRCH     0x0200          /* search up local domain tree */
+
+#define RES_DEFAULT    (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
+
+/*
+ * Resolver "pfcode" values.  Used by dig.
+ */
+#define RES_PRF_STATS  0x0001
+/*                     0x0002  */
+#define RES_PRF_CLASS   0x0004
+#define RES_PRF_CMD    0x0008
+#define RES_PRF_QUES   0x0010
+#define RES_PRF_ANS    0x0020
+#define RES_PRF_AUTH   0x0040
+#define RES_PRF_ADD    0x0080
+#define RES_PRF_HEAD1  0x0100
+#define RES_PRF_HEAD2  0x0200
+#define RES_PRF_TTLID  0x0400
+#define RES_PRF_HEADX  0x0800
+#define RES_PRF_QUERY  0x1000
+#define RES_PRF_REPLY  0x2000
+#define RES_PRF_INIT    0x4000
+/*                     0x8000  */
+
+#include <sys/cdefs.h>
+#include <stdio.h>
+
+extern struct __res_state _res;
+
+/* Private routines shared between libc/net, named, nslookup and others. */
+#define        dn_skipname     __dn_skipname
+#define        fp_query        __fp_query
+#define        hostalias       __hostalias
+#define        putlong         __putlong
+#define        putshort        __putshort
+#define p_class                __p_class
+#define p_time         __p_time
+#define p_type         __p_type
+__BEGIN_DECLS
+int     __dn_skipname __P((const u_char *, const u_char *));
+void    __fp_resstat __P((struct __res_state *, FILE *));
+void    __fp_query __P((char *, FILE *));
+char   *__hostalias __P((const char *));
+void    __putlong __P((u_int32_t, u_char *));
+void    __putshort __P((u_short, u_char *));
+char   *__p_class __P((int));
+char   *__p_time __P((u_int32_t));
+char   *__p_type __P((int));
+
+int     dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **));
+int     dn_expand __P((const u_char *, const u_char *, const u_char *,
+                       u_char *, int));
+int     res_init __P((void));
+int     res_mkquery __P((int, const char *, int, int, const char *, int,
+                         const char *, char *, int));
+int     res_send __P((const char *, int, char *, int));
+__END_DECLS
 
 
-extern struct state _res;
-extern char *p_cdname(), *p_rr(), *p_type(), *p_class();
+#endif /* !_RESOLV_H_ */