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