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

Go to the source code of this file.

Functions

EFI_DHCP6_PACKET_OPTIONPxeBcParseDhcp6Options (IN UINT8 *Buffer, IN UINT32 Length, IN UINT16 OptTag)
 
UINT32 PxeBcBuildDhcp6Options (IN PXEBC_PRIVATE_DATA *Private, OUT EFI_DHCP6_PACKET_OPTION **OptList, IN UINT8 *Buffer)
 
EFI_STATUS PxeBcCacheDhcp6Packet (IN EFI_DHCP6_PACKET *Dst, IN EFI_DHCP6_PACKET *Src)
 
EFI_STATUS PxeBcDns6 (IN PXEBC_PRIVATE_DATA *Private, IN CHAR16 *HostName, OUT EFI_IPv6_ADDRESS *IpAddress)
 
EFI_STATUS PxeBcExtractBootFileUrl (IN PXEBC_PRIVATE_DATA *Private, OUT UINT8 **FileName, IN OUT EFI_IPv6_ADDRESS *SrvAddr, IN CHAR8 *BootFile, IN UINT16 Length)
 
EFI_STATUS PxeBcExtractBootFileParam (IN CHAR8 *BootFilePara, OUT UINT16 *BootFileSize)
 
EFI_STATUS PxeBcParseDhcp6Packet (IN PXEBC_DHCP6_PACKET_CACHE *Cache6)
 
EFI_STATUS PxeBcCopyDhcp6Ack (IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP6_PACKET *Ack, IN BOOLEAN Verified)
 
EFI_STATUS PxeBcCopyDhcp6Proxy (IN PXEBC_PRIVATE_DATA *Private, IN UINT32 OfferIndex)
 
UINT8 * PxeBcDhcp6SeekOption (IN UINT8 *Buf, IN UINT32 SeekLen, IN UINT16 OptType)
 
EFI_STATUS PxeBcRequestBootService (IN PXEBC_PRIVATE_DATA *Private, IN UINT32 Index)
 
EFI_STATUS PxeBcRetryDhcp6Binl (IN PXEBC_PRIVATE_DATA *Private, IN UINT32 Index)
 
EFI_STATUS PxeBcCacheDhcp6Offer (IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP6_PACKET *RcvdOffer)
 
VOID PxeBcSelectDhcp6Offer (IN PXEBC_PRIVATE_DATA *Private)
 
EFI_STATUS PxeBcCacheDnsServerAddresses (IN PXEBC_PRIVATE_DATA *Private, IN PXEBC_DHCP6_PACKET_CACHE *Cache6)
 
EFI_STATUS PxeBcHandleDhcp6Offer (IN PXEBC_PRIVATE_DATA *Private)
 
VOID PxeBcUnregisterIp6Address (IN PXEBC_PRIVATE_DATA *Private)
 
EFI_STATUS PxeBcCheckRouteTable (IN PXEBC_PRIVATE_DATA *Private, IN UINTN TimeOutInSecond, OUT EFI_IPv6_ADDRESS *GatewayAddr)
 
EFI_STATUS PxeBcRegisterIp6Address (IN PXEBC_PRIVATE_DATA *Private, IN EFI_IPv6_ADDRESS *Address)
 
EFI_STATUS PxeBcSetIp6Policy (IN PXEBC_PRIVATE_DATA *Private)
 
EFI_STATUS PxeBcSetIp6Address (IN PXEBC_PRIVATE_DATA *Private)
 
EFI_STATUS EFIAPI PxeBcDhcp6CallBack (IN EFI_DHCP6_PROTOCOL *This, IN VOID *Context, IN EFI_DHCP6_STATE CurrentState, IN EFI_DHCP6_EVENT Dhcp6Event, IN EFI_DHCP6_PACKET *Packet, OUT EFI_DHCP6_PACKET **NewPacket OPTIONAL)
 
EFI_STATUS PxeBcDhcp6Discover (IN PXEBC_PRIVATE_DATA *Private, IN UINT16 Type, IN UINT16 *Layer, IN BOOLEAN UseBis, IN EFI_IP_ADDRESS *DestIp)
 
EFI_STATUS PxeBcDhcp6Sarr (IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP6_PROTOCOL *Dhcp6)
 

Variables

EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress
 

Detailed Description

Functions implementation related with DHCPv6 for UefiPxeBc Driver.

