NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c File Reference


Functions

EFI_DHCP4_PACKET_OPTION * PxeBcParseDhcp4Options (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)
VOID PxeBcCacheDhcp4Packet (IN EFI_DHCP4_PACKET *Dst, IN EFI_DHCP4_PACKET *Src)
EFI_STATUS PxeBcParseDhcp4Packet (IN PXEBC_DHCP4_PACKET_CACHE *Cache4)
VOID PxeBcCopyDhcp4Ack (IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP4_PACKET *Ack, IN BOOLEAN Verified)
VOID PxeBcCopyProxyOffer (IN PXEBC_PRIVATE_DATA *Private, IN UINT32 OfferIndex)
EFI_STATUS PxeBcRetryBinlOffer (IN PXEBC_PRIVATE_DATA *Private, IN UINT32 Index)
VOID 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, OUT EFI_DHCP4_PACKET **NewPacket)
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 - 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 which 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 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] Private Pointer to PxeBc private data.
[out] OptList Pointer to the option pointer array.
[in] Buffer Pointer to the buffer to contain the option list.
[in] NeedMsgType If TRUE, it is necessary to include the Msg type option. Otherwise, it is not necessary.
Returns:
Index The count of the built-in options.

References PXEBC_DHCP4_OPTION_ENTRY::Arch, PXEBC_DHCP4_OPTION_CLID::ArchitectureType, PXEBC_DHCP4_OPTION_ENTRY::Clid, DEFAULT_CLASS_ID_DATA, DEFAULT_UNDI_MAJOR, DEFAULT_UNDI_MINOR, DEFAULT_UNDI_TYPE, GET_NEXT_DHCP_OPTION, PXEBC_DHCP4_OPTION_UUID::Guid, PXEBC_DHCP4_OPTION_CLID::InterfaceName, PXEBC_DHCP4_OPTION_UNDI::MajorVer, PXEBC_DHCP4_OPTION_ENTRY::MaxMesgSize, PXEBC_DHCP4_OPTION_ENTRY::Mesg, PXEBC_DHCP4_OPTION_UNDI::MinorVer, PXEBC_DHCP4_OPTION_ENTRY::Para, PXEBC_DHCP4_OPTION_PARA::ParaList, PXEBC_DHCP4_MSG_TYPE_REQUEST, PXEBC_DHCP4_PACKET_MAX_SIZE, PXEBC_DHCP4_TAG_BOOTFILE, PXEBC_DHCP4_TAG_BOOTFILE_LEN, PXEBC_DHCP4_TAG_BROADCAST, PXEBC_DHCP4_TAG_CLASS_ID, PXEBC_DHCP4_TAG_DNS_SERVER, PXEBC_DHCP4_TAG_DOMAINNAME, PXEBC_DHCP4_TAG_EMTU, PXEBC_DHCP4_TAG_EXTEND_PATH, PXEBC_DHCP4_TAG_HOSTNAME, PXEBC_DHCP4_TAG_LEASE, PXEBC_DHCP4_TAG_MAXMSG, PXEBC_DHCP4_TAG_MSG_TYPE, PXEBC_DHCP4_TAG_NAME_SERVER, PXEBC_DHCP4_TAG_NETMASK, PXEBC_DHCP4_TAG_NIS_DOMAIN, PXEBC_DHCP4_TAG_NIS_SERVER, PXEBC_DHCP4_TAG_NTP_SERVER, PXEBC_DHCP4_TAG_PARA_LIST, PXEBC_DHCP4_TAG_REQUEST_IP, PXEBC_DHCP4_TAG_ROOTPATH, PXEBC_DHCP4_TAG_ROUTER, PXEBC_DHCP4_TAG_SERVER_ID, PXEBC_DHCP4_TAG_T1, PXEBC_DHCP4_TAG_T2, PXEBC_DHCP4_TAG_TFTP, PXEBC_DHCP4_TAG_TIME_OFFSET, PXEBC_DHCP4_TAG_TIME_SERVER, PXEBC_DHCP4_TAG_TTL, PXEBC_DHCP4_TAG_VENDOR, PXEBC_PXE_DHCP4_TAG_ARCH, PXEBC_PXE_DHCP4_TAG_UNDI, PXEBC_PXE_DHCP4_TAG_UUID, PxeBcUintnToAscDecWithFormat(), PXEBC_DHCP4_OPTION_MAX_MESG_SIZE::Size, PXEBC_DHCP4_OPTION_ARCH::Type, PXEBC_DHCP4_OPTION_UNDI::Type, PXEBC_DHCP4_OPTION_UUID::Type, PXEBC_DHCP4_OPTION_MESG::Type, PXEBC_DHCP4_OPTION_ENTRY::Undi, PXEBC_DHCP4_OPTION_CLID::UndiMajor, PXEBC_DHCP4_OPTION_CLID::UndiMinor, and PXEBC_DHCP4_OPTION_ENTRY::Uuid.

Referenced by PxeBcDhcp4Discover(), and PxeBcDhcp4Dora().

