|
|
1.1 root 1: /*
2: * Copyright (c) 1985,1989 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted provided
6: * that: (1) source distributions retain this entire copyright notice and
7: * comment, and (2) distributions including binaries display the following
8: * acknowledgement: ``This product includes software developed by the
9: * University of California, Berkeley and its contributors'' in the
10: * documentation or other materials provided with the distribution and in
11: * all advertising materials mentioning features or use of this software.
12: * Neither the name of the University nor the names of its contributors may
13: * be used to endorse or promote products derived from this software without
14: * specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
16: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
17: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: *
19: * @(#)res.h 5.10 (Berkeley) 6/1/90
20: */
21:
22: /*
23: *******************************************************************************
24: *
25: * res.h --
26: *
27: * Definitions used by modules of the name server lookup program.
28: *
29: * Copyright (c) 1985
30: * Andrew Cherenson
31: * U.C. Berkeley
32: * CS298-26 Fall 1985
33: *
34: *******************************************************************************
35: */
36:
37: #define TRUE 1
38: #define FALSE 0
39: typedef int Boolean;
40:
41: /*
42: * Define return statuses in addtion to the ones defined in namserv.h
43: * let SUCCESS be a synonym for NOERROR
44: *
45: * TIME_OUT - a socket connection timed out.
46: * NO_INFO - the server didn't find any info about the host.
47: * ERROR - one of the following types of errors:
48: * dn_expand, res_mkquery failed
49: * bad command line, socket operation failed, etc.
50: * NONAUTH - the server didn't have the desired info but
51: * returned the name(s) of some servers who should.
52: * NO_RESPONSE - the server didn't respond.
53: *
54: */
55:
56: #define SUCCESS 0
57: #define TIME_OUT -1
58: #define NO_INFO -2
59: #define ERROR -3
60: #define NONAUTH -4
61: #define NO_RESPONSE -5
62:
63: /*
64: * Define additional options for the resolver state structure.
65: *
66: * RES_DEBUG2 more verbose debug level
67: */
68:
69: #define RES_DEBUG2 0x80000000
70:
71: /*
72: * Maximum length of server, host and file names.
73: */
74:
75: #define NAME_LEN 256
76:
77:
78: /*
79: * Modified struct hostent from <netdb.h>
80: *
81: * "Structures returned by network data base library. All addresses
82: * are supplied in host order, and returned in network order (suitable
83: * for use in system calls)."
84: */
85:
86: typedef struct {
87: char *name; /* official name of host */
88: char **domains; /* domains it serves */
89: char **addrList; /* list of addresses from name server */
90: } ServerInfo;
91:
92: typedef struct {
93: char *name; /* official name of host */
94: char **aliases; /* alias list */
95: char **addrList; /* list of addresses from name server */
96: int addrType; /* host address type */
97: int addrLen; /* length of address */
98: ServerInfo **servers;
99: } HostInfo;
100:
101:
102: /*
103: * FilePtr is used for directing listings to a file.
104: * It is global so the Control-C handler can close it.
105: */
106:
107: extern FILE *filePtr;
108:
109: /*
110: * TCP/UDP port of server.
111: */
112: extern unsigned short nsport;
113:
114: /*
115: * External routines:
116: */
117:
118: extern Boolean IsAddr();
119: extern int Print_query();
120: extern char *Print_cdname();
121: extern char *Print_cdname2(); /* fixed width */
122: extern char *Print_rr();
123: extern char *DecodeType(); /* descriptive version of p_type */
124: extern char *DecodeError();
125: extern char *Calloc();
126: extern char *Malloc();
127: extern void NsError();
128: extern void PrintServer();
129: extern void PrintHostInfo();
130: extern void ShowOptions();
131: extern void FreeHostInfoPtr();
132: extern FILE *OpenFile();
133: extern char *res_skip();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.