+++ /dev/null
-/** @file\r
- EFI DHCP protocol implementation.\r
- RFCs supported are:\r
- RFC 2131: Dynamic Host Configuration Protocol\r
- RFC 2132: DHCP Options and BOOTP Vendor Extensions\r
- RFC 1534: Interoperation Between DHCP and BOOTP\r
- RFC 3396: Encoding Long Options in DHCP.\r
-\r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef __EFI_DHCP4_IMPL_H__\r
-#define __EFI_DHCP4_IMPL_H__\r
-\r
-\r
-\r
-#include <Uefi.h>\r
-\r
-#include <Protocol/Dhcp4.h>\r
-#include <Protocol/Udp4.h>\r
-#include <IndustryStandard/Dhcp.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/NetLib.h>\r
-\r
-typedef struct _DHCP_SERVICE DHCP_SERVICE;\r
-typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;\r
-\r
-#include "Dhcp4Option.h"\r
-#include "Dhcp4Io.h"\r
-\r
-#define DHCP_SERVICE_SIGNATURE SIGNATURE_32 ('D', 'H', 'C', 'P')\r
-#define DHCP_PROTOCOL_SIGNATURE SIGNATURE_32 ('d', 'h', 'c', 'p')\r
-\r
-#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)\r
-\r
-//\r
-// The state of the DHCP service. It starts as UNCONFIGED. If\r
-// and active child configures the service successfully, it\r
-// goes to CONFIGED. If the active child configures NULL, it\r
-// goes back to UNCONFIGED. It becomes DESTROY if it is (partly)\r
-// destroyed.\r
-//\r
-#define DHCP_UNCONFIGED 0\r
-#define DHCP_CONFIGED 1\r
-#define DHCP_DESTROY 2\r
-\r
-\r
-struct _DHCP_PROTOCOL {\r
- UINT32 Signature;\r
- EFI_DHCP4_PROTOCOL Dhcp4Protocol;\r
- LIST_ENTRY Link;\r
- EFI_HANDLE Handle;\r
- DHCP_SERVICE *Service;\r
-\r
- BOOLEAN InDestroy;\r
-\r
- EFI_EVENT CompletionEvent;\r
- EFI_EVENT RenewRebindEvent;\r
-\r
- EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token;\r
- UDP_IO *UdpIo; // The UDP IO used for TransmitReceive.\r
- UINT32 Timeout;\r
- UINT16 ElaspedTime;\r
- NET_BUF_QUEUE ResponseQueue;\r
-};\r
-\r
-//\r
-// DHCP driver is specical in that it is a singleton. Although it\r
-// has a service binding, there can be only one active child.\r
-//\r
-struct _DHCP_SERVICE {\r
- UINT32 Signature;\r
- EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
-\r
- INTN ServiceState; // CONFIGED, UNCONFIGED, and DESTROY\r
-\r
- EFI_HANDLE Controller;\r
- EFI_HANDLE Image;\r
-\r
- LIST_ENTRY Children;\r
- UINTN NumChildren;\r
-\r
- INTN DhcpState;\r
- EFI_STATUS IoStatus; // the result of last user operation\r
- UINT32 Xid;\r
-\r
- IP4_ADDR ClientAddr; // lease IP or configured client address\r
- IP4_ADDR Netmask;\r
- IP4_ADDR ServerAddr;\r
-\r
- EFI_DHCP4_PACKET *LastOffer; // The last received offer\r
- EFI_DHCP4_PACKET *Selected;\r
- DHCP_PARAMETER *Para;\r
-\r
- UINT32 Lease;\r
- UINT32 T1;\r
- UINT32 T2;\r
- INTN ExtraRefresh; // This refresh is reqested by user\r
-\r
- UDP_IO *UdpIo; // Udp child receiving all DHCP message\r
- UDP_IO *LeaseIoPort; // Udp child with lease IP\r
- EFI_DHCP4_PACKET *LastPacket; // The last sent packet for retransmission\r
- EFI_MAC_ADDRESS Mac;\r
- UINT8 HwType;\r
- UINT8 HwLen;\r
- UINT8 ClientAddressSendOut[16];\r
-\r
- DHCP_PROTOCOL *ActiveChild;\r
- EFI_DHCP4_CONFIG_DATA ActiveConfig;\r
- UINT32 UserOptionLen;\r
-\r
- //\r
- // Timer event and various timer\r
- //\r
- EFI_EVENT Timer;\r
-\r
- UINT32 PacketToLive; // Retransmission timer for our packets\r
- UINT32 LastTimeout; // Record the init value of PacketToLive every time\r
- INTN CurRetry;\r
- INTN MaxRetries;\r
- UINT32 LeaseLife;\r
-};\r
-\r
-typedef struct {\r
- EFI_DHCP4_PACKET_OPTION **Option;\r
- UINT32 OptionCount;\r
- UINT32 Index;\r
-} DHCP_PARSE_CONTEXT;\r
-\r
-#define DHCP_INSTANCE_FROM_THIS(Proto) \\r
- CR ((Proto), DHCP_PROTOCOL, Dhcp4Protocol, DHCP_PROTOCOL_SIGNATURE)\r
-\r
-#define DHCP_SERVICE_FROM_THIS(Sb) \\r
- CR ((Sb), DHCP_SERVICE, ServiceBinding, DHCP_SERVICE_SIGNATURE)\r
-\r
-extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;\r
-\r
-/**\r
- Give up the control of the DHCP service to let other child\r
- resume. Don't change the service's DHCP state and the Client\r
- address and option list configure as required by RFC2131.\r
-\r
- @param DhcpSb The DHCP service instance.\r
-\r
-**/\r
-VOID\r
-DhcpYieldControl (\r
- IN DHCP_SERVICE *DhcpSb\r
- );\r
-\r
-/**\r
- Complete a Dhcp4 transaction and signal the upper layer.\r
-\r
- @param Instance Dhcp4 instance.\r
-\r
-**/\r
-VOID\r
-PxeDhcpDone (\r
- IN DHCP_PROTOCOL *Instance\r
- );\r
-\r
-/**\r
- Free the resource related to the configure parameters.\r
- DHCP driver will make a copy of the user's configure\r
- such as the time out value.\r
-\r
- @param Config The DHCP configure data\r
-\r
-**/\r
-VOID\r
-DhcpCleanConfigure (\r
- IN OUT EFI_DHCP4_CONFIG_DATA *Config\r
- );\r
-\r
-/**\r
- Callback of Dhcp packet. Does nothing.\r
-\r
- @param Arg The context.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-DhcpDummyExtFree (\r
- IN VOID *Arg\r
- );\r
-\r
-/**\r
- Set the elapsed time based on the given instance and the pointer to the\r
- elapsed time option.\r
-\r
- @param[in] Elapsed The pointer to the position to append.\r
- @param[in] Instance The pointer to the Dhcp4 instance.\r
-**/\r
-VOID\r
-SetElapsedTime (\r
- IN UINT16 *Elapsed,\r
- IN DHCP_PROTOCOL *Instance\r
- );\r
-\r
-#endif\r