VOID PxeBcCacheDhcp4Offer ( IN PXEBC_PRIVATE_DATA Private,
IN EFI_DHCP4_PACKET *  RcvdOffer 
)

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

Parameters:
[in] Private Pointer to PxeBc private data.
[in] RcvdOffer Pointer to the received offer packet.

References IS_PROXY_DHCP_OFFER, PXEBC_DHCP4_PACKET::Offer, PXEBC_DHCP4_PACKET_CACHE::OfferType, PXEBC_DHCP4_PACKET_CACHE::Packet, PXEBC_OFFER_MAX_NUM, PxeBcCacheDhcp4Packet(), PxeBcParseDhcp4Packet(), PxeOfferTypeBootp, PxeOfferTypeMax, and PxeOfferTypeProxyBinl.

Referenced by PxeBcDhcp4CallBack().

VOID PxeBcCacheDhcp4Packet ( 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 PxeBcCacheDhcp4Offer(), PxeBcCopyDhcp4Ack(), PxeBcCopyProxyOffer(), and PxeBcDhcp4Discover().

VOID 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] Private Pointer to PxeBc private data.
[in] Ack Pointer to the DHCPv4 ack packet.
[in] Verified If TRUE, parse the ACK packet and store info into mode data.

References PxeBcCacheDhcp4Packet(), and PxeBcParseDhcp4Packet().

Referenced by PxeBcDhcp4CallBack(), and PxeBcHandleDhcp4Offer().

VOID PxeBcCopyProxyOffer ( IN PXEBC_PRIVATE_DATA Private,
IN UINT32  OfferIndex 
)

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

Parameters:
[in] Private Pointer to PxeBc private data.
[in] OfferIndex The received order of offer packets.

References PXEBC_OFFER_MAX_NUM, PxeBcCacheDhcp4Packet(), and PxeBcParseDhcp4Packet().

Referenced by PxeBcHandleDhcp4Offer().

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,
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 PXEBC_DHCP_PACKET_CACHE::Dhcp4, _PXEBC_PRIVATE_DATA::Function, GET_OPTION_BUFFER_LEN, PXEBC_DHCP4_PACKET::Offer, _PXEBC_PRIVATE_DATA::OfferBuffer, _PXEBC_PRIVATE_DATA::OfferNum, PXEBC_DHCP4_PACKET_CACHE::Packet, _PXEBC_PRIVATE_DATA::PxeBc, PXEBC_DHCP4_PACKET_MAX_SIZE, PXEBC_DHCP4_TAG_MAXMSG, PXEBC_OFFER_MAX_NUM, PxeBcCacheDhcp4Offer(), _PXEBC_PRIVATE_DATA::PxeBcCallback, PxeBcCopyDhcp4Ack(), PxeBcParseDhcp4Options(), PxeBcSelectDhcp4Offer(), and _PXEBC_PRIVATE_DATA::SelectIndex.

Referenced by PxeBcDhcp4Dora().

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] Private Pointer to PxeBc private data.
[in] Type PxeBc option boot item type.
[in] Layer Pointer to option boot item layer.
[in] UseBis Use BIS or not.
[in] DestIp Pointer to the server address.
[in] IpCount The total count of the server address.
[in] SrvList Pointer to EFI_PXE_BASE_CODE_SRVLIST.
Return values:
EFI_SUCCESS Successfully discovered boot file.
EFI_OUT_OF_RESOURCES Failed to allocate resource.
EFI_NOT_FOUND Can't get the PXE reply packet.
Others Failed to discover boot file.

References PXEBC_OPTION_BOOT_ITEM::Layer, PXEBC_BOOT_REQUEST_RETRIES, PXEBC_BOOT_REQUEST_TIMEOUT, PXEBC_BS_DISCOVER_PORT, PXEBC_DHCP4_OPTION_MAX_NUM, PXEBC_DHCP4_OPTION_MAX_SIZE, PXEBC_DHCP4_S_PORT, PXEBC_DHCP4_TAG_EOP, PXEBC_DHCP4_TAG_VENDOR, PXEBC_VENDOR_TAG_BOOT_ITEM, PxeBcBuildDhcp4Options(), PxeBcCacheDhcp4Packet(), and PXEBC_OPTION_BOOT_ITEM::Type.

Referenced by PxeBcDiscoverBootServer(), and PxeBcRetryBinlOffer().

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] Private Pointer to PxeBc private data.
[in] Dhcp4 Pointer to the EFI_DHCP4_PROTOCOL
Return values:
EFI_SUCCESS The D.O.R.A process successfully finished.
Others Failed to finish the D.O.R.A process.

References mPxeDhcpTimeout, PXEBC_DHCP4_OPTION_MAX_NUM, PXEBC_DHCP4_OPTION_MAX_SIZE, PXEBC_DHCP_RETRIES, PxeBcBuildDhcp4Options(), PxeBcDhcp4CallBack(), PxeBcFlushStationIp(), PxeBcHandleDhcp4Offer(), and PxeBcShowIp4Addr().

