NetworkPkg/HttpBootDxe/HttpBootDhcp4.c File Reference


Functions

UINT32 HttpBootBuildDhcp4Options (IN HTTP_BOOT_PRIVATE_DATA *Private, OUT EFI_DHCP4_PACKET_OPTION **OptList, IN UINT8 *Buffer)
EFI_DHCP4_PACKET_OPTION * HttpBootParseDhcp4Options (IN UINT8 *Buffer, IN UINT32 Length, IN UINT8 OptTag)
VOID HttpBootCacheDhcp4Packet (IN EFI_DHCP4_PACKET *Dst, IN EFI_DHCP4_PACKET *Src)
EFI_STATUS HttpBootParseDhcp4Packet (IN HTTP_BOOT_DHCP4_PACKET_CACHE *Cache4)
VOID HttpBootCacheDhcp4Offer (IN HTTP_BOOT_PRIVATE_DATA *Private, IN EFI_DHCP4_PACKET *RcvdOffer)
VOID HttpBootSelectDhcp4Offer (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, OUT EFI_DHCP4_PACKET **NewPacket)
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 HttpBootSetIpPolicy (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, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Function Documentation

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] Private Pointer to HTTP boot driver private data.
[out] OptList Pointer to the option pointer array.
[in] Buffer Pointer to the buffer to contain the option list.
Returns:
Index The count of the built-in options.

References HTTP_BOOT_DHCP4_OPTION_ENTRY::Arch, HTTP_BOOT_DHCP4_OPTION_CLID::ArchitectureType, HTTP_BOOT_DHCP4_OPTION_ENTRY::Clid, DEFAULT_CLASS_ID_DATA, DEFAULT_UNDI_MAJOR, DEFAULT_UNDI_MINOR, DEFAULT_UNDI_TYPE, EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE, GET_NEXT_DHCP_OPTION, HTTP_BOOT_DHCP4_OPTION_UUID::Guid, HTTP_BOOT_DHCP4_TAG_ARCH, HTTP_BOOT_DHCP4_TAG_BOOTFILE, HTTP_BOOT_DHCP4_TAG_BOOTFILE_LEN, HTTP_BOOT_DHCP4_TAG_BROADCAST, HTTP_BOOT_DHCP4_TAG_CLASS_ID, HTTP_BOOT_DHCP4_TAG_DNS_SERVER, HTTP_BOOT_DHCP4_TAG_DOMAINNAME, HTTP_BOOT_DHCP4_TAG_EMTU, HTTP_BOOT_DHCP4_TAG_EXTEND_PATH, HTTP_BOOT_DHCP4_TAG_HOSTNAME, HTTP_BOOT_DHCP4_TAG_LEASE, HTTP_BOOT_DHCP4_TAG_NAME_SERVER, HTTP_BOOT_DHCP4_TAG_NETMASK, HTTP_BOOT_DHCP4_TAG_NIS_DOMAIN, HTTP_BOOT_DHCP4_TAG_NIS_SERVER, HTTP_BOOT_DHCP4_TAG_NTP_SERVER, HTTP_BOOT_DHCP4_TAG_PARA_LIST, HTTP_BOOT_DHCP4_TAG_REQUEST_IP, HTTP_BOOT_DHCP4_TAG_ROOTPATH, HTTP_BOOT_DHCP4_TAG_ROUTER, HTTP_BOOT_DHCP4_TAG_SERVER_ID, HTTP_BOOT_DHCP4_TAG_T1, HTTP_BOOT_DHCP4_TAG_T2, HTTP_BOOT_DHCP4_TAG_TIME_OFFSET, HTTP_BOOT_DHCP4_TAG_TIME_SERVER, HTTP_BOOT_DHCP4_TAG_TTL, HTTP_BOOT_DHCP4_TAG_UNDI, HTTP_BOOT_DHCP4_TAG_UUID, HTTP_BOOT_DHCP4_TAG_VENDOR, HttpBootUintnToAscDecWithFormat(), HTTP_BOOT_DHCP4_OPTION_CLID::InterfaceName, HTTP_BOOT_DHCP4_OPTION_UNDI::MajorVer, HTTP_BOOT_DHCP4_OPTION_UNDI::MinorVer, HTTP_BOOT_DHCP4_OPTION_ENTRY::Para, HTTP_BOOT_DHCP4_OPTION_PARA::ParaList, HTTP_BOOT_DHCP4_OPTION_ARCH::Type, HTTP_BOOT_DHCP4_OPTION_UNDI::Type, HTTP_BOOT_DHCP4_OPTION_UUID::Type, HTTP_BOOT_DHCP4_OPTION_ENTRY::Undi, HTTP_BOOT_DHCP4_OPTION_CLID::UndiMajor, HTTP_BOOT_DHCP4_OPTION_CLID::UndiMinor, and HTTP_BOOT_DHCP4_OPTION_ENTRY::Uuid.

Referenced by HttpBootDhcp4Dora().

VOID 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] Private Pointer to HTTP boot driver private data.
[in] RcvdOffer Pointer to the received offer packet.

References HTTP_BOOT_OFFER_MAX_NUM, HttpBootCacheDhcp4Packet(), HttpBootParseDhcp4Packet(), HttpOfferTypeMax, HTTP_BOOT_DHCP4_PACKET::Offer, HTTP_BOOT_DHCP4_PACKET_CACHE::OfferType, and HTTP_BOOT_DHCP4_PACKET_CACHE::Packet.

