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