summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/dhcp.h
diff options
context:
space:
mode:
authorMichael Brown2009-01-31 08:36:05 +0100
committerMichael Brown2009-02-01 02:21:40 +0100
commite65afc4b10552ec9ac7de2f0d924b96bc71aaad0 (patch)
tree36e528a6d947aa8701208953e74cd496728955b4 /src/include/gpxe/dhcp.h
parent[settings] Avoid duplicate settings block names (diff)
downloadipxe-e65afc4b10552ec9ac7de2f0d924b96bc71aaad0.tar.gz
ipxe-e65afc4b10552ec9ac7de2f0d924b96bc71aaad0.tar.xz
ipxe-e65afc4b10552ec9ac7de2f0d924b96bc71aaad0.zip
[dhcp] Split PXE menuing code out of dhcp.c
The DHCP client code now implements only the mechanism of the DHCP and PXE Boot Server protocols. Boot Server Discovery can be initiated manually using the "pxebs" command. The menuing code is separated out into a user-level function on a par with boot_root_path(), and is entered in preference to a normal filename boot if the DHCP vendor class is "PXEClient" and the PXE boot menu option exists.
Diffstat (limited to 'src/include/gpxe/dhcp.h')
-rw-r--r--src/include/gpxe/dhcp.h90
1 files changed, 79 insertions, 11 deletions
diff --git a/src/include/gpxe/dhcp.h b/src/include/gpxe/dhcp.h
index d49ba7fd..2fddb404 100644
--- a/src/include/gpxe/dhcp.h
+++ b/src/include/gpxe/dhcp.h
@@ -12,12 +12,12 @@
#include <gpxe/list.h>
#include <gpxe/refcnt.h>
#include <gpxe/tables.h>
+#include <gpxe/uuid.h>
+#include <gpxe/netdevice.h>
-struct net_device;
struct job_interface;
struct dhcp_options;
struct dhcp_packet;
-struct dhcp_pxe_boot_menu_item;
/** BOOTP/DHCP server port */
#define BOOTPS_PORT 67
@@ -88,12 +88,53 @@ struct dhcp_pxe_boot_menu_item;
/** PXE boot menu */
#define DHCP_PXE_BOOT_MENU DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 9 )
+/** PXE boot menu */
+struct dhcp_pxe_boot_menu {
+ /** "Type" */
+ uint16_t type;
+ /** Description length */
+ uint8_t desc_len;
+ /** Description */
+ char desc[0];
+} __attribute__ (( packed ));
+
/** PXE boot menu prompt */
#define DHCP_PXE_BOOT_MENU_PROMPT DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 10 )
+/** PXE boot menu prompt */
+struct dhcp_pxe_boot_menu_prompt {
+ /** Timeout
+ *
+ * A value of 0 means "time out immediately and select first
+ * boot item, without displaying the prompt". A value of 255
+ * means "display menu immediately with no timeout". Any
+ * other value means "display prompt, wait this many seconds
+ * for keypress, if key is F8, display menu, otherwise select
+ * first boot item".
+ */
+ uint8_t timeout;
+ /** Prompt to press F8 */
+ char prompt[0];
+} __attribute__ (( packed ));
+
/** PXE boot menu item */
#define DHCP_PXE_BOOT_MENU_ITEM DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 71 )
+/** PXE boot menu item */
+struct dhcp_pxe_boot_menu_item {
+ /** "Type"
+ *
+ * This field actually identifies the specific boot server (or
+ * cluster of boot servers offering identical boot files).
+ */
+ uint16_t type;
+ /** "Layer"
+ *
+ * Just don't ask.
+ */
+ uint16_t layer;
+} __attribute__ (( packed ));
+
/** Requested IP address */
#define DHCP_REQUESTED_ADDRESS 50
@@ -140,6 +181,14 @@ struct dhcp_pxe_boot_menu_item;
/** Client identifier */
#define DHCP_CLIENT_ID 61
+/** Client identifier */
+struct dhcp_client_id {
+ /** Link-layer protocol */
+ uint8_t ll_proto;
+ /** Link-layer address */
+ uint8_t ll_addr[MAX_LL_ADDR_LEN];
+} __attribute__ (( packed ));
+
/** TFTP server name
*
* This option replaces the fixed "sname" field, when that field is
@@ -163,6 +212,16 @@ struct dhcp_pxe_boot_menu_item;
/** UUID client identifier */
#define DHCP_CLIENT_UUID 97
+/** UUID client identifier */
+struct dhcp_client_uuid {
+ /** Identifier type */
+ uint8_t type;
+ /** UUID */
+ union uuid uuid;
+} __attribute__ (( packed ));
+
+#define DHCP_CLIENT_UUID_TYPE 0
+
/** Etherboot-specific encapsulated options
*
* This encapsulated options field is used to contain all options
@@ -213,7 +272,7 @@ struct dhcp_pxe_boot_menu_item;
/** Skip PXE DHCP protocol extensions such as ProxyDHCP
*
* If set to a non-zero value, gPXE will not wait for ProxyDHCP offers
- * and will ignore any PXE-specific DHCP offers that it receives.
+ * and will ignore any PXE-specific DHCP options that it receives.
*/
#define DHCP_EB_NO_PXEDHCP DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb0 )
@@ -230,6 +289,16 @@ struct dhcp_pxe_boot_menu_item;
*/
#define DHCP_EB_BUS_ID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb1 )
+/** Network device descriptor */
+struct dhcp_netdev_desc {
+ /** Bus type ID */
+ uint8_t type;
+ /** Vendor ID */
+ uint16_t vendor;
+ /** Device ID */
+ uint16_t device;
+} __attribute__ (( packed ));
+
/** BIOS drive number
*
* This is the drive number for a drive emulated via INT 13. 0x80 is
@@ -480,13 +549,13 @@ struct dhcphdr {
*/
#define DHCP_MIN_LEN 552
-/** Maximum time that we will wait for ProxyDHCP responses */
-#define PROXYDHCP_WAIT_TIME ( 2 * TICKS_PER_SEC )
-
/** Timeouts for sending DHCP packets */
#define DHCP_MIN_TIMEOUT ( 1 * TICKS_PER_SEC )
#define DHCP_MAX_TIMEOUT ( 10 * TICKS_PER_SEC )
+/** Maximum time that we will wait for ProxyDHCP responses */
+#define PROXYDHCP_MAX_TIMEOUT ( 2 * TICKS_PER_SEC )
+
/** Settings block name used for DHCP responses */
#define DHCP_SETTINGS_NAME "dhcp"
@@ -494,19 +563,18 @@ struct dhcphdr {
#define PROXYDHCP_SETTINGS_NAME "proxydhcp"
/** Setting block name used for BootServerDHCP responses */
-#define BSDHCP_SETTINGS_NAME "bs"
+#define PXEBS_SETTINGS_NAME "pxebs"
extern int dhcp_create_packet ( struct dhcp_packet *dhcppkt,
struct net_device *netdev, uint8_t msgtype,
- struct dhcp_options *options,
+ const void *options, size_t options_len,
void *data, size_t max_len );
extern int dhcp_create_request ( struct dhcp_packet *dhcppkt,
struct net_device *netdev,
unsigned int msgtype, struct in_addr ciaddr,
- struct in_addr server,
- struct in_addr requested_ip,
- struct dhcp_pxe_boot_menu_item *menu_item,
void *data, size_t max_len );
extern int start_dhcp ( struct job_interface *job, struct net_device *netdev );
+extern int start_pxebs ( struct job_interface *job, struct net_device *netdev,
+ struct in_addr pxe_server, unsigned int pxe_type );
#endif /* _GPXE_DHCP_H */