TianoCore EDK2 master
|
#include <Uefi.h>
#include <Protocol/Udp4.h>
#include <Library/IpIoLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DpcLib.h>
Go to the source code of this file.
IpIo Library.
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DxeIpIoLib.c.
IP_IO_IP_INFO *EFIAPI IpIoAddIp | ( | IN OUT IP_IO * | IpIo | ) |
Add a new IP instance for sending data.
If IpIo is NULL, then ASSERT(). If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().
The function is used to add the IP_IO to the IP_IO sending list. The caller can later use IpIoFindSender() to get the IP_IO and call IpIoSend() to send data.
[in,out] | IpIo | Pointer to a IP_IO instance to add a new IP instance for sending purpose. |
Definition at line 1700 of file DxeIpIoLib.c.
Cancel the IP transmit token which wraps this Packet.
If IpIo is NULL, then ASSERT(). If Packet is NULL, then ASSERT().
[in] | IpIo | Pointer to the IP_IO instance. |
[in] | Packet | Pointer to the packet of NET_BUF to cancel. |
Definition at line 1648 of file DxeIpIoLib.c.
EFI_STATUS IpIoCloseProtocolDestroyIpChild | ( | IN EFI_HANDLE | ControllerHandle, |
IN EFI_HANDLE | ImageHandle, | ||
IN EFI_HANDLE | ChildHandle, | ||
IN UINT8 | IpVersion | ||
) |
This function close the previously opened IP protocol and destroy the IP child.
[in] | ControllerHandle | The controller handle. |
[in] | ImageHandle | The image handle. |
[in] | ChildHandle | The child handle of the IP child. |
[in] | IpVersion | The version of the IP protocol to use, either IPv4 or IPv6. |
EFI_SUCCESS | The IP protocol is closed and the relevant IP child is destroyed. |
EFI_UNSUPPORTED | Unsupported IpVersion. |
Others | The required operation failed. |
Definition at line 212 of file DxeIpIoLib.c.
EFI_STATUS EFIAPI IpIoConfigIp | ( | IN OUT IP_IO_IP_INFO * | IpInfo, |
IN OUT VOID *IpConfigData | OPTIONAL | ||
) |
Configure the IP instance of this IpInfo and start the receiving if IpConfigData is not NULL.
If IpInfo is NULL, then ASSERT(). If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().
[in,out] | IpInfo | Pointer to the IP_IO_IP_INFO instance. |
[in,out] | IpConfigData | The IP configure data used to configure the IP instance, if NULL the IP instance is reset. If UseDefaultAddress is set to TRUE, and the configure operation succeeds, the default address information is written back in this IpConfigData. |
EFI_SUCCESS | The IP instance of this IpInfo is configured successfully or no need to reconfigure it. |
Others | Configuration fails. |
Definition at line 1806 of file DxeIpIoLib.c.
IP_IO *EFIAPI IpIoCreate | ( | IN EFI_HANDLE | Image, |
IN EFI_HANDLE | Controller, | ||
IN UINT8 | IpVersion | ||
) |
Create a new IP_IO instance.
If IpVersion is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().
This function uses IP4/IP6 service binding protocol in Controller to create an IP4/IP6 child (aka IP4/IP6 instance).
[in] | Image | The image handle of the driver or application that consumes IP_IO. |
[in] | Controller | The controller handle that has IP4 or IP6 service binding protocol installed. |
[in] | IpVersion | The version of the IP protocol to use, either IPv4 or IPv6. |
Definition at line 1217 of file DxeIpIoLib.c.
EFI_STATUS IpIoCreateIpChildOpenProtocol | ( | IN EFI_HANDLE | ControllerHandle, |
IN EFI_HANDLE | ImageHandle, | ||
IN EFI_HANDLE * | ChildHandle, | ||
IN UINT8 | IpVersion, | ||
OUT VOID ** | Interface | ||
) |
This function create an IP child ,open the IP protocol, and return the opened IP protocol as Interface.
[in] | ControllerHandle | The controller handle. |
[in] | ImageHandle | The image handle. |
[in] | ChildHandle | Pointer to the buffer to save the IP child handle. |
[in] | IpVersion | The version of the IP protocol to use, either IPv4 or IPv6. |
[out] | Interface | Pointer used to get the IP protocol interface. |
EFI_SUCCESS | The IP child is created and the IP protocol interface is retrieved. |
EFI_UNSUPPORTED | Unsupported IpVersion. |
Others | The required operation failed. |
Definition at line 135 of file DxeIpIoLib.c.
IP_IO_SEND_ENTRY * IpIoCreateSndEntry | ( | IN OUT IP_IO * | IpIo, |
IN OUT NET_BUF * | Pkt, | ||
IN IP_IO_IP_PROTOCOL | Sender, | ||
IN VOID *Context | OPTIONAL, | ||
IN VOID *NotifyData | OPTIONAL, | ||
IN EFI_IP_ADDRESS *Dest | OPTIONAL, | ||
IN IP_IO_OVERRIDE * | Override | ||
) |
Create a send entry to wrap a packet before sending out it through IP.
[in,out] | IpIo | Pointer to the IP_IO instance. |
[in,out] | Pkt | Pointer to the packet. |
[in] | Sender | Pointer to the IP sender. |
[in] | Context | Pointer to the context. |
[in] | NotifyData | Pointer to the notify data. |
[in] | Dest | Pointer to the destination IP address. |
[in] | Override | Pointer to the overridden IP_IO data. |
Definition at line 629 of file DxeIpIoLib.c.
EFI_STATUS EFIAPI IpIoDestroy | ( | IN OUT IP_IO * | IpIo | ) |
Destroy an IP_IO instance.
This function is paired with IpIoCreate(). The IP_IO will be closed first. Resource will be freed afterwards. See IpIoCloseProtocolDestroyIpChild().
[in,out] | IpIo | Pointer to the IP_IO instance that needs to be destroyed. |
EFI_SUCCESS | The IP_IO instance destroyed successfully. |
Others | Error condition occurred. |
Definition at line 1518 of file DxeIpIoLib.c.
VOID IpIoDestroySndEntry | ( | IN IP_IO_SEND_ENTRY * | SndEntry | ) |
Destroy the SndEntry.
This function pairs with IpIoCreateSndEntry().
[in] | SndEntry | Pointer to the send entry to be destroyed. |
Definition at line 796 of file DxeIpIoLib.c.
This function add IpIoDummyHandlerDpc to the end of the DPC queue.
[in] | Event | The event signaled. |
[in] | Context | The context passed in by the event notifier. |
Definition at line 968 of file DxeIpIoLib.c.
VOID EFIAPI IpIoDummyHandlerDpc | ( | IN VOID * | Context | ) |
The dummy handler for the dummy IP receive token.
[in] | Context | The context passed in by the event notifier. |
Definition at line 899 of file DxeIpIoLib.c.
VOID EFIAPI IpIoExtFree | ( | IN VOID * | Event | ) |
Free function for receive token of IP_IO. It is used to signal the recycle event to notify IP to recycle the data buffer.
[in] | Event | The event to be signaled. |
Definition at line 605 of file DxeIpIoLib.c.
IP_IO_IP_INFO *EFIAPI IpIoFindSender | ( | IN OUT IP_IO ** | IpIo, |
IN UINT8 | IpVersion, | ||
IN EFI_IP_ADDRESS * | Src | ||
) |
Find the first IP protocol maintained in IpIo whose local address is the same as Src.
This function is called when the caller needs the IpIo to send data to the specified Src. The IpIo was added previously by IpIoAddIp().
[in,out] | IpIo | Pointer to the pointer of the IP_IO instance. |
[in] | IpVersion | The version of the IP protocol to use, either IPv4 or IPv6. |
[in] | Src | The local IP address. |
Definition at line 2043 of file DxeIpIoLib.c.
EFI_STATUS EFIAPI IpIoGetIcmpErrStatus | ( | IN UINT8 | IcmpError, |
IN UINT8 | IpVersion, | ||
OUT BOOLEAN *IsHard | OPTIONAL, | ||
OUT BOOLEAN *Notify | OPTIONAL | ||
) |
Get the ICMP error map information.
The ErrorStatus will be returned. The IsHard and Notify are optional. If they are not NULL, this routine will fill them.
[in] | IcmpError | IcmpError Type. |
[in] | IpVersion | The version of the IP protocol to use, either IPv4 or IPv6. |
[out] | IsHard | If TRUE, indicates that it is a hard error. |
[out] | Notify | If TRUE, SockError needs to be notified. |
EFI_UNSUPPORTED | Unrecognizable ICMP error code. |
Definition at line 2109 of file DxeIpIoLib.c.
EFI_STATUS IpIoIcmpHandler | ( | IN IP_IO * | IpIo, |
IN OUT NET_BUF * | Pkt, | ||
IN EFI_NET_SESSION_DATA * | Session | ||
) |
This function handles ICMP packets.
[in] | IpIo | Pointer to the IP_IO instance. |
[in,out] | Pkt | Pointer to the ICMP packet. |
[in] | Session | Pointer to the net session of this ICMP packet. |
EFI_SUCCESS | The ICMP packet is handled successfully. |
EFI_ABORTED | This type of ICMP packet is not supported. |
EFI_UNSUPPORTED | The IP protocol version in IP_IO is not supported. |
Definition at line 580 of file DxeIpIoLib.c.
EFI_STATUS IpIoIcmpv4Handler | ( | IN IP_IO * | IpIo, |
IN OUT NET_BUF * | Pkt, | ||
IN EFI_NET_SESSION_DATA * | Session | ||
) |
This function handles ICMPv4 packets. It is the worker function of IpIoIcmpHandler.
[in] | IpIo | Pointer to the IP_IO instance. |
[in,out] | Pkt | Pointer to the ICMPv4 packet. |
[in] | Session | Pointer to the net session of this ICMPv4 packet. |
EFI_SUCCESS | The ICMPv4 packet is handled successfully. |
EFI_ABORTED | This type of ICMPv4 packet is not supported. |
Definition at line 270 of file DxeIpIoLib.c.
EFI_STATUS IpIoIcmpv6Handler | ( | IN IP_IO * | IpIo, |
IN OUT NET_BUF * | Pkt, | ||
IN EFI_NET_SESSION_DATA * | Session | ||
) |
This function handles ICMPv6 packets. It is the worker function of IpIoIcmpHandler.
[in] | IpIo | Pointer to the IP_IO instance. |
[in,out] | Pkt | Pointer to the ICMPv6 packet. |
[in] | Session | Pointer to the net session of this ICMPv6 packet. |
EFI_SUCCESS | The ICMPv6 packet is handled successfully. |
EFI_ABORTED | This type of ICMPv6 packet is not supported. |
Definition at line 411 of file DxeIpIoLib.c.
This function add IpIoListenHandlerDpc to the end of the DPC queue.
[in] | Event | The event signaled. |
[in] | Context | The context passed in by the event notifier. |
Definition at line 1186 of file DxeIpIoLib.c.
VOID EFIAPI IpIoListenHandlerDpc | ( | IN VOID * | Context | ) |
Notify function for the IP receive token, used to process the received IP packets.
[in] | Context | The context passed in by the event notifier. |
Definition at line 988 of file DxeIpIoLib.c.
EFI_STATUS EFIAPI IpIoOpen | ( | IN OUT IP_IO * | IpIo, |
IN IP_IO_OPEN_DATA * | OpenData | ||
) |
Open an IP_IO instance for use.
If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().
This function is called after IpIoCreate(). It is used for configuring the IP instance and register the callbacks and their context data for sending and receiving IP packets.
[in,out] | IpIo | Pointer to an IP_IO instance that needs to open. |
[in] | OpenData | The configuration data and callbacks for the IP_IO instance. |
EFI_SUCCESS | The IP_IO instance opened with OpenData successfully. |
EFI_ACCESS_DENIED | The IP_IO instance is configured, avoid to reopen it. |
EFI_UNSUPPORTED | IPv4 RawData mode is no supported. |
EFI_INVALID_PARAMETER | Invalid input parameter. |
Others | Error condition occurred. |
Definition at line 1310 of file DxeIpIoLib.c.
EFI_STATUS EFIAPI IpIoRefreshNeighbor | ( | IN IP_IO * | IpIo, |
IN EFI_IP_ADDRESS * | Neighbor, | ||
IN UINT32 | Timeout | ||
) |
Refresh the remote peer's Neighbor Cache entries.
This function is called when the caller needs the IpIo to refresh the existing IPv6 neighbor cache entries since the neighbor is considered reachable by the node has recently received a confirmation that packets sent recently to the neighbor were received by its IP layer.
[in] | IpIo | Pointer to an IP_IO instance |
[in] | Neighbor | The IP address of the neighbor |
[in] | Timeout | Time in 100-ns units that this entry will remain in the neighbor cache. A value of zero means that the entry is permanent. A value of non-zero means that the entry is dynamic and will be deleted after Timeout. |
EFI_SUCCESS | The operation is completed successfully. |
EFI_NOT_STARTED | The IpIo is not configured. |
EFI_INVALID_PARAMETER | Neighbor Address is invalid. |
EFI_NOT_FOUND | The neighbor cache entry is not in the neighbor table. |
EFI_UNSUPPORTED | IP version is IPv4, which doesn't support neighbor cache refresh. |
EFI_OUT_OF_RESOURCES | Failed due to resource limit. |
Definition at line 2224 of file DxeIpIoLib.c.
VOID EFIAPI IpIoRemoveIp | ( | IN IP_IO * | IpIo, |
IN IP_IO_IP_INFO * | IpInfo | ||
) |
Destroy an IP instance maintained in IpIo->IpList for sending purpose.
If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().
This function pairs with IpIoAddIp(). The IpInfo is previously created by IpIoAddIp(). The IP_IO_IP_INFO::RefCnt is decremented and the IP instance will be destroyed if the RefCnt is zero.
[in] | IpIo | Pointer to the IP_IO instance. |
[in] | IpInfo | Pointer to the IpInfo to be removed. |
Definition at line 1968 of file DxeIpIoLib.c.
EFI_STATUS EFIAPI IpIoSend | ( | IN OUT IP_IO * | IpIo, |
IN OUT NET_BUF * | Pkt, | ||
IN IP_IO_IP_INFO *Sender | OPTIONAL, | ||
IN VOID *Context | OPTIONAL, | ||
IN VOID *NotifyData | OPTIONAL, | ||
IN EFI_IP_ADDRESS *Dest | OPTIONAL, | ||
IN IP_IO_OVERRIDE *OverrideData | OPTIONAL | ||
) |
Send out an IP packet.
This function is called after IpIoOpen(). The data to be sent is wrapped in Pkt. The IP instance wrapped in IpIo is used for sending by default but can be overridden by Sender. Other sending configs, like source address and gateway address etc., are specified in OverrideData.
[in,out] | IpIo | Pointer to an IP_IO instance used for sending IP packet. |
[in,out] | Pkt | Pointer to the IP packet to be sent. |
[in] | Sender | The IP protocol instance used for sending. |
[in] | Context | Optional context data. |
[in] | NotifyData | Optional notify data. |
[in] | Dest | The destination IP address to send this packet to. This parameter is optional when using IPv6. |
[in] | OverrideData | The data to override some configuration of the IP instance used for sending. |
EFI_SUCCESS | The operation is completed successfully. |
EFI_INVALID_PARAMETER | The input parameter is not correct. |
EFI_NOT_STARTED | The IpIo is not configured. |
EFI_OUT_OF_RESOURCES | Failed due to resource limit. |
Others | Error condition occurred. |
Definition at line 1578 of file DxeIpIoLib.c.
EFI_STATUS EFIAPI IpIoStop | ( | IN OUT IP_IO * | IpIo | ) |
Stop an IP_IO instance.
If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().
This function is paired with IpIoOpen(). The IP_IO will be unconfigured and all the pending send/receive tokens will be canceled.
[in,out] | IpIo | Pointer to the IP_IO instance that needs to stop. |
EFI_SUCCESS | The IP_IO instance stopped successfully. |
EFI_INVALID_PARAMETER | Invalid input parameter. |
Others | Error condition occurred. |
Definition at line 1436 of file DxeIpIoLib.c.
Notify function for IP transmit token.
[in] | Event | The event signaled. |
[in] | Context | The context passed in by the event notifier. |
Definition at line 880 of file DxeIpIoLib.c.
VOID EFIAPI IpIoTransmitHandlerDpc | ( | IN VOID * | Context | ) |
Notify function for IP transmit token.
[in] | Context | The context passed in by the event notifier. |
Definition at line 839 of file DxeIpIoLib.c.
GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY mActiveIpIoList |
Definition at line 21 of file DxeIpIoLib.c.
GLOBAL_REMOVE_IF_UNREFERENCED ICMP_ERROR_INFO mIcmp6ErrMap[10] |
Definition at line 78 of file DxeIpIoLib.c.
GLOBAL_REMOVE_IF_UNREFERENCED ICMP_ERROR_INFO mIcmpErrMap[10] |
GLOBAL_REMOVE_IF_UNREFERENCED EFI_IP4_CONFIG_DATA mIp4IoDefaultIpConfigData |
GLOBAL_REMOVE_IF_UNREFERENCED EFI_IP6_CONFIG_DATA mIp6IoDefaultIpConfigData |
Definition at line 47 of file DxeIpIoLib.c.