TianoCore EDK2 master
Loading...
Searching...
No Matches
PxeBcDhcp4.c File Reference
#include "PxeBcImpl.h"

Go to the source code of this file.

Functions

EFI_DHCP4_PACKET_OPTIONPxeBcParseDhcp4Options (IN UINT8 *Buffer, IN UINT32 Length, IN UINT8 OptTag)
 
VOID PxeBcParseVendorOptions (IN EFI_DHCP4_PACKET_OPTION *Dhcp4Option, IN PXEBC_VENDOR_OPTION *VendorOption)
 
UINT32 PxeBcBuildDhcp4Options (IN PXEBC_PRIVATE_DATA *Private, OUT EFI_DHCP4_PACKET_OPTION **OptList, IN UINT8 *Buffer, IN BOOLEAN NeedMsgType)
 
VOID PxeBcSeedDhcp4Packet (OUT EFI_DHCP4_PACKET *Seed, IN EFI_UDP4_PROTOCOL *Udp4)
 
EFI_STATUS PxeBcCacheDhcp4Packet (IN EFI_DHCP4_PACKET *Dst, IN EFI_DHCP4_PACKET *Src)
 
EFI_STATUS PxeBcParseDhcp4Packet (IN PXEBC_DHCP4_PACKET_CACHE *Cache4)
 
EFI_STATUS PxeBcCopyDhcp4Ack (IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP4_PACKET *Ack, IN BOOLEAN Verified)
 
EFI_STATUS PxeBcCopyProxyOffer (IN PXEBC_PRIVATE_DATA *Private, IN UINT32 OfferIndex)
 
EFI_STATUS PxeBcRetryBinlOffer (IN PXEBC_PRIVATE_DATA *Private, IN UINT32 Index)
 
EFI_STATUS PxeBcCacheDhcp4Offer (IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP4_PACKET *RcvdOffer)
 
VOID PxeBcSelectDhcp4Offer (IN PXEBC_PRIVATE_DATA *Private)
 
EFI_STATUS PxeBcHandleDhcp4Offer (IN PXEBC_PRIVATE_DATA *Private)
 
EFI_STATUS EFIAPI PxeBcDhcp4CallBack (IN EFI_DHCP4_PROTOCOL *This, IN VOID *Context, IN EFI_DHCP4_STATE CurrentState, IN EFI_DHCP4_EVENT Dhcp4Event, IN EFI_DHCP4_PACKET *Packet OPTIONAL, OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL)
 
EFI_STATUS PxeBcDhcp4Discover (IN PXEBC_PRIVATE_DATA *Private, IN UINT16 Type, IN UINT16 *Layer, IN BOOLEAN UseBis, IN EFI_IP_ADDRESS *DestIp, IN UINT16 IpCount, IN EFI_PXE_BASE_CODE_SRVLIST *SrvList)
 
EFI_STATUS PxeBcSetIp4Policy (IN PXEBC_PRIVATE_DATA *Private)
 
EFI_STATUS PxeBcDhcp4Dora (IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP4_PROTOCOL *Dhcp4)
 

Variables

UINT8 mInterestedDhcp4Tags [PXEBC_DHCP4_TAG_INDEX_MAX]
 
UINT32 mPxeDhcpTimeout [4] = { 4, 8, 16, 32 }
 

Detailed Description

Functions implementation related with DHCPv4 for UefiPxeBc Driver.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PxeBcDhcp4.c.

Function Documentation

◆ PxeBcBuildDhcp4Options()

UINT32 PxeBcBuildDhcp4Options ( IN PXEBC_PRIVATE_DATA Private,
OUT EFI_DHCP4_PACKET_OPTION **  OptList,
IN UINT8 *  Buffer,
IN BOOLEAN  NeedMsgType 
)

Build the options buffer for the DHCPv4 request packet.

Parameters
[in]PrivatePointer to PxeBc private data.
[out]OptListPointer to the option pointer array.
[in]BufferPointer to the buffer to contain the option list.
[in]NeedMsgTypeIf TRUE, it is necessary to include the Msg type option. Otherwise, it is not necessary.
Returns
Index The count of the built-in options.

Definition at line 217 of file PxeBcDhcp4.c.

◆ PxeBcCacheDhcp4Offer()

EFI_STATUS PxeBcCacheDhcp4Offer ( IN PXEBC_PRIVATE_DATA Private,
IN EFI_DHCP4_PACKET RcvdOffer 
)

Cache all the received DHCPv4 offers, and set OfferIndex and OfferCount.

Parameters
[in]PrivatePointer to PxeBc private data.
[in]RcvdOfferPointer to the received offer packet.
Return values
EFI_SUCCESSCache and parse the packet successfully.
OthersOperation failed.

Definition at line 801 of file PxeBcDhcp4.c.

◆ PxeBcCacheDhcp4Packet()

EFI_STATUS PxeBcCacheDhcp4Packet ( IN EFI_DHCP4_PACKET Dst,
IN EFI_DHCP4_PACKET Src 
)

