138451Smsmith/* $NetBSD: bootp.h,v 1.4 1997/09/06 13:55:57 drochner Exp $ */ 238451Smsmith 338451Smsmith/* 438451Smsmith * Bootstrap Protocol (BOOTP). RFC951 and RFC1048. 538451Smsmith * 638451Smsmith * This file specifies the "implementation-independent" BOOTP protocol 738451Smsmith * information which is common to both client and server. 838451Smsmith * 938451Smsmith * Copyright 1988 by Carnegie Mellon. 1038451Smsmith * 1138451Smsmith * Permission to use, copy, modify, and distribute this program for any 1238451Smsmith * purpose and without fee is hereby granted, provided that this copyright 1338451Smsmith * and permission notice appear on all copies and supporting documentation, 1438451Smsmith * the name of Carnegie Mellon not be used in advertising or publicity 1538451Smsmith * pertaining to distribution of the program without specific prior 1638451Smsmith * permission, and notice be given in supporting documentation that copying 1738451Smsmith * and distribution is by permission of Carnegie Mellon and Stanford 1838451Smsmith * University. Carnegie Mellon makes no representations about the 1938451Smsmith * suitability of this software for any purpose. It is provided "as is" 2038451Smsmith * without express or implied warranty. 2164527Sps * 2264527Sps * $FreeBSD$ 2338451Smsmith */ 2438451Smsmith 2538451Smsmith 2638451Smsmithstruct bootp { 2738451Smsmith unsigned char bp_op; /* packet opcode type */ 2838451Smsmith unsigned char bp_htype; /* hardware addr type */ 2938451Smsmith unsigned char bp_hlen; /* hardware addr length */ 3038451Smsmith unsigned char bp_hops; /* gateway hops */ 3138451Smsmith unsigned int bp_xid; /* transaction ID */ 3238451Smsmith unsigned short bp_secs; /* seconds since boot began */ 3338451Smsmith unsigned short bp_flags; 3438451Smsmith struct in_addr bp_ciaddr; /* client IP address */ 3538451Smsmith struct in_addr bp_yiaddr; /* 'your' IP address */ 3638451Smsmith struct in_addr bp_siaddr; /* server IP address */ 3738451Smsmith struct in_addr bp_giaddr; /* gateway IP address */ 3838451Smsmith unsigned char bp_chaddr[16]; /* client hardware address */ 3938451Smsmith unsigned char bp_sname[64]; /* server host name */ 4038451Smsmith unsigned char bp_file[128]; /* boot file name */ 4138451Smsmith#ifdef SUPPORT_DHCP 4238451Smsmith#define BOOTP_VENDSIZE 312 4338451Smsmith#else 4438451Smsmith#define BOOTP_VENDSIZE 64 4538451Smsmith#endif 4638451Smsmith unsigned char bp_vend[BOOTP_VENDSIZE]; /* vendor-specific area */ 4738451Smsmith}; 4838451Smsmith 4938451Smsmith/* 5038451Smsmith * UDP port numbers, server and client. 5138451Smsmith */ 5238451Smsmith#define IPPORT_BOOTPS 67 5338451Smsmith#define IPPORT_BOOTPC 68 5438451Smsmith 5538451Smsmith#define BOOTREPLY 2 5638451Smsmith#define BOOTREQUEST 1 5738451Smsmith 5838451Smsmith 5938451Smsmith/* 6038451Smsmith * Vendor magic cookie (v_magic) for CMU 6138451Smsmith */ 6238451Smsmith#define VM_CMU "CMU" 6338451Smsmith 6438451Smsmith/* 6538451Smsmith * Vendor magic cookie (v_magic) for RFC1048 6638451Smsmith */ 6738451Smsmith#define VM_RFC1048 { 99, 130, 83, 99 } 6838451Smsmith 6938451Smsmith 7038451Smsmith 7138451Smsmith/* 7238451Smsmith * RFC1048 tag values used to specify what information is being supplied in 7338451Smsmith * the vendor field of the packet. 7438451Smsmith */ 7538451Smsmith 7638451Smsmith#define TAG_PAD ((unsigned char) 0) 7738451Smsmith#define TAG_SUBNET_MASK ((unsigned char) 1) 7838451Smsmith#define TAG_TIME_OFFSET ((unsigned char) 2) 7938451Smsmith#define TAG_GATEWAY ((unsigned char) 3) 8038451Smsmith#define TAG_TIME_SERVER ((unsigned char) 4) 8138451Smsmith#define TAG_NAME_SERVER ((unsigned char) 5) 8238451Smsmith#define TAG_DOMAIN_SERVER ((unsigned char) 6) 8338451Smsmith#define TAG_LOG_SERVER ((unsigned char) 7) 8438451Smsmith#define TAG_COOKIE_SERVER ((unsigned char) 8) 8538451Smsmith#define TAG_LPR_SERVER ((unsigned char) 9) 8638451Smsmith#define TAG_IMPRESS_SERVER ((unsigned char) 10) 8738451Smsmith#define TAG_RLP_SERVER ((unsigned char) 11) 8838451Smsmith#define TAG_HOSTNAME ((unsigned char) 12) 8938451Smsmith#define TAG_BOOTSIZE ((unsigned char) 13) 9038451Smsmith#define TAG_DUMPFILE ((unsigned char) 14) 9138451Smsmith#define TAG_DOMAINNAME ((unsigned char) 15) 9238451Smsmith#define TAG_SWAPSERVER ((unsigned char) 16) 9338451Smsmith#define TAG_ROOTPATH ((unsigned char) 17) 9438451Smsmith 9538451Smsmith#ifdef SUPPORT_DHCP 9638451Smsmith#define TAG_REQ_ADDR ((unsigned char) 50) 9738451Smsmith#define TAG_LEASETIME ((unsigned char) 51) 9838451Smsmith#define TAG_OVERLOAD ((unsigned char) 52) 9938451Smsmith#define TAG_DHCP_MSGTYPE ((unsigned char) 53) 10038451Smsmith#define TAG_SERVERID ((unsigned char) 54) 10138451Smsmith#define TAG_PARAM_REQ ((unsigned char) 55) 10238451Smsmith#define TAG_MSG ((unsigned char) 56) 10338451Smsmith#define TAG_MAXSIZE ((unsigned char) 57) 10438451Smsmith#define TAG_T1 ((unsigned char) 58) 10538451Smsmith#define TAG_T2 ((unsigned char) 59) 10638451Smsmith#define TAG_CLASSID ((unsigned char) 60) 10738451Smsmith#define TAG_CLIENTID ((unsigned char) 61) 10838451Smsmith#endif 10938451Smsmith 11038451Smsmith#define TAG_END ((unsigned char) 255) 11138451Smsmith 11238451Smsmith#ifdef SUPPORT_DHCP 11338451Smsmith#define DHCPDISCOVER 1 11438451Smsmith#define DHCPOFFER 2 11538451Smsmith#define DHCPREQUEST 3 11638451Smsmith#define DHCPDECLINE 4 11738451Smsmith#define DHCPACK 5 11838451Smsmith#define DHCPNAK 6 11938451Smsmith#define DHCPRELEASE 7 12038451Smsmith#endif 12138451Smsmith 12238451Smsmith/* 12364527Sps * bootp flags 12464527Sps */ 12564527Sps#define BOOTP_NONE 0x0000 /* No flags */ 12664527Sps#define BOOTP_PXE 0x0001 /* Booting from PXE. */ 12764527Sps 12864527Sps/* 12938451Smsmith * "vendor" data permitted for CMU bootp clients. 13038451Smsmith */ 13138451Smsmith 13238451Smsmithstruct cmu_vend { 13338451Smsmith unsigned char v_magic[4]; /* magic number */ 13438451Smsmith unsigned int v_flags; /* flags/opcodes, etc. */ 13538451Smsmith struct in_addr v_smask; /* Subnet mask */ 13638451Smsmith struct in_addr v_dgate; /* Default gateway */ 13738451Smsmith struct in_addr v_dns1, v_dns2; /* Domain name servers */ 13838451Smsmith struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */ 13938451Smsmith struct in_addr v_ts1, v_ts2; /* Time servers */ 14038451Smsmith unsigned char v_unused[25]; /* currently unused */ 14138451Smsmith}; 14238451Smsmith 14338451Smsmith 14438451Smsmith/* v_flags values */ 14538451Smsmith#define VF_SMASK 1 /* Subnet mask field contains valid data */ 146