(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PxeBcDhcp6.c.

Function Documentation

◆ PxeBcBuildDhcp6Options()

UINT32 PxeBcBuildDhcp6Options ( IN PXEBC_PRIVATE_DATA Private,
OUT EFI_DHCP6_PACKET_OPTION **  OptList,
IN UINT8 *  Buffer 
)

Build the options buffer for the DHCPv6 request packet.

Parameters
[in]PrivateThe pointer to PxeBc private data.
[out]OptListThe pointer to the option pointer array.
[in]BufferThe pointer to the buffer to contain the option list.
Returns
Index The count of the built-in options.

Definition at line 73 of file PxeBcDhcp6.c.

◆ PxeBcCacheDhcp6Offer()

EFI_STATUS PxeBcCacheDhcp6Offer ( IN PXEBC_PRIVATE_DATA Private,
IN EFI_DHCP6_PACKET RcvdOffer 
)

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

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.
[in]RcvdOfferThe pointer to the received offer packet.
Return values
EFI_SUCCESSCache and parse the packet successfully.
OthersOperation failed.

Definition at line 1171 of file PxeBcDhcp6.c.

◆ PxeBcCacheDhcp6Packet()

EFI_STATUS PxeBcCacheDhcp6Packet ( IN EFI_DHCP6_PACKET Dst,
IN EFI_DHCP6_PACKET Src 
)

Cache the DHCPv6 packet.

Parameters
[in]DstThe pointer to the cache buffer for DHCPv6 packet.
[in]SrcThe pointer to the DHCPv6 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 183 of file PxeBcDhcp6.c.

◆ PxeBcCacheDnsServerAddresses()

EFI_STATUS PxeBcCacheDnsServerAddresses ( IN PXEBC_PRIVATE_DATA Private,
IN PXEBC_DHCP6_PACKET_CACHE Cache6 
)

Cache the DHCPv6 DNS Server addresses

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.
[in]Cache6The pointer to PXEBC_DHCP6_PACKET_CACHE.
Return values
EFI_SUCCESSCache the DHCPv6 DNS Server address successfully.
EFI_OUT_OF_RESOURCESFailed to allocate resources.
EFI_DEVICE_ERRORThe DNS Server Address Length provided by a untrusted option is not a multiple of 16 bytes (sizeof (EFI_IPv6_ADDRESS)).

Definition at line 1356 of file PxeBcDhcp6.c.

◆ PxeBcCheckRouteTable()

EFI_STATUS PxeBcCheckRouteTable ( IN PXEBC_PRIVATE_DATA Private,
IN UINTN  TimeOutInSecond,
OUT EFI_IPv6_ADDRESS GatewayAddr 
)

Check whether IP driver could route the message which will be sent to ServerIp address.

This function will check the IP6 route table every 1 seconds until specified timeout is expired, if a valid route is found in IP6 route table, the address will be filed in GatewayAddr and return.

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.
[in]TimeOutInSecondTimeout value in seconds.
[out]GatewayAddrPointer to store the gateway IP address.
Return values
EFI_SUCCESSFound a valid gateway address successfully.
EFI_TIMEOUTThe operation is time out.
OtherUnexpected error happened.

Definition at line 1575 of file PxeBcDhcp6.c.

◆ PxeBcCopyDhcp6Ack()

EFI_STATUS PxeBcCopyDhcp6Ack ( IN PXEBC_PRIVATE_DATA Private,
IN EFI_DHCP6_PACKET Ack,
IN BOOLEAN  Verified 
)

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

Parameters
[in]PrivateThe pointer to PxeBc private data.
[in]AckThe pointer to the DHCPv6 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 742 of file PxeBcDhcp6.c.

◆ PxeBcCopyDhcp6Proxy()

EFI_STATUS PxeBcCopyDhcp6Proxy ( IN PXEBC_PRIVATE_DATA Private,
IN UINT32  OfferIndex 
)

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

Parameters
[in]PrivateThe pointer 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 781 of file PxeBcDhcp6.c.

◆ PxeBcDhcp6CallBack()

EFI_STATUS EFIAPI PxeBcDhcp6CallBack ( IN EFI_DHCP6_PROTOCOL This,
IN VOID *  Context,
IN EFI_DHCP6_STATE  CurrentState,
IN EFI_DHCP6_EVENT  Dhcp6Event,
IN EFI_DHCP6_PACKET Packet,
OUT EFI_DHCP6_PACKET **NewPacket  OPTIONAL 
)

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

Parameters
[in]ThisThe pointer to the EFI DHCPv6 Protocol.
[in]ContextThe pointer to the context set by EFI_DHCP6_PROTOCOL.Configure().
[in]CurrentStateThe current operational state of the EFI DHCPv Protocol driver.
[in]Dhcp6EventThe event that occurs in the current state, which usually means a state transition.
[in]PacketThe DHCPv6 packet that is going to be sent or was already received.
[out]NewPacketThe packet that is used to replace the Packet above.
Return values
EFI_SUCCESSTold the EFI DHCPv6 Protocol driver to continue the DHCP process.
EFI_NOT_READYOnly used in the Dhcp6Selecting state. The EFI DHCPv6 Protocol driver will continue to wait for more packets.
EFI_ABORTEDTold the EFI DHCPv6 Protocol driver to abort the current process.

Definition at line 1986 of file PxeBcDhcp6.c.

◆ PxeBcDhcp6Discover()

EFI_STATUS PxeBcDhcp6Discover ( IN PXEBC_PRIVATE_DATA Private,
IN UINT16  Type,
IN UINT16 *  Layer,
IN BOOLEAN  UseBis,
IN EFI_IP_ADDRESS DestIp 
)

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

Parameters
[in]PrivateThe pointer to PxeBc private data.
[in]TypePxeBc option boot item type.
[in]LayerThe pointer to option boot item layer.
[in]UseBisUse BIS or not.
[in]DestIpThe pointer to the server address.
Return values
EFI_SUCCESSSuccessfully discovered the boot file.
EFI_OUT_OF_RESOURCESFailed to allocate resources.
EFI_NOT_FOUNDCan't get the PXE reply packet.
OthersFailed to discover the boot file.

Definition at line 2161 of file PxeBcDhcp6.c.

◆ PxeBcDhcp6Sarr()

EFI_STATUS PxeBcDhcp6Sarr ( IN PXEBC_PRIVATE_DATA Private,
IN EFI_DHCP6_PROTOCOL Dhcp6 
)

Start the DHCPv6 S.A.R.R. process to acquire the IPv6 address and other PXE boot information.

Parameters
[in]PrivateThe pointer to PxeBc private data.
[in]Dhcp6The pointer to the EFI_DHCP6_PROTOCOL
Return values
EFI_SUCCESSThe S.A.R.R. process successfully finished.
OthersFailed to finish the S.A.R.R. process.

Definition at line 2335 of file PxeBcDhcp6.c.

◆ PxeBcDhcp6SeekOption()

UINT8 * PxeBcDhcp6SeekOption ( IN UINT8 *  Buf,
IN UINT32  SeekLen,
IN UINT16  OptType 
)

Seek the address of the first byte of the option header.

Parameters
[in]BufThe pointer to the buffer.
[in]SeekLenThe length to seek.
[in]OptTypeThe option type.
Return values
NULLIf it failed to seek the option.
othersThe position to the option.

Definition at line 827 of file PxeBcDhcp6.c.

◆ PxeBcDns6()

EFI_STATUS PxeBcDns6 ( IN PXEBC_PRIVATE_DATA Private,
IN CHAR16 *  HostName,
OUT EFI_IPv6_ADDRESS IpAddress 
)

Retrieve the boot server address using the EFI_DNS6_PROTOCOL.

Parameters
[in]PrivatePointer to PxeBc private data.
[in]HostNamePointer to buffer containing hostname.
[out]IpAddressOn output, pointer to buffer containing IPv6 address.
Return values
EFI_SUCCESSOperation succeeded.
EFI_OUT_OF_RESOURCESFailed to allocate needed resources.
EFI_DEVICE_ERRORAn unexpected network error occurred.
OthersOther errors as indicated.

Definition at line 212 of file PxeBcDhcp6.c.

◆ PxeBcExtractBootFileParam()

EFI_STATUS PxeBcExtractBootFileParam ( IN CHAR8 *  BootFilePara,
OUT UINT16 *  BootFileSize 
)

Parse the Boot File Parameter option.

Parameters
[in]BootFileParaThe pointer to boot file parameter option data.
[out]BootFileSizeThe pointer to the parsed boot file size.
Return values
EFI_SUCCESSSuccessfully obtained the boot file size from parameter option.
EFI_NOT_FOUNDFailed to extract the boot file size from parameter option.

Definition at line 580 of file PxeBcDhcp6.c.

◆ PxeBcExtractBootFileUrl()

EFI_STATUS PxeBcExtractBootFileUrl ( IN PXEBC_PRIVATE_DATA Private,
OUT UINT8 **  FileName,
IN OUT EFI_IPv6_ADDRESS SrvAddr,
IN CHAR8 *  BootFile,
IN UINT16  Length 
)

Parse the Boot File URL option.

Parameters
[in]PrivatePointer to PxeBc private data.
[out]FileNameThe pointer to the boot file name.
[in,out]SrvAddrThe pointer to the boot server address.
[in]BootFileThe pointer to the boot file URL option data.
[in]LengthThe length of the boot file URL option data.
Return values
EFI_ABORTEDUser cancel operation.
EFI_SUCCESSSelected the boot menu successfully.
EFI_NOT_READYRead the input key from the keyboard has not finish.

Definition at line 380 of file PxeBcDhcp6.c.

◆ PxeBcHandleDhcp6Offer()

EFI_STATUS PxeBcHandleDhcp6Offer ( IN PXEBC_PRIVATE_DATA Private)

Handle the DHCPv6 offer packet.

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.
Return values
EFI_SUCCESSHandled the DHCPv6 offer packet successfully.
EFI_NO_RESPONSENo response to the following request packet.
EFI_OUT_OF_RESOURCESFailed to allocate resources.
EFI_BUFFER_TOO_SMALLCan't cache the offer pacet.

Definition at line 1415 of file PxeBcDhcp6.c.

◆ PxeBcParseDhcp6Options()

EFI_DHCP6_PACKET_OPTION * PxeBcParseDhcp6Options ( IN UINT8 *  Buffer,
IN UINT32  Length,
IN UINT16  OptTag 
)

Parse out a DHCPv6 option by OptTag, and find the position in buffer.

Parameters
[in]BufferThe pointer to the option buffer.
[in]LengthLength of the option buffer.
[in]OptTagThe required option tag.
Return values
NULLFailed to parse the required option.
OthersThe position of the required option in buffer.

Definition at line 35 of file PxeBcDhcp6.c.

◆ PxeBcParseDhcp6Packet()

EFI_STATUS PxeBcParseDhcp6Packet ( IN PXEBC_DHCP6_PACKET_CACHE Cache6)

Parse the cached DHCPv6 packet, including all the options.

Parameters
[in]Cache6The pointer to a cached DHCPv6 packet.
Return values
EFI_SUCCESSParsed the DHCPv6 packet successfully.
EFI_DEVICE_ERRORFailed to parse and invalid the packet.

Definition at line 632 of file PxeBcDhcp6.c.

◆ PxeBcRegisterIp6Address()

EFI_STATUS PxeBcRegisterIp6Address ( IN PXEBC_PRIVATE_DATA Private,
IN EFI_IPv6_ADDRESS Address 
)

Register the ready station address and gateway by Ip6Config protocol.

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.
[in]AddressThe pointer to the ready address.
Return values
EFI_SUCCESSRegistered the address successfully.
OthersFailed to register the address.

Definition at line 1696 of file PxeBcDhcp6.c.

◆ PxeBcRequestBootService()

EFI_STATUS PxeBcRequestBootService ( IN PXEBC_PRIVATE_DATA Private,
IN UINT32  Index 
)

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

Parameters
[in]PrivateThe pointer to PxeBc private data.
[in]IndexPxeBc option boot item type.
Return values
EFI_SUCCESSSuccessfully discovered the boot file.
EFI_OUT_OF_RESOURCESFailed to allocate resources.
EFI_NOT_FOUNDCan't get the PXE reply packet.
OthersFailed to discover the boot file.

Definition at line 868 of file PxeBcDhcp6.c.

◆ PxeBcRetryDhcp6Binl()

EFI_STATUS PxeBcRetryDhcp6Binl ( IN PXEBC_PRIVATE_DATA Private,
IN UINT32  Index 
)

Retry to request bootfile name by the BINL offer.

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

Definition at line 1080 of file PxeBcDhcp6.c.

◆ PxeBcSelectDhcp6Offer()

VOID PxeBcSelectDhcp6Offer ( IN PXEBC_PRIVATE_DATA Private)

Select an DHCPv6 offer, and record SelectIndex and SelectProxyType.

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.

Definition at line 1249 of file PxeBcDhcp6.c.

◆ PxeBcSetIp6Address()

EFI_STATUS PxeBcSetIp6Address ( IN PXEBC_PRIVATE_DATA Private)

This function will register the station IP address and flush IP instance to start using the new IP address.

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.
Return values
EFI_SUCCESSThe new IP address has been configured successfully.
OthersFailed to configure the address.

Definition at line 1935 of file PxeBcDhcp6.c.

◆ PxeBcSetIp6Policy()

EFI_STATUS PxeBcSetIp6Policy ( IN PXEBC_PRIVATE_DATA Private)

Set the IP6 policy to Automatic.

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.
Return values
EFI_SUCCESSSwitch the IP policy successfully.
OthersUnexpected error happened.

Definition at line 1881 of file PxeBcDhcp6.c.

◆ PxeBcUnregisterIp6Address()

VOID PxeBcUnregisterIp6Address ( IN PXEBC_PRIVATE_DATA Private)

Unregister the address by Ip6Config protocol.

Parameters
[in]PrivateThe pointer to PXEBC_PRIVATE_DATA.

Definition at line 1547 of file PxeBcDhcp6.c.

Variable Documentation

◆ mAllDhcpRelayAndServersAddress

EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress
Initial value:
= {
{ 0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2 }
}

Definition at line 19 of file PxeBcDhcp6.c.