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 #include <stdio.h> 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /* 49 * Resolver configuration file. 50 * Normally not present, but may contain the address of the 51 * inital name server(s) to query and the domain search list. 52 */ 53 54 #ifndef _PATH_RESCONF 55 #define _PATH_RESCONF "/etc/resolv.conf" 56 #endif 57 58 #define ADDRSORT 1 /* enable the address-sorting option */ 59 #define MAXADDR 10 /* max # addresses to sort by */ 60 61 #define MAXNS 3 /* max # name servers we'll track */ 62 #define MAXDFLSRCH 3 /* # default domain levels to try */ 63 #define MAXDNSRCH 6 /* max # default domain levels to try */ 64 #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ 65 66 #define RES_TIMEOUT 6 /* seconds between retries */ 67 68 struct state { 69 int retrans; /* retransmition time interval */ 70 int retry; /* number of times to retransmit */ 71 long options; /* option flags - see below. */ 72 int nscount; /* number of name servers */ 73 struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ 74 #define nsaddr nsaddr_list[0] /* for backward compatibility */ 75 u_short id; /* current packet id */ 76 char defdname[MAXDNAME]; /* default domain */ 77 char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ 78 int ascount; /* number of addresses */ 79 struct in_addr sort_list[MAXADDR]; /* address sorting list */ 80 }; 81 82 /* 83 * Resolver options 84 */ 85 #define RES_INIT 0x0001 /* address initialized */ 86 #define RES_DEBUG 0x0002 /* print debug messages */ 87 #define RES_AAONLY 0x0004 /* authoritative answers only */ 88 #define RES_USEVC 0x0008 /* use virtual circuit */ 89 #define RES_PRIMARY 0x0010 /* query primary server only */ 90 #define RES_IGNTC 0x0020 /* ignore trucation errors */ 91 #define RES_RECURSE 0x0040 /* recursion desired */ 92 #define RES_DEFNAMES 0x0080 /* use default domain name */ 93 #define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ 94 #define RES_DNSRCH 0x0200 /* search up local domain tree */ 95 96 #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) 97 98 extern struct state _res; 99 100 #ifdef __STDC__ 101 extern char *p_cdname(char *, char *, FILE *); 102 extern char *p_rr(char *, char *, FILE *); 103 extern char *p_type(int); 104 extern char *p_class(int); 105 extern char *p_time(unsigned long); 106 #else 107 extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time(); 108 #endif /* __STDC__ */ 109 110 #ifdef __cplusplus 111 } 112 #endif 113 114 #endif /* _RESOLV_H */ 115