1 /* 2 * Copyright (c) 1983, 1987, 1989 The Regents of the University of California. 3 * All rights reserved. 4 * 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. 20 * 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 * from: @(#)resolv.h 5.15 (Berkeley) 4/3/91 34 * $Id: resolv.h,v 1.2 1993/08/01 18:45:24 mycroft Exp $ 35 */ 36 37 #ifndef _RESOLV_H_ 38 #define _RESOLV_H_ 39 40 /* 41 * Resolver configuration file. 42 * Normally not present, but may contain the address of the 43 * inital name server(s) to query and the domain search list. 44 */ 45 46 #ifndef _PATH_RESCONF 47 #define _PATH_RESCONF "/etc/resolv.conf" 48 #endif 49 50 /* 51 * Global defines and variables for resolver stub. 52 */ 53 #define MAXNS 3 /* max # name servers we'll track */ 54 #define MAXDFLSRCH 3 /* # default domain levels to try */ 55 #define MAXDNSRCH 6 /* max # domains in search path */ 56 #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ 57 58 #define RES_TIMEOUT 5 /* min. seconds between retries */ 59 60 struct state { 61 int retrans; /* retransmition time interval */ 62 int retry; /* number of times to retransmit */ 63 long options; /* option flags - see below. */ 64 int nscount; /* number of name servers */ 65 struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ 66 #define nsaddr nsaddr_list[0] /* for backward compatibility */ 67 u_short id; /* current packet id */ 68 char defdname[MAXDNAME]; /* default domain */ 69 char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ 70 }; 71 72 /* 73 * Resolver options 74 */ 75 #define RES_INIT 0x0001 /* address initialized */ 76 #define RES_DEBUG 0x0002 /* print debug messages */ 77 #define RES_AAONLY 0x0004 /* authoritative answers only */ 78 #define RES_USEVC 0x0008 /* use virtual circuit */ 79 #define RES_PRIMARY 0x0010 /* query primary server only */ 80 #define RES_IGNTC 0x0020 /* ignore trucation errors */ 81 #define RES_RECURSE 0x0040 /* recursion desired */ 82 #define RES_DEFNAMES 0x0080 /* use default domain name */ 83 #define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ 84 #define RES_DNSRCH 0x0200 /* search up local domain tree */ 85 86 #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) 87 88 extern struct state _res; 89 90 #include <sys/cdefs.h> 91 #include <stdio.h> 92 93 /* Private routines shared between libc/net, named, nslookup and others. */ 94 #define dn_skipname __dn_skipname 95 #define fp_query __fp_query 96 #define hostalias __hostalias 97 #define putlong __putlong 98 #define putshort __putshort 99 #define p_class __p_class 100 #define p_time __p_time 101 #define p_type __p_type 102 __BEGIN_DECLS 103 int __dn_skipname __P((const u_char *, const u_char *)); 104 void __fp_query __P((char *, FILE *)); 105 char *__hostalias __P((const char *)); 106 void __putlong __P((u_long, u_char *)); 107 void __putshort __P((u_short, u_char *)); 108 char *__p_class __P((int)); 109 char *__p_time __P((u_long)); 110 char *__p_type __P((int)); 111 112 int dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **)); 113 int dn_expand __P((const u_char *, const u_char *, const u_char *, 114 u_char *, int)); 115 int res_init __P((void)); 116 int res_mkquery __P((int, const char *, int, int, const char *, int, 117 const struct rrec *, char *, int)); 118 int res_send __P((const char *, int, char *, int)); 119 __END_DECLS 120 121 #endif /* !_RESOLV_H_ */ 122