TianoCore EDK2 master
|
#include <Uefi.h>
#include <Protocol/Udp4.h>
#include <Protocol/Udp6.h>
#include <Library/UdpIoLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DpcLib.h>
Go to the source code of this file.
Functions | |
VOID | UdpIoFreeTxToken (IN UDP_TX_TOKEN *TxToken) |
VOID | UdpIoFreeRxToken (IN UDP_RX_TOKEN *RxToken) |
VOID EFIAPI | UdpIoOnDgramSentDpc (IN VOID *Context) |
VOID EFIAPI | UdpIoOnDgramSent (IN EFI_EVENT Event, IN VOID *Context) |
VOID EFIAPI | UdpIoRecycleDgram (IN VOID *Context) |
VOID EFIAPI | UdpIoOnDgramRcvdDpc (IN VOID *Context) |
VOID EFIAPI | UdpIoOnDgramRcvd (IN EFI_EVENT Event, IN VOID *Context) |
UDP_RX_TOKEN * | UdpIoCreateRxToken (IN UDP_IO *UdpIo, IN UDP_IO_CALLBACK CallBack, IN VOID *Context, IN UINT32 HeadLen) |
UDP_TX_TOKEN * | UdpIoCreateTxToken (IN UDP_IO *UdpIo, IN NET_BUF *Packet, IN UDP_END_POINT *EndPoint OPTIONAL, IN EFI_IP_ADDRESS *Gateway OPTIONAL, IN UDP_IO_CALLBACK CallBack, IN VOID *Context) |
UDP_IO *EFIAPI | UdpIoCreateIo (IN EFI_HANDLE Controller, IN EFI_HANDLE ImageHandle, IN UDP_IO_CONFIG Configure, IN UINT8 UdpVersion, IN VOID *Context) |
VOID EFIAPI | UdpIoCancelDgrams (IN UDP_IO *UdpIo, IN EFI_STATUS IoStatus, IN UDP_IO_TO_CANCEL ToCancel OPTIONAL, IN VOID *Context OPTIONAL) |
EFI_STATUS EFIAPI | UdpIoFreeIo (IN UDP_IO *UdpIo) |
VOID EFIAPI | UdpIoCleanIo (IN UDP_IO *UdpIo) |
EFI_STATUS EFIAPI | UdpIoSendDatagram (IN UDP_IO *UdpIo, IN NET_BUF *Packet, IN UDP_END_POINT *EndPoint OPTIONAL, IN EFI_IP_ADDRESS *Gateway OPTIONAL, IN UDP_IO_CALLBACK CallBack, IN VOID *Context) |
BOOLEAN EFIAPI | UdpIoCancelSingleDgram (IN UDP_TX_TOKEN *Token, IN VOID *Context) |
VOID EFIAPI | UdpIoCancelSentDatagram (IN UDP_IO *UdpIo, IN NET_BUF *Packet) |
EFI_STATUS EFIAPI | UdpIoRecvDatagram (IN UDP_IO *UdpIo, IN UDP_IO_CALLBACK CallBack, IN VOID *Context, IN UINT32 HeadLen) |
Help functions to access UDP service, it is used by both the DHCP and MTFTP.
Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DxeUdpIoLib.c.
VOID EFIAPI UdpIoCancelDgrams | ( | IN UDP_IO * | UdpIo, |
IN EFI_STATUS | IoStatus, | ||
IN UDP_IO_TO_CANCEL ToCancel | OPTIONAL, | ||
IN VOID *Context | OPTIONAL | ||
) |
Cancel all the sent datagram that pass the selection criteria of ToCancel.
If ToCancel is NULL, all the datagrams are cancelled. If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
[in] | UdpIo | The UDP_IO to cancel packet. |
[in] | IoStatus | The IoStatus to return to the packet owners. |
[in] | ToCancel | The select function to test whether to cancel this packet or not. |
[in] | Context | The opaque parameter to the ToCancel. |
Definition at line 765 of file DxeUdpIoLib.c.
Cancel a single sent datagram.
[in] | UdpIo | The UDP_IO to cancel the packet from |
[in] | Packet | The packet to cancel |
Definition at line 1051 of file DxeUdpIoLib.c.
BOOLEAN EFIAPI UdpIoCancelSingleDgram | ( | IN UDP_TX_TOKEN * | Token, |
IN VOID * | Context | ||
) |
The select function to cancel a single sent datagram.
[in] | Token | The UDP_TX_TOKEN to test against |
[in] | Context | The NET_BUF of the sent datagram |
TRUE | The packet is to be cancelled. |
FALSE | The packet is not to be cancelled. |
Definition at line 1026 of file DxeUdpIoLib.c.
Clean up the UDP_IO without freeing it. The function is called when user wants to re-use the UDP_IO later.
If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
It will release all the transmitted datagrams and receive request. It will also configure NULL for the UDP instance.
[in] | UdpIo | The UDP_IO to clean up. |
Definition at line 915 of file DxeUdpIoLib.c.
UDP_IO *EFIAPI UdpIoCreateIo | ( | IN EFI_HANDLE | Controller, |
IN EFI_HANDLE | ImageHandle, | ||
IN UDP_IO_CONFIG | Configure, | ||
IN UINT8 | UdpVersion, | ||
IN VOID * | Context | ||
) |
Creates a UDP_IO to access the UDP service. It creates and configures a UDP child.
If Configure is NULL, then ASSERT(). If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
It locates the UDP service binding prototype on the Controller parameter uses the UDP service binding prototype to create a UDP child (also known as a UDP instance) configures the UDP child by calling Configure function prototype. Any failures in creating or configuring the UDP child return NULL for failure.
[in] | Controller | The controller that has the UDP service binding. protocol installed. |
[in] | ImageHandle | The image handle for the driver. |
[in] | Configure | The function to configure the created UDP child. |
[in] | UdpVersion | The UDP protocol version, UDP4 or UDP6. |
[in] | Context | The opaque parameter for the Configure function. |
Definition at line 602 of file DxeUdpIoLib.c.
UDP_RX_TOKEN * UdpIoCreateRxToken | ( | IN UDP_IO * | UdpIo, |
IN UDP_IO_CALLBACK | CallBack, | ||
IN VOID * | Context, | ||
IN UINT32 | HeadLen | ||
) |
Create a UDP_RX_TOKEN to wrap the request.
[in] | UdpIo | The UdpIo to receive packets from. |
[in] | CallBack | The function to call when receive finished. |
[in] | Context | The opaque parameter to the CallBack. |
[in] | HeadLen | The head length to reserve for the packet. |
Definition at line 348 of file DxeUdpIoLib.c.
UDP_TX_TOKEN * UdpIoCreateTxToken | ( | IN UDP_IO * | UdpIo, |
IN NET_BUF * | Packet, | ||
IN UDP_END_POINT *EndPoint | OPTIONAL, | ||
IN EFI_IP_ADDRESS *Gateway | OPTIONAL, | ||
IN UDP_IO_CALLBACK | CallBack, | ||
IN VOID * | Context | ||
) |
Wrap a transmit request into a new created UDP_TX_TOKEN.
If Packet is NULL, then ASSERT(). If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
[in] | UdpIo | The UdpIo to send packet to. |
[in] | Packet | The user's packet. |
[in] | EndPoint | The local and remote access point. |
[in] | Gateway | The overridden next hop. |
[in] | CallBack | The function to call when transmission completed. |
[in] | Context | The opaque parameter to the call back. |
Definition at line 425 of file DxeUdpIoLib.c.
EFI_STATUS EFIAPI UdpIoFreeIo | ( | IN UDP_IO * | UdpIo | ) |
Free the UDP_IO and all its related resources.
If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
The function will cancel all sent datagram and receive request.
[in] | UdpIo | The UDP_IO to free. |
EFI_SUCCESS | The UDP_IO is freed. |
Others | Failed to free UDP_IO. |
Definition at line 809 of file DxeUdpIoLib.c.
VOID UdpIoFreeRxToken | ( | IN UDP_RX_TOKEN * | RxToken | ) |
Free a UDP_RX_TOKEN. The RX event is closed.
[in] | RxToken | The UDP_RX_TOKEN to release. |
Definition at line 50 of file DxeUdpIoLib.c.
VOID UdpIoFreeTxToken | ( | IN UDP_TX_TOKEN * | TxToken | ) |
Free a UDP_TX_TOKEN. The TX event is closed.
[in] | TxToken | The UDP_TX_TOKEN to release. |
Definition at line 28 of file DxeUdpIoLib.c.
Request UdpIoOnDgramRcvdDpc() as a DPC at TPL_CALLBACK.
[in] | Event | The UDP receive request event. |
[in] | Context | The UDP RX token. |
Definition at line 325 of file DxeUdpIoLib.c.
VOID EFIAPI UdpIoOnDgramRcvdDpc | ( | IN VOID * | Context | ) |
The event handle for UDP receive request.
It will build a NET_BUF from the received UDP data, then deliver it to the receiver.
[in] | Context | The UDP RX token. |
Definition at line 158 of file DxeUdpIoLib.c.
Request UdpIoOnDgramSentDpc as a DPC at TPL_CALLBACK.
[in] | Event | The event signaled. |
[in] | Context | The UDP TX Token. |
Definition at line 109 of file DxeUdpIoLib.c.
VOID EFIAPI UdpIoOnDgramSentDpc | ( | IN VOID * | Context | ) |
The callback function when the packet is sent by UDP.
It will remove the packet from the local list then call the packet owner's callback function set by UdpIoSendDatagram.
[in] | Context | The UDP TX Token. |
Definition at line 76 of file DxeUdpIoLib.c.
EFI_STATUS EFIAPI UdpIoRecvDatagram | ( | IN UDP_IO * | UdpIo, |
IN UDP_IO_CALLBACK | CallBack, | ||
IN VOID * | Context, | ||
IN UINT32 | HeadLen | ||
) |
Issue a receive request to the UDP_IO.
If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
This function is called when upper-layer needs packet from UDP for processing. Only one receive request is acceptable at a time so a common usage model is to invoke this function inside its Callback function when the former packet is processed.
[in] | UdpIo | The UDP_IO to receive the packet from. |
[in] | CallBack | The call back function to execute when the packet is received. |
[in] | Context | The opaque context passed to Callback. |
[in] | HeadLen | The length of the upper-layer's protocol header. |
EFI_ALREADY_STARTED | There is already a pending receive request. Only one receive request is supported at a time. |
EFI_OUT_OF_RESOURCES | Failed to allocate needed resources. |
EFI_SUCCESS | The receive request is issued successfully. |
EFI_UNSUPPORTED | The UDP version in UDP_IO is not supported. |
Definition at line 1084 of file DxeUdpIoLib.c.
VOID EFIAPI UdpIoRecycleDgram | ( | IN VOID * | Context | ) |
Recycle the received UDP data.
[in] | Context | The UDP_RX_TOKEN. |
Definition at line 128 of file DxeUdpIoLib.c.
EFI_STATUS EFIAPI UdpIoSendDatagram | ( | IN UDP_IO * | UdpIo, |
IN NET_BUF * | Packet, | ||
IN UDP_END_POINT *EndPoint | OPTIONAL, | ||
IN EFI_IP_ADDRESS *Gateway | OPTIONAL, | ||
IN UDP_IO_CALLBACK | CallBack, | ||
IN VOID * | Context | ||
) |
Send a packet through the UDP_IO.
If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
The packet will be wrapped in UDP_TX_TOKEN. Function Callback will be called when the packet is sent. The optional parameter EndPoint overrides the default address pair if specified.
[in] | UdpIo | The UDP_IO to send the packet through. |
[in] | Packet | The packet to send. |
[in] | EndPoint | The local and remote access point. Override the default address pair set during configuration. |
[in] | Gateway | The gateway to use. |
[in] | CallBack | The function being called when packet is transmitted or failed. |
[in] | Context | The opaque parameter passed to CallBack. |
EFI_OUT_OF_RESOURCES | Failed to allocate resource for the packet. |
EFI_SUCCESS | The packet is successfully delivered to UDP for transmission. |
Definition at line 971 of file DxeUdpIoLib.c.