bootpd.h revision 1.1 1 /************************************************************************
2 Copyright 1988, 1991 by Carnegie Mellon University
3
4 All Rights Reserved
5
6 Permission to use, copy, modify, and distribute this software and its
7 documentation for any purpose and without fee is hereby granted, provided
8 that the above copyright notice appear in all copies and that both that
9 copyright notice and this permission notice appear in supporting
10 documentation, and that the name of Carnegie Mellon University not be used
11 in advertising or publicity pertaining to distribution of the software
12 without specific, written prior permission.
13
14 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
15 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
16 IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
17 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
18 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19 ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 SOFTWARE.
21 ************************************************************************/
22
23
24 /*
25 * bootpd.h -- common header file for all the modules of the bootpd program.
26 */
27
28 #include "bptypes.h"
29 #include "hash.h"
30 #include "hwaddr.h"
31
32 #ifndef TRUE
33 #define TRUE 1
34 #endif
35 #ifndef FALSE
36 #define FALSE 0
37 #endif
38
39 #ifndef PRIVATE
40 #define PRIVATE static
41 #endif
42
43 #ifndef SIGUSR1
44 #define SIGUSR1 30 /* From 4.3 <signal.h> */
45 #endif
46
47 #define MAXSTRINGLEN 80 /* Max string length */
48
49
50 /*
51 * Return pointer to static string which gives full network error message.
52 */
53 #define get_network_errmsg get_errmsg
54
55
56 /*
57 * Data structure used to hold an arbitrary-lengthed list of IP addresses.
58 * The list may be shared among multiple hosts by setting the linkcount
59 * appropriately.
60 */
61
62 struct in_addr_list {
63 unsigned int linkcount, addrcount;
64 struct in_addr addr[1]; /* Dynamically extended */
65 };
66
67
68 /*
69 * Data structures used to hold shared strings and shared binary data.
70 * The linkcount must be set appropriately.
71 */
72
73 struct shared_string {
74 unsigned int linkcount;
75 char string[1]; /* Dynamically extended */
76 };
77
78 struct shared_bindata {
79 unsigned int linkcount, length;
80 byte data[1]; /* Dynamically extended */
81 };
82
83
84 /*
85 * Flag structure which indicates which symbols have been defined for a
86 * given host. This information is used to determine which data should or
87 * should not be reported in the bootp packet vendor info field.
88 */
89
90 struct flag {
91 unsigned bootfile :1,
92 bootserver :1,
93 bootsize :1,
94 bootsize_auto :1,
95 cookie_server :1,
96 domain_server :1,
97 gateway :1,
98 generic :1,
99 haddr :1,
100 homedir :1,
101 htype :1,
102 impress_server :1,
103 iaddr :1,
104 log_server :1,
105 lpr_server :1,
106 name_server :1,
107 name_switch :1,
108 rlp_server :1,
109 send_name :1,
110 subnet_mask :1,
111 tftpdir :1,
112 time_offset :1,
113 time_server :1,
114 dump_file :1,
115 domain_name :1,
116 swap_server :1,
117 root_path :1,
118 exten_file :1,
119 reply_addr :1,
120 nis_domain :1,
121 nis_server :1,
122 ntp_server :1,
123 exec_file :1,
124 /* XXX - Add new tags here */
125 vm_cookie :1;
126 };
127
128
129
131 /*
132 * The flags structure contains TRUE flags for all the fields which
133 * are considered valid, regardless of whether they were explicitly
134 * specified or indirectly inferred from another entry.
135 *
136 * The gateway and the various server fields all point to a shared list of
137 * IP addresses.
138 *
139 * The hostname, home directory, and bootfile are all shared strings.
140 *
141 * The generic data field is a shared binary data structure. It is used to
142 * hold future RFC1048 vendor data until bootpd is updated to understand it.
143 *
144 * The vm_cookie field specifies the four-octet vendor magic cookie to use
145 * if it is desired to always send the same response to a given host.
146 *
147 * Hopefully, the rest is self-explanatory.
148 */
149
150 struct host {
151 unsigned linkcount; /* hash list inserts */
152 struct flag flags; /* ALL valid fields */
153 struct in_addr_list *cookie_server,
154 *domain_server,
155 *gateway,
156 *impress_server,
157 *log_server,
158 *lpr_server,
159 *name_server,
160 *rlp_server,
161 *time_server,
162 *nis_server,
163 *ntp_server;
164 struct shared_string *bootfile,
165 *hostname,
166 *domain_name,
167 *homedir,
168 *tftpdir,
169 *dump_file,
170 *exten_file,
171 *root_path,
172 *nis_domain,
173 *exec_file;
174 struct shared_bindata *generic;
175 byte vm_cookie[4],
176 htype, /* RFC826 says this should be 16-bits but
177 RFC951 only allocates 1 byte. . . */
178 haddr[MAXHADDRLEN];
179 int32 time_offset;
180 unsigned int bootsize;
181 struct in_addr bootserver,
182 iaddr,
183 swap_server,
184 reply_addr,
185 subnet_mask;
186 /* XXX - Add new tags here (or above as appropriate) */
187 };
188
189
191
192 /*
193 * Variables shared among modules.
194 */
195
196 extern int debug;
197 extern char *bootptab;
198 extern char *progname;
199
200 extern u_char vm_cmu[4];
201 extern u_char vm_rfc1048[4];
202
203 extern hash_tbl *hwhashtable;
204 extern hash_tbl *iphashtable;
205 extern hash_tbl *nmhashtable;
206
207