Cache the DHCPv4 packet.

Parameters
[in]DstPointer to the cache buffer for DHCPv4 packet.
[in]SrcPointer to the DHCPv4 packet to be cached.
Return values
EFI_SUCCESSPacket is copied.
EFI_BUFFER_TOO_SMALLCache buffer is not big enough to hold the packet.

Definition at line 420 of file PxeBcDhcp4.c.

◆ PxeBcCopyDhcp4Ack()

EFI_STATUS PxeBcCopyDhcp4Ack ( IN PXEBC_PRIVATE_DATA Private,
IN EFI_DHCP4_PACKET Ack,
IN BOOLEAN  Verified 
)

Cache the DHCPv4 ack packet, and parse it on demand.

Parameters
[in]PrivatePointer to PxeBc private data.
[in]AckPointer to the DHCPv4 ack packet.
[in]VerifiedIf TRUE, parse the ACK packet and store info into mode data.
Return values
EFI_SUCCESSCache and parse the packet successfully.
EFI_BUFFER_TOO_SMALLCache buffer is not big enough to hold the packet.

Definition at line 622 of file PxeBcDhcp4.c.

◆ PxeBcCopyProxyOffer()

EFI_STATUS PxeBcCopyProxyOffer ( IN PXEBC_PRIVATE_DATA Private,
IN UINT32  OfferIndex 
)

Cache the DHCPv4 proxy offer packet according to the received order.

Parameters
[in]PrivatePointer to PxeBc private data.
[in]OfferIndexThe received order of offer packets.
Return values
EFI_SUCCESSCache and parse the packet successfully.
EFI_BUFFER_TOO_SMALLCache buffer is not big enough to hold the packet.

Definition at line 661 of file PxeBcDhcp4.c.

◆ PxeBcDhcp4CallBack()

EFI_STATUS EFIAPI PxeBcDhcp4CallBack ( IN EFI_DHCP4_PROTOCOL This,
IN VOID *  Context,
IN EFI_DHCP4_STATE  CurrentState,
IN EFI_DHCP4_EVENT  Dhcp4Event,
IN EFI_DHCP4_PACKET *Packet  OPTIONAL,
OUT EFI_DHCP4_PACKET **NewPacket  OPTIONAL 
)

EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver to intercept events that occurred in the configuration process.

Parameters
[in]ThisPointer to the EFI DHCPv4 Protocol.
[in]ContextPointer to the context set by EFI_DHCP4_PROTOCOL.Configure().
[in]CurrentStateThe current operational state of the EFI DHCPv4 Protocol driver.
[in]Dhcp4EventThe event that occurs in the current state, which usually means a state transition.
[in]PacketThe DHCPv4 packet that is going to be sent or already received.
[out]NewPacketThe packet that is used to replace the above Packet.
Return values
EFI_SUCCESSTells the EFI DHCPv4 Protocol driver to continue the DHCP process.
EFI_NOT_READYOnly used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol driver will continue to wait for more DHCPOFFER packets until the retry timeout expires.
EFI_ABORTEDTells the EFI DHCPv4 Protocol driver to abort the current process and return to the Dhcp4Init or Dhcp4InitReboot state.

Definition at line 1174 of file PxeBcDhcp4.c.

◆ PxeBcDhcp4Discover()

EFI_STATUS PxeBcDhcp4Discover ( IN PXEBC_PRIVATE_DATA Private,
IN UINT16  Type,
IN UINT16 *  Layer,
IN BOOLEAN  UseBis,
IN EFI_IP_ADDRESS DestIp,
IN UINT16  IpCount,
IN EFI_PXE_BASE_CODE_SRVLIST SrvList 
)

Build and send out the request packet for the bootfile, and parse the reply.

Parameters
[in]PrivatePointer to PxeBc private data.
[in]TypePxeBc option boot item type.
[in]LayerPointer to option boot item layer.
[in]UseBisUse BIS or not.
[in]DestIpPointer to the server address.
[in]IpCountThe total count of the server address.
[in]SrvListPointer to EFI_PXE_BASE_CODE_SRVLIST.
Return values
EFI_SUCCESSSuccessfully discovered boot file.
EFI_OUT_OF_RESOURCESFailed to allocate resource.
EFI_NOT_FOUNDCan't get the PXE reply packet.
OthersFailed to discover boot file.

Definition at line 1355 of file PxeBcDhcp4.c.

◆ PxeBcDhcp4Dora()

EFI_STATUS PxeBcDhcp4Dora ( IN PXEBC_PRIVATE_DATA Private,
IN EFI_DHCP4_PROTOCOL Dhcp4 
)

Start the D.O.R.A DHCPv4 process to acquire the IPv4 address and other PXE boot information.

Parameters
[in]PrivatePointer to PxeBc private data.
[in]Dhcp4Pointer to the EFI_DHCP4_PROTOCOL
Return values
EFI_SUCCESSThe D.O.R.A process successfully finished.
OthersFailed to finish the D.O.R.A process.

