xref: /titanic_51/usr/src/boot/lib/libstand/bootp.h (revision e543da67477c7d52932d2aaac908c055bafd2e70)
14a5d661aSToomas Soome /*
24a5d661aSToomas Soome  * Bootstrap Protocol (BOOTP).  RFC951 and RFC1048.
34a5d661aSToomas Soome  *
44a5d661aSToomas Soome  * This file specifies the "implementation-independent" BOOTP protocol
54a5d661aSToomas Soome  * information which is common to both client and server.
64a5d661aSToomas Soome  *
74a5d661aSToomas Soome  * Copyright 1988 by Carnegie Mellon.
84a5d661aSToomas Soome  *
94a5d661aSToomas Soome  * Permission to use, copy, modify, and distribute this program for any
104a5d661aSToomas Soome  * purpose and without fee is hereby granted, provided that this copyright
114a5d661aSToomas Soome  * and permission notice appear on all copies and supporting documentation,
124a5d661aSToomas Soome  * the name of Carnegie Mellon not be used in advertising or publicity
134a5d661aSToomas Soome  * pertaining to distribution of the program without specific prior
144a5d661aSToomas Soome  * permission, and notice be given in supporting documentation that copying
154a5d661aSToomas Soome  * and distribution is by permission of Carnegie Mellon and Stanford
164a5d661aSToomas Soome  * University.  Carnegie Mellon makes no representations about the
174a5d661aSToomas Soome  * suitability of this software for any purpose.  It is provided "as is"
184a5d661aSToomas Soome  * without express or implied warranty.
194a5d661aSToomas Soome  */
204a5d661aSToomas Soome 
2159dfa57dSToomas Soome #include <netinet/in.h>
2259dfa57dSToomas Soome 
237b0ff4b9SToomas Soome #ifndef _BOOTP_H_
247b0ff4b9SToomas Soome #define	_BOOTP_H_
254a5d661aSToomas Soome 
264a5d661aSToomas Soome struct bootp {
274a5d661aSToomas Soome 	unsigned char	bp_op;		/* packet opcode type */
284a5d661aSToomas Soome 	unsigned char	bp_htype;	/* hardware addr type */
294a5d661aSToomas Soome 	unsigned char	bp_hlen;	/* hardware addr length */
304a5d661aSToomas Soome 	unsigned char	bp_hops;	/* gateway hops */
314a5d661aSToomas Soome 	unsigned int	bp_xid;		/* transaction ID */
324a5d661aSToomas Soome 	unsigned short	bp_secs;	/* seconds since boot began */
334a5d661aSToomas Soome 	unsigned short	bp_flags;
344a5d661aSToomas Soome 	struct in_addr	bp_ciaddr;	/* client IP address */
354a5d661aSToomas Soome 	struct in_addr	bp_yiaddr;	/* 'your' IP address */
364a5d661aSToomas Soome 	struct in_addr	bp_siaddr;	/* server IP address */
374a5d661aSToomas Soome 	struct in_addr	bp_giaddr;	/* gateway IP address */
384a5d661aSToomas Soome 	unsigned char	bp_chaddr[16];	/* client hardware address */
394a5d661aSToomas Soome 	unsigned char	bp_sname[64];	/* server host name */
404a5d661aSToomas Soome 	unsigned char	bp_file[128];	/* boot file name */
414a5d661aSToomas Soome #ifdef SUPPORT_DHCP
424a5d661aSToomas Soome #define BOOTP_VENDSIZE 312
434a5d661aSToomas Soome #else
444a5d661aSToomas Soome #define BOOTP_VENDSIZE 64
454a5d661aSToomas Soome #endif
464a5d661aSToomas Soome 	unsigned char	bp_vend[BOOTP_VENDSIZE];	/* vendor-specific area */
474a5d661aSToomas Soome };
484a5d661aSToomas Soome 
494a5d661aSToomas Soome /*
504a5d661aSToomas Soome  * UDP port numbers, server and client.
514a5d661aSToomas Soome  */
524a5d661aSToomas Soome #define	IPPORT_BOOTPS		67
534a5d661aSToomas Soome #define	IPPORT_BOOTPC		68
544a5d661aSToomas Soome 
554a5d661aSToomas Soome #define BOOTREPLY		2
564a5d661aSToomas Soome #define BOOTREQUEST		1
574a5d661aSToomas Soome 
584a5d661aSToomas Soome 
594a5d661aSToomas Soome /*
604a5d661aSToomas Soome  * Vendor magic cookie (v_magic) for CMU
614a5d661aSToomas Soome  */
624a5d661aSToomas Soome #define VM_CMU		"CMU"
634a5d661aSToomas Soome 
644a5d661aSToomas Soome /*
654a5d661aSToomas Soome  * Vendor magic cookie (v_magic) for RFC1048
664a5d661aSToomas Soome  */
674a5d661aSToomas Soome #define VM_RFC1048	{ 99, 130, 83, 99 }
684a5d661aSToomas Soome 
694a5d661aSToomas Soome 
704a5d661aSToomas Soome 
714a5d661aSToomas Soome /*
724a5d661aSToomas Soome  * RFC1048 tag values used to specify what information is being supplied in
734a5d661aSToomas Soome  * the vendor field of the packet.
744a5d661aSToomas Soome  */
754a5d661aSToomas Soome 
764a5d661aSToomas Soome #define TAG_PAD			((unsigned char)   0)
774a5d661aSToomas Soome #define TAG_SUBNET_MASK		((unsigned char)   1)
784a5d661aSToomas Soome #define TAG_TIME_OFFSET		((unsigned char)   2)
794a5d661aSToomas Soome #define TAG_GATEWAY		((unsigned char)   3)
804a5d661aSToomas Soome #define TAG_TIME_SERVER		((unsigned char)   4)
814a5d661aSToomas Soome #define TAG_NAME_SERVER		((unsigned char)   5)
824a5d661aSToomas Soome #define TAG_DOMAIN_SERVER	((unsigned char)   6)
834a5d661aSToomas Soome #define TAG_LOG_SERVER		((unsigned char)   7)
844a5d661aSToomas Soome #define TAG_COOKIE_SERVER	((unsigned char)   8)
854a5d661aSToomas Soome #define TAG_LPR_SERVER		((unsigned char)   9)
864a5d661aSToomas Soome #define TAG_IMPRESS_SERVER	((unsigned char)  10)
874a5d661aSToomas Soome #define TAG_RLP_SERVER		((unsigned char)  11)
884a5d661aSToomas Soome #define TAG_HOSTNAME		((unsigned char)  12)
894a5d661aSToomas Soome #define TAG_BOOTSIZE		((unsigned char)  13)
904a5d661aSToomas Soome #define TAG_DUMPFILE		((unsigned char)  14)
914a5d661aSToomas Soome #define TAG_DOMAINNAME		((unsigned char)  15)
924a5d661aSToomas Soome #define TAG_SWAPSERVER		((unsigned char)  16)
934a5d661aSToomas Soome #define TAG_ROOTPATH		((unsigned char)  17)
94e1bd2803SToomas Soome #define	TAG_INTF_MTU		((unsigned char)  26)
954a5d661aSToomas Soome 
964a5d661aSToomas Soome #ifdef SUPPORT_DHCP
974a5d661aSToomas Soome #define TAG_REQ_ADDR		((unsigned char)  50)
984a5d661aSToomas Soome #define TAG_LEASETIME		((unsigned char)  51)
994a5d661aSToomas Soome #define TAG_OVERLOAD		((unsigned char)  52)
1004a5d661aSToomas Soome #define TAG_DHCP_MSGTYPE	((unsigned char)  53)
1014a5d661aSToomas Soome #define TAG_SERVERID		((unsigned char)  54)
1024a5d661aSToomas Soome #define TAG_PARAM_REQ		((unsigned char)  55)
1034a5d661aSToomas Soome #define TAG_MSG			((unsigned char)  56)
1044a5d661aSToomas Soome #define TAG_MAXSIZE		((unsigned char)  57)
1054a5d661aSToomas Soome #define TAG_T1			((unsigned char)  58)
1064a5d661aSToomas Soome #define TAG_T2			((unsigned char)  59)
1074a5d661aSToomas Soome #define TAG_CLASSID		((unsigned char)  60)
1084a5d661aSToomas Soome #define TAG_CLIENTID		((unsigned char)  61)
109*be960eccSToomas Soome #define TAG_USER_CLASS		((unsigned char)  77)
1104a5d661aSToomas Soome #endif
1114a5d661aSToomas Soome 
1124a5d661aSToomas Soome #define TAG_END			((unsigned char) 255)
1134a5d661aSToomas Soome 
1144a5d661aSToomas Soome #ifdef SUPPORT_DHCP
1154a5d661aSToomas Soome #define DHCPDISCOVER 1
1164a5d661aSToomas Soome #define DHCPOFFER 2
1174a5d661aSToomas Soome #define DHCPREQUEST 3
1184a5d661aSToomas Soome #define DHCPDECLINE 4
1194a5d661aSToomas Soome #define DHCPACK 5
1204a5d661aSToomas Soome #define DHCPNAK 6
1214a5d661aSToomas Soome #define DHCPRELEASE 7
1224a5d661aSToomas Soome #endif
1234a5d661aSToomas Soome 
1244a5d661aSToomas Soome /*
1254a5d661aSToomas Soome  * "vendor" data permitted for CMU bootp clients.
1264a5d661aSToomas Soome  */
1274a5d661aSToomas Soome 
1284a5d661aSToomas Soome struct cmu_vend {
1294a5d661aSToomas Soome 	unsigned char	v_magic[4];	/* magic number */
1304a5d661aSToomas Soome 	unsigned int	v_flags;	/* flags/opcodes, etc. */
1314a5d661aSToomas Soome 	struct in_addr	v_smask;	/* Subnet mask */
1324a5d661aSToomas Soome 	struct in_addr	v_dgate;	/* Default gateway */
1334a5d661aSToomas Soome 	struct in_addr	v_dns1, v_dns2; /* Domain name servers */
1344a5d661aSToomas Soome 	struct in_addr	v_ins1, v_ins2; /* IEN-116 name servers */
1354a5d661aSToomas Soome 	struct in_addr	v_ts1, v_ts2;	/* Time servers */
1364a5d661aSToomas Soome 	unsigned char	v_unused[25];	/* currently unused */
1374a5d661aSToomas Soome };
1384a5d661aSToomas Soome 
1394a5d661aSToomas Soome 
1404a5d661aSToomas Soome /* v_flags values */
1414a5d661aSToomas Soome #define VF_SMASK	1	/* Subnet mask field contains valid data */
1427b0ff4b9SToomas Soome 
14359dfa57dSToomas Soome /* cached bootp response/dhcp ack */
14459dfa57dSToomas Soome extern struct bootp *bootp_response;
1457b2a1233SToomas Soome extern size_t bootp_response_size;
14659dfa57dSToomas Soome 
1477b0ff4b9SToomas Soome #endif /* _BOOTP_H_ */
148