NULL\r
};\r
\r
-EFI_SERVICE_BINDING_PROTOCOL mDhcp4ServiceBindingTemplete = {\r
+EFI_SERVICE_BINDING_PROTOCOL mDhcp4ServiceBindingTemplate = {\r
Dhcp4ServiceBindingCreateChild,\r
Dhcp4ServiceBindingDestroyChild\r
};\r
\r
/**\r
+ This is the declaration of an EFI image entry point. This entry point is\r
+ the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
+ both device drivers and bus drivers.\r
+ \r
Entry point of the DHCP driver to install various protocols.\r
\r
- @param ImageHandle The image handle of the driver.\r
- @param SystemTable The system table.\r
+ @param ImageHandle The firmware allocated handle for the UEFI image.\r
+ @param SystemTable A pointer to the EFI System Table.\r
\r
- @retval EFI_SUCCES if the driver binding and component name protocols are successfully\r
- @retval Others Failed to install the protocols.\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Test to see if DHCP driver supports the ControllerHandle.\r
-\r
- @param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to test\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCES This driver supports this device\r
- @retval other This driver does not support this device\r
+ Test to see if this driver supports ControllerHandle. This service\r
+ is called by the EFI boot service ConnectController(). In\r
+ order to make drivers as small as possible, there are a few calling\r
+ restrictions for this service. ConnectController() must\r
+ follow these calling restrictions. If any other agent wishes to call\r
+ Supported() it must also follow these calling restrictions.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to test\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver supports this device\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+ @retval other This driver does not support this device\r
\r
**/\r
EFI_STATUS\r
\r
/**\r
Destory the DHCP service. The Dhcp4 service may be partly initialized,\r
- or partly destoried. If a resource is destoried, it is marked as so in\r
- case the destory failed and being called again later.\r
+ or partly destroyed. If a resource is destroyed, it is marked as so in\r
+ case the destroy failed and being called again later.\r
\r
@param DhcpSb The DHCP service instance to destory.\r
\r
- @retval EFI_SUCCESS The DHCP service is successfully closed.\r
+ @retval EFI_SUCCESS Always return success.\r
\r
**/\r
EFI_STATUS\r
\r
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource .\r
@retval EFI_SUCCESS The DHCP service instance is created.\r
+ @retval other Other error occurs.\r
\r
**/\r
EFI_STATUS\r
}\r
\r
DhcpSb->Signature = DHCP_SERVICE_SIGNATURE;\r
- DhcpSb->ServiceBinding = mDhcp4ServiceBindingTemplete;\r
DhcpSb->ServiceState = DHCP_UNCONFIGED;\r
DhcpSb->InDestory = FALSE;\r
DhcpSb->Controller = Controller;\r
InitializeListHead (&DhcpSb->Children);\r
DhcpSb->DhcpState = Dhcp4Stopped;\r
DhcpSb->Xid = NET_RANDOM (NetRandomInitSeed ());\r
-\r
+ CopyMem (\r
+ &DhcpSb->ServiceBinding,\r
+ &mDhcp4ServiceBindingTemplate,\r
+ sizeof (EFI_SERVICE_BINDING_PROTOCOL)\r
+ );\r
//\r
// Create various resources, UdpIo, Timer, and get Mac address\r
//\r
\r
\r
/**\r
- Start this driver on ControllerHandle.\r
-\r
- @param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCES This driver is added to ControllerHandle\r
- @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
- @retval other This driver does not support this device\r
+ Start this driver on ControllerHandle. This service is called by the\r
+ EFI boot service ConnectController(). In order to make\r
+ drivers as small as possible, there are a few calling restrictions for\r
+ this service. ConnectController() must follow these\r
+ calling restrictions. If any other agent wishes to call Start() it\r
+ must also follow these calling restrictions.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to bind driver to\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver is added to ControllerHandle\r
+ @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
+ @retval other This driver does not support this device\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Stop this driver on ControllerHandle.\r
-\r
- @param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number\r
- of children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCES This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
+ Stop this driver on ControllerHandle. This service is called by the\r
+ EFI boot service DisconnectController(). In order to\r
+ make drivers as small as possible, there are a few calling\r
+ restrictions for this service. DisconnectController()\r
+ must follow these calling restrictions. If any other agent wishes\r
+ to call Stop() it must also follow these calling restrictions.\r
+ \r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to stop driver on\r
+ @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
+ children is zero stop the entire bus driver.\r
+ @param ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+ @retval EFI_SUCCESS This driver is removed ControllerHandle\r
+ @retval other This driver was not removed from this device\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Initialize a new DHCP child.\r
+ Initialize a new DHCP instance.\r
\r
@param DhcpSb The dhcp service instance\r
@param Instance The dhcp instance to initialize\r
**/\r
VOID\r
DhcpInitProtocol (\r
- IN DHCP_SERVICE *DhcpSb,\r
- IN DHCP_PROTOCOL *Instance\r
+ IN DHCP_SERVICE *DhcpSb,\r
+ IN OUT DHCP_PROTOCOL *Instance\r
)\r
{\r
Instance->Signature = DHCP_PROTOCOL_SIGNATURE;\r
\r
\r
/**\r
- Creates a child handle with a set of DHCP4 services.\r
+ Creates a child handle with a set of I/O services.\r
\r
- @param This Protocol instance pointer.\r
- @param ChildHandle Pointer to the handle of the child to create. If\r
- it is NULL, then a new handle is created. If it\r
- is not NULL, then the DHCP4 services are added to\r
- the existing child handle.\r
+ @param This Protocol instance pointer.\r
+ @param ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
+ then a new handle is created. If it is not NULL, then the\r
+ I/O services are added to the existing child handle.\r
\r
- @retval EFI_SUCCES The child handle was created with the DHCP4\r
- services\r
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to create the child\r
- @retval other The child handle was not created\r
+ @retval EFI_SUCCES The child handle was created with the I/O services\r
+ @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create\r
+ the child\r
+ @retval other The child handle was not created\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Destroys a child handle with a set of DHCP4 services.\r
+ Destroys a child handle with a set of I/O services.\r
\r
- @param This Protocol instance pointer.\r
- @param ChildHandle Handle of the child to destroy\r
+ @param This Protocol instance pointer.\r
+ @param ChildHandle Handle of the child to destroy\r
\r
- @retval EFI_SUCCES The DHCP4 service is removed from the child handle\r
- @retval EFI_UNSUPPORTED The child handle does not support the DHCP4\r
- service\r
- @retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.\r
- @retval EFI_ACCESS_DENIED The child handle could not be destroyed because\r
- its DHCP4 services are being used.\r
- @retval other The child handle was not destroyed\r
+ @retval EFI_SUCCES The I/O services were removed from the child handle\r
+ @retval EFI_UNSUPPORTED The child handle does not support the I/O services\r
+ that are being removed.\r
+ @retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.\r
+ @retval EFI_ACCESS_DENIED The child handle could not be destroyed because its\r
+ I/O services are being used.\r
+ @retval other The child handle was not destroyed\r
\r
**/\r
EFI_STATUS\r
}\r
\r
//\r
- // A child can be destoried more than once. For example,\r
- // Dhcp4DriverBindingStop will destory all of its children.\r
+ // A child can be destroyed more than once. For example,\r
+ // Dhcp4DriverBindingStop will destroy all of its children.\r
// when caller driver is being stopped, it will destory the\r
// dhcp child it opens.\r
//\r
\r
#include "Dhcp4Impl.h"\r
\r
+/**\r
+ Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.\r
+ \r
+ The GetModeData() function returns the current operating mode and cached data\r
+ 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
+EFI_STATUS\r
+EFIAPI\r
+EfiDhcp4GetModeData (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData\r
+ );\r
+\r
+/**\r
+ Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.\r
+\r
+ The Configure() function is used to initialize, change, or reset the operational\r
+ settings of the EFI DHCPv4 Protocol driver for the communication device on which\r
+ the EFI DHCPv4 Service Binding Protocol is installed. This function can be\r
+ successfully called only if both of the following are true:\r
+ * This instance of the EFI DHCPv4 Protocol driver is in the Dhcp4Stopped, Dhcp4Init,\r
+ Dhcp4InitReboot, or Dhcp4Bound states.\r
+ * No other EFI DHCPv4 Protocol driver instance that is controlled by this EFI\r
+ DHCPv4 Service Binding Protocol driver instance has configured this EFI DHCPv4\r
+ Protocol driver.\r
+ When this driver is in the Dhcp4Stopped state, it can transfer into one of the\r
+ following two possible initial states:\r
+ * Dhcp4Init\r
+ * Dhcp4InitReboot\r
+ The driver can transfer into these states by calling Configure() with a non-NULL\r
+ Dhcp4CfgData. The driver will transfer into the appropriate state based on the\r
+ supplied client network address in the ClientAddress parameter and DHCP options\r
+ in the OptionList parameter as described in RFC 2131.\r
+ When Configure() is called successfully while Dhcp4CfgData is set to NULL, the\r
+ default configuring data will be reset in the EFI DHCPv4 Protocol driver and\r
+ the state of the EFI DHCPv4 Protocol driver will not be changed. If one instance\r
+ wants to make it possible for another instance to configure the EFI DHCPv4 Protocol\r
+ driver, it must call this function with Dhcp4CfgData set to NULL.\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
+EFI_STATUS\r
+EFIAPI\r
+EfiDhcp4Configure (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL\r
+ ); \r
+\r
+/**\r
+ Starts the DHCP configuration process.\r
+\r
+ The Start() function starts the DHCP configuration process. This function can\r
+ be called only when the EFI DHCPv4 Protocol driver is in the Dhcp4Init or\r
+ Dhcp4InitReboot state.\r
+ If the DHCP process completes successfully, the state of the EFI DHCPv4 Protocol\r
+ driver will be transferred through Dhcp4Selecting and Dhcp4Requesting to the\r
+ Dhcp4Bound state. The CompletionEvent will then be signaled if it is not NULL.\r
+ If the process aborts, either by the user or by some unexpected network error,\r
+ the state is restored to the Dhcp4Init state. The Start() function can be called\r
+ again to restart the process.\r
+ Refer to RFC 2131 for precise state transitions during this process. At the\r
+ time when each event occurs in this process, the callback function that was set\r
+ by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this\r
+ opportunity to control the 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
+EFI_STATUS\r
+EFIAPI\r
+EfiDhcp4Start (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN EFI_EVENT CompletionEvent OPTIONAL\r
+ );\r
+\r
+/**\r
+ Extends the lease time by sending a request packet.\r
+ \r
+ The RenewRebind() function is used to manually extend the lease time when the\r
+ EFI DHCPv4 Protocol driver is in the Dhcp4Bound state and the lease time has\r
+ not expired yet. This function will send a request packet to the previously\r
+ found server (or to any server when RebindRequest is TRUE) and transfer the\r
+ state into the Dhcp4Renewing state (or Dhcp4Rebinding when RebindingRequest is\r
+ TRUE). When a response is received, the state is returned to Dhcp4Bound.\r
+ If no response is received before the try count is exceeded (the RequestTryCount\r
+ field that is specified in EFI_DHCP4_CONFIG_DATA) but before the lease time that\r
+ was issued by the previous server expires, the driver will return to the Dhcp4Bound\r
+ state and the previous configuration is restored. The outgoing and incoming packets\r
+ can be captured by the EFI_DHCP4_CALLBACK function.\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
+EFI_STATUS\r
+EFIAPI\r
+EfiDhcp4RenewRebind (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN BOOLEAN RebindRequest,\r
+ IN EFI_EVENT CompletionEvent OPTIONAL\r
+ );\r
+\r
+/**\r
+ Releases the current address configuration.\r
+\r
+ The Release() function releases the current configured IP address by doing either\r
+ of the following:\r
+ * Sending a DHCPRELEASE packet when the EFI DHCPv4 Protocol driver is in the\r
+ Dhcp4Bound state\r
+ * Setting the previously assigned IP address that was provided with the\r
+ EFI_DHCP4_PROTOCOL.Configure() function to 0.0.0.0 when the driver is in\r
+ Dhcp4InitReboot state\r
+ After a successful call to this function, the EFI DHCPv4 Protocol driver returns\r
+ to the Dhcp4Init state and any subsequent incoming packets will be discarded silently.\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
+EFI_STATUS\r
+EFIAPI\r
+EfiDhcp4Release (\r
+ IN EFI_DHCP4_PROTOCOL *This\r
+ );\r
+\r
+/**\r
+ Stops the current address configuration.\r
+ \r
+ The Stop() function is used to stop the DHCP configuration process. After this\r
+ function is called successfully, the EFI DHCPv4 Protocol driver is transferred\r
+ into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called\r
+ before DHCP configuration process can be started again. This function can be\r
+ called when the EFI DHCPv4 Protocol driver is in any state.\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
+EFI_STATUS\r
+EFIAPI\r
+EfiDhcp4Stop (\r
+ IN EFI_DHCP4_PROTOCOL *This\r
+ );\r
+\r
+/**\r
+ Builds a DHCP packet, given the options to be appended or deleted or replaced.\r
+\r
+ The Build() function is used to assemble a new packet from the original packet\r
+ by replacing or deleting existing options or appending new options. This function\r
+ does not change any state of the EFI DHCPv4 Protocol driver and can be used at\r
+ any time.\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
+EFI_STATUS\r
+EFIAPI\r
+EfiDhcp4Build (\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
+ Transmits a DHCP formatted packet and optionally waits for responses.\r
+ \r
+ The TransmitReceive() function is used to transmit a DHCP packet and optionally\r
+ wait for the response from servers. This function does not change the state of\r
+ the EFI DHCPv4 Protocol driver and thus can be used at any time.\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
+EFI_STATUS\r
+EFIAPI\r
+EfiDhcp4TransmitReceive (\r
+ IN EFI_DHCP4_PROTOCOL *This,\r
+ IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token\r
+ );\r
+\r
+/**\r
+ Parses the packed DHCP option data.\r
+ \r
+ The Parse() function is used to retrieve the option list from a DHCP packet.\r
+ If *OptionCount isn’t zero, and there is enough space for all the DHCP options\r
+ in the Packet, each element of PacketOptionList is set to point to somewhere in\r
+ the Packet->Dhcp4.Option where a new DHCP option begins. If RFC3396 is supported,\r
+ the caller should reassemble the parsed DHCP options to get the finial result.\r
+ If *OptionCount is zero or there isn’t enough space for all of them, the number\r
+ of DHCP options in the Packet is returned in OptionCount.\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
+EFI_STATUS\r
+EFIAPI\r
+EfiDhcp4Parse (\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
+EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate = {\r
+ EfiDhcp4GetModeData,\r
+ EfiDhcp4Configure,\r
+ EfiDhcp4Start,\r
+ EfiDhcp4RenewRebind,\r
+ EfiDhcp4Release,\r
+ EfiDhcp4Stop,\r
+ EfiDhcp4Build,\r
+ EfiDhcp4TransmitReceive,\r
+ EfiDhcp4Parse\r
+};\r
\r
/**\r
- Get the current operation parameter and lease for the network interface.\r
+ Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.\r
+ \r
+ The GetModeData() function returns the current operating mode and cached data\r
+ packet for the EFI DHCPv4 Protocol driver.\r
\r
- @param This The DHCP protocol instance\r
- @param Dhcp4ModeData The variable to save the DHCP mode data.\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_INVALID_PARAMETER The parameter is invalid\r
- @retval EFI_SUCCESS The Dhcp4ModeData is updated with the current\r
- operation parameter.\r
+ @retval EFI_SUCCESS The mode data was returned.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
\r
**/\r
EFI_STATUS\r
// Caller can use GetModeData to retrieve current DHCP states\r
// no matter whether it is the active child or not.\r
//\r
- Dhcp4ModeData->State = (EFI_DHCP4_STATE) DhcpSb->DhcpState;\r
+ Dhcp4ModeData->State = (EFI_DHCP4_STATE) DhcpSb->DhcpState;\r
CopyMem (&Dhcp4ModeData->ConfigData, &DhcpSb->ActiveConfig, sizeof (Dhcp4ModeData->ConfigData));\r
CopyMem (&Dhcp4ModeData->ClientMacAddress, &DhcpSb->Mac, sizeof (Dhcp4ModeData->ClientMacAddress));\r
\r
if (Para != NULL) {\r
Ip = HTONL (Para->Router);\r
CopyMem (&Dhcp4ModeData->RouterAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
- Dhcp4ModeData->LeaseTime = Para->Lease;\r
+ Dhcp4ModeData->LeaseTime = Para->Lease;\r
} else {\r
ZeroMem (&Dhcp4ModeData->RouterAddress, sizeof (EFI_IPv4_ADDRESS));\r
- Dhcp4ModeData->LeaseTime = 0xffffffff;\r
+ Dhcp4ModeData->LeaseTime = 0xffffffff;\r
}\r
\r
Dhcp4ModeData->ReplyPacket = DhcpSb->Selected;\r
**/\r
VOID\r
DhcpCleanConfigure (\r
- IN EFI_DHCP4_CONFIG_DATA *Config\r
+ IN OUT EFI_DHCP4_CONFIG_DATA *Config\r
)\r
{\r
UINT32 Index;\r
**/\r
EFI_STATUS\r
DhcpCopyConfigure (\r
- IN EFI_DHCP4_CONFIG_DATA *Dst,\r
- IN EFI_DHCP4_CONFIG_DATA *Src\r
+ OUT EFI_DHCP4_CONFIG_DATA *Dst,\r
+ IN EFI_DHCP4_CONFIG_DATA *Src\r
)\r
{\r
EFI_DHCP4_PACKET_OPTION **DstOptions;\r
\r
\r
/**\r
- Configure the DHCP protocol instance and its underlying DHCP service\r
- for operation. If Dhcp4CfgData is NULL and the child is currently\r
- controlling the DHCP service, release the control.\r
-\r
- @param This The DHCP protocol instance\r
- @param Dhcp4CfgData The DHCP configure data.\r
-\r
- @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
- @retval EFI_ACCESS_DENIED The service isn't in one of configurable states,\r
- or there is already an active child.\r
- @retval EFI_OUT_OF_RESOURCE Failed to allocate some resources.\r
- @retval EFI_SUCCESS The child is configured.\r
+ Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.\r
+\r
+ The Configure() function is used to initialize, change, or reset the operational\r
+ settings of the EFI DHCPv4 Protocol driver for the communication device on which\r
+ the EFI DHCPv4 Service Binding Protocol is installed. This function can be\r
+ successfully called only if both of the following are true:\r
+ * This instance of the EFI DHCPv4 Protocol driver is in the Dhcp4Stopped, Dhcp4Init,\r
+ Dhcp4InitReboot, or Dhcp4Bound states.\r
+ * No other EFI DHCPv4 Protocol driver instance that is controlled by this EFI\r
+ DHCPv4 Service Binding Protocol driver instance has configured this EFI DHCPv4\r
+ Protocol driver.\r
+ When this driver is in the Dhcp4Stopped state, it can transfer into one of the\r
+ following two possible initial states:\r
+ * Dhcp4Init\r
+ * Dhcp4InitReboot\r
+ The driver can transfer into these states by calling Configure() with a non-NULL\r
+ Dhcp4CfgData. The driver will transfer into the appropriate state based on the\r
+ supplied client network address in the ClientAddress parameter and DHCP options\r
+ in the OptionList parameter as described in RFC 2131.\r
+ When Configure() is called successfully while Dhcp4CfgData is set to NULL, the\r
+ default configuring data will be reset in the EFI DHCPv4 Protocol driver and\r
+ the state of the EFI DHCPv4 Protocol driver will not be changed. If one instance\r
+ wants to make it possible for another instance to configure the EFI DHCPv4 Protocol\r
+ driver, it must call this function with Dhcp4CfgData set to NULL.\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
EFI_STATUS\r
\r
\r
/**\r
- Start the DHCP process.\r
-\r
- @param This The DHCP protocol instance\r
- @param CompletionEvent The event to signal is address is acquired.\r
-\r
- @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
- @retval EFI_NOT_STARTED The protocol hasn't been configured.\r
- @retval EFI_ALREADY_STARTED The DHCP process has already been started.\r
- @retval EFI_SUCCESS The DHCP process is started.\r
+ Starts the DHCP configuration process.\r
+\r
+ The Start() function starts the DHCP configuration process. This function can\r
+ be called only when the EFI DHCPv4 Protocol driver is in the Dhcp4Init or\r
+ Dhcp4InitReboot state.\r
+ If the DHCP process completes successfully, the state of the EFI DHCPv4 Protocol\r
+ driver will be transferred through Dhcp4Selecting and Dhcp4Requesting to the\r
+ Dhcp4Bound state. The CompletionEvent will then be signaled if it is not NULL.\r
+ If the process aborts, either by the user or by some unexpected network error,\r
+ the state is restored to the Dhcp4Init state. The Start() function can be called\r
+ again to restart the process.\r
+ Refer to RFC 2131 for precise state transitions during this process. At the\r
+ time when each event occurs in this process, the callback function that was set\r
+ by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this\r
+ opportunity to control the 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
EFI_STATUS\r
\r
\r
/**\r
- Request an extra manual renew/rebind.\r
-\r
- @param This The DHCP protocol instance\r
- @param RebindRequest TRUE if request a rebind, otherwise renew it\r
- @param CompletionEvent Event to signal when complete\r
-\r
- @retval EFI_INVALID_PARAMETER The parameters are invalid\r
- @retval EFI_NOT_STARTED The DHCP protocol hasn't been started.\r
- @retval EFI_ACCESS_DENIED The DHCP protocol isn't in Bound state.\r
- @retval EFI_SUCCESS The DHCP is renewed/rebound.\r
+ Extends the lease time by sending a request packet.\r
+ \r
+ The RenewRebind() function is used to manually extend the lease time when the\r
+ EFI DHCPv4 Protocol driver is in the Dhcp4Bound state and the lease time has\r
+ not expired yet. This function will send a request packet to the previously\r
+ found server (or to any server when RebindRequest is TRUE) and transfer the\r
+ state into the Dhcp4Renewing state (or Dhcp4Rebinding when RebindingRequest is\r
+ TRUE). When a response is received, the state is returned to Dhcp4Bound.\r
+ If no response is received before the try count is exceeded (the RequestTryCount\r
+ field that is specified in EFI_DHCP4_CONFIG_DATA) but before the lease time that\r
+ was issued by the previous server expires, the driver will return to the Dhcp4Bound\r
+ state and the previous configuration is restored. The outgoing and incoming packets\r
+ can be captured by the EFI_DHCP4_CALLBACK function.\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
EFI_STATUS\r
\r
\r
/**\r
- Release the current acquired lease.\r
+ Releases the current address configuration.\r
+\r
+ The Release() function releases the current configured IP address by doing either\r
+ of the following:\r
+ * Sending a DHCPRELEASE packet when the EFI DHCPv4 Protocol driver is in the\r
+ Dhcp4Bound state\r
+ * Setting the previously assigned IP address that was provided with the\r
+ EFI_DHCP4_PROTOCOL.Configure() function to 0.0.0.0 when the driver is in\r
+ Dhcp4InitReboot state\r
+ After a successful call to this function, the EFI DHCPv4 Protocol driver returns\r
+ to the Dhcp4Init state and any subsequent incoming packets will be discarded silently.\r
\r
- @param This The DHCP protocol instance\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
\r
- @retval EFI_INVALID_PARAMETER The parameter is invalid\r
- @retval EFI_DEVICE_ERROR Failed to transmit the DHCP release packet\r
- @retval EFI_ACCESS_DENIED The DHCP service isn't in one of the connected\r
- state.\r
- @retval EFI_SUCCESS The lease is released.\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
EFI_STATUS\r
\r
\r
/**\r
- Stop the current DHCP process. After this, other DHCP child\r
- can gain control of the service, configure and use it.\r
+ Stops the current address configuration.\r
+ \r
+ The Stop() function is used to stop the DHCP configuration process. After this\r
+ function is called successfully, the EFI DHCPv4 Protocol driver is transferred\r
+ into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called\r
+ before DHCP configuration process can be started again. This function can be\r
+ called when the EFI DHCPv4 Protocol driver is in any state.\r
\r
- @param This The DHCP protocol instance\r
+ @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
\r
- @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
- @retval EFI_SUCCESS The DHCP process is stopped.\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
EFI_STATUS\r
\r
\r
/**\r
- Build a new DHCP packet from the seed packet. Options may be deleted or\r
- appended. The caller should free the NewPacket when finished using it.\r
-\r
- @param This The DHCP protocol instance.\r
- @param SeedPacket The seed packet to start with\r
- @param DeleteCount The number of options to delete\r
- @param DeleteList The options to delete from the packet\r
- @param AppendCount The number of options to append\r
- @param AppendList The options to append to the packet\r
- @param NewPacket The new packet, allocated and built by this\r
- function.\r
-\r
- @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
- @retval EFI_OUT_OF_RESOURCES Failed to allocate memory\r
- @retval EFI_SUCCESS The packet is build.\r
+ Builds a DHCP packet, given the options to be appended or deleted or replaced.\r
+\r
+ The Build() function is used to assemble a new packet from the original packet\r
+ by replacing or deleting existing options or appending new options. This function\r
+ does not change any state of the EFI DHCPv4 Protocol driver and can be used at\r
+ any time.\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
EFI_STATUS\r
);\r
}\r
\r
+/**\r
+ Callback by UdpIoCreatePort() when creating UdpIo for this Dhcp4 instance.\r
+ \r
+ @param UdpIo The UdpIo being created.\r
+ @param Context Dhcp4 instance.\r
+ \r
+ @retval EFI_SUCCESS UdpIo is configured successfully.\r
+ @retval other Other error occurs.\r
+**/\r
EFI_STATUS\r
Dhcp4InstanceConfigUdpIo (\r
IN UDP_IO_PORT *UdpIo,\r
return UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);\r
}\r
\r
+/**\r
+ Create UdpIo for this Dhcp4 instance.\r
+ \r
+ @param Instance The Dhcp4 instance.\r
+ \r
+ @retval EFI_SUCCESS UdpIo is created successfully.\r
+ @retval EFI_OUT_OF_RESOURCES Fails to create UdpIo because of limited\r
+ resources or configuration failure.\r
+**/\r
EFI_STATUS\r
Dhcp4InstanceCreateUdpIo (\r
- IN DHCP_PROTOCOL *Instance\r
+ IN OUT DHCP_PROTOCOL *Instance\r
)\r
{\r
DHCP_SERVICE *DhcpSb;\r
}\r
}\r
\r
+/**\r
+ Callback of Dhcp packet. Does nothing.\r
+ \r
+ @param Arg The context.\r
+ \r
+ @return None.\r
+**/\r
VOID\r
DhcpDummyExtFree (\r
IN VOID *Arg\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Release the packet.\r
-\r
-Arguments:\r
-\r
- Arg - The packet to release\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
{\r
}\r
\r
+/**\r
+ Callback of UdpIoRecvDatagram() that handles a Dhcp4 packet.\r
+ \r
+ Only BOOTP responses will be handled that correspond to the Xid of the request\r
+ sent out. The packet will be queued to the response queue.\r
+ \r
+ @param UdpPacket The Dhcp4 packet.\r
+ @param Points Udp4 address pair.\r
+ @param IoStatus Status of the input.\r
+ @param Context Extra info for the input.\r
+ \r
+ @return None.\r
+ \r
+**/\r
VOID\r
PxeDhcpInput (\r
NET_BUF *UdpPacket,\r
DhcpSb = Instance->Service;\r
\r
//\r
- // Don't restart receive if error occurs or DHCP is destoried.\r
+ // Don't restart receive if error occurs or DHCP is destroyed.\r
//\r
if (EFI_ERROR (IoStatus)) {\r
return ;\r
}\r
}\r
\r
+/**\r
+ Complete a Dhcp4 transaction and signal the upper layer.\r
+ \r
+ @param Instance Dhcp4 instance.\r
+ \r
+ @return None.\r
+\r
+**/\r
VOID\r
PxeDhcpDone (\r
IN DHCP_PROTOCOL *Instance\r
}\r
\r
//\r
- // Copy the recieved DHCP responses.\r
+ // Copy the received DHCP responses.\r
//\r
NetbufQueCopy (&Instance->ResponseQueue, 0, Instance->ResponseQueue.BufSize, (UINT8 *) Token->ResponseList);\r
Token->Status = EFI_SUCCESS;\r
\r
SIGNAL_USER:\r
//\r
- // Clean the resources dedicated for this transmit receive transaction.\r
+ // Clean up the resources dedicated for this transmit receive transaction.\r
//\r
NetbufQueFlush (&Instance->ResponseQueue);\r
UdpIoCleanPort (Instance->UdpIo);\r
\r
/**\r
Transmits a DHCP formatted packet and optionally waits for responses.\r
+ \r
+ The TransmitReceive() function is used to transmit a DHCP packet and optionally\r
+ wait for the response from servers. This function does not change the state of\r
+ the EFI DHCPv4 Protocol driver and thus can be used at any time.\r
\r
@param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
@param Token Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.\r
return EFI_NOT_READY;\r
}\r
\r
- if ((Token->Packet->Dhcp4.Magik != DHCP_OPTION_MAGIC) ||\r
- (NTOHL (Token->Packet->Dhcp4.Header.Xid) == Instance->Service->Xid) ||\r
- (Token->TimeoutValue == 0) ||\r
- ((Token->ListenPointCount != 0) && (Token->ListenPoints == NULL)) ||\r
- EFI_ERROR (DhcpValidateOptions (Token->Packet, NULL)) ||\r
- EFI_IP4_EQUAL (&Token->RemoteAddress, &mZeroIp4Addr)) {\r
+ if ((Token->Packet->Dhcp4.Magik != DHCP_OPTION_MAGIC) ||\r
+ (NTOHL (Token->Packet->Dhcp4.Header.Xid) == Instance->Service->Xid) ||\r
+ (Token->TimeoutValue == 0) ||\r
+ ((Token->ListenPointCount != 0) && (Token->ListenPoints == NULL)) ||\r
+ EFI_ERROR (DhcpValidateOptions (Token->Packet, NULL)) ||\r
+ EFI_IP4_EQUAL (&Token->RemoteAddress, &mZeroIp4Addr)\r
+ ) {\r
//\r
- // The DHCP packet isn't well-formed, the Transaction ID is already used\r
- // , the timeout value is zero, the ListenPoint is invalid,\r
- // or the RemoteAddress is zero.\r
+ // The DHCP packet isn't well-formed, the Transaction ID is already used,\r
+ // the timeout value is zero, the ListenPoint is invalid, or the\r
+ // RemoteAddress is zero.\r
//\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r
// Save the Client Address is sent out\r
//\r
- CopyMem (&DhcpSb->ClientAddressSendOut[0], &Token->Packet->Dhcp4.Header.ClientHwAddr[0], Token->Packet->Dhcp4.Header.HwAddrLen);\r
+ CopyMem (\r
+ &DhcpSb->ClientAddressSendOut[0],\r
+ &Token->Packet->Dhcp4.Header.ClientHwAddr[0],\r
+ Token->Packet->Dhcp4.Header.HwAddrLen\r
+ );\r
\r
//\r
// Wrap the DHCP packet into a net buffer.\r
the individual DHCP option in the packet.\r
\r
@param Tag The DHCP option type\r
- @param Len length of the DHCP option data\r
+ @param Len Length of the DHCP option data\r
@param Data The DHCP option data\r
@param Context The context, to pass several parameters in.\r
\r
\r
\r
/**\r
- Parse the DHCP options in the Packet into the PacketOptionList.\r
- User should allocate this array of EFI_DHCP4_PACKET_OPTION points.\r
-\r
- @param This The DHCP protocol instance\r
- @param Packet The DHCP packet to parse\r
- @param OptionCount On input, the size of the PacketOptionList; On\r
- output, the actual number of options processed.\r
- @param PacketOptionList The array of EFI_DHCP4_PACKET_OPTION points\r
-\r
- @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
- @retval EFI_BUFFER_TOO_SMALL A bigger array of points is needed.\r
- @retval EFI_SUCCESS The options are parsed.\r
+ Parses the packed DHCP option data.\r
+ \r
+ The Parse() function is used to retrieve the option list from a DHCP packet.\r
+ If *OptionCount isn’t zero, and there is enough space for all the DHCP options\r
+ in the Packet, each element of PacketOptionList is set to point to somewhere in\r
+ the Packet->Dhcp4.Option where a new DHCP option begins. If RFC3396 is supported,\r
+ the caller should reassemble the parsed DHCP options to get the finial result.\r
+ If *OptionCount is zero or there isn’t enough space for all of them, the number\r
+ of DHCP options in the Packet is returned in OptionCount.\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
EFI_STATUS\r
\r
return EFI_SUCCESS;\r
}\r
-\r
-EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate = {\r
- EfiDhcp4GetModeData,\r
- EfiDhcp4Configure,\r
- EfiDhcp4Start,\r
- EfiDhcp4RenewRebind,\r
- EfiDhcp4Release,\r
- EfiDhcp4Stop,\r
- EfiDhcp4Build,\r
- EfiDhcp4TransmitReceive,\r
- EfiDhcp4Parse\r
-};\r
-\r