Referenced by HttpBootDhcp4CallBack().

VOID HttpBootCacheDhcp4Packet ( IN EFI_DHCP4_PACKET *  Dst,
IN EFI_DHCP4_PACKET *  Src 
)

Cache the DHCPv4 packet.

Parameters:
[in] Dst Pointer to the cache buffer for DHCPv4 packet.
[in] Src Pointer to the DHCPv4 packet to be cached.

Referenced by HttpBootCacheDhcp4Offer().

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,
OUT EFI_DHCP4_PACKET **  NewPacket 
)

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] This Pointer to the EFI DHCPv4 Protocol.
[in] Context Pointer to the context set by EFI_DHCP4_PROTOCOL.Configure().
[in] CurrentState The current operational state of the EFI DHCPv4 Protocol driver.
[in] Dhcp4Event The event that occurs in the current state, which usually means a state transition.
[in] Packet The DHCPv4 packet that is going to be sent or already received.
[out] NewPacket The packet that is used to replace the above Packet.
Return values:
EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.
EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol driver will continue to wait for more DHCPOFFER packets until the retry timeout expires.
EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and return to the Dhcp4Init or Dhcp4InitReboot state.

References HTTP_BOOT_DHCP_PACKET_CACHE::Dhcp4, GET_OPTION_BUFFER_LEN, HTTP_BOOT_DHCP4_PACKET_MAX_SIZE, HTTP_BOOT_DHCP4_TAG_MAXMSG, HTTP_BOOT_OFFER_MAX_NUM, HttpBootCacheDhcp4Offer(), HttpBootParseDhcp4Options(), HttpBootSelectDhcp4Offer(), HTTP_BOOT_DHCP4_PACKET::Offer, _HTTP_BOOT_PRIVATE_DATA::OfferBuffer, _HTTP_BOOT_PRIVATE_DATA::OfferNum, HTTP_BOOT_DHCP4_PACKET_CACHE::Packet, and _HTTP_BOOT_PRIVATE_DATA::SelectIndex.

Referenced by 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] Private Pointer to HTTP boot driver private data.
Return values:
EFI_SUCCESS The D.O.R.A process successfully finished.
Others Failed to finish the D.O.R.A process.

References HTTP_BOOT_DHCP4_OPTION_MAX_NUM, HTTP_BOOT_DHCP4_OPTION_MAX_SIZE, HTTP_BOOT_DHCP_RETRIES, HttpBootBuildDhcp4Options(), HttpBootDhcp4CallBack(), HttpBootRegisterIp4Gateway(), HttpBootSetIpPolicy(), HttpBootShowIp4Addr(), and mHttpDhcpTimeout.

Referenced by HttpBootDhcp().

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] Buffer Pointer to the option buffer.
[in] Length Length of the option buffer.
[in] OptTag Tag of the required option.
Return values:
NULL Failed to find the required option.
Others The position of the required option.

References HTTP_BOOT_DHCP4_TAG_EOP, and HTTP_BOOT_DHCP4_TAG_PAD.

Referenced by HttpBootDhcp4CallBack(), and HttpBootParseDhcp4Packet().

EFI_STATUS HttpBootParseDhcp4Packet ( IN HTTP_BOOT_DHCP4_PACKET_CACHE Cache4  ) 

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] Private The pointer to HTTP_BOOT_PRIVATE_DATA.
[in] DataLength Size of the buffer pointed to by DnsServerData in bytes.
[in] DnsServerData Point a list of DNS server address in an array of EFI_IPv4_ADDRESS instances.
Return values:
EFI_SUCCESS The DNS configuration has been configured successfully.
Others Failed to configure the address.

Referenced by HttpBootExtractUriInfo().

EFI_STATUS HttpBootRegisterIp4Gateway ( IN HTTP_BOOT_PRIVATE_DATA Private  ) 

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

Parameters:
[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA.
Return values:
EFI_SUCCESS The new IP configuration has been configured successfully.
Others Failed to configure the address.

Referenced by HttpBootDhcp4Dora().

VOID HttpBootSelectDhcp4Offer ( IN HTTP_BOOT_PRIVATE_DATA Private  ) 

Select an DHCPv4 offer, and record SelectIndex and SelectProxyType.

Parameters:
[in] Private Pointer to HTTP boot driver private data.

References HttpOfferTypeDhcpDns, HttpOfferTypeDhcpIpUri, HttpOfferTypeDhcpNameUri, HttpOfferTypeDhcpNameUriDns, HttpOfferTypeDhcpOnly, HttpOfferTypeMax, HttpOfferTypeProxyIpUri, and HttpOfferTypeProxyNameUri.

Referenced by HttpBootDhcp4CallBack().

EFI_STATUS HttpBootSetIpPolicy ( IN HTTP_BOOT_PRIVATE_DATA Private  ) 

This function will switch the IP4 configuration policy to Static.

Parameters:
[in] Private Pointer to HTTP boot driver private data.
Return values:
EFI_SUCCESS The policy is already configured to static.
Others Other error as indicated..

References Policy.

Referenced by HttpBootDhcp4Dora().


Variable Documentation

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

Referenced by HttpBootDhcp4Dora().

UINT8 mInterestedDhcp4Tags[HTTP_BOOT_DHCP4_TAG_INDEX_MAX]


Generated on Mon Sep 28 08:49:05 2015 for NetworkPkg[ALL] by  doxygen 1.5.7.1