--- /dev/null
+/** @file\r
+ EFI_DHCP4_PROTOCOL as defined in UEFI 2.0.\r
+ EFI_DHCP4_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.\r
+ These protocols are used to collect configuration information for the EFI IPv4 Protocol \r
+ drivers and to provide DHCPv4 server and PXE boot server discovery services.\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. This program and the accompanying materials \r
+ are licensed and made available under the terms and conditions of the BSD License \r
+ which accompanies this distribution. The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php \r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+ Module Name: DHCP4.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_DHCP4_PROTOCOL_H__\r
+#define __EFI_DHCP4_PROTOCOL_H__\r
+\r
+#define EFI_DHCP4_PROTOCOL_GUID \\r
+ { \\r
+ 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \\r
+ }\r
+\r
+#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \\r
+ { \\r
+ 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \\r
+ }\r
+ \r
+typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL;\r
+\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT8 OpCode;\r
+ UINT8 Length;\r
+ UINT8 Data[1];\r
+} EFI_DHCP4_PACKET_OPTION;\r
+#pragma pack()\r
+\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT8 OpCode;\r
+ UINT8 HwType;\r
+ UINT8 HwAddrLen;\r
+ UINT8 Hops;\r
+ UINT32 Xid;\r
+ UINT16 Seconds;\r
+ UINT16 Reserved;\r
+ EFI_IPv4_ADDRESS ClientAddr; //Client IP address from client\r
+ EFI_IPv4_ADDRESS YourAddr; //Client IP address from server\r
+ EFI_IPv4_ADDRESS ServerAddr; //IP address of next server in bootstrap \r
+ EFI_IPv4_ADDRESS GatewayAddr; //Relay agent IP address\r
+ UINT8 ClientHwAddr[16]; //Client hardware address\r
+ CHAR8 ServerName[64]; \r
+ CHAR8 BootFileName[128];\r
+}EFI_DHCP4_HEADER;\r
+#pragma pack()\r
+\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT32 Size;\r
+ UINT32 Length;\r
+\r
+ struct {\r
+ EFI_DHCP4_HEADER Header;\r
+ UINT32 Magik;\r
+ UINT8 Option[1];\r
+ } Dhcp4;\r
+} EFI_DHCP4_PACKET;\r
+#pragma pack()\r
+\r
+\r
+typedef enum {\r
+ Dhcp4Stopped = 0x0,\r
+ Dhcp4Init = 0x1,\r
+ Dhcp4Selecting = 0x2,\r
+ Dhcp4Requesting = 0x3,\r
+ Dhcp4Bound = 0x4,\r
+ Dhcp4Renewing = 0x5,\r
+ Dhcp4Rebinding = 0x6,\r
+ Dhcp4InitReboot = 0x7,\r
+ Dhcp4Rebooting = 0x8\r
+} EFI_DHCP4_STATE;\r
+\r
+\r
+typedef enum{\r
+ Dhcp4SendDiscover = 0x01,\r
+ Dhcp4RcvdOffer = 0x02,\r
+ Dhcp4SelectOffer = 0x03,\r
+ Dhcp4SendRequest = 0x04,\r
+ Dhcp4RcvdAck = 0x05,\r
+ Dhcp4RcvdNak = 0x06,\r
+ Dhcp4SendDecline = 0x07,\r
+ Dhcp4BoundCompleted = 0x08,\r
+ Dhcp4EnterRenewing = 0x09,\r
+ Dhcp4EnterRebinding = 0x0a,\r
+ Dhcp4AddressLost = 0x0b,\r
+ Dhcp4Fail = 0x0c\r
+} EFI_DHCP4_EVENT;\r
+\r
+/** \r
+ Callback routine \r
+ \r
+ @param This Pointer to the EFI DHCPv4 Protocol instance that is used to\r
+ configure this callback function. \r
+ @param Context Pointer to the context that is initialized by\r
+ EFI_DHCP4_PROTOCOL.Configure(). \r
+ @param CurrentState The current operational state of the EFI DHCPv4 Protocol\r
+ driver. \r
+ @param Dhcp4Event The event that occurs in the current state, which usually means a\r
+ state transition. \r
+ @param Packet The DHCP packet that is going to be sent or already received. \r
+ @param NewPacket The packet that is used to replace the above Packet.\r
+ \r
+ @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.\r
+ @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol \r
+ driver will continue to wait for more DHCPOFFER packets until the retry\r
+ timeout expires. \r
+ @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and\r
+ return to the Dhcp4Init or Dhcp4InitReboot state. \r
+ \r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_DHCP4_CALLBACK) (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN VOID *Context,\r
+ IN EFI_DHCP4_STATE CurrentState,\r
+ IN EFI_DHCP4_EVENT Dhcp4Event,\r
+ IN EFI_DHCP4_PACKET *Packet OPTIONAL, \r
+ OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL\r
+ );\r
+\r
+\r
+typedef struct {\r
+ UINT32 DiscoverTryCount; \r
+ UINT32 *DiscoverTimeout;\r
+ UINT32 RequestTryCount;\r
+ UINT32 *RequestTimeout;\r
+ EFI_IPv4_ADDRESS ClientAddress;\r
+ EFI_DHCP4_CALLBACK Dhcp4Callback;\r
+ void *CallbackContext;\r
+ UINT32 OptionCount;\r
+ EFI_DHCP4_PACKET_OPTION **OptionList;\r
+} EFI_DHCP4_CONFIG_DATA;\r
+\r
+\r
+typedef struct {\r
+ EFI_DHCP4_STATE State;\r
+ EFI_DHCP4_CONFIG_DATA ConfigData;\r
+ EFI_IPv4_ADDRESS ClientAddress;\r
+ EFI_MAC_ADDRESS ClientMacAddress;\r
+ EFI_IPv4_ADDRESS ServerAddress;\r
+ EFI_IPv4_ADDRESS RouterAddress;\r
+ EFI_IPv4_ADDRESS SubnetMask;\r
+ UINT32 LeaseTime;\r
+ EFI_DHCP4_PACKET *ReplyPacket;\r
+} EFI_DHCP4_MODE_DATA;\r
+\r
+\r
+typedef struct {\r
+ EFI_IPv4_ADDRESS ListenAddress;\r
+ EFI_IPv4_ADDRESS SubnetMask;\r
+ UINT16 ListenPort;\r
+} EFI_DHCP4_LISTEN_POINT;\r
+\r
+\r
+typedef struct {\r
+ OUT EFI_STATUS Status;\r
+ IN EFI_EVENT CompletionEvent;\r
+ IN EFI_IPv4_ADDRESS RemoteAddress;\r
+ IN UINT16 RemotePort;\r
+ IN EFI_IPv4_ADDRESS GatewayAddress;\r
+ IN UINT32 ListenPointCount;\r
+ IN EFI_DHCP4_LISTEN_POINT *ListenPoints;\r
+ IN UINT32 TimeoutValue;\r
+ IN EFI_DHCP4_PACKET *Packet;\r
+ OUT UINT32 ResponseCount;\r
+ OUT EFI_DHCP4_PACKET *ResponseList;\r
+} EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN;\r
+\r
+\r
+/**\r
+ Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.\r
+\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+ @param Dhcp4ModeData Pointer to storage for the EFI_DHCP4_MODE_DATA structure.\r
+\r
+ @retval EFI_SUCCESS The mode data was returned.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_DHCP4_GET_MODE_DATA)(\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData\r
+ )\r
+;\r
+\r
+/**\r
+ Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.\r
+\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+ @param Dhcp4CfgData Pointer to the EFI_DHCP4_CONFIG_DATA.\r
+\r
+ @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or\r
+ Dhcp4InitReboot state, if the original state of this driver\r
+ was Dhcp4Stopped and the value of Dhcp4CfgData was\r
+ not NULL. Otherwise, the state was left unchanged.\r
+ @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the\r
+ Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;\r
+ Or onother instance of this EFI DHCPv4 Protocol driver is already\r
+ in a valid configured state.\r
+ @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+ @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_CONFIGURE) (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL\r
+ )\r
+;\r
+\r
+\r
+/**\r
+ Starts the DHCP configuration process.\r
+\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+ @param CompletionEvent If not NULL, indicates the event that will be signaled when the\r
+ EFI DHCPv4 Protocol driver is transferred into the\r
+ Dhcp4Bound state or when the DHCP process is aborted.\r
+ EFI_DHCP4_PROTOCOL.GetModeData() can be called to\r
+ check the completion status. If NULL,\r
+ EFI_DHCP4_PROTOCOL.Start() will wait until the driver\r
+ is transferred into the Dhcp4Bound state or the process fails.\r
+\r
+ @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed\r
+ when CompletionEvent is NULL.\r
+ @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped\r
+ state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+ @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
+ @retval EFI_TIMEOUT The DHCP configuration process failed because no response was\r
+ received from the server within the specified timeout value.\r
+ @retval EFI_ABORTED The user aborted the DHCP process.\r
+ @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the\r
+ DHCP process.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_START) (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN EFI_EVENT CompletionEvent OPTIONAL\r
+ )\r
+;\r
+\r
+/**\r
+ Extends the lease time by sending a request packet.\r
+\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+ @param RebindRequest If TRUE, this function broadcasts the request packets and enters\r
+ the Dhcp4Rebinding state. Otherwise, it sends a unicast\r
+ request packet and enters the Dhcp4Renewing state.\r
+ @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase\r
+ completes or some error occurs.\r
+ EFI_DHCP4_PROTOCOL.GetModeData() can be called to\r
+ check the completion status. If NULL,\r
+ EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait\r
+ until the DHCP process finishes.\r
+\r
+ @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the\r
+ Dhcp4Renewing state or is back to the Dhcp4Bound state.\r
+ @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped\r
+ state. EFI_DHCP4_PROTOCOL.Configure() needs to\r
+ be called.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+ @retval EFI_TIMEOUT There was no response from the server when the try count was\r
+ exceeded.\r
+ @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_RENEW_REBIND) (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN BOOLEAN RebindRequest,\r
+ IN EFI_EVENT CompletionEvent OPTIONAL\r
+ )\r
+; \r
+\r
+/**\r
+ Releases the current address configuration.\r
+\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+ @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_RELEASE) (\r
+ IN EFI_DHCP4_PROTOCOL *This\r
+ )\r
+; \r
+\r
+/**\r
+ Stops the current address configuration.\r
+\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+ \r
+ @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_STOP) (\r
+ IN EFI_DHCP4_PROTOCOL *This\r
+ )\r
+; \r
+\r
+/**\r
+ Builds a DHCP packet, given the options to be appended or deleted or replaced.\r
+\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+ @param SeedPacket Initial packet to be used as a base for building new packet.\r
+ @param DeleteCount Number of opcodes in the DeleteList.\r
+ @param DeleteList List of opcodes to be deleted from the seed packet.\r
+ Ignored if DeleteCount is zero.\r
+ @param AppendCount Number of entries in the OptionList.\r
+ @param AppendList Pointer to a DHCP option list to be appended to SeedPacket.\r
+ If SeedPacket also contains options in this list, they are\r
+ replaced by new options (except pad option). Ignored if\r
+ AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION\r
+ @param NewPacket Pointer to storage for the pointer to the new allocated packet.\r
+ Use the EFI Boot Service FreePool() on the resulting pointer\r
+ when done with the packet.\r
+\r
+ @retval EFI_SUCCESS The new packet was built.\r
+ @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated.\r
+ @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_BUILD) (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN EFI_DHCP4_PACKET *SeedPacket,\r
+ IN UINT32 DeleteCount,\r
+ IN UINT8 *DeleteList OPTIONAL,\r
+ IN UINT32 AppendCount,\r
+ IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,\r
+ OUT EFI_DHCP4_PACKET **NewPacket\r
+ );\r
+; \r
+\r
+/**\r
+ Transmits a DHCP formatted packet and optionally waits for responses.\r
+\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+ @param Token Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.\r
+\r
+ @retval EFI_SUCCESS The packet was successfully queued for transmission.\r
+ @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+ @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call\r
+ this function after collection process completes.\r
+ @retval EFI_NO_MAPPING The default station address is not available yet.\r
+ @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
+ @retval Others Some other unexpected error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_TRANSMIT_RECEIVE) (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token\r
+ )\r
+;\r
+\r
+\r
+/**\r
+ Parses the packed DHCP option data.\r
+\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+ @param Packet Pointer to packet to be parsed.\r
+ @param OptionCount On input, the number of entries in the PacketOptionList.\r
+ On output, the number of entries that were written into the\r
+ PacketOptionList.\r
+ @param PacketOptionList List of packet option entries to be filled in. End option or pad\r
+ options are not included.\r
+\r
+ @retval EFI_SUCCESS The packet was successfully parsed.\r
+ @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+ @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE:\r
+ 1) *OptionCount is smaller than the number of options that\r
+ were found in the Packet.\r
+ 2) PacketOptionList is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_PARSE) (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN EFI_DHCP4_PACKET *Packet,\r
+ IN OUT UINT32 *OptionCount,\r
+ OUT EFI_DHCP4_PACKET_OPTION *PacketOptionList[] OPTIONAL\r
+ )\r
+;\r
+\r
+\r
+struct _EFI_DHCP4_PROTOCOL {\r
+ EFI_DHCP4_GET_MODE_DATA GetModeData;\r
+ EFI_DHCP4_CONFIGURE Configure;\r
+ EFI_DHCP4_START Start;\r
+ EFI_DHCP4_RENEW_REBIND RenewRebind;\r
+ EFI_DHCP4_RELEASE Release;\r
+ EFI_DHCP4_STOP Stop;\r
+ EFI_DHCP4_BUILD Build;\r
+ EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive;\r
+ EFI_DHCP4_PARSE Parse;\r
+};\r
+\r
+extern EFI_GUID gEfiDhcp4ProtocolGuid;\r
+extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid;\r
+\r
+#endif\r