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 * Bootstrap Protocol (BOOTP). RFC951 and RFC1395. 25 * 26 * $Id: bootp.h $ 27 * 28 * 29 * This file specifies the "implementation-independent" BOOTP protocol 30 * information which is common to both client and server. 31 * 32 */ 33 34 #include "bptypes.h" /* for int32, u_int32 */ 35 36 #define BP_CHADDR_LEN 16 37 #define BP_SNAME_LEN 64 38 #define BP_FILE_LEN 128 39 #define BP_VEND_LEN 64 40 #define BP_MINPKTSZ 300 /* to check sizeof(struct bootp) */ 41 42 struct bootp { 43 unsigned char bp_op; /* packet opcode type */ 44 unsigned char bp_htype; /* hardware addr type */ 45 unsigned char bp_hlen; /* hardware addr length */ 46 unsigned char bp_hops; /* gateway hops */ 47 unsigned int32 bp_xid; /* transaction ID */ 48 unsigned short bp_secs; /* seconds since boot began */ 49 unsigned short bp_flags; /* RFC1532 broadcast, etc. */ 50 struct in_addr bp_ciaddr; /* client IP address */ 51 struct in_addr bp_yiaddr; /* 'your' IP address */ 52 struct in_addr bp_siaddr; /* server IP address */ 53 struct in_addr bp_giaddr; /* gateway IP address */ 54 unsigned char bp_chaddr[BP_CHADDR_LEN]; /* client hardware address */ 55 char bp_sname[BP_SNAME_LEN]; /* server host name */ 56 char bp_file[BP_FILE_LEN]; /* boot file name */ 57 unsigned char bp_vend[BP_VEND_LEN]; /* vendor-specific area */ 58 /* note that bp_vend can be longer, extending to end of packet. */ 59 }; 60 61 /* 62 * UDP port numbers, server and client. 63 */ 64 #define IPPORT_BOOTPS 67 65 #define IPPORT_BOOTPC 68 66 67 #define BOOTREPLY 2 68 #define BOOTREQUEST 1 69 70 /* 71 * Hardware types from Assigned Numbers RFC. 72 */ 73 #define HTYPE_ETHERNET 1 74 #define HTYPE_EXP_ETHERNET 2 75 #define HTYPE_AX25 3 76 #define HTYPE_PRONET 4 77 #define HTYPE_CHAOS 5 78 #define HTYPE_IEEE802 6 79 #define HTYPE_ARCNET 7 80 81 /* 82 * Vendor magic cookie (v_magic) for CMU 83 */ 84 #define VM_CMU "CMU" 85 86 /* 87 * Vendor magic cookie (v_magic) for RFC1048 88 */ 89 #define VM_RFC1048 { 99, 130, 83, 99 } 90 91 92 93 /* 94 * Tag values used to specify what information is being supplied in 95 * the vendor (options) data area of the packet. 96 */ 97 /* RFC 1048 */ 98 #define TAG_END ((unsigned char) 255) 99 #define TAG_PAD ((unsigned char) 0) 100 #define TAG_SUBNET_MASK ((unsigned char) 1) 101 #define TAG_TIME_OFFSET ((unsigned char) 2) 102 #define TAG_GATEWAY ((unsigned char) 3) 103 #define TAG_TIME_SERVER ((unsigned char) 4) 104 #define TAG_NAME_SERVER ((unsigned char) 5) 105 #define TAG_DOMAIN_SERVER ((unsigned char) 6) 106 #define TAG_LOG_SERVER ((unsigned char) 7) 107 #define TAG_COOKIE_SERVER ((unsigned char) 8) 108 #define TAG_LPR_SERVER ((unsigned char) 9) 109 #define TAG_IMPRESS_SERVER ((unsigned char) 10) 110 #define TAG_RLP_SERVER ((unsigned char) 11) 111 #define TAG_HOST_NAME ((unsigned char) 12) 112 #define TAG_BOOT_SIZE ((unsigned char) 13) 113 /* RFC 1395 */ 114 #define TAG_DUMP_FILE ((unsigned char) 14) 115 #define TAG_DOMAIN_NAME ((unsigned char) 15) 116 #define TAG_SWAP_SERVER ((unsigned char) 16) 117 #define TAG_ROOT_PATH ((unsigned char) 17) 118 /* RFC 1497 */ 119 #define TAG_EXTEN_FILE ((unsigned char) 18) 120 /* RFC 1533 */ 121 #define TAG_NIS_DOMAIN ((unsigned char) 40) 122 #define TAG_NIS_SERVER ((unsigned char) 41) 123 #define TAG_NTP_SERVER ((unsigned char) 42) 124 /* DHCP maximum message size. */ 125 #define TAG_MAX_MSGSZ ((unsigned char) 57) 126 127 /* XXX - Add new tags here */ 128 129 130 /* 131 * "vendor" data permitted for CMU bootp clients. 132 */ 133 134 struct cmu_vend { 135 char v_magic[4]; /* magic number */ 136 unsigned int32 v_flags; /* flags/opcodes, etc. */ 137 struct in_addr v_smask; /* Subnet mask */ 138 struct in_addr v_dgate; /* Default gateway */ 139 struct in_addr v_dns1, v_dns2; /* Domain name servers */ 140 struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */ 141 struct in_addr v_ts1, v_ts2; /* Time servers */ 142 int32 v_unused[6]; /* currently unused */ 143 }; 144 145 146 /* v_flags values */ 147 #define VF_SMASK 1 /* Subnet mask field contains valid data */ 148