bootp.h

Go to the documentation of this file.
00001 #ifndef _BOOTP_H
00002 #define _BOOTP_H
00003 
00004 #ifdef  ALTERNATE_DHCP_PORTS_1067_1068
00005 #undef  NON_STANDARD_BOOTP_SERVER
00006 #define NON_STANDARD_BOOTP_SERVER       1067
00007 #undef  NON_STANDARD_BOOTP_CLIENT
00008 #define NON_STANDARD_BOOTP_CLIENT       1068
00009 #endif
00010 
00011 #ifdef  NON_STANDARD_BOOTP_SERVER
00012 #define BOOTP_SERVER    NON_STANDARD_BOOTP_SERVER
00013 #else
00014 #define BOOTP_SERVER    67
00015 #endif
00016 #ifdef  NON_STANDARD_BOOTP_CLIENT
00017 #define BOOTP_CLIENT    NON_STANDARD_BOOTP_CLIENT
00018 #else
00019 #define BOOTP_CLIENT    68
00020 #endif
00021 #define PROXYDHCP_SERVER        4011 /* For PXE */
00022 
00023 #define BOOTP_REQUEST   1
00024 #define BOOTP_REPLY     2
00025 
00026 #define TAG_LEN(p)              (*((p)+1))
00027 #define RFC1533_COOKIE          99, 130, 83, 99
00028 #define RFC1533_PAD             0
00029 #define RFC1533_NETMASK         1
00030 #define RFC1533_TIMEOFFSET      2
00031 #define RFC1533_GATEWAY         3
00032 #define RFC1533_TIMESERVER      4
00033 #define RFC1533_IEN116NS        5
00034 #define RFC1533_DNS             6
00035 #define RFC1533_LOGSERVER       7
00036 #define RFC1533_COOKIESERVER    8
00037 #define RFC1533_LPRSERVER       9
00038 #define RFC1533_IMPRESSSERVER   10
00039 #define RFC1533_RESOURCESERVER  11
00040 #define RFC1533_HOSTNAME        12
00041 #define RFC1533_BOOTFILESIZE    13
00042 #define RFC1533_MERITDUMPFILE   14
00043 #define RFC1533_DOMAINNAME      15
00044 #define RFC1533_SWAPSERVER      16
00045 #define RFC1533_ROOTPATH        17
00046 #define RFC1533_EXTENSIONPATH   18
00047 #define RFC1533_IPFORWARDING    19
00048 #define RFC1533_IPSOURCEROUTING 20
00049 #define RFC1533_IPPOLICYFILTER  21
00050 #define RFC1533_IPMAXREASSEMBLY 22
00051 #define RFC1533_IPTTL           23
00052 #define RFC1533_IPMTU           24
00053 #define RFC1533_IPMTUPLATEAU    25
00054 #define RFC1533_INTMTU          26
00055 #define RFC1533_INTLOCALSUBNETS 27
00056 #define RFC1533_INTBROADCAST    28
00057 #define RFC1533_INTICMPDISCOVER 29
00058 #define RFC1533_INTICMPRESPOND  30
00059 #define RFC1533_INTROUTEDISCOVER 31
00060 #define RFC1533_INTROUTESOLICIT 32
00061 #define RFC1533_INTSTATICROUTES 33
00062 #define RFC1533_LLTRAILERENCAP  34
00063 #define RFC1533_LLARPCACHETMO   35
00064 #define RFC1533_LLETHERNETENCAP 36
00065 #define RFC1533_TCPTTL          37
00066 #define RFC1533_TCPKEEPALIVETMO 38
00067 #define RFC1533_TCPKEEPALIVEGB  39
00068 #define RFC1533_NISDOMAIN       40
00069 #define RFC1533_NISSERVER       41
00070 #define RFC1533_NTPSERVER       42
00071 #define RFC1533_VENDOR          43
00072 #define RFC1533_NBNS            44
00073 #define RFC1533_NBDD            45
00074 #define RFC1533_NBNT            46
00075 #define RFC1533_NBSCOPE         47
00076 #define RFC1533_XFS             48
00077 #define RFC1533_XDM             49
00078 #ifndef NO_DHCP_SUPPORT
00079 #define RFC2132_REQ_ADDR        50
00080 #define RFC2132_MSG_TYPE        53
00081 #define RFC2132_SRV_ID          54
00082 #define RFC2132_PARAM_LIST      55
00083 #define RFC2132_MAX_SIZE        57
00084 #define RFC2132_VENDOR_CLASS_ID 60
00085 #define RFC2132_CLIENT_ID       61
00086 #define RFC2132_TFTP_SERVER_NAME 66
00087 #define RFC2132_BOOTFILE_NAME   67
00088 #define RFC3004_USER_CLASS      77
00089 
00090 #ifdef PXE_DHCP_STRICT
00091 /*
00092  * The following options are acknowledged in RFC3679 because they are
00093  * widely used by PXE implementations, but have never been properly
00094  * allocated. Despite other PXE options being correctly packed in a
00095  * vendor encapsulated field, these are exposed. Sigh.  Note that the
00096  * client UUID (option 97) is also noted in the PXE spec as using
00097  * option 61.
00098  */
00099 #define RFC3679_PXE_CLIENT_ARCH 93
00100 #define RFC3679_PXE_CLIENT_NDI  94
00101 #define RFC3679_PXE_CLIENT_UUID 97
00102 
00103 /* The lengths are fixed. */
00104 #define RFC3679_PXE_CLIENT_ARCH_LENGTH 2
00105 #define RFC3679_PXE_CLIENT_NDI_LENGTH 3
00106 #define RFC3679_PXE_CLIENT_UUID_LENGTH 17
00107 
00108 /*
00109  * Values of RFC3679_PXE_CLIENT_ARCH can apparently be one of the
00110  * following, according to the PXE spec. The spec only actually
00111  * described the 2nd octet, not the first. Duh... assume 0.
00112  */
00113 #define RFC3679_PXE_CLIENT_ARCH_IAX86PC   0,0
00114 #define RFC3679_PXE_CLIENT_ARCH_NECPC98   0,1
00115 #define RFC3679_PXE_CLIENT_ARCH_IA64PC    0,2
00116 #define RFC3679_PXE_CLIENT_ARCH_DECALPHA  0,3
00117 #define RFC3679_PXE_CLIENT_ARCH_ARCX86    0,4
00118 #define RFC3679_PXE_CLIENT_ARCH_INTELLEAN 0,5
00119 
00120 /* 
00121  * Only one valid value of NDI type (must be 1) and UNDI version (must
00122  * be 2.1)
00123  */
00124 #define RFC3679_PXE_CLIENT_NDI_21 1,2,1
00125 
00126 /*
00127  * UUID - type must be 1 and then 16 octets of UID, as with the client ID.
00128  * The value is a default for testing only
00129  */
00130 #define RFC3679_PXE_CLIENT_UUID_TYPE 0
00131 #warning "UUID is a default for testing ONLY!"
00132 #define RFC3679_PXE_CLIENT_UUID_DEFAULT \
00133         RFC3679_PXE_CLIENT_UUID_TYPE, \
00134         0xDE,0xAD,0xBE,0xEF, \
00135         0xDE,0xAD,0xBE,0xEF, \
00136         0xDE,0xAD,0xBE,0xEF, \
00137         0xDE,0xAD,0xBE,0xEF
00138 /*
00139  * The Vendor Class ID. Note that the Arch and UNDI version numbers
00140  * are fixed and must be same as the ARCH and NDI above.
00141  */
00142 #define RFC2132_VENDOR_CLASS_ID_PXE_LENGTH 32
00143 #define RFC2132_VENDOR_CLASS_ID_PXE \
00144         'P','X','E','C','l','i','e','n','t',':', \
00145         'A','r','c','h',':','0','0','0','0','0',':', \
00146         'U','N','D','I',':','0','0','2','0','0','1'
00147 
00148 /*
00149  * The following vendor options are required in the PXE spec to pull
00150  * options for the *next* image. The PXE spec doesn't help us with
00151  * this (like explaining why).
00152  */
00153 #define RFC1533_VENDOR_PXE_OPT128 128
00154 #define RFC1533_VENDOR_PXE_OPT129 129
00155 #define RFC1533_VENDOR_PXE_OPT130 130
00156 #define RFC1533_VENDOR_PXE_OPT131 131
00157 #define RFC1533_VENDOR_PXE_OPT132 132
00158 #define RFC1533_VENDOR_PXE_OPT133 133
00159 #define RFC1533_VENDOR_PXE_OPT134 134
00160 #define RFC1533_VENDOR_PXE_OPT135 135
00161 
00162 #endif /* PXE_DHCP_STRICT */
00163 
00164 #define DHCPDISCOVER            1
00165 #define DHCPOFFER               2
00166 #define DHCPREQUEST             3
00167 #define DHCPACK                 5
00168 #endif  /* NO_DHCP_SUPPORT */
00169 
00170 #define RFC1533_VENDOR_MAJOR    0
00171 #define RFC1533_VENDOR_MINOR    0
00172 
00173 #define RFC1533_VENDOR_MAGIC    128
00174 #define RFC1533_VENDOR_ADDPARM  129
00175 #define RFC1533_VENDOR_ETHDEV   130
00176 /* We should really apply for an official Etherboot encap option */
00177 #define RFC1533_VENDOR_ETHERBOOT_ENCAP 150
00178 /* I'll leave it to FREEBSD to decide if they want to renumber */
00179 #ifdef  IMAGE_FREEBSD
00180 #define RFC1533_VENDOR_HOWTO    132
00181 #define RFC1533_VENDOR_KERNEL_ENV    133
00182 #endif
00183 #define RFC1533_VENDOR_NIC_DEV_ID 175
00184 #define RFC1533_VENDOR_ARCH     177
00185 
00186 #define RFC1533_END             255
00187 
00188 #define BOOTP_VENDOR_LEN        64
00189 #ifndef NO_DHCP_SUPPORT
00190 #define DHCP_OPT_LEN            312
00191 #endif  /* NO_DHCP_SUPPORT */
00192 
00193 /* Format of a bootp packet */
00194 struct bootp_t {
00195         uint8_t  bp_op;
00196         uint8_t  bp_htype;
00197         uint8_t  bp_hlen;
00198         uint8_t  bp_hops;
00199         uint32_t bp_xid;
00200         uint16_t bp_secs;
00201         uint16_t unused;
00202         in_addr bp_ciaddr;
00203         in_addr bp_yiaddr;
00204         in_addr bp_siaddr;
00205         in_addr bp_giaddr;
00206         uint8_t  bp_hwaddr[16];
00207         uint8_t  bp_sname[64];
00208         char     bp_file[128];
00209 #ifdef  NO_DHCP_SUPPORT
00210         uint8_t  bp_vend[BOOTP_VENDOR_LEN];
00211 #else
00212         uint8_t  bp_vend[DHCP_OPT_LEN];
00213 #endif  /* NO_DHCP_SUPPORT */
00214 };
00215 
00216 /* Format of a bootp IP packet */
00217 struct bootpip_t
00218 {
00219         struct iphdr ip;
00220         struct udphdr udp;
00221         struct bootp_t bp;
00222 };
00223 
00224 /* Format of bootp packet with extensions */
00225 struct bootpd_t {
00226         struct bootp_t bootp_reply;
00227         uint8_t bootp_extension[MAX_BOOTP_EXTLEN];
00228 };
00229 
00230 #endif  /* _BOOTP_H */

Generated on Tue Apr 6 20:01:06 2010 for gPXE by  doxygen 1.5.7.1