|
|
1.1 root 1: /*
2: * Copyright (c) 1985 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that this notice is preserved and that due credit is given
7: * to the University of California at Berkeley. The name of the University
8: * may not be used to endorse or promote products derived from this
9: * software without specific prior written permission. This software
10: * is provided ``as is'' without express or implied warranty.
11: *
12: * @(#)res.h 5.3 (Berkeley) 2/17/88
13: */
14:
15: /*
16: *******************************************************************************
17: *
18: * res.h --
19: *
20: * Definitions used by modules of the name server
21: * lookup program.
22: *
23: * Copyright (c) 1985
24: * Andrew Cherenson
25: * CS298-26 Fall 1985
26: *
27: *******************************************************************************
28: */
29:
30: #define TRUE 1
31: #define FALSE 0
32:
33: /*
34: * Define return statuses in addtion to the ones defined in namserv.h
35: * let SUCCESS be a synonym for NOERROR
36: *
37: * TIME_OUT - a socket connection timed out.
38: * NO_INFO - the server didn't find any info about the host.
39: * ERROR - one of the following types of errors:
40: * dn_expand, res_mkquery failed
41: * bad command line, socket operation failed, etc.
42: * NONAUTH - the server didn't have the desired info but
43: * returned the name(s) of some servers who should.
44: *
45: */
46:
47: #define SUCCESS 0
48: #define TIME_OUT -1
49: #define NO_INFO -2
50: #define ERROR -3
51: #define NONAUTH -4
52:
53: /*
54: * Define additional options for the resolver state structure.
55: *
56: * RES_DEBUG2 more verbose debug level
57: */
58:
59: #define RES_DEBUG2 0x80000000
60:
61: /*
62: * Maximum length of server, host and file names.
63: */
64:
65: #define NAME_LEN 80
66:
67:
68: /*
69: * Modified struct hostent from <netdb.h>
70: *
71: * "Structures returned by network data base library. All addresses
72: * are supplied in host order, and returned in network order (suitable
73: * for use in system calls)."
74: */
75:
76: typedef struct {
77: char *name; /* official name of host */
78: char **domains; /* domains it serves */
79: char **addrList; /* list of addresses from name server */
80: } ServerInfo;
81:
82: typedef struct {
83: char *name; /* official name of host */
84: char **aliases; /* alias list */
85: char **addrList; /* list of addresses from name server */
86: int addrType; /* host address type */
87: int addrLen; /* length of address */
88: ServerInfo **servers;
89: } HostInfo;
90:
91:
92: /*
93: * SockFD is the file descriptor for sockets used to connect with
94: * the name servers. It is global so the Control-C handler can close
95: * it. Likewise for filePtr, which is used for directing listings
96: * to a file.
97: */
98:
99: extern int sockFD;
100: extern FILE *filePtr;
101:
102:
103: /*
104: * External routines:
105: */
106:
107: extern int Print_query();
108: extern char *Print_cdname();
109: extern char *Print_cdname2(); /* fixed width */
110: extern char *Print_rr();
111: extern char *DecodeType(); /* descriptive version of p_type */
112: extern char *DecodeError();
113: extern char *Calloc();
114: extern void NsError();
115: extern void PrintServer();
116: extern void PrintHostInfo();
117: extern void ShowOptions();
118: extern void FreeHostInfoPtr();
119: extern FILE *OpenFile();
120: extern char *inet_ntoa();
121: extern char *res_skip();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.