Upgrade libressl. 1/2
[dragonfly.git] / libexec / bootpd / bootpd.h
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  * $FreeBSD: src/libexec/bootpd/bootpd.h,v 1.2 1999/11/12 10:11:48 marcel Exp $
28  * $DragonFly: src/libexec/bootpd/bootpd.h,v 1.2 2003/06/17 04:27:07 dillon Exp $
29  */
30
31 #include "bptypes.h"
32 #include "hash.h"
33 #include "hwaddr.h"
34
35 #ifndef TRUE
36 #define TRUE    1
37 #endif
38 #ifndef FALSE
39 #define FALSE   0
40 #endif
41
42 #ifndef PRIVATE
43 #define PRIVATE static
44 #endif
45
46 #ifndef SIGUSR1
47 #define SIGUSR1                  30     /* From 4.3 <signal.h> */
48 #endif
49
50 #define MAXSTRINGLEN             80     /* Max string length */
51
52 /* Local definitions: */
53 #define MAX_MSG_SIZE            (3*512) /* Maximum packet size */
54
55
56 /*
57  * Return pointer to static string which gives full network error message.
58  */
59 #define get_network_errmsg get_errmsg
60
61
62 /*
63  * Data structure used to hold an arbitrary-lengthed list of IP addresses.
64  * The list may be shared among multiple hosts by setting the linkcount
65  * appropriately.
66  */
67
68 struct in_addr_list {
69     unsigned int        linkcount, addrcount;
70     struct in_addr      addr[1];                /* Dynamically extended */
71 };
72
73
74 /*
75  * Data structures used to hold shared strings and shared binary data.
76  * The linkcount must be set appropriately.
77  */
78
79 struct shared_string {
80     unsigned int        linkcount;
81     char                string[1];              /* Dynamically extended */
82 };
83
84 struct shared_bindata {
85     unsigned int        linkcount, length;
86     byte                data[1];                /* Dynamically extended */
87 };
88
89
90 /*
91  * Flag structure which indicates which symbols have been defined for a
92  * given host.  This information is used to determine which data should or
93  * should not be reported in the bootp packet vendor info field.
94  */
95
96 struct flag {
97     unsigned    bootfile        :1,
98                 bootserver      :1,
99                 bootsize        :1,
100                 bootsize_auto   :1,
101                 cookie_server   :1,
102                 domain_server   :1,
103                 gateway         :1,
104                 generic         :1,
105                 haddr           :1,
106                 homedir         :1,
107                 htype           :1,
108                 impress_server  :1,
109                 iaddr           :1,
110                 log_server      :1,
111                 lpr_server      :1,
112                 name_server     :1,
113                 name_switch     :1,
114                 rlp_server      :1,
115                 send_name       :1,
116                 subnet_mask     :1,
117                 tftpdir         :1,
118                 time_offset     :1,
119                 time_server     :1,
120                 dump_file       :1,
121                 domain_name     :1,
122                 swap_server     :1,
123                 root_path       :1,
124                 exten_file      :1,
125                 reply_addr      :1,
126                 nis_domain      :1,
127                 nis_server      :1,
128                 ntp_server      :1,
129                 exec_file       :1,
130                 msg_size        :1,
131                 min_wait        :1,
132                 /* XXX - Add new tags here */
133                 vm_cookie       :1;
134 };
135
136 \f
137
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 \f
198
199
200 /*
201  * Variables shared among modules.
202  */
203
204 extern int debug;
205 extern char *bootptab;
206 extern char *progname;
207
208 extern u_char vm_cmu[4];
209 extern u_char vm_rfc1048[4];
210
211 extern hash_tbl *hwhashtable;
212 extern hash_tbl *iphashtable;
213 extern hash_tbl *nmhashtable;
214