/************************************************************************1Copyright 1988, 1991 by Carnegie Mellon University23All Rights Reserved45Permission to use, copy, modify, and distribute this software and its6documentation for any purpose and without fee is hereby granted, provided7that the above copyright notice appear in all copies and that both that8copyright notice and this permission notice appear in supporting9documentation, and that the name of Carnegie Mellon University not be used10in advertising or publicity pertaining to distribution of the software11without specific, written prior permission.1213CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS14SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.15IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL16DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR17PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS18ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS19SOFTWARE.20************************************************************************/2122/*23* Bootstrap Protocol (BOOTP). RFC951 and RFC1395.24*25*26* This file specifies the "implementation-independent" BOOTP protocol27* information which is common to both client and server.28*29*/3031#include "bptypes.h" /* for int32, u_int32 */3233#define BP_CHADDR_LEN 1634#define BP_SNAME_LEN 6435#define BP_FILE_LEN 12836#define BP_VEND_LEN 6437#define BP_MINPKTSZ 300 /* to check sizeof(struct bootp) */38/* Overhead to fit a bootp message into an Ethernet packet. */39#define BP_MSG_OVERHEAD (14 + 20 + 8) /* Ethernet + IP + UDP headers */4041struct bootp {42unsigned char bp_op; /* packet opcode type */43unsigned char bp_htype; /* hardware addr type */44unsigned char bp_hlen; /* hardware addr length */45unsigned char bp_hops; /* gateway hops */46u_int32 bp_xid; /* transaction ID */47unsigned short bp_secs; /* seconds since boot began */48unsigned short bp_flags; /* RFC1532 broadcast, etc. */49struct in_addr bp_ciaddr; /* client IP address */50struct in_addr bp_yiaddr; /* 'your' IP address */51struct in_addr bp_siaddr; /* server IP address */52struct in_addr bp_giaddr; /* gateway IP address */53unsigned char bp_chaddr[BP_CHADDR_LEN]; /* client hardware address */54char bp_sname[BP_SNAME_LEN]; /* server host name */55char bp_file[BP_FILE_LEN]; /* boot file name */56unsigned char bp_vend[BP_VEND_LEN]; /* vendor-specific area */57/* note that bp_vend can be longer, extending to end of packet. */58};5960/*61* UDP port numbers, server and client.62*/63#define IPPORT_BOOTPS 6764#define IPPORT_BOOTPC 686566#define BOOTREPLY 267#define BOOTREQUEST 16869/*70* Hardware types from Assigned Numbers RFC.71*/72#define HTYPE_ETHERNET 173#define HTYPE_EXP_ETHERNET 274#define HTYPE_AX25 375#define HTYPE_PRONET 476#define HTYPE_CHAOS 577#define HTYPE_IEEE802 678#define HTYPE_ARCNET 77980/*81* Vendor magic cookie (v_magic) for CMU82*/83#define VM_CMU "CMU"8485/*86* Vendor magic cookie (v_magic) for RFC104887*/88#define VM_RFC1048 { 99, 130, 83, 99 }89909192/*93* Tag values used to specify what information is being supplied in94* the vendor (options) data area of the packet.95*/96/* RFC 1048 */97#define TAG_END ((unsigned char) 255)98#define TAG_PAD ((unsigned char) 0)99#define TAG_SUBNET_MASK ((unsigned char) 1)100#define TAG_TIME_OFFSET ((unsigned char) 2)101#define TAG_GATEWAY ((unsigned char) 3)102#define TAG_TIME_SERVER ((unsigned char) 4)103#define TAG_NAME_SERVER ((unsigned char) 5)104#define TAG_DOMAIN_SERVER ((unsigned char) 6)105#define TAG_LOG_SERVER ((unsigned char) 7)106#define TAG_COOKIE_SERVER ((unsigned char) 8)107#define TAG_LPR_SERVER ((unsigned char) 9)108#define TAG_IMPRESS_SERVER ((unsigned char) 10)109#define TAG_RLP_SERVER ((unsigned char) 11)110#define TAG_HOST_NAME ((unsigned char) 12)111#define TAG_BOOT_SIZE ((unsigned char) 13)112/* RFC 1395 */113#define TAG_DUMP_FILE ((unsigned char) 14)114#define TAG_DOMAIN_NAME ((unsigned char) 15)115#define TAG_SWAP_SERVER ((unsigned char) 16)116#define TAG_ROOT_PATH ((unsigned char) 17)117/* RFC 1497 */118#define TAG_EXTEN_FILE ((unsigned char) 18)119/* RFC 1533 */120#define TAG_NIS_DOMAIN ((unsigned char) 40)121#define TAG_NIS_SERVER ((unsigned char) 41)122#define TAG_NTP_SERVER ((unsigned char) 42)123/* DHCP maximum message size. */124#define TAG_MAX_MSGSZ ((unsigned char) 57)125126/* XXX - Add new tags here */127128129/*130* "vendor" data permitted for CMU bootp clients.131*/132133struct cmu_vend {134char v_magic[4]; /* magic number */135u_int32 v_flags; /* flags/opcodes, etc. */136struct in_addr v_smask; /* Subnet mask */137struct in_addr v_dgate; /* Default gateway */138struct in_addr v_dns1, v_dns2; /* Domain name servers */139struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */140struct in_addr v_ts1, v_ts2; /* Time servers */141int32 v_unused[6]; /* currently unused */142};143144145/* v_flags values */146#define VF_SMASK 1 /* Subnet mask field contains valid data */147148149