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