TianoCore EDK2 master
Loading...
Searching...
No Matches
HttpBootDhcp4.c File Reference
#include "HttpBootDxe.h"

Go to the source code of this file.

Functions

UINT32 HttpBootBuildDhcp4Options (IN HTTP_BOOT_PRIVATE_DATA *Private, OUT EFI_DHCP4_PACKET_OPTION **OptList, IN UINT8 *Buffer)
 
EFI_DHCP4_PACKET_OPTIONHttpBootParseDhcp4Options (IN UINT8 *Buffer, IN UINT32 Length, IN UINT8 OptTag)
 
EFI_STATUS HttpBootCacheDhcp4Packet (IN EFI_DHCP4_PACKET *Dst, IN EFI_DHCP4_PACKET *Src)
 
EFI_STATUS HttpBootParseDhcp4Packet (IN HTTP_BOOT_DHCP4_PACKET_CACHE *Cache4)
 
EFI_STATUS HttpBootCacheDhcp4Offer (IN HTTP_BOOT_PRIVATE_DATA *Private, IN EFI_DHCP4_PACKET *RcvdOffer)
 
VOID HttpBootSelectDhcpOffer (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS EFIAPI HttpBootDhcp4CallBack (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 HttpBootRegisterIp4Gateway (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS HttpBootRegisterIp4Dns (IN HTTP_BOOT_PRIVATE_DATA *Private, IN UINTN DataLength, IN VOID *DnsServerData)
 
EFI_STATUS HttpBootSetIp4Policy (IN HTTP_BOOT_PRIVATE_DATA *Private)
 
EFI_STATUS HttpBootDhcp4Dora (IN HTTP_BOOT_PRIVATE_DATA *Private)
 

Variables

UINT8 mInterestedDhcp4Tags [HTTP_BOOT_DHCP4_TAG_INDEX_MAX]
 
UINT32 mHttpDhcpTimeout [4] = { 4, 8, 16, 32 }
 

Detailed Description

Functions implementation related with DHCPv4 for HTTP boot driver.

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

Definition in file HttpBootDhcp4.c.

Function Documentation

◆ HttpBootBuildDhcp4Options()

UINT32 HttpBootBuildDhcp4Options ( IN HTTP_BOOT_PRIVATE_DATA Private,
OUT EFI_DHCP4_PACKET_OPTION **  OptList,
IN UINT8 *  Buffer 
)

Build the options buffer for the DHCPv4 request packet.

Parameters
[in]PrivatePointer to HTTP boot driver private data.
[out]OptListPointer to the option pointer array.
[in]BufferPointer to the buffer to contain the option list.
Returns
Index The count of the built-in options.

Definition at line 40 of file HttpBootDhcp4.c.

◆ HttpBootCacheDhcp4Offer()

EFI_STATUS HttpBootCacheDhcp4Offer ( IN HTTP_BOOT_PRIVATE_DATA Private,
IN EFI_DHCP4_PACKET RcvdOffer 
)

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

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

Definition at line 443 of file HttpBootDhcp4.c.

◆ HttpBootCacheDhcp4Packet()

EFI_STATUS HttpBootCacheDhcp4Packet ( 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 222 of file HttpBootDhcp4.c.

◆ HttpBootDhcp4CallBack()

EFI_STATUS EFIAPI HttpBootDhcp4CallBack ( 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 579 of file HttpBootDhcp4.c.

◆ HttpBootDhcp4Dora()

EFI_STATUS HttpBootDhcp4Dora ( IN HTTP_BOOT_PRIVATE_DATA Private)

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

Parameters
[in]PrivatePointer to HTTP boot driver private data.
Return values
EFI_SUCCESSThe D.O.R.A process successfully finished.
OthersFailed to finish the D.O.R.A process.

Definition at line 809 of file HttpBootDhcp4.c.

◆ HttpBootParseDhcp4Options()

EFI_DHCP4_PACKET_OPTION * HttpBootParseDhcp4Options ( 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 176 of file HttpBootDhcp4.c.

◆ HttpBootParseDhcp4Packet()

EFI_STATUS HttpBootParseDhcp4Packet ( IN HTTP_BOOT_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 an invalid packet.

Definition at line 247 of file HttpBootDhcp4.c.

◆ HttpBootRegisterIp4Dns()

EFI_STATUS HttpBootRegisterIp4Dns ( IN HTTP_BOOT_PRIVATE_DATA Private,
IN UINTN  DataLength,
IN VOID *  DnsServerData 
)

This function will register the default DNS addresses to the network device.

Parameters
[in]PrivateThe pointer to HTTP_BOOT_PRIVATE_DATA.
[in]DataLengthSize of the buffer pointed to by DnsServerData in bytes.
[in]DnsServerDataPoint a list of DNS server address in an array of EFI_IPv4_ADDRESS instances.
Return values
EFI_SUCCESSThe DNS configuration has been configured successfully.
OthersFailed to configure the address.

Definition at line 731 of file HttpBootDhcp4.c.

◆ HttpBootRegisterIp4Gateway()

EFI_STATUS HttpBootRegisterIp4Gateway ( IN HTTP_BOOT_PRIVATE_DATA Private)

This function will register the IPv4 gateway address to the network device.

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

Definition at line 689 of file HttpBootDhcp4.c.

◆ HttpBootSelectDhcpOffer()

VOID HttpBootSelectDhcpOffer ( IN HTTP_BOOT_PRIVATE_DATA Private)

Select an DHCPv4 or DHCP6 offer, and record SelectIndex and SelectProxyType.

Parameters
[in]PrivatePointer to HTTP boot driver private data.

Definition at line 492 of file HttpBootDhcp4.c.

◆ HttpBootSetIp4Policy()

EFI_STATUS HttpBootSetIp4Policy ( IN HTTP_BOOT_PRIVATE_DATA Private)

This function will switch the IP4 configuration policy to Static.

Parameters
[in]PrivatePointer to HTTP boot driver private data.
Return values
EFI_SUCCESSThe policy is already configured to static.
OthersOther error as indicated..

Definition at line 761 of file HttpBootDhcp4.c.

Variable Documentation

◆ mHttpDhcpTimeout

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

Definition at line 27 of file HttpBootDhcp4.c.

◆ mInterestedDhcp4Tags

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

Definition at line 14 of file HttpBootDhcp4.c.