NetworkPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the NetworkPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
2f88bd3a12
commit
d1050b9dff
@@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "Udp4Impl.h"
|
||||
|
||||
UINT16 mUdp4RandomPort;
|
||||
@@ -60,10 +59,10 @@ Udp4FindInstanceByPort (
|
||||
VOID
|
||||
EFIAPI
|
||||
Udp4DgramSent (
|
||||
IN EFI_STATUS Status,
|
||||
IN VOID *Context,
|
||||
IN IP_IO_IP_PROTOCOL Sender,
|
||||
IN VOID *NotifyData
|
||||
IN EFI_STATUS Status,
|
||||
IN VOID *Context,
|
||||
IN IP_IO_IP_PROTOCOL Sender,
|
||||
IN VOID *NotifyData
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -246,7 +245,6 @@ Udp4SendPortUnreach (
|
||||
IN VOID *Udp4Header
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Create the Udp service context data.
|
||||
|
||||
@@ -267,9 +265,9 @@ Udp4CreateService (
|
||||
IN EFI_HANDLE ControllerHandle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
IP_IO_OPEN_DATA OpenData;
|
||||
EFI_IP4_CONFIG_DATA *Ip4ConfigData;
|
||||
EFI_STATUS Status;
|
||||
IP_IO_OPEN_DATA OpenData;
|
||||
EFI_IP4_CONFIG_DATA *Ip4ConfigData;
|
||||
|
||||
ZeroMem (Udp4Service, sizeof (UDP4_SERVICE_DATA));
|
||||
|
||||
@@ -295,7 +293,7 @@ Udp4CreateService (
|
||||
Ip4ConfigData = &OpenData.IpConfigData.Ip4CfgData;
|
||||
CopyMem (Ip4ConfigData, &mIp4IoDefaultIpConfigData, sizeof (EFI_IP4_CONFIG_DATA));
|
||||
Ip4ConfigData->AcceptBroadcast = TRUE;
|
||||
OpenData.RcvdContext = (VOID *) Udp4Service;
|
||||
OpenData.RcvdContext = (VOID *)Udp4Service;
|
||||
OpenData.SndContext = NULL;
|
||||
OpenData.PktRcvdNotify = Udp4DgramRcvd;
|
||||
OpenData.PktSentNotify = Udp4DgramSent;
|
||||
@@ -347,7 +345,6 @@ ON_ERROR:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clean the Udp service context data.
|
||||
|
||||
@@ -375,7 +372,6 @@ Udp4CleanService (
|
||||
IpIoDestroy (Udp4Service->IpIo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function checks and timeouts the I/O datagrams holding by the corresponding
|
||||
service context.
|
||||
@@ -399,7 +395,7 @@ Udp4CheckTimeout (
|
||||
LIST_ENTRY *NextEntry;
|
||||
UDP4_RXDATA_WRAP *Wrap;
|
||||
|
||||
Udp4Service = (UDP4_SERVICE_DATA *) Context;
|
||||
Udp4Service = (UDP4_SERVICE_DATA *)Context;
|
||||
NET_CHECK_SIGNATURE (Udp4Service, UDP4_SERVICE_DATA_SIGNATURE);
|
||||
|
||||
NET_LIST_FOR_EACH (Entry, &Udp4Service->ChildrenList) {
|
||||
@@ -429,7 +425,7 @@ Udp4CheckTimeout (
|
||||
//
|
||||
// Remove this RxData if it timeouts.
|
||||
//
|
||||
Udp4RecycleRxDataWrap (NULL, (VOID *) Wrap);
|
||||
Udp4RecycleRxDataWrap (NULL, (VOID *)Wrap);
|
||||
} else {
|
||||
Wrap->TimeoutTick -= (UDP4_TIMEOUT_INTERVAL / 10);
|
||||
}
|
||||
@@ -437,7 +433,6 @@ Udp4CheckTimeout (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function initializes the new created udp instance.
|
||||
|
||||
@@ -481,7 +476,6 @@ Udp4InitInstance (
|
||||
Instance->InDestroy = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function cleans the udp instance.
|
||||
|
||||
@@ -498,7 +492,6 @@ Udp4CleanInstance (
|
||||
NetMapClean (&Instance->TxTokens);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function finds the udp instance by the specified <Address, Port> pair.
|
||||
|
||||
@@ -538,7 +531,8 @@ Udp4FindInstanceByPort (
|
||||
}
|
||||
|
||||
if (EFI_IP4_EQUAL (&ConfigData->StationAddress, Address) &&
|
||||
(ConfigData->StationPort == Port)) {
|
||||
(ConfigData->StationPort == Port))
|
||||
{
|
||||
//
|
||||
// if both the address and the port are the same, return TRUE.
|
||||
//
|
||||
@@ -552,7 +546,6 @@ Udp4FindInstanceByPort (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function tries to bind the udp instance according to the configured port
|
||||
allocation strategy.
|
||||
@@ -585,9 +578,9 @@ Udp4Bind (
|
||||
StationAddress = &ConfigData->StationAddress;
|
||||
|
||||
if (ConfigData->StationPort != 0) {
|
||||
|
||||
if (!ConfigData->AllowDuplicatePort &&
|
||||
Udp4FindInstanceByPort (InstanceList, StationAddress, ConfigData->StationPort)) {
|
||||
Udp4FindInstanceByPort (InstanceList, StationAddress, ConfigData->StationPort))
|
||||
{
|
||||
//
|
||||
// Do not allow duplicate port and the port is already used by other instance.
|
||||
//
|
||||
@@ -604,11 +597,9 @@ Udp4Bind (
|
||||
//
|
||||
ConfigData->StationPort = mUdp4RandomPort;
|
||||
} else {
|
||||
|
||||
StartPort = mUdp4RandomPort;
|
||||
|
||||
while (Udp4FindInstanceByPort(InstanceList, StationAddress, mUdp4RandomPort)) {
|
||||
|
||||
while (Udp4FindInstanceByPort (InstanceList, StationAddress, mUdp4RandomPort)) {
|
||||
mUdp4RandomPort++;
|
||||
if (mUdp4RandomPort == 0) {
|
||||
mUdp4RandomPort = UDP4_PORT_KNOWN;
|
||||
@@ -634,7 +625,6 @@ Udp4Bind (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is used to check whether the NewConfigData has any un-reconfigurable
|
||||
parameters changed compared to the OldConfigData.
|
||||
@@ -657,7 +647,8 @@ Udp4IsReconfigurable (
|
||||
(NewConfigData->AcceptBroadcast != OldConfigData->AcceptBroadcast) ||
|
||||
(NewConfigData->AcceptPromiscuous != OldConfigData->AcceptPromiscuous) ||
|
||||
(NewConfigData->AllowDuplicatePort != OldConfigData->AllowDuplicatePort)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The receiving filter parameters cannot be changed.
|
||||
//
|
||||
@@ -666,7 +657,8 @@ Udp4IsReconfigurable (
|
||||
|
||||
if ((!NewConfigData->AcceptAnyPort) &&
|
||||
(NewConfigData->StationPort != OldConfigData->StationPort)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The port is not changeable.
|
||||
//
|
||||
@@ -674,7 +666,6 @@ Udp4IsReconfigurable (
|
||||
}
|
||||
|
||||
if (!NewConfigData->AcceptPromiscuous) {
|
||||
|
||||
if (NewConfigData->UseDefaultAddress != OldConfigData->UseDefaultAddress) {
|
||||
//
|
||||
// The NewConfigData differs to the old one on the UseDefaultAddress.
|
||||
@@ -685,7 +676,8 @@ Udp4IsReconfigurable (
|
||||
if (!NewConfigData->UseDefaultAddress &&
|
||||
(!EFI_IP4_EQUAL (&NewConfigData->StationAddress, &OldConfigData->StationAddress) ||
|
||||
!EFI_IP4_EQUAL (&NewConfigData->SubnetMask, &OldConfigData->SubnetMask))
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// If the instance doesn't use the default address, and the new address or
|
||||
// new subnet mask is different from the old values.
|
||||
@@ -702,8 +694,9 @@ Udp4IsReconfigurable (
|
||||
}
|
||||
|
||||
if (!EFI_IP4_EQUAL (&NewConfigData->RemoteAddress, &mZeroIp4Addr) &&
|
||||
NewConfigData->RemotePort != OldConfigData->RemotePort
|
||||
) {
|
||||
(NewConfigData->RemotePort != OldConfigData->RemotePort)
|
||||
)
|
||||
{
|
||||
//
|
||||
// The RemotePort differs if it's designated in the configdata.
|
||||
//
|
||||
@@ -716,7 +709,6 @@ Udp4IsReconfigurable (
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function builds the Ip4 configdata from the Udp4ConfigData.
|
||||
|
||||
@@ -742,10 +734,9 @@ Udp4BuildIp4ConfigData (
|
||||
//
|
||||
// use the -1 magic number to disable the receiving process of the ip instance.
|
||||
//
|
||||
Ip4ConfigData->ReceiveTimeout = (UINT32) (-1);
|
||||
Ip4ConfigData->ReceiveTimeout = (UINT32)(-1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function validates the TxToken, it returns the error code according to the spec.
|
||||
|
||||
@@ -798,9 +789,9 @@ Udp4ValidateTxToken (
|
||||
|
||||
TotalLen = 0;
|
||||
for (Index = 0; Index < TxData->FragmentCount; Index++) {
|
||||
|
||||
if ((TxData->FragmentTable[Index].FragmentBuffer == NULL) ||
|
||||
(TxData->FragmentTable[Index].FragmentLength == 0)) {
|
||||
(TxData->FragmentTable[Index].FragmentLength == 0))
|
||||
{
|
||||
//
|
||||
// if the FragmentBuffer is NULL or the FragmentLeng is zero.
|
||||
//
|
||||
@@ -822,8 +813,9 @@ Udp4ValidateTxToken (
|
||||
CopyMem (&GatewayAddress, TxData->GatewayAddress, sizeof (IP4_ADDR));
|
||||
|
||||
if (!Instance->ConfigData.UseDefaultAddress &&
|
||||
(EFI_NTOHL(Instance->ConfigData.SubnetMask) != 0) &&
|
||||
!NetIp4IsUnicast (NTOHL (GatewayAddress), EFI_NTOHL(Instance->ConfigData.SubnetMask))) {
|
||||
(EFI_NTOHL (Instance->ConfigData.SubnetMask) != 0) &&
|
||||
!NetIp4IsUnicast (NTOHL (GatewayAddress), EFI_NTOHL (Instance->ConfigData.SubnetMask)))
|
||||
{
|
||||
//
|
||||
// The specified GatewayAddress is not a unicast IPv4 address while it's not 0.
|
||||
//
|
||||
@@ -835,13 +827,13 @@ Udp4ValidateTxToken (
|
||||
UdpSessionData = TxData->UdpSessionData;
|
||||
|
||||
if (UdpSessionData != NULL) {
|
||||
|
||||
CopyMem (&SourceAddress, &UdpSessionData->SourceAddress, sizeof (IP4_ADDR));
|
||||
|
||||
if ((SourceAddress != 0) &&
|
||||
!Instance->ConfigData.UseDefaultAddress &&
|
||||
(EFI_NTOHL(Instance->ConfigData.SubnetMask) != 0) &&
|
||||
!NetIp4IsUnicast (HTONL (SourceAddress), EFI_NTOHL(Instance->ConfigData.SubnetMask))) {
|
||||
(EFI_NTOHL (Instance->ConfigData.SubnetMask) != 0) &&
|
||||
!NetIp4IsUnicast (HTONL (SourceAddress), EFI_NTOHL (Instance->ConfigData.SubnetMask)))
|
||||
{
|
||||
//
|
||||
// Check whether SourceAddress is a valid IPv4 address in case it's not zero.
|
||||
// The configured station address is used if SourceAddress is zero.
|
||||
@@ -877,7 +869,6 @@ Udp4ValidateTxToken (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function checks whether the specified Token duplicates with the one in the Map.
|
||||
|
||||
@@ -902,8 +893,8 @@ Udp4TokenExist (
|
||||
EFI_UDP4_COMPLETION_TOKEN *Token;
|
||||
EFI_UDP4_COMPLETION_TOKEN *TokenInItem;
|
||||
|
||||
Token = (EFI_UDP4_COMPLETION_TOKEN*) Context;
|
||||
TokenInItem = (EFI_UDP4_COMPLETION_TOKEN*) Item->Key;
|
||||
Token = (EFI_UDP4_COMPLETION_TOKEN *)Context;
|
||||
TokenInItem = (EFI_UDP4_COMPLETION_TOKEN *)Item->Key;
|
||||
|
||||
if ((Token == TokenInItem) || (Token->Event == TokenInItem->Event)) {
|
||||
//
|
||||
@@ -916,7 +907,6 @@ Udp4TokenExist (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function calculates the checksum for the Packet, utilizing the pre-calculated
|
||||
pseudo HeadSum to reduce some overhead.
|
||||
@@ -930,21 +920,20 @@ Udp4TokenExist (
|
||||
**/
|
||||
UINT16
|
||||
Udp4Checksum (
|
||||
IN NET_BUF *Packet,
|
||||
IN UINT16 HeadSum
|
||||
IN NET_BUF *Packet,
|
||||
IN UINT16 HeadSum
|
||||
)
|
||||
{
|
||||
UINT16 Checksum;
|
||||
|
||||
Checksum = NetbufChecksum (Packet);
|
||||
Checksum = NetAddChecksum (Checksum, HeadSum);
|
||||
Checksum = NetbufChecksum (Packet);
|
||||
Checksum = NetAddChecksum (Checksum, HeadSum);
|
||||
|
||||
Checksum = NetAddChecksum (Checksum, HTONS ((UINT16) Packet->TotalSize));
|
||||
Checksum = NetAddChecksum (Checksum, HTONS ((UINT16)Packet->TotalSize));
|
||||
|
||||
return (UINT16) ~Checksum;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function removes the specified Token from the TokenMap.
|
||||
|
||||
@@ -966,7 +955,7 @@ Udp4RemoveToken (
|
||||
//
|
||||
// Find the Token first.
|
||||
//
|
||||
Item = NetMapFindKey (TokenMap, (VOID *) Token);
|
||||
Item = NetMapFindKey (TokenMap, (VOID *)Token);
|
||||
|
||||
if (Item != NULL) {
|
||||
//
|
||||
@@ -980,7 +969,6 @@ Udp4RemoveToken (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
@@ -995,17 +983,17 @@ Udp4RemoveToken (
|
||||
VOID
|
||||
EFIAPI
|
||||
Udp4DgramSent (
|
||||
IN EFI_STATUS Status,
|
||||
IN VOID *Context,
|
||||
IN IP_IO_IP_PROTOCOL Sender,
|
||||
IN VOID *NotifyData
|
||||
IN EFI_STATUS Status,
|
||||
IN VOID *Context,
|
||||
IN IP_IO_IP_PROTOCOL Sender,
|
||||
IN VOID *NotifyData
|
||||
)
|
||||
{
|
||||
UDP4_INSTANCE_DATA *Instance;
|
||||
EFI_UDP4_COMPLETION_TOKEN *Token;
|
||||
|
||||
Instance = (UDP4_INSTANCE_DATA *) Context;
|
||||
Token = (EFI_UDP4_COMPLETION_TOKEN *) NotifyData;
|
||||
Instance = (UDP4_INSTANCE_DATA *)Context;
|
||||
Token = (EFI_UDP4_COMPLETION_TOKEN *)NotifyData;
|
||||
|
||||
if (Udp4RemoveToken (&Instance->TxTokens, Token) == EFI_SUCCESS) {
|
||||
//
|
||||
@@ -1017,7 +1005,6 @@ Udp4DgramSent (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function processes the received datagram passed up by the IpIo layer.
|
||||
|
||||
@@ -1049,12 +1036,12 @@ Udp4DgramRcvd (
|
||||
//
|
||||
// Demultiplex the received datagram.
|
||||
//
|
||||
Udp4Demultiplex ((UDP4_SERVICE_DATA *) Context, NetSession, Packet);
|
||||
Udp4Demultiplex ((UDP4_SERVICE_DATA *)Context, NetSession, Packet);
|
||||
} else {
|
||||
//
|
||||
// Handle the ICMP_ERROR packet.
|
||||
//
|
||||
Udp4IcmpHandler ((UDP4_SERVICE_DATA *) Context, IcmpError, NetSession, Packet);
|
||||
Udp4IcmpHandler ((UDP4_SERVICE_DATA *)Context, IcmpError, NetSession, Packet);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1064,7 +1051,6 @@ Udp4DgramRcvd (
|
||||
DispatchDpc ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function removes the multicast group specified by Arg from the Map.
|
||||
|
||||
@@ -1113,7 +1099,6 @@ Udp4LeaveGroup (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function cancels the token specified by Arg in the Map. This is a callback
|
||||
used by Udp4InstanceCancelToken().
|
||||
@@ -1153,15 +1138,15 @@ Udp4CancelTokens (
|
||||
// will invoke Udp4DgramSent, the token will be signaled and this Item will
|
||||
// be removed from the Map there.
|
||||
//
|
||||
Packet = (NET_BUF *) (Item->Value);
|
||||
IpIo = (IP_IO *) (*((UINTN *) &Packet->ProtoData[0]));
|
||||
Packet = (NET_BUF *)(Item->Value);
|
||||
IpIo = (IP_IO *)(*((UINTN *)&Packet->ProtoData[0]));
|
||||
|
||||
IpIoCancelTxToken (IpIo, Packet);
|
||||
} else {
|
||||
//
|
||||
// The token is a receive token. Abort it and remove it from the Map.
|
||||
//
|
||||
TokenToCancel = (EFI_UDP4_COMPLETION_TOKEN *) Item->Key;
|
||||
TokenToCancel = (EFI_UDP4_COMPLETION_TOKEN *)Item->Key;
|
||||
NetMapRemoveItem (Map, Item, NULL);
|
||||
|
||||
TokenToCancel->Status = EFI_ABORTED;
|
||||
@@ -1175,7 +1160,6 @@ Udp4CancelTokens (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function removes all the Wrap datas in the RcvdDgramQue.
|
||||
|
||||
@@ -1198,12 +1182,10 @@ Udp4FlushRcvdDgram (
|
||||
//
|
||||
// The Wrap will be removed from the RcvdDgramQue by this function call.
|
||||
//
|
||||
Udp4RecycleRxDataWrap (NULL, (VOID *) Wrap);
|
||||
Udp4RecycleRxDataWrap (NULL, (VOID *)Wrap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Cancel Udp4 tokens from the Udp4 instance.
|
||||
|
||||
@@ -1250,13 +1232,14 @@ Udp4InstanceCancelToken (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ASSERT ((Token != NULL) || ((0 == NetMapGetCount (&Instance->TxTokens))
|
||||
&& (0 == NetMapGetCount (&Instance->RxTokens))));
|
||||
ASSERT (
|
||||
(Token != NULL) || ( (0 == NetMapGetCount (&Instance->TxTokens))
|
||||
&& (0 == NetMapGetCount (&Instance->RxTokens)))
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function matches the received udp datagram with the Instance.
|
||||
|
||||
@@ -1289,7 +1272,8 @@ Udp4MatchDgram (
|
||||
|
||||
if ((!ConfigData->AcceptAnyPort && (Udp4Session->DestinationPort != ConfigData->StationPort)) ||
|
||||
((ConfigData->RemotePort != 0) && (Udp4Session->SourcePort != ConfigData->RemotePort))
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The local port or the remote port doesn't match.
|
||||
//
|
||||
@@ -1298,7 +1282,8 @@ Udp4MatchDgram (
|
||||
|
||||
if (!EFI_IP4_EQUAL (&ConfigData->RemoteAddress, &mZeroIp4Addr) &&
|
||||
!EFI_IP4_EQUAL (&ConfigData->RemoteAddress, &Udp4Session->SourceAddress)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// This datagram doesn't come from the instance's specified sender.
|
||||
//
|
||||
@@ -1307,7 +1292,8 @@ Udp4MatchDgram (
|
||||
|
||||
if (EFI_IP4_EQUAL (&ConfigData->StationAddress, &mZeroIp4Addr) ||
|
||||
EFI_IP4_EQUAL (&Udp4Session->DestinationAddress, &ConfigData->StationAddress)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The instance is configured to receive datagrams destined to any station IP or
|
||||
// the destination address of this datagram matches the configured station IP.
|
||||
@@ -1325,8 +1311,9 @@ Udp4MatchDgram (
|
||||
}
|
||||
|
||||
if (IP4_IS_MULTICAST (NTOHL (Destination)) &&
|
||||
NetMapFindKey (&Instance->McastIps, (VOID *) (UINTN) Destination) != NULL
|
||||
) {
|
||||
(NetMapFindKey (&Instance->McastIps, (VOID *)(UINTN)Destination) != NULL)
|
||||
)
|
||||
{
|
||||
//
|
||||
// It's a multicast packet and the multicast address is accepted by this instance.
|
||||
//
|
||||
@@ -1336,7 +1323,6 @@ Udp4MatchDgram (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function removes the Wrap specified by Context and release relevant resources.
|
||||
|
||||
@@ -1353,7 +1339,7 @@ Udp4RecycleRxDataWrap (
|
||||
{
|
||||
UDP4_RXDATA_WRAP *Wrap;
|
||||
|
||||
Wrap = (UDP4_RXDATA_WRAP *) Context;
|
||||
Wrap = (UDP4_RXDATA_WRAP *)Context;
|
||||
|
||||
//
|
||||
// Remove the Wrap from the list it belongs to.
|
||||
@@ -1373,7 +1359,6 @@ Udp4RecycleRxDataWrap (
|
||||
FreePool (Wrap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function wraps the Packet and the RxData.
|
||||
|
||||
@@ -1393,14 +1378,16 @@ Udp4WrapRxData (
|
||||
IN EFI_UDP4_RECEIVE_DATA *RxData
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UDP4_RXDATA_WRAP *Wrap;
|
||||
EFI_STATUS Status;
|
||||
UDP4_RXDATA_WRAP *Wrap;
|
||||
|
||||
//
|
||||
// Allocate buffer for the Wrap.
|
||||
//
|
||||
Wrap = AllocatePool (sizeof (UDP4_RXDATA_WRAP) +
|
||||
(Packet->BlockOpNum - 1) * sizeof (EFI_UDP4_FRAGMENT_DATA));
|
||||
Wrap = AllocatePool (
|
||||
sizeof (UDP4_RXDATA_WRAP) +
|
||||
(Packet->BlockOpNum - 1) * sizeof (EFI_UDP4_FRAGMENT_DATA)
|
||||
);
|
||||
if (Wrap == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1430,7 +1417,6 @@ Udp4WrapRxData (
|
||||
return Wrap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function enqueues the received datagram into the instances' receiving queues.
|
||||
|
||||
@@ -1487,7 +1473,6 @@ Udp4EnqueueDgram (
|
||||
return Enqueued;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function delivers the received datagrams for the specified instance.
|
||||
|
||||
@@ -1506,8 +1491,8 @@ Udp4InstanceDeliverDgram (
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
if (!IsListEmpty (&Instance->RcvdDgramQue) &&
|
||||
!NetMapIsEmpty (&Instance->RxTokens)) {
|
||||
|
||||
!NetMapIsEmpty (&Instance->RxTokens))
|
||||
{
|
||||
Wrap = NET_LIST_HEAD (&Instance->RcvdDgramQue, UDP4_RXDATA_WRAP, Link);
|
||||
|
||||
if (NET_BUF_SHARED (Wrap->Packet)) {
|
||||
@@ -1526,7 +1511,7 @@ Udp4InstanceDeliverDgram (
|
||||
|
||||
NetListRemoveHead (&Instance->RcvdDgramQue);
|
||||
|
||||
Token = (EFI_UDP4_COMPLETION_TOKEN *) NetMapRemoveHead (&Instance->RxTokens, NULL);
|
||||
Token = (EFI_UDP4_COMPLETION_TOKEN *)NetMapRemoveHead (&Instance->RxTokens, NULL);
|
||||
|
||||
//
|
||||
// Build the FragmentTable and set the FragmentCount in RxData.
|
||||
@@ -1536,7 +1521,7 @@ Udp4InstanceDeliverDgram (
|
||||
|
||||
NetbufBuildExt (
|
||||
Wrap->Packet,
|
||||
(NET_FRAGMENT *) RxData->FragmentTable,
|
||||
(NET_FRAGMENT *)RxData->FragmentTable,
|
||||
&RxData->FragmentCount
|
||||
);
|
||||
|
||||
@@ -1551,7 +1536,6 @@ Udp4InstanceDeliverDgram (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function delivers the datagrams enqueued in the instances.
|
||||
|
||||
@@ -1583,7 +1567,6 @@ Udp4DeliverDgram (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function demultiplexes the received udp datagram to the appropriate instances.
|
||||
|
||||
@@ -1601,7 +1584,7 @@ Udp4Demultiplex (
|
||||
IN NET_BUF *Packet
|
||||
)
|
||||
{
|
||||
EFI_UDP_HEADER *Udp4Header;
|
||||
EFI_UDP_HEADER *Udp4Header;
|
||||
UINT16 HeadSum;
|
||||
EFI_UDP4_RECEIVE_DATA RxData;
|
||||
EFI_UDP4_SESSION_DATA *Udp4Session;
|
||||
@@ -1615,7 +1598,7 @@ Udp4Demultiplex (
|
||||
//
|
||||
// Get the datagram header from the packet buffer.
|
||||
//
|
||||
Udp4Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
|
||||
Udp4Header = (EFI_UDP_HEADER *)NetbufGetByte (Packet, 0, NULL);
|
||||
ASSERT (Udp4Header != NULL);
|
||||
|
||||
if (Udp4Header->Checksum != 0) {
|
||||
@@ -1650,7 +1633,7 @@ Udp4Demultiplex (
|
||||
//
|
||||
NetbufTrim (Packet, UDP4_HEADER_SIZE, TRUE);
|
||||
|
||||
RxData.DataLength = (UINT32) Packet->TotalSize;
|
||||
RxData.DataLength = (UINT32)Packet->TotalSize;
|
||||
|
||||
//
|
||||
// Try to enqueue this datagram into the instances.
|
||||
@@ -1677,7 +1660,6 @@ Udp4Demultiplex (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function builds and sends out a icmp port unreachable message.
|
||||
|
||||
@@ -1718,7 +1700,7 @@ Udp4SendPortUnreach (
|
||||
// Calculate the required length of the icmp error message.
|
||||
//
|
||||
Len = sizeof (IP4_ICMP_ERROR_HEAD) + (EFI_IP4_HEADER_LEN (IpHdr) -
|
||||
sizeof (IP4_HEAD)) + ICMP_ERROR_PACKET_LENGTH;
|
||||
sizeof (IP4_HEAD)) + ICMP_ERROR_PACKET_LENGTH;
|
||||
|
||||
//
|
||||
// Allocate buffer for the icmp error message.
|
||||
@@ -1731,7 +1713,7 @@ Udp4SendPortUnreach (
|
||||
//
|
||||
// Allocate space for the IP4_ICMP_ERROR_HEAD.
|
||||
//
|
||||
IcmpErrHdr = (IP4_ICMP_ERROR_HEAD *) NetbufAllocSpace (Packet, Len, FALSE);
|
||||
IcmpErrHdr = (IP4_ICMP_ERROR_HEAD *)NetbufAllocSpace (Packet, Len, FALSE);
|
||||
ASSERT (IcmpErrHdr != NULL);
|
||||
|
||||
//
|
||||
@@ -1750,7 +1732,7 @@ Udp4SendPortUnreach (
|
||||
//
|
||||
// Copy the UDP header.
|
||||
//
|
||||
Ptr = (UINT8 *) &IcmpErrHdr->IpHead + EFI_IP4_HEADER_LEN (IpHdr);
|
||||
Ptr = (UINT8 *)&IcmpErrHdr->IpHead + EFI_IP4_HEADER_LEN (IpHdr);
|
||||
CopyMem (Ptr, Udp4Header, ICMP_ERROR_PACKET_LENGTH);
|
||||
|
||||
//
|
||||
@@ -1777,7 +1759,6 @@ Udp4SendPortUnreach (
|
||||
NetbufFree (Packet);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function handles the received Icmp Error message and demultiplexes it to the
|
||||
instance.
|
||||
@@ -1797,7 +1778,7 @@ Udp4IcmpHandler (
|
||||
IN NET_BUF *Packet
|
||||
)
|
||||
{
|
||||
EFI_UDP_HEADER *Udp4Header;
|
||||
EFI_UDP_HEADER *Udp4Header;
|
||||
EFI_UDP4_SESSION_DATA Udp4Session;
|
||||
LIST_ENTRY *Entry;
|
||||
UDP4_INSTANCE_DATA *Instance;
|
||||
@@ -1807,7 +1788,7 @@ Udp4IcmpHandler (
|
||||
return;
|
||||
}
|
||||
|
||||
Udp4Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
|
||||
Udp4Header = (EFI_UDP_HEADER *)NetbufGetByte (Packet, 0, NULL);
|
||||
ASSERT (Udp4Header != NULL);
|
||||
|
||||
CopyMem (&Udp4Session.SourceAddress, &NetSession->Source, sizeof (EFI_IPv4_ADDRESS));
|
||||
@@ -1848,7 +1829,6 @@ Udp4IcmpHandler (
|
||||
NetbufFree (Packet);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function reports the received ICMP error.
|
||||
|
||||
@@ -1873,7 +1853,7 @@ Udp4ReportIcmpError (
|
||||
//
|
||||
// Try to get a RxToken from the RxTokens map.
|
||||
//
|
||||
Token = (EFI_UDP4_COMPLETION_TOKEN *) NetMapRemoveHead (&Instance->RxTokens, NULL);
|
||||
Token = (EFI_UDP4_COMPLETION_TOKEN *)NetMapRemoveHead (&Instance->RxTokens, NULL);
|
||||
|
||||
if (Token != NULL) {
|
||||
//
|
||||
@@ -1890,7 +1870,6 @@ Udp4ReportIcmpError (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is a dummy ext-free function for the NET_BUF created for the output
|
||||
udp datagram.
|
||||
@@ -1905,4 +1884,3 @@ Udp4NetVectorExtFree (
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user