TianoCore EDK2 master
|
#include "Udp4Impl.h"
Go to the source code of this file.
Variables | |
UINT16 | mUdp4RandomPort |
The implementation of the Udp4 protocol.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Udp4Impl.c.
EFI_STATUS Udp4Bind | ( | IN LIST_ENTRY * | InstanceList, |
IN OUT EFI_UDP4_CONFIG_DATA * | ConfigData | ||
) |
This function tries to bind the udp instance according to the configured port allocation strategy.
[in] | InstanceList | Pointer to the head of the list linking the udp instances. |
[in,out] | ConfigData | Pointer to the ConfigData of the instance to be bound. ConfigData->StationPort will be assigned with an available port value on success. |
EFI_SUCCESS | The bound operation is completed successfully. |
EFI_ACCESS_DENIED | The <Address, Port> specified by the ConfigData is already used by other instance. |
EFI_OUT_OF_RESOURCES | No available port resources. |
Definition at line 566 of file Udp4Impl.c.
VOID Udp4BuildIp4ConfigData | ( | IN EFI_UDP4_CONFIG_DATA * | Udp4ConfigData, |
IN OUT EFI_IP4_CONFIG_DATA * | Ip4ConfigData | ||
) |
This function builds the Ip4 configdata from the Udp4ConfigData.
[in] | Udp4ConfigData | Pointer to the EFI_UDP4_CONFIG_DATA. |
[in,out] | Ip4ConfigData | Pointer to the EFI_IP4_CONFIG_DATA. |
Definition at line 720 of file Udp4Impl.c.
EFI_STATUS EFIAPI Udp4CancelTokens | ( | IN NET_MAP * | Map, |
IN NET_MAP_ITEM * | Item, | ||
IN VOID *Arg | OPTIONAL | ||
) |
This function cancels the token specified by Arg in the Map. This is a callback used by Udp4InstanceCancelToken().
[in] | Map | Pointer to the NET_MAP. |
[in] | Item | Pointer to the NET_MAP_ITEM. |
[in] | Arg | Pointer to the token to be cancelled, if NULL, the token specified by Item is cancelled. |
EFI_SUCCESS | The token is cancelled if Arg is NULL or the token is not the same as that in the Item if Arg is not NULL. |
EFI_ABORTED | Arg is not NULL, and the token specified by Arg is cancelled. |
Definition at line 1120 of file Udp4Impl.c.
This function calculates the checksum for the Packet, utilizing the pre-calculated pseudo HeadSum to reduce some overhead.
[in] | Packet | Pointer to the NET_BUF contains the udp datagram. |
[in] | HeadSum | Checksum of the pseudo header except the length field. |
The | 16-bit checksum of this udp datagram. |
Definition at line 922 of file Udp4Impl.c.
This function checks and timeouts the I/O datagrams holding by the corresponding service context.
[in] | Event | The event this function registered to. |
[in] | Context | The context data registered during the creation of the Event. |
Definition at line 386 of file Udp4Impl.c.
VOID Udp4CleanInstance | ( | IN UDP4_INSTANCE_DATA * | Instance | ) |
This function cleans the udp instance.
[in] | Instance | Pointer to the UDP4_INSTANCE_DATA to clean. |
Definition at line 486 of file Udp4Impl.c.
VOID Udp4CleanService | ( | IN UDP4_SERVICE_DATA * | Udp4Service | ) |
Clean the Udp service context data.
[in] | Udp4Service | Pointer to the UDP4_SERVICE_DATA. |
Definition at line 355 of file Udp4Impl.c.
EFI_STATUS Udp4CreateService | ( | IN OUT UDP4_SERVICE_DATA * | Udp4Service, |
IN EFI_HANDLE | ImageHandle, | ||
IN EFI_HANDLE | ControllerHandle | ||
) |
Create the Udp service context data.
[in,out] | Udp4Service | Pointer to the UDP4_SERVICE_DATA. |
[in] | ImageHandle | The image handle of this udp4 driver. |
[in] | ControllerHandle | The controller handle this udp4 driver binds on. |
EFI_SUCCESS | The udp4 service context data is created and initialized. |
EFI_OUT_OF_RESOURCES | Cannot allocate memory. |
other | Other error occurs. |
Definition at line 262 of file Udp4Impl.c.
VOID Udp4DeliverDgram | ( | IN UDP4_SERVICE_DATA * | Udp4Service | ) |
This function delivers the datagrams enqueued in the instances.
[in] | Udp4Service | Pointer to the udp service context data. |
Definition at line 1546 of file Udp4Impl.c.
VOID Udp4Demultiplex | ( | IN UDP4_SERVICE_DATA * | Udp4Service, |
IN EFI_NET_SESSION_DATA * | NetSession, | ||
IN NET_BUF * | Packet | ||
) |
This function demultiplexes the received udp datagram to the appropriate instances.
[in] | Udp4Service | Pointer to the udp service context data. |
[in] | NetSession | Pointer to the EFI_NET_SESSION_DATA abstracted from the received datagram. |
[in] | Packet | Pointer to the buffer containing the received udp datagram. |
Definition at line 1581 of file Udp4Impl.c.
VOID EFIAPI Udp4DgramRcvd | ( | IN EFI_STATUS | Status, |
IN UINT8 | IcmpError, | ||
IN EFI_NET_SESSION_DATA * | NetSession, | ||
IN NET_BUF * | Packet, | ||
IN VOID * | Context | ||
) |
This function processes the received datagram passed up by the IpIo layer.
[in] | Status | The status of this udp datagram. |
[in] | IcmpError | The IcmpError code, only available when Status is EFI_ICMP_ERROR. |
[in] | NetSession | Pointer to the EFI_NET_SESSION_DATA. |
[in] | Packet | Pointer to the NET_BUF containing the received udp datagram. |
[in] | Context | Pointer to the context data. |
Definition at line 1022 of file Udp4Impl.c.
VOID EFIAPI Udp4DgramSent | ( | IN EFI_STATUS | Status, |
IN VOID * | Context, | ||
IN IP_IO_IP_PROTOCOL | Sender, | ||
IN VOID * | NotifyData | ||
) |
This function is the packet transmitting notify function registered to the IpIo interface. It's called to signal the udp TxToken when IpIo layer completes the transmitting of the udp datagram.
[in] | Status | The completion status of the output udp datagram. |
[in] | Context | Pointer to the context data. |
[in] | Sender | Specify a pointer of EFI_IP4_PROTOCOL for sending. |
[in] | NotifyData | Pointer to the notify data. |
Definition at line 985 of file Udp4Impl.c.
UINTN Udp4EnqueueDgram | ( | IN UDP4_SERVICE_DATA * | Udp4Service, |
IN NET_BUF * | Packet, | ||
IN EFI_UDP4_RECEIVE_DATA * | RxData | ||
) |
This function enqueues the received datagram into the instances' receiving queues.
[in] | Udp4Service | Pointer to the udp service context data. |
[in] | Packet | Pointer to the buffer containing the received datagram. |
[in] | RxData | Pointer to the EFI_UDP4_RECEIVE_DATA of this datagram. |
Definition at line 1433 of file Udp4Impl.c.
BOOLEAN Udp4FindInstanceByPort | ( | IN LIST_ENTRY * | InstanceList, |
IN EFI_IPv4_ADDRESS * | Address, | ||
IN UINT16 | Port | ||
) |
This function finds the udp instance by the specified <Address, Port> pair.
[in] | InstanceList | Pointer to the head of the list linking the udp instances. |
[in] | Address | Pointer to the specified IPv4 address. |
[in] | Port | The udp port number. |
TRUE | The specified <Address, Port> pair is found. |
FALSE | Otherwise. |
Definition at line 508 of file Udp4Impl.c.
VOID Udp4FlushRcvdDgram | ( | IN UDP4_INSTANCE_DATA * | Instance | ) |
This function removes all the Wrap datas in the RcvdDgramQue.
[in] | Instance | Pointer to the udp instance context data. |
Definition at line 1170 of file Udp4Impl.c.
VOID Udp4IcmpHandler | ( | IN UDP4_SERVICE_DATA * | Udp4Service, |
IN UINT8 | IcmpError, | ||
IN EFI_NET_SESSION_DATA * | NetSession, | ||
IN NET_BUF * | Packet | ||
) |
This function handles the received Icmp Error message and demultiplexes it to the instance.
[in] | Udp4Service | Pointer to the udp service context data. |
[in] | IcmpError | The icmp error code. |
[in] | NetSession | Pointer to the EFI_NET_SESSION_DATA abstracted from the received Icmp Error packet. |
[in] | Packet | Pointer to the Icmp Error packet. |
Definition at line 1774 of file Udp4Impl.c.
VOID Udp4InitInstance | ( | IN UDP4_SERVICE_DATA * | Udp4Service, |
IN OUT UDP4_INSTANCE_DATA * | Instance | ||
) |
This function initializes the new created udp instance.
[in] | Udp4Service | Pointer to the UDP4_SERVICE_DATA. |
[in,out] | Instance | Pointer to the un-initialized UDP4_INSTANCE_DATA. |
Definition at line 444 of file Udp4Impl.c.
EFI_STATUS Udp4InstanceCancelToken | ( | IN UDP4_INSTANCE_DATA * | Instance, |
IN EFI_UDP4_COMPLETION_TOKEN *Token | OPTIONAL | ||
) |
Cancel Udp4 tokens from the Udp4 instance.
[in] | Instance | Pointer to the udp instance context data. |
[in] | Token | Pointer to the token to be canceled, if NULL, all tokens in this instance will be cancelled. |
EFI_SUCCESS | The Token is cancelled. |
EFI_NOT_FOUND | The Token is not found. |
Definition at line 1201 of file Udp4Impl.c.
VOID Udp4InstanceDeliverDgram | ( | IN UDP4_INSTANCE_DATA * | Instance | ) |
This function delivers the received datagrams for the specified instance.
[in] | Instance | Pointer to the instance context data. |
Definition at line 1483 of file Udp4Impl.c.
BOOLEAN Udp4IsReconfigurable | ( | IN EFI_UDP4_CONFIG_DATA * | OldConfigData, |
IN EFI_UDP4_CONFIG_DATA * | NewConfigData | ||
) |
This function is used to check whether the NewConfigData has any un-reconfigurable parameters changed compared to the OldConfigData.
[in] | OldConfigData | Pointer to the current ConfigData the udp instance uses. |
[in] | NewConfigData | Pointer to the new ConfigData. |
TRUE | The instance is reconfigurable. |
FALSE | Otherwise. |
Definition at line 641 of file Udp4Impl.c.
EFI_STATUS EFIAPI Udp4LeaveGroup | ( | IN OUT NET_MAP * | Map, |
IN NET_MAP_ITEM * | Item, | ||
IN VOID *Arg | OPTIONAL | ||
) |
This function removes the multicast group specified by Arg from the Map.
[in,out] | Map | Pointer to the NET_MAP. |
[in] | Item | Pointer to the NET_MAP_ITEM. |
[in] | Arg | Pointer to the Arg, it's the pointer to a multicast IPv4 Address. |
EFI_SUCCESS | The multicast address is removed. |
EFI_ABORTED | The specified multicast address is removed and the Arg is not NULL. |
Definition at line 1069 of file Udp4Impl.c.
BOOLEAN Udp4MatchDgram | ( | IN UDP4_INSTANCE_DATA * | Instance, |
IN EFI_UDP4_SESSION_DATA * | Udp4Session | ||
) |
This function matches the received udp datagram with the Instance.
[in] | Instance | Pointer to the udp instance context data. |
[in] | Udp4Session | Pointer to the EFI_UDP4_SESSION_DATA abstracted from the received udp datagram. |
TRUE | The udp datagram matches the receiving requirements of the udp Instance. |
FALSE | Otherwise. |
Definition at line 1256 of file Udp4Impl.c.
VOID EFIAPI Udp4NetVectorExtFree | ( | VOID * | Context | ) |
This function is a dummy ext-free function for the NET_BUF created for the output udp datagram.
[in] | Context | Pointer to the context data. |
Definition at line 1882 of file Udp4Impl.c.
This function removes the Wrap specified by Context and release relevant resources.
[in] | Event | The Event this notify function registered to. |
[in] | Context | Pointer to the context data. |
Definition at line 1335 of file Udp4Impl.c.
EFI_STATUS Udp4RemoveToken | ( | IN OUT NET_MAP * | TokenMap, |
IN EFI_UDP4_COMPLETION_TOKEN * | Token | ||
) |
This function removes the specified Token from the TokenMap.
[in,out] | TokenMap | Pointer to the NET_MAP containing the tokens. |
[in] | Token | Pointer to the Token to be removed. |
EFI_SUCCESS | The specified Token is removed from the TokenMap. |
EFI_NOT_FOUND | The specified Token is not found in the TokenMap. |
Definition at line 948 of file Udp4Impl.c.
VOID Udp4ReportIcmpError | ( | IN UDP4_INSTANCE_DATA * | Instance | ) |
This function reports the received ICMP error.
[in] | Instance | Pointer to the udp instance context data. |
Definition at line 1839 of file Udp4Impl.c.
VOID Udp4SendPortUnreach | ( | IN IP_IO * | IpIo, |
IN EFI_NET_SESSION_DATA * | NetSession, | ||
IN VOID * | Udp4Header | ||
) |
This function builds and sends out a icmp port unreachable message.
[in] | IpIo | Pointer to the IP_IO instance. |
[in] | NetSession | Pointer to the EFI_NET_SESSION_DATA of the packet causes this icmp error message. |
[in] | Udp4Header | Pointer to the udp header of the datagram causes this icmp error message. |
Definition at line 1674 of file Udp4Impl.c.
EFI_STATUS EFIAPI Udp4TokenExist | ( | IN NET_MAP * | Map, |
IN NET_MAP_ITEM * | Item, | ||
IN VOID * | Context | ||
) |
This function checks whether the specified Token duplicates with the one in the Map.
[in] | Map | Pointer to the NET_MAP. |
[in] | Item | Pointer to the NET_MAP_ITEM contain the pointer to the Token. |
[in] | Context | Pointer to the Token to be checked. |
EFI_SUCCESS | The Token specified by Context differs from the one in the Item. |
EFI_ACCESS_DENIED | The Token duplicates with the one in the Item. |
Definition at line 887 of file Udp4Impl.c.
EFI_STATUS Udp4ValidateTxToken | ( | IN UDP4_INSTANCE_DATA * | Instance, |
IN EFI_UDP4_COMPLETION_TOKEN * | TxToken | ||
) |
This function validates the TxToken, it returns the error code according to the spec.
[in] | Instance | Pointer to the udp instance context data. |
[in] | TxToken | Pointer to the token to be checked. |
EFI_SUCCESS | The TxToken is valid. |
EFI_INVALID_PARAMETER | One or more of the following are TRUE: This is NULL. Token is NULL. Token.Event is NULL. Token.Packet.TxData is NULL. Token.Packet.TxData.FragmentCount is zero. Token.Packet.TxData.DataLength is not equal to the sum of fragment lengths. One or more of the Token.Packet.TxData.FragmentTable[]. FragmentLength fields is zero. One or more of the Token.Packet.TxData.FragmentTable[]. FragmentBuffer fields is NULL. Token.Packet.TxData. GatewayAddress is not a unicast IPv4 address if it is not NULL. One or more IPv4 addresses in Token.Packet.TxData. UdpSessionData are not valid unicast IPv4 addresses if the UdpSessionData is not NULL. |
EFI_BAD_BUFFER_SIZE | The data length is greater than the maximum UDP packet size. |
Definition at line 767 of file Udp4Impl.c.
UDP4_RXDATA_WRAP * Udp4WrapRxData | ( | IN UDP4_INSTANCE_DATA * | Instance, |
IN NET_BUF * | Packet, | ||
IN EFI_UDP4_RECEIVE_DATA * | RxData | ||
) |
This function wraps the Packet and the RxData.
[in] | Instance | Pointer to the instance context data. |
[in] | Packet | Pointer to the buffer containing the received datagram. |
[in] | RxData | Pointer to the EFI_UDP4_RECEIVE_DATA of this datagram. |
Definition at line 1375 of file Udp4Impl.c.
UINT16 mUdp4RandomPort |
Definition at line 11 of file Udp4Impl.c.