TianoCore EDK2 master
|
#include "PxeBcImpl.h"
Go to the source code of this file.
Support functions implementation for UefiPxeBc Driver.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file PxeBcSupport.c.
VOID CalcElapsedTime | ( | IN PXEBC_PRIVATE_DATA * | Private | ) |
Calculate the elapsed time.
[in] | Private | The pointer to PXE private data |
Definition at line 1495 of file PxeBcSupport.c.
Update the arp cache periodically.
Event | The pointer to EFI_PXE_BC_PROTOCOL. |
Context | Context of the timer event. |
Definition at line 180 of file PxeBcSupport.c.
BOOLEAN PxeBcCheckArpCache | ( | IN EFI_PXE_BASE_CODE_MODE * | Mode, |
IN EFI_IPv4_ADDRESS * | Ip4Addr, | ||
OUT EFI_MAC_ADDRESS * | MacAddress | ||
) |
Do arp resolution from arp cache in PxeBcMode.
Mode | The pointer to EFI_PXE_BASE_CODE_MODE. |
Ip4Addr | The Ip4 address for resolution. |
MacAddress | The resolved MAC address if the resolution is successful. The value is undefined if the resolution fails. |
TRUE | Found an matched entry. |
FALSE | Did not find a matched entry. |
Definition at line 144 of file PxeBcSupport.c.
BOOLEAN PxeBcCheckByDestIp | ( | IN EFI_PXE_BASE_CODE_MODE * | Mode, |
IN VOID * | Session, | ||
IN OUT EFI_IP_ADDRESS * | DestIp, | ||
IN UINT16 | OpFlags | ||
) |
Filter the received packet using the destination Ip.
[in] | Mode | The pointer to the mode data of PxeBc. |
[in] | Session | The pointer to the current UDPv4 session. |
[in,out] | DestIp | The pointer to the destination Ip address. |
[in] | OpFlags | Operation flag for UdpRead/UdpWrite. |
TRUE | Passed the IPv4 filter successfully. |
FALSE | Failed to pass the IPv4 filter. |
Definition at line 929 of file PxeBcSupport.c.
BOOLEAN PxeBcCheckByDestPort | ( | IN EFI_PXE_BASE_CODE_MODE * | Mode, |
IN VOID * | Session, | ||
IN OUT UINT16 * | DestPort, | ||
IN UINT16 | OpFlags | ||
) |
Check the received packet using the destination port.
[in] | Mode | The pointer to the mode data of PxeBc. |
[in] | Session | The pointer to the current UDPv4 session. |
[in,out] | DestPort | The pointer to the destination port. |
[in] | OpFlags | Operation flag for UdpRead/UdpWrite. |
TRUE | Passed the IPv4 filter successfully. |
FALSE | Failed to pass the IPv4 filter. |
Definition at line 991 of file PxeBcSupport.c.
BOOLEAN PxeBcCheckByIpFilter | ( | IN EFI_PXE_BASE_CODE_MODE * | Mode, |
IN VOID * | Session, | ||
IN UINT16 | OpFlags | ||
) |
Check the received packet using the Ip filter.
[in] | Mode | The pointer to the mode data of PxeBc. |
[in] | Session | The pointer to the current UDPv4 session. |
[in] | OpFlags | Operation flag for UdpRead/UdpWrite. |
TRUE | Passed the Ip filter successfully. |
FALSE | Failed to pass the Ip filter. |
Definition at line 840 of file PxeBcSupport.c.
Notify the callback function when an event is triggered.
[in] | Event | The triggered event. |
[in] | Context | The opaque parameter to the function. |
Definition at line 123 of file PxeBcSupport.c.
EFI_STATUS PxeBcConfigUdp4Write | ( | IN EFI_UDP4_PROTOCOL * | Udp4, |
IN EFI_IPv4_ADDRESS * | StationIp, | ||
IN EFI_IPv4_ADDRESS * | SubnetMask, | ||
IN EFI_IPv4_ADDRESS * | Gateway, | ||
IN OUT UINT16 * | SrcPort, | ||
IN BOOLEAN | DoNotFragment, | ||
IN UINT8 | Ttl, | ||
IN UINT8 | ToS | ||
) |
This function is to configure a UDPv4 instance for UdpWrite.
[in] | Udp4 | The pointer to EFI_UDP4_PROTOCOL. |
[in] | StationIp | The pointer to the station address. |
[in] | SubnetMask | The pointer to the subnet mask. |
[in] | Gateway | The pointer to the gateway address. |
[in,out] | SrcPort | The pointer to the source port. |
[in] | DoNotFragment | If TRUE, fragment is not enabled. Otherwise, fragment is enabled. |
[in] | Ttl | The time to live field of the IP header. |
[in] | ToS | The type of service field of the IP header. |
EFI_SUCCESS | Successfully configured this instance. |
Others | Failed to configure this instance. |
Definition at line 519 of file PxeBcSupport.c.
EFI_STATUS PxeBcConfigUdp6Write | ( | IN EFI_UDP6_PROTOCOL * | Udp6, |
IN EFI_IPv6_ADDRESS * | StationIp, | ||
IN OUT UINT16 * | SrcPort | ||
) |
This function is to configure a UDPv6 instance for UdpWrite.
[in] | Udp6 | The pointer to EFI_UDP6_PROTOCOL. |
[in] | StationIp | The pointer to the station address. |
[in,out] | SrcPort | The pointer to the source port. |
EFI_SUCCESS | Successfully configured this instance. |
Others | Failed to configure this instance. |
Definition at line 583 of file PxeBcSupport.c.
BOOLEAN PxeBcFilterBySrcIp | ( | IN EFI_PXE_BASE_CODE_MODE * | Mode, |
IN VOID * | Session, | ||
IN OUT EFI_IP_ADDRESS * | SrcIp, | ||
IN UINT16 | OpFlags | ||
) |
Filter the received packet using the source Ip.
[in] | Mode | The pointer to the mode data of PxeBc. |
[in] | Session | The pointer to the current UDPv4 session. |
[in,out] | SrcIp | The pointer to the source Ip address. |
[in] | OpFlags | Operation flag for UdpRead/UdpWrite. |
TRUE | Passed the IPv4 filter successfully. |
FALSE | Failed to pass the IPv4 filter. |
Definition at line 1038 of file PxeBcSupport.c.
BOOLEAN PxeBcFilterBySrcPort | ( | IN EFI_PXE_BASE_CODE_MODE * | Mode, |
IN VOID * | Session, | ||
IN OUT UINT16 * | SrcPort, | ||
IN UINT16 | OpFlags | ||
) |
Filter the received packet using the source port.
[in] | Mode | The pointer to the mode data of PxeBc. |
[in] | Session | The pointer to the current UDPv4 session. |
[in,out] | SrcPort | The pointer to the source port. |
[in] | OpFlags | Operation flag for UdpRead/UdpWrite. |
TRUE | Passed the IPv4 filter successfully. |
FALSE | Failed to pass the IPv4 filter. |
Definition at line 1093 of file PxeBcSupport.c.
EFI_STATUS PxeBcFlushStationIp | ( | PXEBC_PRIVATE_DATA * | Private, |
EFI_IP_ADDRESS *StationIp | OPTIONAL, | ||
EFI_IP_ADDRESS *SubnetMask | OPTIONAL | ||
) |
Flush the previous configuration using the new station Ip address.
[in] | Private | The pointer to the PxeBc private data. |
[in] | StationIp | The pointer to the station Ip address. |
[in] | SubnetMask | The pointer to the subnet mask address for v4. |
EFI_SUCCESS | Successfully flushed the previous configuration. |
Others | Failed to flush using the new station Ip. |
Definition at line 24 of file PxeBcSupport.c.
VOID EFIAPI PxeBcIcmp6ErrorDpcHandle | ( | IN VOID * | Context | ) |
Notify function to handle the received ICMP6 message in DPC.
Context | The PXEBC private data. |
Definition at line 377 of file PxeBcSupport.c.
Callback function to update the latest ICMP6 error message.
Event | The event signalled. |
Context | The context passed in using the event notifier. |
Definition at line 493 of file PxeBcSupport.c.
VOID EFIAPI PxeBcIcmpErrorDpcHandle | ( | IN VOID * | Context | ) |
Notify function to handle the received ICMP message in DPC.
Context | The PXEBC private data. |
Definition at line 242 of file PxeBcSupport.c.
Callback function to update the latest ICMP6 error message.
Event | The event signalled. |
Context | The context passed in using the event notifier. |
Definition at line 361 of file PxeBcSupport.c.
VOID PxeBcShowIp4Addr | ( | IN EFI_IPv4_ADDRESS * | Ip | ) |
This function is to display the IPv4 address.
[in] | Ip | The pointer to the IPv4 address. |
Definition at line 1344 of file PxeBcSupport.c.
VOID PxeBcShowIp6Addr | ( | IN EFI_IPv6_ADDRESS * | Ip | ) |
This function is to display the IPv6 address.
[in] | Ip | The pointer to the IPv6 address. |
Definition at line 1365 of file PxeBcSupport.c.
EFI_STATUS PxeBcUdp4Read | ( | IN EFI_UDP4_PROTOCOL * | Udp4, |
IN EFI_UDP4_COMPLETION_TOKEN * | Token, | ||
IN EFI_PXE_BASE_CODE_MODE * | Mode, | ||
IN EFI_EVENT | TimeoutEvent, | ||
IN UINT16 | OpFlags, | ||
IN BOOLEAN * | IsDone, | ||
OUT BOOLEAN * | IsMatched, | ||
IN OUT EFI_IP_ADDRESS *DestIp | OPTIONAL, | ||
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort | OPTIONAL, | ||
IN OUT EFI_IP_ADDRESS *SrcIp | OPTIONAL, | ||
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort | OPTIONAL | ||
) |
This function is to receive packet using Udp4Read.
[in] | Udp4 | The pointer to EFI_UDP4_PROTOCOL. |
[in] | Token | The pointer to EFI_UDP4_COMPLETION_TOKEN. |
[in] | Mode | The pointer to EFI_PXE_BASE_CODE_MODE. |
[in] | TimeoutEvent | The event for timeout. |
[in] | OpFlags | The UDP operation flags. |
[in] | IsDone | The pointer to the IsDone flag. |
[out] | IsMatched | The pointer to the IsMatched flag. |
[in,out] | DestIp | The pointer to the destination address. |
[in,out] | DestPort | The pointer to the destination port. |
[in,out] | SrcIp | The pointer to the source address. |
[in,out] | SrcPort | The pointer to the source port. |
EFI_SUCCESS | Successfully read the data using Udp4. |
Others | Failed to send out data. |
Definition at line 1147 of file PxeBcSupport.c.
EFI_STATUS PxeBcUdp4Write | ( | IN EFI_UDP4_PROTOCOL * | Udp4, |
IN EFI_UDP4_SESSION_DATA * | Session, | ||
IN EFI_EVENT | TimeoutEvent, | ||
IN EFI_IPv4_ADDRESS *Gateway | OPTIONAL, | ||
IN UINTN *HeaderSize | OPTIONAL, | ||
IN VOID *HeaderPtr | OPTIONAL, | ||
IN UINTN * | BufferSize, | ||
IN VOID * | BufferPtr | ||
) |
This function is to configure a UDPv4 instance for UdpWrite.
[in] | Udp4 | The pointer to EFI_UDP4_PROTOCOL. |
[in] | Session | The pointer to the UDP4 session data. |
[in] | TimeoutEvent | The event for timeout. |
[in] | Gateway | The pointer to the gateway address. |
[in] | HeaderSize | An optional field which may be set to the length of a header at HeaderPtr to be prefixed to the data at BufferPtr. |
[in] | HeaderPtr | If HeaderSize is not NULL, a pointer to a header to be prefixed to the data at BufferPtr. |
[in] | BufferSize | A pointer to the size of the data at BufferPtr. |
[in] | BufferPtr | A pointer to the data to be written. |
EFI_SUCCESS | Successfully send out data using Udp4Write. |
Others | Failed to send out data. |
Definition at line 639 of file PxeBcSupport.c.
EFI_STATUS PxeBcUdp6Read | ( | IN EFI_UDP6_PROTOCOL * | Udp6, |
IN EFI_UDP6_COMPLETION_TOKEN * | Token, | ||
IN EFI_PXE_BASE_CODE_MODE * | Mode, | ||
IN EFI_EVENT | TimeoutEvent, | ||
IN UINT16 | OpFlags, | ||
IN BOOLEAN * | IsDone, | ||
OUT BOOLEAN * | IsMatched, | ||
IN OUT EFI_IP_ADDRESS *DestIp | OPTIONAL, | ||
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort | OPTIONAL, | ||
IN OUT EFI_IP_ADDRESS *SrcIp | OPTIONAL, | ||
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort | OPTIONAL | ||
) |
This function is to receive packets using Udp6Read.
[in] | Udp6 | The pointer to EFI_UDP6_PROTOCOL. |
[in] | Token | The pointer to EFI_UDP6_COMPLETION_TOKEN. |
[in] | Mode | The pointer to EFI_PXE_BASE_CODE_MODE. |
[in] | TimeoutEvent | The event for timeout. |
[in] | OpFlags | The UDP operation flags. |
[in] | IsDone | The pointer to the IsDone flag. |
[out] | IsMatched | The pointer to the IsMatched flag. |
[in,out] | DestIp | The pointer to the destination address. |
[in,out] | DestPort | The pointer to the destination port. |
[in,out] | SrcIp | The pointer to the source address. |
[in,out] | SrcPort | The pointer to the source port. |
EFI_SUCCESS | Successfully read data using Udp6. |
Others | Failed to send out data. |
Definition at line 1252 of file PxeBcSupport.c.
EFI_STATUS PxeBcUdp6Write | ( | IN EFI_UDP6_PROTOCOL * | Udp6, |
IN EFI_UDP6_SESSION_DATA * | Session, | ||
IN EFI_EVENT | TimeoutEvent, | ||
IN UINTN *HeaderSize | OPTIONAL, | ||
IN VOID *HeaderPtr | OPTIONAL, | ||
IN UINTN * | BufferSize, | ||
IN VOID * | BufferPtr | ||
) |
This function is to configure a UDPv4 instance for UdpWrite.
[in] | Udp6 | The pointer to EFI_UDP6_PROTOCOL. |
[in] | Session | The pointer to the UDP6 session data. |
[in] | TimeoutEvent | The event for timeout. |
[in] | HeaderSize | An optional field which may be set to the length of a header at HeaderPtr to be prefixed to the data at BufferPtr. |
[in] | HeaderPtr | If HeaderSize is not NULL, a pointer to a header to be prefixed to the data at BufferPtr. |
[in] | BufferSize | A pointer to the size of the data at BufferPtr. |
[in] | BufferPtr | A pointer to the data to be written. |
EFI_SUCCESS | Successfully sent out data using Udp6Write. |
Others | Failed to send out data. |
Definition at line 745 of file PxeBcSupport.c.
This function is to convert a UINTN to a ASCII string, and return the actual length of the buffer.
[in] | Number | Numeric value to be converted. |
[in] | Buffer | The pointer to the buffer for ASCII string. |
[in] | BufferSize | The maxsize of the buffer. |
Definition at line 1428 of file PxeBcSupport.c.
This function is to convert UINTN to ASCII string with the required formatting.
[in] | Number | Numeric value to be converted. |
[in] | Buffer | The pointer to the buffer for ASCII string. |
[in] | Length | The length of the required format. |
Definition at line 1401 of file PxeBcSupport.c.
EFI_STATUS PxeBcUniHexToUint8 | ( | OUT UINT8 * | Digit, |
IN CHAR16 | Char | ||
) |
This function is to convert unicode hex number to a UINT8.
[out] | Digit | The converted UINT8 for output. |
[in] | Char | The unicode hex number to be converted. |
EFI_SUCCESS | Successfully converted the unicode hex. |
EFI_INVALID_PARAMETER | Failed to convert the unicode hex. |
Definition at line 1465 of file PxeBcSupport.c.