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: stable/11/stand/libsa/bootp.h 344408 2019-02-21 02:43:48Z kevans $ 2338451Smsmith */ 2438451Smsmith 25329099Skevans#ifndef _BOOTP_H_ 26329099Skevans#define _BOOTP_H_ 2738451Smsmith 2838451Smsmithstruct bootp { 2938451Smsmith unsigned char bp_op; /* packet opcode type */ 3038451Smsmith unsigned char bp_htype; /* hardware addr type */ 3138451Smsmith unsigned char bp_hlen; /* hardware addr length */ 3238451Smsmith unsigned char bp_hops; /* gateway hops */ 3338451Smsmith unsigned int bp_xid; /* transaction ID */ 3438451Smsmith unsigned short bp_secs; /* seconds since boot began */ 3538451Smsmith unsigned short bp_flags; 3638451Smsmith struct in_addr bp_ciaddr; /* client IP address */ 3738451Smsmith struct in_addr bp_yiaddr; /* 'your' IP address */ 3838451Smsmith struct in_addr bp_siaddr; /* server IP address */ 3938451Smsmith struct in_addr bp_giaddr; /* gateway IP address */ 4038451Smsmith unsigned char bp_chaddr[16]; /* client hardware address */ 4138451Smsmith unsigned char bp_sname[64]; /* server host name */ 42344408Skevans char bp_file[128]; /* boot file name */ 4338451Smsmith#ifdef SUPPORT_DHCP 4438451Smsmith#define BOOTP_VENDSIZE 312 4538451Smsmith#else 4638451Smsmith#define BOOTP_VENDSIZE 64 4738451Smsmith#endif 4838451Smsmith unsigned char bp_vend[BOOTP_VENDSIZE]; /* vendor-specific area */ 4938451Smsmith}; 5038451Smsmith 5138451Smsmith/* 5238451Smsmith * UDP port numbers, server and client. 5338451Smsmith */ 5438451Smsmith#define IPPORT_BOOTPS 67 5538451Smsmith#define IPPORT_BOOTPC 68 5638451Smsmith 5738451Smsmith#define BOOTREPLY 2 5838451Smsmith#define BOOTREQUEST 1 5938451Smsmith 6038451Smsmith 6138451Smsmith/* 6238451Smsmith * Vendor magic cookie (v_magic) for CMU 6338451Smsmith */ 6438451Smsmith#define VM_CMU "CMU" 6538451Smsmith 6638451Smsmith/* 6738451Smsmith * Vendor magic cookie (v_magic) for RFC1048 6838451Smsmith */ 6938451Smsmith#define VM_RFC1048 { 99, 130, 83, 99 } 7038451Smsmith 7138451Smsmith 7238451Smsmith 7338451Smsmith/* 7438451Smsmith * RFC1048 tag values used to specify what information is being supplied in 7538451Smsmith * the vendor field of the packet. 7638451Smsmith */ 7738451Smsmith 7838451Smsmith#define TAG_PAD ((unsigned char) 0) 7938451Smsmith#define TAG_SUBNET_MASK ((unsigned char) 1) 8038451Smsmith#define TAG_TIME_OFFSET ((unsigned char) 2) 8138451Smsmith#define TAG_GATEWAY ((unsigned char) 3) 8238451Smsmith#define TAG_TIME_SERVER ((unsigned char) 4) 8338451Smsmith#define TAG_NAME_SERVER ((unsigned char) 5) 8438451Smsmith#define TAG_DOMAIN_SERVER ((unsigned char) 6) 8538451Smsmith#define TAG_LOG_SERVER ((unsigned char) 7) 8638451Smsmith#define TAG_COOKIE_SERVER ((unsigned char) 8) 8738451Smsmith#define TAG_LPR_SERVER ((unsigned char) 9) 8838451Smsmith#define TAG_IMPRESS_SERVER ((unsigned char) 10) 8938451Smsmith#define TAG_RLP_SERVER ((unsigned char) 11) 9038451Smsmith#define TAG_HOSTNAME ((unsigned char) 12) 9138451Smsmith#define TAG_BOOTSIZE ((unsigned char) 13) 9238451Smsmith#define TAG_DUMPFILE ((unsigned char) 14) 9338451Smsmith#define TAG_DOMAINNAME ((unsigned char) 15) 9438451Smsmith#define TAG_SWAPSERVER ((unsigned char) 16) 9538451Smsmith#define TAG_ROOTPATH ((unsigned char) 17) 96297150Sian#define TAG_INTF_MTU ((unsigned char) 26) 9738451Smsmith 9838451Smsmith#ifdef SUPPORT_DHCP 9938451Smsmith#define TAG_REQ_ADDR ((unsigned char) 50) 10038451Smsmith#define TAG_LEASETIME ((unsigned char) 51) 10138451Smsmith#define TAG_OVERLOAD ((unsigned char) 52) 10238451Smsmith#define TAG_DHCP_MSGTYPE ((unsigned char) 53) 10338451Smsmith#define TAG_SERVERID ((unsigned char) 54) 10438451Smsmith#define TAG_PARAM_REQ ((unsigned char) 55) 10538451Smsmith#define TAG_MSG ((unsigned char) 56) 10638451Smsmith#define TAG_MAXSIZE ((unsigned char) 57) 10738451Smsmith#define TAG_T1 ((unsigned char) 58) 10838451Smsmith#define TAG_T2 ((unsigned char) 59) 10938451Smsmith#define TAG_CLASSID ((unsigned char) 60) 11038451Smsmith#define TAG_CLIENTID ((unsigned char) 61) 111329100Skevans#define TAG_USER_CLASS ((unsigned char) 77) 11238451Smsmith#endif 11338451Smsmith 11438451Smsmith#define TAG_END ((unsigned char) 255) 11538451Smsmith 11638451Smsmith#ifdef SUPPORT_DHCP 11738451Smsmith#define DHCPDISCOVER 1 11838451Smsmith#define DHCPOFFER 2 11938451Smsmith#define DHCPREQUEST 3 12038451Smsmith#define DHCPDECLINE 4 12138451Smsmith#define DHCPACK 5 12238451Smsmith#define DHCPNAK 6 12338451Smsmith#define DHCPRELEASE 7 12438451Smsmith#endif 12538451Smsmith 12638451Smsmith/* 12738451Smsmith * "vendor" data permitted for CMU bootp clients. 12838451Smsmith */ 12938451Smsmith 13038451Smsmithstruct cmu_vend { 13138451Smsmith unsigned char v_magic[4]; /* magic number */ 13238451Smsmith unsigned int v_flags; /* flags/opcodes, etc. */ 13338451Smsmith struct in_addr v_smask; /* Subnet mask */ 13438451Smsmith struct in_addr v_dgate; /* Default gateway */ 13538451Smsmith struct in_addr v_dns1, v_dns2; /* Domain name servers */ 13638451Smsmith struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */ 13738451Smsmith struct in_addr v_ts1, v_ts2; /* Time servers */ 13838451Smsmith unsigned char v_unused[25]; /* currently unused */ 13938451Smsmith}; 14038451Smsmith 14138451Smsmith 14238451Smsmith/* v_flags values */ 14338451Smsmith#define VF_SMASK 1 /* Subnet mask field contains valid data */ 144329099Skevans 145329100Skevans/* cached bootp response/dhcp ack */ 146329100Skevansextern struct bootp *bootp_response; 147329100Skevansextern size_t bootp_response_size; 148329100Skevans 149329099Skevans#endif /* _BOOTP_H_ */ 150