1*f439973dSWarner Losh /** @file 2*f439973dSWarner Losh EFI_DHCP4_PROTOCOL as defined in UEFI 2.0. 3*f439973dSWarner Losh EFI_DHCP4_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0. 4*f439973dSWarner Losh These protocols are used to collect configuration information for the EFI IPv4 Protocol 5*f439973dSWarner Losh drivers and to provide DHCPv4 server and PXE boot server discovery services. 6*f439973dSWarner Losh 7*f439973dSWarner Losh Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 8*f439973dSWarner Losh SPDX-License-Identifier: BSD-2-Clause-Patent 9*f439973dSWarner Losh 10*f439973dSWarner Losh @par Revision Reference: 11*f439973dSWarner Losh This Protocol was introduced in UEFI Specification 2.0. 12*f439973dSWarner Losh 13*f439973dSWarner Losh **/ 14*f439973dSWarner Losh 15*f439973dSWarner Losh #ifndef __EFI_DHCP4_PROTOCOL_H__ 16*f439973dSWarner Losh #define __EFI_DHCP4_PROTOCOL_H__ 17*f439973dSWarner Losh 18*f439973dSWarner Losh #define EFI_DHCP4_PROTOCOL_GUID \ 19*f439973dSWarner Losh { \ 20*f439973dSWarner Losh 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \ 21*f439973dSWarner Losh } 22*f439973dSWarner Losh 23*f439973dSWarner Losh #define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \ 24*f439973dSWarner Losh { \ 25*f439973dSWarner Losh 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \ 26*f439973dSWarner Losh } 27*f439973dSWarner Losh 28*f439973dSWarner Losh typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL; 29*f439973dSWarner Losh 30*f439973dSWarner Losh #pragma pack(1) 31*f439973dSWarner Losh typedef struct { 32*f439973dSWarner Losh /// 33*f439973dSWarner Losh /// DHCP option code. 34*f439973dSWarner Losh /// 35*f439973dSWarner Losh UINT8 OpCode; 36*f439973dSWarner Losh /// 37*f439973dSWarner Losh /// Length of the DHCP option data. Not present if OpCode is 0 or 255. 38*f439973dSWarner Losh /// 39*f439973dSWarner Losh UINT8 Length; 40*f439973dSWarner Losh /// 41*f439973dSWarner Losh /// Start of the DHCP option data. Not present if OpCode is 0 or 255 or if Length is zero. 42*f439973dSWarner Losh /// 43*f439973dSWarner Losh UINT8 Data[1]; 44*f439973dSWarner Losh } EFI_DHCP4_PACKET_OPTION; 45*f439973dSWarner Losh #pragma pack() 46*f439973dSWarner Losh 47*f439973dSWarner Losh #pragma pack(1) 48*f439973dSWarner Losh /// 49*f439973dSWarner Losh /// EFI_DHCP4_PACKET defines the format of DHCPv4 packets. See RFC 2131 for more information. 50*f439973dSWarner Losh /// 51*f439973dSWarner Losh typedef struct { 52*f439973dSWarner Losh UINT8 OpCode; 53*f439973dSWarner Losh UINT8 HwType; 54*f439973dSWarner Losh UINT8 HwAddrLen; 55*f439973dSWarner Losh UINT8 Hops; 56*f439973dSWarner Losh UINT32 Xid; 57*f439973dSWarner Losh UINT16 Seconds; 58*f439973dSWarner Losh UINT16 Reserved; 59*f439973dSWarner Losh EFI_IPv4_ADDRESS ClientAddr; ///< Client IP address from client. 60*f439973dSWarner Losh EFI_IPv4_ADDRESS YourAddr; ///< Client IP address from server. 61*f439973dSWarner Losh EFI_IPv4_ADDRESS ServerAddr; ///< IP address of next server in bootstrap. 62*f439973dSWarner Losh EFI_IPv4_ADDRESS GatewayAddr; ///< Relay agent IP address. 63*f439973dSWarner Losh UINT8 ClientHwAddr[16]; ///< Client hardware address. 64*f439973dSWarner Losh CHAR8 ServerName[64]; 65*f439973dSWarner Losh CHAR8 BootFileName[128]; 66*f439973dSWarner Losh } EFI_DHCP4_HEADER; 67*f439973dSWarner Losh #pragma pack() 68*f439973dSWarner Losh 69*f439973dSWarner Losh #pragma pack(1) 70*f439973dSWarner Losh typedef struct { 71*f439973dSWarner Losh /// 72*f439973dSWarner Losh /// Size of the EFI_DHCP4_PACKET buffer. 73*f439973dSWarner Losh /// 74*f439973dSWarner Losh UINT32 Size; 75*f439973dSWarner Losh /// 76*f439973dSWarner Losh /// Length of the EFI_DHCP4_PACKET from the first byte of the Header field 77*f439973dSWarner Losh /// to the last byte of the Option[] field. 78*f439973dSWarner Losh /// 79*f439973dSWarner Losh UINT32 Length; 80*f439973dSWarner Losh 81*f439973dSWarner Losh struct { 82*f439973dSWarner Losh /// 83*f439973dSWarner Losh /// DHCP packet header. 84*f439973dSWarner Losh /// 85*f439973dSWarner Losh EFI_DHCP4_HEADER Header; 86*f439973dSWarner Losh /// 87*f439973dSWarner Losh /// DHCP magik cookie in network byte order. 88*f439973dSWarner Losh /// 89*f439973dSWarner Losh UINT32 Magik; 90*f439973dSWarner Losh /// 91*f439973dSWarner Losh /// Start of the DHCP packed option data. 92*f439973dSWarner Losh /// 93*f439973dSWarner Losh UINT8 Option[1]; 94*f439973dSWarner Losh } Dhcp4; 95*f439973dSWarner Losh } EFI_DHCP4_PACKET; 96*f439973dSWarner Losh #pragma pack() 97*f439973dSWarner Losh 98*f439973dSWarner Losh typedef enum { 99*f439973dSWarner Losh /// 100*f439973dSWarner Losh /// The EFI DHCPv4 Protocol driver is stopped. 101*f439973dSWarner Losh /// 102*f439973dSWarner Losh Dhcp4Stopped = 0x0, 103*f439973dSWarner Losh /// 104*f439973dSWarner Losh /// The EFI DHCPv4 Protocol driver is inactive. 105*f439973dSWarner Losh /// 106*f439973dSWarner Losh Dhcp4Init = 0x1, 107*f439973dSWarner Losh /// 108*f439973dSWarner Losh /// The EFI DHCPv4 Protocol driver is collecting DHCP offer packets from DHCP servers. 109*f439973dSWarner Losh /// 110*f439973dSWarner Losh Dhcp4Selecting = 0x2, 111*f439973dSWarner Losh /// 112*f439973dSWarner Losh /// The EFI DHCPv4 Protocol driver has sent the request to the DHCP server and is waiting for a response. 113*f439973dSWarner Losh /// 114*f439973dSWarner Losh Dhcp4Requesting = 0x3, 115*f439973dSWarner Losh /// 116*f439973dSWarner Losh /// The DHCP configuration has completed. 117*f439973dSWarner Losh /// 118*f439973dSWarner Losh Dhcp4Bound = 0x4, 119*f439973dSWarner Losh /// 120*f439973dSWarner Losh /// The DHCP configuration is being renewed and another request has 121*f439973dSWarner Losh /// been sent out, but it has not received a response from the server yet. 122*f439973dSWarner Losh /// 123*f439973dSWarner Losh Dhcp4Renewing = 0x5, 124*f439973dSWarner Losh /// 125*f439973dSWarner Losh /// The DHCP configuration has timed out and the EFI DHCPv4 126*f439973dSWarner Losh /// Protocol driver is trying to extend the lease time. 127*f439973dSWarner Losh /// 128*f439973dSWarner Losh Dhcp4Rebinding = 0x6, 129*f439973dSWarner Losh /// 130*f439973dSWarner Losh /// The EFI DHCPv4 Protocol driver was initialized with a previously 131*f439973dSWarner Losh /// allocated or known IP address. 132*f439973dSWarner Losh /// 133*f439973dSWarner Losh Dhcp4InitReboot = 0x7, 134*f439973dSWarner Losh /// 135*f439973dSWarner Losh /// The EFI DHCPv4 Protocol driver is seeking to reuse the previously 136*f439973dSWarner Losh /// allocated IP address by sending a request to the DHCP server. 137*f439973dSWarner Losh /// 138*f439973dSWarner Losh Dhcp4Rebooting = 0x8 139*f439973dSWarner Losh } EFI_DHCP4_STATE; 140*f439973dSWarner Losh 141*f439973dSWarner Losh typedef enum { 142*f439973dSWarner Losh /// 143*f439973dSWarner Losh /// The packet to start the configuration sequence is about to be sent. 144*f439973dSWarner Losh /// 145*f439973dSWarner Losh Dhcp4SendDiscover = 0x01, 146*f439973dSWarner Losh /// 147*f439973dSWarner Losh /// A reply packet was just received. 148*f439973dSWarner Losh /// 149*f439973dSWarner Losh Dhcp4RcvdOffer = 0x02, 150*f439973dSWarner Losh /// 151*f439973dSWarner Losh /// It is time for Dhcp4Callback to select an offer. 152*f439973dSWarner Losh /// 153*f439973dSWarner Losh Dhcp4SelectOffer = 0x03, 154*f439973dSWarner Losh /// 155*f439973dSWarner Losh /// A request packet is about to be sent. 156*f439973dSWarner Losh /// 157*f439973dSWarner Losh Dhcp4SendRequest = 0x04, 158*f439973dSWarner Losh /// 159*f439973dSWarner Losh /// A DHCPACK packet was received and will be passed to Dhcp4Callback. 160*f439973dSWarner Losh /// 161*f439973dSWarner Losh Dhcp4RcvdAck = 0x05, 162*f439973dSWarner Losh /// 163*f439973dSWarner Losh /// A DHCPNAK packet was received and will be passed to Dhcp4Callback. 164*f439973dSWarner Losh /// 165*f439973dSWarner Losh Dhcp4RcvdNak = 0x06, 166*f439973dSWarner Losh /// 167*f439973dSWarner Losh /// A decline packet is about to be sent. 168*f439973dSWarner Losh /// 169*f439973dSWarner Losh Dhcp4SendDecline = 0x07, 170*f439973dSWarner Losh /// 171*f439973dSWarner Losh /// The DHCP configuration process has completed. No packet is associated with this event. 172*f439973dSWarner Losh /// 173*f439973dSWarner Losh Dhcp4BoundCompleted = 0x08, 174*f439973dSWarner Losh /// 175*f439973dSWarner Losh /// It is time to enter the Dhcp4Renewing state and to contact the server 176*f439973dSWarner Losh /// that originally issued the network address. No packet is associated with this event. 177*f439973dSWarner Losh /// 178*f439973dSWarner Losh Dhcp4EnterRenewing = 0x09, 179*f439973dSWarner Losh /// 180*f439973dSWarner Losh /// It is time to enter the Dhcp4Rebinding state and to contact any server. 181*f439973dSWarner Losh /// No packet is associated with this event. 182*f439973dSWarner Losh /// 183*f439973dSWarner Losh Dhcp4EnterRebinding = 0x0a, 184*f439973dSWarner Losh /// 185*f439973dSWarner Losh /// The configured IP address was lost either because the lease has expired, 186*f439973dSWarner Losh /// the user released the configuration, or a DHCPNAK packet was received in 187*f439973dSWarner Losh /// the Dhcp4Renewing or Dhcp4Rebinding state. No packet is associated with this event. 188*f439973dSWarner Losh /// 189*f439973dSWarner Losh Dhcp4AddressLost = 0x0b, 190*f439973dSWarner Losh /// 191*f439973dSWarner Losh /// The DHCP process failed because a DHCPNAK packet was received or the user 192*f439973dSWarner Losh /// aborted the DHCP process at a time when the configuration was not available yet. 193*f439973dSWarner Losh /// No packet is associated with this event. 194*f439973dSWarner Losh /// 195*f439973dSWarner Losh Dhcp4Fail = 0x0c 196*f439973dSWarner Losh } EFI_DHCP4_EVENT; 197*f439973dSWarner Losh 198*f439973dSWarner Losh /** 199*f439973dSWarner Losh Callback routine. 200*f439973dSWarner Losh 201*f439973dSWarner Losh EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver 202*f439973dSWarner Losh to intercept events that occurred in the configuration process. This structure 203*f439973dSWarner Losh provides advanced control of each state transition of the DHCP process. The 204*f439973dSWarner Losh returned status code determines the behavior of the EFI DHCPv4 Protocol driver. 205*f439973dSWarner Losh There are three possible returned values, which are described in the following 206*f439973dSWarner Losh table. 207*f439973dSWarner Losh 208*f439973dSWarner Losh @param This The pointer to the EFI DHCPv4 Protocol instance that is used to 209*f439973dSWarner Losh configure this callback function. 210*f439973dSWarner Losh @param Context The pointer to the context that is initialized by 211*f439973dSWarner Losh EFI_DHCP4_PROTOCOL.Configure(). 212*f439973dSWarner Losh @param CurrentState The current operational state of the EFI DHCPv4 Protocol 213*f439973dSWarner Losh driver. 214*f439973dSWarner Losh @param Dhcp4Event The event that occurs in the current state, which usually means a 215*f439973dSWarner Losh state transition. 216*f439973dSWarner Losh @param Packet The DHCP packet that is going to be sent or already received. 217*f439973dSWarner Losh @param NewPacket The packet that is used to replace the above Packet. 218*f439973dSWarner Losh 219*f439973dSWarner Losh @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process. 220*f439973dSWarner Losh When it is in the Dhcp4Selecting state, it tells the EFI DHCPv4 Protocol 221*f439973dSWarner Losh driver to stop collecting additional packets. The driver will exit 222*f439973dSWarner Losh the Dhcp4Selecting state and enter the Dhcp4Requesting state. 223*f439973dSWarner Losh @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol 224*f439973dSWarner Losh driver will continue to wait for more packets until the retry 225*f439973dSWarner Losh timeout expires. 226*f439973dSWarner Losh @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and 227*f439973dSWarner Losh return to the Dhcp4Init or Dhcp4InitReboot state. 228*f439973dSWarner Losh 229*f439973dSWarner Losh **/ 230*f439973dSWarner Losh typedef 231*f439973dSWarner Losh EFI_STATUS 232*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_CALLBACK)( 233*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This, 234*f439973dSWarner Losh IN VOID *Context, 235*f439973dSWarner Losh IN EFI_DHCP4_STATE CurrentState, 236*f439973dSWarner Losh IN EFI_DHCP4_EVENT Dhcp4Event, 237*f439973dSWarner Losh IN EFI_DHCP4_PACKET *Packet OPTIONAL, 238*f439973dSWarner Losh OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL 239*f439973dSWarner Losh ); 240*f439973dSWarner Losh 241*f439973dSWarner Losh typedef struct { 242*f439973dSWarner Losh /// 243*f439973dSWarner Losh /// The number of times to try sending a packet during the Dhcp4SendDiscover 244*f439973dSWarner Losh /// event and waiting for a response during the Dhcp4RcvdOffer event. 245*f439973dSWarner Losh /// Set to zero to use the default try counts and timeout values. 246*f439973dSWarner Losh /// 247*f439973dSWarner Losh UINT32 DiscoverTryCount; 248*f439973dSWarner Losh /// 249*f439973dSWarner Losh /// The maximum amount of time (in seconds) to wait for returned packets in each 250*f439973dSWarner Losh /// of the retries. Timeout values of zero will default to a timeout value 251*f439973dSWarner Losh /// of one second. Set to NULL to use default timeout values. 252*f439973dSWarner Losh /// 253*f439973dSWarner Losh UINT32 *DiscoverTimeout; 254*f439973dSWarner Losh /// 255*f439973dSWarner Losh /// The number of times to try sending a packet during the Dhcp4SendRequest event 256*f439973dSWarner Losh /// and waiting for a response during the Dhcp4RcvdAck event before accepting 257*f439973dSWarner Losh /// failure. Set to zero to use the default try counts and timeout values. 258*f439973dSWarner Losh /// 259*f439973dSWarner Losh UINT32 RequestTryCount; 260*f439973dSWarner Losh /// 261*f439973dSWarner Losh /// The maximum amount of time (in seconds) to wait for return packets in each of the retries. 262*f439973dSWarner Losh /// Timeout values of zero will default to a timeout value of one second. 263*f439973dSWarner Losh /// Set to NULL to use default timeout values. 264*f439973dSWarner Losh /// 265*f439973dSWarner Losh UINT32 *RequestTimeout; 266*f439973dSWarner Losh /// 267*f439973dSWarner Losh /// For a DHCPDISCOVER, setting this parameter to the previously allocated IP 268*f439973dSWarner Losh /// address will cause the EFI DHCPv4 Protocol driver to enter the Dhcp4InitReboot state. 269*f439973dSWarner Losh /// And set this field to 0.0.0.0 to enter the Dhcp4Init state. 270*f439973dSWarner Losh /// For a DHCPINFORM this parameter should be set to the client network address 271*f439973dSWarner Losh /// which was assigned to the client during a DHCPDISCOVER. 272*f439973dSWarner Losh /// 273*f439973dSWarner Losh EFI_IPv4_ADDRESS ClientAddress; 274*f439973dSWarner Losh /// 275*f439973dSWarner Losh /// The callback function to intercept various events that occurred in 276*f439973dSWarner Losh /// the DHCP configuration process. Set to NULL to ignore all those events. 277*f439973dSWarner Losh /// 278*f439973dSWarner Losh EFI_DHCP4_CALLBACK Dhcp4Callback; 279*f439973dSWarner Losh /// 280*f439973dSWarner Losh /// The pointer to the context that will be passed to Dhcp4Callback when it is called. 281*f439973dSWarner Losh /// 282*f439973dSWarner Losh VOID *CallbackContext; 283*f439973dSWarner Losh /// 284*f439973dSWarner Losh /// Number of DHCP options in the OptionList. 285*f439973dSWarner Losh /// 286*f439973dSWarner Losh UINT32 OptionCount; 287*f439973dSWarner Losh /// 288*f439973dSWarner Losh /// List of DHCP options to be included in every packet that is sent during the 289*f439973dSWarner Losh /// Dhcp4SendDiscover event. Pad options are appended automatically by DHCP driver 290*f439973dSWarner Losh /// in outgoing DHCP packets. If OptionList itself contains pad option, they are 291*f439973dSWarner Losh /// ignored by the driver. OptionList can be freed after EFI_DHCP4_PROTOCOL.Configure() 292*f439973dSWarner Losh /// returns. Ignored if OptionCount is zero. 293*f439973dSWarner Losh /// 294*f439973dSWarner Losh EFI_DHCP4_PACKET_OPTION **OptionList; 295*f439973dSWarner Losh } EFI_DHCP4_CONFIG_DATA; 296*f439973dSWarner Losh 297*f439973dSWarner Losh typedef struct { 298*f439973dSWarner Losh /// 299*f439973dSWarner Losh /// The EFI DHCPv4 Protocol driver operating state. 300*f439973dSWarner Losh /// 301*f439973dSWarner Losh EFI_DHCP4_STATE State; 302*f439973dSWarner Losh /// 303*f439973dSWarner Losh /// The configuration data of the current EFI DHCPv4 Protocol driver instance. 304*f439973dSWarner Losh /// 305*f439973dSWarner Losh EFI_DHCP4_CONFIG_DATA ConfigData; 306*f439973dSWarner Losh /// 307*f439973dSWarner Losh /// The client IP address that was acquired from the DHCP server. If it is zero, 308*f439973dSWarner Losh /// the DHCP acquisition has not completed yet and the following fields in this structure are undefined. 309*f439973dSWarner Losh /// 310*f439973dSWarner Losh EFI_IPv4_ADDRESS ClientAddress; 311*f439973dSWarner Losh /// 312*f439973dSWarner Losh /// The local hardware address. 313*f439973dSWarner Losh /// 314*f439973dSWarner Losh EFI_MAC_ADDRESS ClientMacAddress; 315*f439973dSWarner Losh /// 316*f439973dSWarner Losh /// The server IP address that is providing the DHCP service to this client. 317*f439973dSWarner Losh /// 318*f439973dSWarner Losh EFI_IPv4_ADDRESS ServerAddress; 319*f439973dSWarner Losh /// 320*f439973dSWarner Losh /// The router IP address that was acquired from the DHCP server. 321*f439973dSWarner Losh /// May be zero if the server does not offer this address. 322*f439973dSWarner Losh /// 323*f439973dSWarner Losh EFI_IPv4_ADDRESS RouterAddress; 324*f439973dSWarner Losh /// 325*f439973dSWarner Losh /// The subnet mask of the connected network that was acquired from the DHCP server. 326*f439973dSWarner Losh /// 327*f439973dSWarner Losh EFI_IPv4_ADDRESS SubnetMask; 328*f439973dSWarner Losh /// 329*f439973dSWarner Losh /// The lease time (in 1-second units) of the configured IP address. 330*f439973dSWarner Losh /// The value 0xFFFFFFFF means that the lease time is infinite. 331*f439973dSWarner Losh /// A default lease of 7 days is used if the DHCP server does not provide a value. 332*f439973dSWarner Losh /// 333*f439973dSWarner Losh UINT32 LeaseTime; 334*f439973dSWarner Losh /// 335*f439973dSWarner Losh /// The cached latest DHCPACK or DHCPNAK or BOOTP REPLY packet. May be NULL if no packet is cached. 336*f439973dSWarner Losh /// 337*f439973dSWarner Losh EFI_DHCP4_PACKET *ReplyPacket; 338*f439973dSWarner Losh } EFI_DHCP4_MODE_DATA; 339*f439973dSWarner Losh 340*f439973dSWarner Losh typedef struct { 341*f439973dSWarner Losh /// 342*f439973dSWarner Losh /// Alternate listening address. It can be a unicast, multicast, or broadcast address. 343*f439973dSWarner Losh /// 344*f439973dSWarner Losh EFI_IPv4_ADDRESS ListenAddress; 345*f439973dSWarner Losh /// 346*f439973dSWarner Losh /// The subnet mask of above listening unicast/broadcast IP address. 347*f439973dSWarner Losh /// Ignored if ListenAddress is a multicast address. 348*f439973dSWarner Losh /// 349*f439973dSWarner Losh EFI_IPv4_ADDRESS SubnetMask; 350*f439973dSWarner Losh /// 351*f439973dSWarner Losh /// Alternate station source (or listening) port number. 352*f439973dSWarner Losh /// If zero, then the default station port number (68) will be used. 353*f439973dSWarner Losh /// 354*f439973dSWarner Losh UINT16 ListenPort; 355*f439973dSWarner Losh } EFI_DHCP4_LISTEN_POINT; 356*f439973dSWarner Losh 357*f439973dSWarner Losh typedef struct { 358*f439973dSWarner Losh /// 359*f439973dSWarner Losh /// The completion status of transmitting and receiving. 360*f439973dSWarner Losh /// 361*f439973dSWarner Losh EFI_STATUS Status; 362*f439973dSWarner Losh /// 363*f439973dSWarner Losh /// If not NULL, the event that will be signaled when the collection process 364*f439973dSWarner Losh /// completes. If NULL, this function will busy-wait until the collection process competes. 365*f439973dSWarner Losh /// 366*f439973dSWarner Losh EFI_EVENT CompletionEvent; 367*f439973dSWarner Losh /// 368*f439973dSWarner Losh /// The pointer to the server IP address. This address may be a unicast, multicast, or broadcast address. 369*f439973dSWarner Losh /// 370*f439973dSWarner Losh EFI_IPv4_ADDRESS RemoteAddress; 371*f439973dSWarner Losh /// 372*f439973dSWarner Losh /// The server listening port number. If zero, the default server listening port number (67) will be used. 373*f439973dSWarner Losh /// 374*f439973dSWarner Losh UINT16 RemotePort; 375*f439973dSWarner Losh /// 376*f439973dSWarner Losh /// The pointer to the gateway address to override the existing setting. 377*f439973dSWarner Losh /// 378*f439973dSWarner Losh EFI_IPv4_ADDRESS GatewayAddress; 379*f439973dSWarner Losh /// 380*f439973dSWarner Losh /// The number of entries in ListenPoints. If zero, the default station address and port number 68 are used. 381*f439973dSWarner Losh /// 382*f439973dSWarner Losh UINT32 ListenPointCount; 383*f439973dSWarner Losh /// 384*f439973dSWarner Losh /// An array of station address and port number pairs that are used as receiving filters. 385*f439973dSWarner Losh /// The first entry is also used as the source address and source port of the outgoing packet. 386*f439973dSWarner Losh /// 387*f439973dSWarner Losh EFI_DHCP4_LISTEN_POINT *ListenPoints; 388*f439973dSWarner Losh /// 389*f439973dSWarner Losh /// The number of seconds to collect responses. Zero is invalid. 390*f439973dSWarner Losh /// 391*f439973dSWarner Losh UINT32 TimeoutValue; 392*f439973dSWarner Losh /// 393*f439973dSWarner Losh /// The pointer to the packet to be transmitted. 394*f439973dSWarner Losh /// 395*f439973dSWarner Losh EFI_DHCP4_PACKET *Packet; 396*f439973dSWarner Losh /// 397*f439973dSWarner Losh /// Number of received packets. 398*f439973dSWarner Losh /// 399*f439973dSWarner Losh UINT32 ResponseCount; 400*f439973dSWarner Losh /// 401*f439973dSWarner Losh /// The pointer to the allocated list of received packets. 402*f439973dSWarner Losh /// 403*f439973dSWarner Losh EFI_DHCP4_PACKET *ResponseList; 404*f439973dSWarner Losh } EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN; 405*f439973dSWarner Losh 406*f439973dSWarner Losh /** 407*f439973dSWarner Losh Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver. 408*f439973dSWarner Losh 409*f439973dSWarner Losh The GetModeData() function returns the current operating mode and cached data 410*f439973dSWarner Losh packet for the EFI DHCPv4 Protocol driver. 411*f439973dSWarner Losh 412*f439973dSWarner Losh @param This The pointer to the EFI_DHCP4_PROTOCOL instance. 413*f439973dSWarner Losh @param Dhcp4ModeData The pointer to storage for the EFI_DHCP4_MODE_DATA structure. 414*f439973dSWarner Losh 415*f439973dSWarner Losh @retval EFI_SUCCESS The mode data was returned. 416*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER This is NULL. 417*f439973dSWarner Losh 418*f439973dSWarner Losh **/ 419*f439973dSWarner Losh typedef 420*f439973dSWarner Losh EFI_STATUS 421*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_GET_MODE_DATA)( 422*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This, 423*f439973dSWarner Losh OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData 424*f439973dSWarner Losh ); 425*f439973dSWarner Losh 426*f439973dSWarner Losh /** 427*f439973dSWarner Losh Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver. 428*f439973dSWarner Losh 429*f439973dSWarner Losh The Configure() function is used to initialize, change, or reset the operational 430*f439973dSWarner Losh settings of the EFI DHCPv4 Protocol driver for the communication device on which 431*f439973dSWarner Losh the EFI DHCPv4 Service Binding Protocol is installed. This function can be 432*f439973dSWarner Losh successfully called only if both of the following are true: 433*f439973dSWarner Losh * This instance of the EFI DHCPv4 Protocol driver is in the Dhcp4Stopped, Dhcp4Init, 434*f439973dSWarner Losh Dhcp4InitReboot, or Dhcp4Bound states. 435*f439973dSWarner Losh * No other EFI DHCPv4 Protocol driver instance that is controlled by this EFI 436*f439973dSWarner Losh DHCPv4 Service Binding Protocol driver instance has configured this EFI DHCPv4 437*f439973dSWarner Losh Protocol driver. 438*f439973dSWarner Losh When this driver is in the Dhcp4Stopped state, it can transfer into one of the 439*f439973dSWarner Losh following two possible initial states: 440*f439973dSWarner Losh * Dhcp4Init 441*f439973dSWarner Losh * Dhcp4InitReboot. 442*f439973dSWarner Losh The driver can transfer into these states by calling Configure() with a non-NULL 443*f439973dSWarner Losh Dhcp4CfgData. The driver will transfer into the appropriate state based on the 444*f439973dSWarner Losh supplied client network address in the ClientAddress parameter and DHCP options 445*f439973dSWarner Losh in the OptionList parameter as described in RFC 2131. 446*f439973dSWarner Losh When Configure() is called successfully while Dhcp4CfgData is set to NULL, the 447*f439973dSWarner Losh default configuring data will be reset in the EFI DHCPv4 Protocol driver and 448*f439973dSWarner Losh the state of the EFI DHCPv4 Protocol driver will not be changed. If one instance 449*f439973dSWarner Losh wants to make it possible for another instance to configure the EFI DHCPv4 Protocol 450*f439973dSWarner Losh driver, it must call this function with Dhcp4CfgData set to NULL. 451*f439973dSWarner Losh 452*f439973dSWarner Losh @param This The pointer to the EFI_DHCP4_PROTOCOL instance. 453*f439973dSWarner Losh @param Dhcp4CfgData The pointer to the EFI_DHCP4_CONFIG_DATA. 454*f439973dSWarner Losh 455*f439973dSWarner Losh @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or 456*f439973dSWarner Losh Dhcp4InitReboot state, if the original state of this driver 457*f439973dSWarner Losh was Dhcp4Stopped, Dhcp4Init,Dhcp4InitReboot, or Dhcp4Bound 458*f439973dSWarner Losh and the value of Dhcp4CfgData was not NULL. 459*f439973dSWarner Losh Otherwise, the state was left unchanged. 460*f439973dSWarner Losh @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the 461*f439973dSWarner Losh Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state; 462*f439973dSWarner Losh Or onother instance of this EFI DHCPv4 Protocol driver is already 463*f439973dSWarner Losh in a valid configured state. 464*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE: 465*f439973dSWarner Losh This is NULL. 466*f439973dSWarner Losh DiscoverTryCount > 0 and DiscoverTimeout is NULL 467*f439973dSWarner Losh RequestTryCount > 0 and RequestTimeout is NULL. 468*f439973dSWarner Losh OptionCount >0 and OptionList is NULL. 469*f439973dSWarner Losh ClientAddress is not a valid unicast address. 470*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 471*f439973dSWarner Losh @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. 472*f439973dSWarner Losh 473*f439973dSWarner Losh **/ 474*f439973dSWarner Losh typedef 475*f439973dSWarner Losh EFI_STATUS 476*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_CONFIGURE)( 477*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This, 478*f439973dSWarner Losh IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL 479*f439973dSWarner Losh ); 480*f439973dSWarner Losh 481*f439973dSWarner Losh /** 482*f439973dSWarner Losh Starts the DHCP configuration process. 483*f439973dSWarner Losh 484*f439973dSWarner Losh The Start() function starts the DHCP configuration process. This function can 485*f439973dSWarner Losh be called only when the EFI DHCPv4 Protocol driver is in the Dhcp4Init or 486*f439973dSWarner Losh Dhcp4InitReboot state. 487*f439973dSWarner Losh If the DHCP process completes successfully, the state of the EFI DHCPv4 Protocol 488*f439973dSWarner Losh driver will be transferred through Dhcp4Selecting and Dhcp4Requesting to the 489*f439973dSWarner Losh Dhcp4Bound state. The CompletionEvent will then be signaled if it is not NULL. 490*f439973dSWarner Losh If the process aborts, either by the user or by some unexpected network error, 491*f439973dSWarner Losh the state is restored to the Dhcp4Init state. The Start() function can be called 492*f439973dSWarner Losh again to restart the process. 493*f439973dSWarner Losh Refer to RFC 2131 for precise state transitions during this process. At the 494*f439973dSWarner Losh time when each event occurs in this process, the callback function that was set 495*f439973dSWarner Losh by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this 496*f439973dSWarner Losh opportunity to control the process. 497*f439973dSWarner Losh 498*f439973dSWarner Losh @param This The pointer to the EFI_DHCP4_PROTOCOL instance. 499*f439973dSWarner Losh @param CompletionEvent If not NULL, it indicates the event that will be signaled when the 500*f439973dSWarner Losh EFI DHCPv4 Protocol driver is transferred into the 501*f439973dSWarner Losh Dhcp4Bound state or when the DHCP process is aborted. 502*f439973dSWarner Losh EFI_DHCP4_PROTOCOL.GetModeData() can be called to 503*f439973dSWarner Losh check the completion status. If NULL, 504*f439973dSWarner Losh EFI_DHCP4_PROTOCOL.Start() will wait until the driver 505*f439973dSWarner Losh is transferred into the Dhcp4Bound state or the process fails. 506*f439973dSWarner Losh 507*f439973dSWarner Losh @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed 508*f439973dSWarner Losh when CompletionEvent is NULL. 509*f439973dSWarner Losh @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped 510*f439973dSWarner Losh state. EFI_DHCP4_PROTOCOL. Configure() needs to be called. 511*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER This is NULL. 512*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 513*f439973dSWarner Losh @retval EFI_TIMEOUT The DHCP configuration process failed because no response was 514*f439973dSWarner Losh received from the server within the specified timeout value. 515*f439973dSWarner Losh @retval EFI_ABORTED The user aborted the DHCP process. 516*f439973dSWarner Losh @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the 517*f439973dSWarner Losh DHCP process. 518*f439973dSWarner Losh @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. 519*f439973dSWarner Losh @retval EFI_NO_MEDIA There was a media error. 520*f439973dSWarner Losh 521*f439973dSWarner Losh **/ 522*f439973dSWarner Losh typedef 523*f439973dSWarner Losh EFI_STATUS 524*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_START)( 525*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This, 526*f439973dSWarner Losh IN EFI_EVENT CompletionEvent OPTIONAL 527*f439973dSWarner Losh ); 528*f439973dSWarner Losh 529*f439973dSWarner Losh /** 530*f439973dSWarner Losh Extends the lease time by sending a request packet. 531*f439973dSWarner Losh 532*f439973dSWarner Losh The RenewRebind() function is used to manually extend the lease time when the 533*f439973dSWarner Losh EFI DHCPv4 Protocol driver is in the Dhcp4Bound state, and the lease time has 534*f439973dSWarner Losh not expired yet. This function will send a request packet to the previously 535*f439973dSWarner Losh found server (or to any server when RebindRequest is TRUE) and transfer the 536*f439973dSWarner Losh state into the Dhcp4Renewing state (or Dhcp4Rebinding when RebindingRequest is 537*f439973dSWarner Losh TRUE). When a response is received, the state is returned to Dhcp4Bound. 538*f439973dSWarner Losh If no response is received before the try count is exceeded (the RequestTryCount 539*f439973dSWarner Losh field that is specified in EFI_DHCP4_CONFIG_DATA) but before the lease time that 540*f439973dSWarner Losh was issued by the previous server expires, the driver will return to the Dhcp4Bound 541*f439973dSWarner Losh state, and the previous configuration is restored. The outgoing and incoming packets 542*f439973dSWarner Losh can be captured by the EFI_DHCP4_CALLBACK function. 543*f439973dSWarner Losh 544*f439973dSWarner Losh @param This The pointer to the EFI_DHCP4_PROTOCOL instance. 545*f439973dSWarner Losh @param RebindRequest If TRUE, this function broadcasts the request packets and enters 546*f439973dSWarner Losh the Dhcp4Rebinding state. Otherwise, it sends a unicast 547*f439973dSWarner Losh request packet and enters the Dhcp4Renewing state. 548*f439973dSWarner Losh @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase 549*f439973dSWarner Losh completes or some error occurs. 550*f439973dSWarner Losh EFI_DHCP4_PROTOCOL.GetModeData() can be called to 551*f439973dSWarner Losh check the completion status. If NULL, 552*f439973dSWarner Losh EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait 553*f439973dSWarner Losh until the DHCP process finishes. 554*f439973dSWarner Losh 555*f439973dSWarner Losh @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the 556*f439973dSWarner Losh Dhcp4Renewing state or is back to the Dhcp4Bound state. 557*f439973dSWarner Losh @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped 558*f439973dSWarner Losh state. EFI_DHCP4_PROTOCOL.Configure() needs to 559*f439973dSWarner Losh be called. 560*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER This is NULL. 561*f439973dSWarner Losh @retval EFI_TIMEOUT There was no response from the server when the try count was 562*f439973dSWarner Losh exceeded. 563*f439973dSWarner Losh @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state. 564*f439973dSWarner Losh @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. 565*f439973dSWarner Losh 566*f439973dSWarner Losh **/ 567*f439973dSWarner Losh typedef 568*f439973dSWarner Losh EFI_STATUS 569*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_RENEW_REBIND)( 570*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This, 571*f439973dSWarner Losh IN BOOLEAN RebindRequest, 572*f439973dSWarner Losh IN EFI_EVENT CompletionEvent OPTIONAL 573*f439973dSWarner Losh ); 574*f439973dSWarner Losh 575*f439973dSWarner Losh /** 576*f439973dSWarner Losh Releases the current address configuration. 577*f439973dSWarner Losh 578*f439973dSWarner Losh The Release() function releases the current configured IP address by doing either 579*f439973dSWarner Losh of the following: 580*f439973dSWarner Losh * Sending a DHCPRELEASE packet when the EFI DHCPv4 Protocol driver is in the 581*f439973dSWarner Losh Dhcp4Bound state 582*f439973dSWarner Losh * Setting the previously assigned IP address that was provided with the 583*f439973dSWarner Losh EFI_DHCP4_PROTOCOL.Configure() function to 0.0.0.0 when the driver is in 584*f439973dSWarner Losh Dhcp4InitReboot state 585*f439973dSWarner Losh After a successful call to this function, the EFI DHCPv4 Protocol driver returns 586*f439973dSWarner Losh to the Dhcp4Init state, and any subsequent incoming packets will be discarded silently. 587*f439973dSWarner Losh 588*f439973dSWarner Losh @param This The pointer to the EFI_DHCP4_PROTOCOL instance. 589*f439973dSWarner Losh 590*f439973dSWarner Losh @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase. 591*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER This is NULL. 592*f439973dSWarner Losh @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state. 593*f439973dSWarner Losh @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. 594*f439973dSWarner Losh 595*f439973dSWarner Losh **/ 596*f439973dSWarner Losh typedef 597*f439973dSWarner Losh EFI_STATUS 598*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_RELEASE)( 599*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This 600*f439973dSWarner Losh ); 601*f439973dSWarner Losh 602*f439973dSWarner Losh /** 603*f439973dSWarner Losh Stops the current address configuration. 604*f439973dSWarner Losh 605*f439973dSWarner Losh The Stop() function is used to stop the DHCP configuration process. After this 606*f439973dSWarner Losh function is called successfully, the EFI DHCPv4 Protocol driver is transferred 607*f439973dSWarner Losh into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called 608*f439973dSWarner Losh before DHCP configuration process can be started again. This function can be 609*f439973dSWarner Losh called when the EFI DHCPv4 Protocol driver is in any state. 610*f439973dSWarner Losh 611*f439973dSWarner Losh @param This The pointer to the EFI_DHCP4_PROTOCOL instance. 612*f439973dSWarner Losh 613*f439973dSWarner Losh @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase. 614*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER This is NULL. 615*f439973dSWarner Losh 616*f439973dSWarner Losh **/ 617*f439973dSWarner Losh typedef 618*f439973dSWarner Losh EFI_STATUS 619*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_STOP)( 620*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This 621*f439973dSWarner Losh ); 622*f439973dSWarner Losh 623*f439973dSWarner Losh /** 624*f439973dSWarner Losh Builds a DHCP packet, given the options to be appended or deleted or replaced. 625*f439973dSWarner Losh 626*f439973dSWarner Losh The Build() function is used to assemble a new packet from the original packet 627*f439973dSWarner Losh by replacing or deleting existing options or appending new options. This function 628*f439973dSWarner Losh does not change any state of the EFI DHCPv4 Protocol driver and can be used at 629*f439973dSWarner Losh any time. 630*f439973dSWarner Losh 631*f439973dSWarner Losh @param This The pointer to the EFI_DHCP4_PROTOCOL instance. 632*f439973dSWarner Losh @param SeedPacket Initial packet to be used as a base for building new packet. 633*f439973dSWarner Losh @param DeleteCount Number of opcodes in the DeleteList. 634*f439973dSWarner Losh @param DeleteList List of opcodes to be deleted from the seed packet. 635*f439973dSWarner Losh Ignored if DeleteCount is zero. 636*f439973dSWarner Losh @param AppendCount Number of entries in the OptionList. 637*f439973dSWarner Losh @param AppendList The pointer to a DHCP option list to be appended to SeedPacket. 638*f439973dSWarner Losh If SeedPacket also contains options in this list, they are 639*f439973dSWarner Losh replaced by new options (except pad option). Ignored if 640*f439973dSWarner Losh AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION 641*f439973dSWarner Losh @param NewPacket The pointer to storage for the pointer to the new allocated packet. 642*f439973dSWarner Losh Use the EFI Boot Service FreePool() on the resulting pointer 643*f439973dSWarner Losh when done with the packet. 644*f439973dSWarner Losh 645*f439973dSWarner Losh @retval EFI_SUCCESS The new packet was built. 646*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated. 647*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: 648*f439973dSWarner Losh This is NULL. 649*f439973dSWarner Losh SeedPacket is NULL. 650*f439973dSWarner Losh SeedPacket is not a well-formed DHCP packet. 651*f439973dSWarner Losh AppendCount is not zero and AppendList is NULL. 652*f439973dSWarner Losh DeleteCount is not zero and DeleteList is NULL. 653*f439973dSWarner Losh NewPacket is NULL 654*f439973dSWarner Losh Both DeleteCount and AppendCount are zero and 655*f439973dSWarner Losh NewPacket is not NULL. 656*f439973dSWarner Losh 657*f439973dSWarner Losh **/ 658*f439973dSWarner Losh typedef 659*f439973dSWarner Losh EFI_STATUS 660*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_BUILD)( 661*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This, 662*f439973dSWarner Losh IN EFI_DHCP4_PACKET *SeedPacket, 663*f439973dSWarner Losh IN UINT32 DeleteCount, 664*f439973dSWarner Losh IN UINT8 *DeleteList OPTIONAL, 665*f439973dSWarner Losh IN UINT32 AppendCount, 666*f439973dSWarner Losh IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL, 667*f439973dSWarner Losh OUT EFI_DHCP4_PACKET **NewPacket 668*f439973dSWarner Losh ); 669*f439973dSWarner Losh 670*f439973dSWarner Losh /** 671*f439973dSWarner Losh Transmits a DHCP formatted packet and optionally waits for responses. 672*f439973dSWarner Losh 673*f439973dSWarner Losh The TransmitReceive() function is used to transmit a DHCP packet and optionally 674*f439973dSWarner Losh wait for the response from servers. This function does not change the state of 675*f439973dSWarner Losh the EFI DHCPv4 Protocol driver. It can be used at any time because of this. 676*f439973dSWarner Losh 677*f439973dSWarner Losh @param This The pointer to the EFI_DHCP4_PROTOCOL instance. 678*f439973dSWarner Losh @param Token The pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure. 679*f439973dSWarner Losh 680*f439973dSWarner Losh @retval EFI_SUCCESS The packet was successfully queued for transmission. 681*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: 682*f439973dSWarner Losh This is NULL. 683*f439973dSWarner Losh Token.RemoteAddress is zero. 684*f439973dSWarner Losh Token.Packet is NULL. 685*f439973dSWarner Losh Token.Packet is not a well-formed DHCP packet. 686*f439973dSWarner Losh The transaction ID in Token.Packet is in use by another DHCP process. 687*f439973dSWarner Losh @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call 688*f439973dSWarner Losh this function after collection process completes. 689*f439973dSWarner Losh @retval EFI_NO_MAPPING The default station address is not available yet. 690*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 691*f439973dSWarner Losh @retval EFI_UNSUPPORTED The implementation doesn't support this function 692*f439973dSWarner Losh @retval Others Some other unexpected error occurred. 693*f439973dSWarner Losh 694*f439973dSWarner Losh **/ 695*f439973dSWarner Losh typedef 696*f439973dSWarner Losh EFI_STATUS 697*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_TRANSMIT_RECEIVE)( 698*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This, 699*f439973dSWarner Losh IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token 700*f439973dSWarner Losh ); 701*f439973dSWarner Losh 702*f439973dSWarner Losh /** 703*f439973dSWarner Losh Parses the packed DHCP option data. 704*f439973dSWarner Losh 705*f439973dSWarner Losh The Parse() function is used to retrieve the option list from a DHCP packet. 706*f439973dSWarner Losh If *OptionCount isn't zero, and there is enough space for all the DHCP options 707*f439973dSWarner Losh in the Packet, each element of PacketOptionList is set to point to somewhere in 708*f439973dSWarner Losh the Packet->Dhcp4.Option where a new DHCP option begins. If RFC3396 is supported, 709*f439973dSWarner Losh the caller should reassemble the parsed DHCP options to get the final result. 710*f439973dSWarner Losh If *OptionCount is zero or there isn't enough space for all of them, the number 711*f439973dSWarner Losh of DHCP options in the Packet is returned in OptionCount. 712*f439973dSWarner Losh 713*f439973dSWarner Losh @param This The pointer to the EFI_DHCP4_PROTOCOL instance. 714*f439973dSWarner Losh @param Packet The pointer to packet to be parsed. 715*f439973dSWarner Losh @param OptionCount On input, the number of entries in the PacketOptionList. 716*f439973dSWarner Losh On output, the number of entries that were written into the 717*f439973dSWarner Losh PacketOptionList. 718*f439973dSWarner Losh @param PacketOptionList A list of packet option entries to be filled in. End option or pad 719*f439973dSWarner Losh options are not included. 720*f439973dSWarner Losh 721*f439973dSWarner Losh @retval EFI_SUCCESS The packet was successfully parsed. 722*f439973dSWarner Losh @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: 723*f439973dSWarner Losh This is NULL. 724*f439973dSWarner Losh The packet is NULL. 725*f439973dSWarner Losh The packet is not a well-formed DHCP packet. 726*f439973dSWarner Losh OptionCount is NULL. 727*f439973dSWarner Losh @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE: 728*f439973dSWarner Losh 1) *OptionCount is smaller than the number of options that 729*f439973dSWarner Losh were found in the Packet. 730*f439973dSWarner Losh 2) PacketOptionList is NULL. 731*f439973dSWarner Losh @retval EFI_OUT_OF_RESOURCE The packet failed to parse because of a resource shortage. 732*f439973dSWarner Losh 733*f439973dSWarner Losh **/ 734*f439973dSWarner Losh typedef 735*f439973dSWarner Losh EFI_STATUS 736*f439973dSWarner Losh (EFIAPI *EFI_DHCP4_PARSE)( 737*f439973dSWarner Losh IN EFI_DHCP4_PROTOCOL *This, 738*f439973dSWarner Losh IN EFI_DHCP4_PACKET *Packet, 739*f439973dSWarner Losh IN OUT UINT32 *OptionCount, 740*f439973dSWarner Losh OUT EFI_DHCP4_PACKET_OPTION *PacketOptionList[] OPTIONAL 741*f439973dSWarner Losh ); 742*f439973dSWarner Losh 743*f439973dSWarner Losh /// 744*f439973dSWarner Losh /// This protocol is used to collect configuration information for the EFI IPv4 Protocol drivers 745*f439973dSWarner Losh /// and to provide DHCPv4 server and PXE boot server discovery services. 746*f439973dSWarner Losh /// 747*f439973dSWarner Losh struct _EFI_DHCP4_PROTOCOL { 748*f439973dSWarner Losh EFI_DHCP4_GET_MODE_DATA GetModeData; 749*f439973dSWarner Losh EFI_DHCP4_CONFIGURE Configure; 750*f439973dSWarner Losh EFI_DHCP4_START Start; 751*f439973dSWarner Losh EFI_DHCP4_RENEW_REBIND RenewRebind; 752*f439973dSWarner Losh EFI_DHCP4_RELEASE Release; 753*f439973dSWarner Losh EFI_DHCP4_STOP Stop; 754*f439973dSWarner Losh EFI_DHCP4_BUILD Build; 755*f439973dSWarner Losh EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive; 756*f439973dSWarner Losh EFI_DHCP4_PARSE Parse; 757*f439973dSWarner Losh }; 758*f439973dSWarner Losh 759*f439973dSWarner Losh extern EFI_GUID gEfiDhcp4ProtocolGuid; 760*f439973dSWarner Losh extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid; 761*f439973dSWarner Losh 762*f439973dSWarner Losh #endif 763