Home | History | Annotate | Line # | Download | only in common
      1  1.1    gwr /************************************************************************
      2  1.1    gwr           Copyright 1988, 1991 by Carnegie Mellon University
      3  1.1    gwr 
      4  1.1    gwr                           All Rights Reserved
      5  1.1    gwr 
      6  1.1    gwr Permission to use, copy, modify, and distribute this software and its
      7  1.1    gwr documentation for any purpose and without fee is hereby granted, provided
      8  1.1    gwr that the above copyright notice appear in all copies and that both that
      9  1.1    gwr copyright notice and this permission notice appear in supporting
     10  1.1    gwr documentation, and that the name of Carnegie Mellon University not be used
     11  1.1    gwr in advertising or publicity pertaining to distribution of the software
     12  1.1    gwr without specific, written prior permission.
     13  1.1    gwr 
     14  1.1    gwr CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
     15  1.1    gwr SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
     16  1.1    gwr IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
     17  1.1    gwr DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
     18  1.1    gwr PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
     19  1.1    gwr ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
     20  1.1    gwr SOFTWARE.
     21  1.1    gwr ************************************************************************/
     22  1.1    gwr 
     23  1.1    gwr /*
     24  1.1    gwr  * Bootstrap Protocol (BOOTP).  RFC951 and RFC1395.
     25  1.1    gwr  *
     26  1.4  lukem  * $NetBSD: bootp.h,v 1.4 1997/10/18 04:36:52 lukem Exp $
     27  1.2    gwr  *
     28  1.1    gwr  *
     29  1.1    gwr  * This file specifies the "implementation-independent" BOOTP protocol
     30  1.1    gwr  * information which is common to both client and server.
     31  1.1    gwr  *
     32  1.1    gwr  */
     33  1.1    gwr 
     34  1.1    gwr #include "bptypes.h"	/* for int32, u_int32 */
     35  1.1    gwr 
     36  1.1    gwr #define BP_CHADDR_LEN	 16
     37  1.1    gwr #define BP_SNAME_LEN	 64
     38  1.1    gwr #define BP_FILE_LEN	128
     39  1.1    gwr #define BP_VEND_LEN	 64
     40  1.1    gwr #define BP_MINPKTSZ	300	/* to check sizeof(struct bootp) */
     41  1.1    gwr 
     42  1.1    gwr struct bootp {
     43  1.1    gwr     unsigned char    bp_op;			/* packet opcode type */
     44  1.1    gwr     unsigned char    bp_htype;			/* hardware addr type */
     45  1.1    gwr     unsigned char    bp_hlen;			/* hardware addr length */
     46  1.1    gwr     unsigned char    bp_hops;			/* gateway hops */
     47  1.3    cgd     u_int32	     bp_xid;			/* transaction ID */
     48  1.1    gwr     unsigned short   bp_secs;			/* seconds since boot began */
     49  1.2    gwr     unsigned short   bp_flags;			/* RFC1532 broadcast, etc. */
     50  1.1    gwr     struct in_addr   bp_ciaddr;			/* client IP address */
     51  1.1    gwr     struct in_addr   bp_yiaddr;			/* 'your' IP address */
     52  1.1    gwr     struct in_addr   bp_siaddr;			/* server IP address */
     53  1.1    gwr     struct in_addr   bp_giaddr;			/* gateway IP address */
     54  1.1    gwr     unsigned char    bp_chaddr[BP_CHADDR_LEN];	/* client hardware address */
     55  1.1    gwr     char	     bp_sname[BP_SNAME_LEN];	/* server host name */
     56  1.1    gwr     char	     bp_file[BP_FILE_LEN];	/* boot file name */
     57  1.1    gwr     unsigned char    bp_vend[BP_VEND_LEN];	/* vendor-specific area */
     58  1.1    gwr     /* note that bp_vend can be longer, extending to end of packet. */
     59  1.1    gwr };
     60  1.1    gwr 
     61  1.1    gwr /*
     62  1.1    gwr  * UDP port numbers, server and client.
     63  1.1    gwr  */
     64  1.1    gwr #define	IPPORT_BOOTPS		67
     65  1.1    gwr #define	IPPORT_BOOTPC		68
     66  1.1    gwr 
     67  1.1    gwr #define BOOTREPLY		2
     68  1.1    gwr #define BOOTREQUEST		1
     69  1.1    gwr 
     70  1.1    gwr /*
     71  1.1    gwr  * Hardware types from Assigned Numbers RFC.
     72  1.1    gwr  */
     73  1.1    gwr #define HTYPE_ETHERNET		  1
     74  1.1    gwr #define HTYPE_EXP_ETHERNET	  2
     75  1.1    gwr #define HTYPE_AX25		  3
     76  1.1    gwr #define HTYPE_PRONET		  4
     77  1.1    gwr #define HTYPE_CHAOS		  5
     78  1.1    gwr #define HTYPE_IEEE802		  6
     79  1.1    gwr #define HTYPE_ARCNET		  7
     80  1.1    gwr 
     81  1.1    gwr /*
     82  1.1    gwr  * Vendor magic cookie (v_magic) for CMU
     83  1.1    gwr  */
     84  1.1    gwr #define VM_CMU		"CMU"
     85  1.1    gwr 
     86  1.1    gwr /*
     87  1.1    gwr  * Vendor magic cookie (v_magic) for RFC1048
     88  1.1    gwr  */
     89  1.1    gwr #define VM_RFC1048	{ 99, 130, 83, 99 }
     90  1.1    gwr 
     91  1.1    gwr 
     92  1.1    gwr 
     94  1.1    gwr /*
     95  1.1    gwr  * Tag values used to specify what information is being supplied in
     96  1.1    gwr  * the vendor (options) data area of the packet.
     97  1.1    gwr  */
     98  1.1    gwr /* RFC 1048 */
     99  1.1    gwr #define TAG_END			((unsigned char) 255)
    100  1.1    gwr #define TAG_PAD			((unsigned char)   0)
    101  1.1    gwr #define TAG_SUBNET_MASK		((unsigned char)   1)
    102  1.1    gwr #define TAG_TIME_OFFSET		((unsigned char)   2)
    103  1.1    gwr #define TAG_GATEWAY		((unsigned char)   3)
    104  1.1    gwr #define TAG_TIME_SERVER		((unsigned char)   4)
    105  1.1    gwr #define TAG_NAME_SERVER		((unsigned char)   5)
    106  1.1    gwr #define TAG_DOMAIN_SERVER	((unsigned char)   6)
    107  1.1    gwr #define TAG_LOG_SERVER		((unsigned char)   7)
    108  1.1    gwr #define TAG_COOKIE_SERVER	((unsigned char)   8)
    109  1.1    gwr #define TAG_LPR_SERVER		((unsigned char)   9)
    110  1.1    gwr #define TAG_IMPRESS_SERVER	((unsigned char)  10)
    111  1.1    gwr #define TAG_RLP_SERVER		((unsigned char)  11)
    112  1.1    gwr #define TAG_HOST_NAME		((unsigned char)  12)
    113  1.1    gwr #define TAG_BOOT_SIZE		((unsigned char)  13)
    114  1.1    gwr /* RFC 1395 */
    115  1.1    gwr #define TAG_DUMP_FILE		((unsigned char)  14)
    116  1.1    gwr #define TAG_DOMAIN_NAME		((unsigned char)  15)
    117  1.1    gwr #define TAG_SWAP_SERVER		((unsigned char)  16)
    118  1.1    gwr #define TAG_ROOT_PATH		((unsigned char)  17)
    119  1.1    gwr /* RFC 1497 */
    120  1.1    gwr #define TAG_EXTEN_FILE		((unsigned char)  18)
    121  1.1    gwr /* RFC 1533 */
    122  1.1    gwr #define TAG_NIS_DOMAIN		((unsigned char)  40)
    123  1.1    gwr #define TAG_NIS_SERVER		((unsigned char)  41)
    124  1.2    gwr #define TAG_NTP_SERVER		((unsigned char)  42)
    125  1.2    gwr /* DHCP maximum message size. */
    126  1.2    gwr #define TAG_MAX_MSGSZ		((unsigned char)  57)
    127  1.1    gwr 
    128  1.1    gwr /* XXX - Add new tags here */
    129  1.1    gwr 
    130  1.1    gwr 
    131  1.1    gwr /*
    132  1.1    gwr  * "vendor" data permitted for CMU bootp clients.
    133  1.1    gwr  */
    134  1.1    gwr 
    135  1.1    gwr struct cmu_vend {
    136  1.3    cgd 	char		v_magic[4];	/* magic number */
    137  1.1    gwr 	u_int32		v_flags;	/* flags/opcodes, etc. */
    138  1.1    gwr 	struct in_addr 	v_smask;	/* Subnet mask */
    139  1.1    gwr 	struct in_addr 	v_dgate;	/* Default gateway */
    140  1.1    gwr 	struct in_addr	v_dns1, v_dns2; /* Domain name servers */
    141  1.1    gwr 	struct in_addr	v_ins1, v_ins2; /* IEN-116 name servers */
    142  1.1    gwr 	struct in_addr	v_ts1, v_ts2;	/* Time servers */
    143  1.1    gwr 	int32		v_unused[6];	/* currently unused */
    144  1.1    gwr };
    145  1.1    gwr 
    146  1.1    gwr 
    147  1.1    gwr /* v_flags values */
    148             #define VF_SMASK	1	/* Subnet mask field contains valid data */
    149