1 /*        $NetBSD: res.h,v 1.1.1.2 2012/09/09 16:08:11 christos Exp $ */
2 
3 /*
4  * Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /*
20  *        @(#)res.h 5.10 (Berkeley) 6/1/90
21  *        Id: res.h,v 1.3 2009/03/03 23:49:07 tbox Exp
22  */
23 
24 /*
25  *******************************************************************************
26  *
27  *  res.h --
28  *
29  *        Definitions used by modules of the name server lookup program.
30  *
31  *        Copyright (c) 1985
32  *        Andrew Cherenson
33  *        U.C. Berkeley
34  *        CS298-26  Fall 1985
35  *
36  *******************************************************************************
37  */
38 
39 #define TRUE        1
40 #define FALSE       0
41 typedef int Boolean;
42 
43 #define MAXALIASES  35
44 #define MAXADDRS    35
45 #define MAXDOMAINS  35
46 #define MAXSERVERS  10
47 
48 /*
49  *  Define return statuses in addtion to the ones defined in namserv.h
50  *   let SUCCESS be a synonym for NOERROR
51  *
52  *        TIME_OUT  - a socket connection timed out.
53  *        NO_INFO             - the server didn't find any info about the host.
54  *        ERROR               - one of the following types of errors:
55  *                               dn_expand, res_mkquery failed
56  *                               bad command line, socket operation failed, etc.
57  *        NONAUTH             - the server didn't have the desired info but
58  *                              returned the name(s) of some servers who should.
59  *        NO_RESPONSE         - the server didn't respond.
60  *
61  */
62 
63 #ifdef ERROR
64 #undef ERROR
65 #endif
66 
67 #define  SUCCESS              0
68 #define  TIME_OUT             -1
69 #define  NO_INFO              -2
70 #define  ERROR                          -3
71 #define  NONAUTH              -4
72 #define  NO_RESPONSE                    -5
73 
74 /*
75  *  Define additional options for the resolver state structure.
76  *
77  *   RES_DEBUG2               more verbose debug level
78  */
79 
80 #define RES_DEBUG2  0x00400000
81 
82 /*
83  *  Maximum length of server, host and file names.
84  */
85 
86 #define NAME_LEN 256
87 
88 
89 /*
90  * Modified struct hostent from <netdb.h>
91  *
92  * "Structures returned by network data base library.  All addresses
93  * are supplied in host order, and returned in network order (suitable
94  * for use in system calls)."
95  */
96 
97 typedef struct {
98           int     addrType;
99           int     addrLen;
100           char    *addr;
101 } AddrInfo;
102 
103 typedef struct      {
104           char      *name;              /* official name of host */
105           char      **domains;          /* domains it serves */
106           AddrInfo **addrList;          /* list of addresses from name server */
107 } ServerInfo;
108 
109 typedef struct      {
110           char      *name;              /* official name of host */
111           char      **aliases;          /* alias list */
112           AddrInfo **addrList;          /* list of addresses from name server */
113           ServerInfo **servers;
114 } HostInfo;
115 
116 /*
117  *  External routines:
118  */
119 
120 extern int pickString(const char *, char *, size_t);
121 extern int matchString(const char *, const char *);
122 extern int StringToType(char *, int, FILE *);
123 extern int StringToClass(char *, int, FILE *);
124 
125