Definition at line 1657 of file PxeBcDhcp4.c.

◆ PxeBcHandleDhcp4Offer()

EFI_STATUS PxeBcHandleDhcp4Offer ( IN PXEBC_PRIVATE_DATA Private)

Handle the DHCPv4 offer packet.

Parameters
[in]PrivatePointer to PxeBc private data.
Return values
EFI_SUCCESSHandled the DHCPv4 offer packet successfully.
EFI_NO_RESPONSENo response to the following request packet.
EFI_NOT_FOUNDNo boot filename received.
EFI_BUFFER_TOO_SMALLCan't cache the offer pacet.

Definition at line 1013 of file PxeBcDhcp4.c.

◆ PxeBcParseDhcp4Options()

EFI_DHCP4_PACKET_OPTION * PxeBcParseDhcp4Options ( IN UINT8 *  Buffer,
IN UINT32  Length,
IN UINT8  OptTag 
)

Parse a certain dhcp4 option by OptTag in Buffer, and return with start pointer.

Parameters
[in]BufferPointer to the option buffer.
[in]LengthLength of the option buffer.
[in]OptTagTag of the required option.
Return values
NULLFailed to find the required option.
OthersThe position of the required option.

Definition at line 42 of file PxeBcDhcp4.c.

◆ PxeBcParseDhcp4Packet()

EFI_STATUS PxeBcParseDhcp4Packet ( IN PXEBC_DHCP4_PACKET_CACHE Cache4)

Parse the cached DHCPv4 packet, including all the options.

Parameters
[in]Cache4Pointer to cached DHCPv4 packet.
Return values
EFI_SUCCESSParsed the DHCPv4 packet successfully.
EFI_DEVICE_ERRORFailed to parse and invalid packet.

Definition at line 445 of file PxeBcDhcp4.c.

◆ PxeBcParseVendorOptions()

VOID PxeBcParseVendorOptions ( IN EFI_DHCP4_PACKET_OPTION Dhcp4Option,
IN PXEBC_VENDOR_OPTION VendorOption 
)

Parse the PXE vendor options and extract the information from them.

Parameters
[in]Dhcp4OptionPointer to vendor options in buffer.
[in]VendorOptionPointer to structure to store information in vendor options.

Definition at line 85 of file PxeBcDhcp4.c.

◆ PxeBcRetryBinlOffer()

EFI_STATUS PxeBcRetryBinlOffer ( IN PXEBC_PRIVATE_DATA Private,
IN UINT32  Index 
)

Retry to request bootfile name by the BINL offer.

Parameters
[in]PrivatePointer to PxeBc private data.
[in]IndexThe received order of offer packets.
Return values
EFI_SUCCESSSuccessfully retried to request bootfile name.
EFI_DEVICE_ERRORFailed to retry bootfile name.

Definition at line 706 of file PxeBcDhcp4.c.

◆ PxeBcSeedDhcp4Packet()

VOID PxeBcSeedDhcp4Packet ( OUT EFI_DHCP4_PACKET Seed,
IN EFI_UDP4_PROTOCOL Udp4 
)

Create a template DHCPv4 packet as a seed.

Parameters
[out]SeedPointer to the seed packet.
[in]Udp4Pointer to EFI_UDP4_PROTOCOL.

Definition at line 383 of file PxeBcDhcp4.c.

◆ PxeBcSelectDhcp4Offer()

VOID PxeBcSelectDhcp4Offer ( IN PXEBC_PRIVATE_DATA Private)

Select an DHCPv4 offer, and record SelectIndex and SelectProxyType.

Parameters
[in]PrivatePointer to PxeBc private data.

Definition at line 892 of file PxeBcDhcp4.c.

◆ PxeBcSetIp4Policy()

EFI_STATUS PxeBcSetIp4Policy ( IN PXEBC_PRIVATE_DATA Private)

Switch the Ip4 policy to static.

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.
Return values
EFI_SUCCESSThe policy is already configured to static.
OthersOther error as indicated..

Definition at line 1609 of file PxeBcDhcp4.c.

Variable Documentation

◆ mInterestedDhcp4Tags

UINT8 mInterestedDhcp4Tags[PXEBC_DHCP4_TAG_INDEX_MAX]
Initial value:
= {
DHCP4_TAG_BOOTFILE_LEN,
DHCP4_TAG_VENDOR,
DHCP4_TAG_OVERLOAD,
DHCP4_TAG_MSG_TYPE,
DHCP4_TAG_SERVER_ID,
DHCP4_TAG_VENDOR_CLASS_ID,
DHCP4_TAG_BOOTFILE
}

Definition at line 15 of file PxeBcDhcp4.c.

◆ mPxeDhcpTimeout

UINT32 mPxeDhcpTimeout[4] = { 4, 8, 16, 32 }

Definition at line 28 of file PxeBcDhcp4.c.