13229Spst/************************************************************************ 23229Spst Copyright 1988, 1991 by Carnegie Mellon University 33229Spst 43229Spst All Rights Reserved 53229Spst 63229SpstPermission to use, copy, modify, and distribute this software and its 73229Spstdocumentation for any purpose and without fee is hereby granted, provided 83229Spstthat the above copyright notice appear in all copies and that both that 93229Spstcopyright notice and this permission notice appear in supporting 103229Spstdocumentation, and that the name of Carnegie Mellon University not be used 113229Spstin advertising or publicity pertaining to distribution of the software 123229Spstwithout specific, written prior permission. 133229Spst 143229SpstCARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 153229SpstSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 163229SpstIN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 173229SpstDAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 183229SpstPROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 193229SpstACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 203229SpstSOFTWARE. 213229Spst************************************************************************/ 223229Spst 233229Spst 243229Spst/* 253229Spst * bootpd.h -- common header file for all the modules of the bootpd program. 2653105Smarcel * 2753105Smarcel * $FreeBSD$ 283229Spst */ 293229Spst 303229Spst#include "bptypes.h" 313229Spst#include "hash.h" 323229Spst#include "hwaddr.h" 333229Spst 343229Spst#ifndef TRUE 353229Spst#define TRUE 1 363229Spst#endif 373229Spst#ifndef FALSE 383229Spst#define FALSE 0 393229Spst#endif 403229Spst 413229Spst#ifndef PRIVATE 423229Spst#define PRIVATE static 433229Spst#endif 443229Spst 453229Spst#ifndef SIGUSR1 463229Spst#define SIGUSR1 30 /* From 4.3 <signal.h> */ 473229Spst#endif 483229Spst 493229Spst#define MAXSTRINGLEN 80 /* Max string length */ 503229Spst 513229Spst/* Local definitions: */ 523229Spst#define MAX_MSG_SIZE (3*512) /* Maximum packet size */ 533229Spst 543229Spst 553229Spst/* 563229Spst * Return pointer to static string which gives full network error message. 573229Spst */ 583229Spst#define get_network_errmsg get_errmsg 593229Spst 603229Spst 613229Spst/* 623229Spst * Data structure used to hold an arbitrary-lengthed list of IP addresses. 633229Spst * The list may be shared among multiple hosts by setting the linkcount 643229Spst * appropriately. 653229Spst */ 663229Spst 673229Spststruct in_addr_list { 683229Spst unsigned int linkcount, addrcount; 693229Spst struct in_addr addr[1]; /* Dynamically extended */ 703229Spst}; 713229Spst 723229Spst 733229Spst/* 743229Spst * Data structures used to hold shared strings and shared binary data. 753229Spst * The linkcount must be set appropriately. 763229Spst */ 773229Spst 783229Spststruct shared_string { 793229Spst unsigned int linkcount; 803229Spst char string[1]; /* Dynamically extended */ 813229Spst}; 823229Spst 833229Spststruct shared_bindata { 843229Spst unsigned int linkcount, length; 853229Spst byte data[1]; /* Dynamically extended */ 863229Spst}; 873229Spst 883229Spst 893229Spst/* 903229Spst * Flag structure which indicates which symbols have been defined for a 913229Spst * given host. This information is used to determine which data should or 923229Spst * should not be reported in the bootp packet vendor info field. 933229Spst */ 943229Spst 953229Spststruct flag { 963229Spst unsigned bootfile :1, 973229Spst bootserver :1, 983229Spst bootsize :1, 993229Spst bootsize_auto :1, 1003229Spst cookie_server :1, 1013229Spst domain_server :1, 1023229Spst gateway :1, 1033229Spst generic :1, 1043229Spst haddr :1, 1053229Spst homedir :1, 1063229Spst htype :1, 1073229Spst impress_server :1, 1083229Spst iaddr :1, 1093229Spst log_server :1, 1103229Spst lpr_server :1, 1113229Spst name_server :1, 1123229Spst name_switch :1, 1133229Spst rlp_server :1, 1143229Spst send_name :1, 1153229Spst subnet_mask :1, 1163229Spst tftpdir :1, 1173229Spst time_offset :1, 1183229Spst time_server :1, 1193229Spst dump_file :1, 1203229Spst domain_name :1, 1213229Spst swap_server :1, 1223229Spst root_path :1, 1233229Spst exten_file :1, 1243229Spst reply_addr :1, 1253229Spst nis_domain :1, 1263229Spst nis_server :1, 1273229Spst ntp_server :1, 1283229Spst exec_file :1, 1293229Spst msg_size :1, 1303229Spst min_wait :1, 1313229Spst /* XXX - Add new tags here */ 1323229Spst vm_cookie :1; 1333229Spst}; 1343229Spst 1353229Spst 1363229Spst 1373229Spst/* 1383229Spst * The flags structure contains TRUE flags for all the fields which 1393229Spst * are considered valid, regardless of whether they were explicitly 1403229Spst * specified or indirectly inferred from another entry. 1413229Spst * 1423229Spst * The gateway and the various server fields all point to a shared list of 1433229Spst * IP addresses. 1443229Spst * 1453229Spst * The hostname, home directory, and bootfile are all shared strings. 1463229Spst * 1473229Spst * The generic data field is a shared binary data structure. It is used to 1483229Spst * hold future RFC1048 vendor data until bootpd is updated to understand it. 1493229Spst * 1503229Spst * The vm_cookie field specifies the four-octet vendor magic cookie to use 1513229Spst * if it is desired to always send the same response to a given host. 1523229Spst * 1533229Spst * Hopefully, the rest is self-explanatory. 1543229Spst */ 1553229Spst 1563229Spststruct host { 1573229Spst unsigned linkcount; /* hash list inserts */ 1583229Spst struct flag flags; /* ALL valid fields */ 1593229Spst struct in_addr_list *cookie_server, 1603229Spst *domain_server, 1613229Spst *gateway, 1623229Spst *impress_server, 1633229Spst *log_server, 1643229Spst *lpr_server, 1653229Spst *name_server, 1663229Spst *rlp_server, 1673229Spst *time_server, 1683229Spst *nis_server, 1693229Spst *ntp_server; 1703229Spst struct shared_string *bootfile, 1713229Spst *hostname, 1723229Spst *domain_name, 1733229Spst *homedir, 1743229Spst *tftpdir, 1753229Spst *dump_file, 1763229Spst *exten_file, 1773229Spst *root_path, 1783229Spst *nis_domain, 1793229Spst *exec_file; 1803229Spst struct shared_bindata *generic; 1813229Spst byte vm_cookie[4], 1823229Spst htype, /* RFC826 says this should be 16-bits but 1833229Spst RFC951 only allocates 1 byte. . . */ 1843229Spst haddr[MAXHADDRLEN]; 1853229Spst int32 time_offset; 18653105Smarcel u_int32 bootsize, 1873229Spst msg_size, 1883229Spst min_wait; 1893229Spst struct in_addr bootserver, 1903229Spst iaddr, 1913229Spst swap_server, 1923229Spst reply_addr, 1933229Spst subnet_mask; 1943229Spst /* XXX - Add new tags here (or above as appropriate) */ 1953229Spst}; 1963229Spst 1973229Spst 1983229Spst 1993229Spst/* 2003229Spst * Variables shared among modules. 2013229Spst */ 2023229Spst 2033229Spstextern int debug; 2043229Spstextern char *bootptab; 2053229Spstextern char *progname; 2063229Spst 2073229Spstextern u_char vm_cmu[4]; 2083229Spstextern u_char vm_rfc1048[4]; 2093229Spst 2103229Spstextern hash_tbl *hwhashtable; 2113229Spstextern hash_tbl *iphashtable; 2123229Spstextern hash_tbl *nmhashtable; 2133229Spst 214