Referenced by EfiPxeBcDhcp().

EFI_STATUS PxeBcHandleDhcp4Offer ( IN PXEBC_PRIVATE_DATA Private  ) 

Handle the DHCPv4 offer packet.

Parameters:
[in] Private Pointer to PxeBc private data.
Return values:
EFI_SUCCESS Handled the DHCPv4 offer packet successfully.
EFI_NO_RESPONSE No response to the following request packet.
EFI_NOT_FOUND No boot filename received.

References IS_PROXY_DHCP_OFFER, PXEBC_DHCP4_PACKET::Offer, PXEBC_DHCP4_PACKET_CACHE::OfferType, PXEBC_DHCP4_PACKET_CACHE::OptList, PXEBC_DHCP4_PACKET_CACHE::Packet, PXEBC_DHCP4_TAG_INDEX_BOOTFILE, PXEBC_OFFER_MAX_NUM, PxeBcCopyDhcp4Ack(), PxeBcCopyProxyOffer(), PxeBcRetryBinlOffer(), PxeOfferTypeBootp, PxeOfferTypeDhcpBinl, PxeOfferTypeDhcpOnly, PxeOfferTypeMax, and PxeOfferTypeProxyBinl.

Referenced by PxeBcDhcp4Dora().

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] 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 PXEBC_DHCP4_TAG_EOP, and PXEBC_DHCP4_TAG_PAD.

Referenced by PxeBcDhcp4CallBack(), and PxeBcParseDhcp4Packet().

EFI_STATUS PxeBcParseDhcp4Packet ( IN PXEBC_DHCP4_PACKET_CACHE Cache4  ) 

VOID PxeBcParseVendorOptions ( IN EFI_DHCP4_PACKET_OPTION *  Dhcp4Option,
IN PXEBC_VENDOR_OPTION VendorOption 
)

EFI_STATUS PxeBcRetryBinlOffer ( IN PXEBC_PRIVATE_DATA Private,
IN UINT32  Index 
)

Retry to request bootfile name by the BINL offer.

Parameters:
[in] Private Pointer to PxeBc private data.
[in] Index The received order of offer packets.
Return values:
EFI_SUCCESS Successfully retried to request bootfile name.
EFI_DEVICE_ERROR Failed to retry bootfile name.

References PXEBC_DHCP4_PACKET::Offer, PXEBC_DHCP4_PACKET_CACHE::OfferType, PXEBC_DHCP4_PACKET_CACHE::OptList, PXEBC_DHCP4_PACKET_CACHE::Packet, PXEBC_DHCP4_TAG_INDEX_BOOTFILE, PXEBC_DHCP4_TAG_INDEX_SERVER_ID, PXEBC_OFFER_MAX_NUM, PxeBcDhcp4Discover(), PxeBcParseDhcp4Packet(), PxeOfferTypeDhcpBinl, PxeOfferTypeProxyBinl, PxeOfferTypeProxyPxe10, and PxeOfferTypeProxyWfm11a.

Referenced by PxeBcHandleDhcp4Offer().

VOID PxeBcSeedDhcp4Packet ( OUT EFI_DHCP4_PACKET *  Seed,
IN EFI_UDP4_PROTOCOL *  Udp4 
)

Create a template DHCPv4 packet as a seed.

Parameters:
[out] Seed Pointer to the seed packet.
[in] Udp4 Pointer to EFI_UDP4_PROTOCOL.

References PXEBC_DHCP4_MAGIC, PXEBC_DHCP4_OPCODE_REQUEST, and PXEBC_DHCP4_TAG_EOP.

Referenced by EfiPxeBcStart().

VOID PxeBcSelectDhcp4Offer ( IN PXEBC_PRIVATE_DATA Private  ) 

Select an DHCPv4 offer, and record SelectIndex and SelectProxyType.

Parameters:
[in] Private Pointer to PxeBc private data.

References IS_PROXY_DHCP_OFFER, PXEBC_DHCP4_TAG_INDEX_BOOTFILE, PxeOfferTypeBootp, PxeOfferTypeDhcpBinl, PxeOfferTypeDhcpOnly, PxeOfferTypeDhcpPxe10, PxeOfferTypeDhcpWfm11a, PxeOfferTypeProxyBinl, PxeOfferTypeProxyPxe10, and PxeOfferTypeProxyWfm11a.

Referenced by PxeBcDhcp4CallBack().

EFI_STATUS PxeBcSetIp4Policy ( IN PXEBC_PRIVATE_DATA Private  ) 

Switch the Ip4 policy to static.

Parameters:
[in] Private The pointer to PXEBC_PRIVATE_DATA.
Return values:
EFI_SUCCESS The policy is already configured to static.
Others Other error as indicated..

References Policy.

Referenced by EfiPxeBcStart().


Variable Documentation

UINT8 mInterestedDhcp4Tags[PXEBC_DHCP4_TAG_INDEX_MAX]

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

Referenced by PxeBcDhcp4Dora().


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