summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/Udp4Dxe
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:07 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commitd1050b9dff1cace252aff86630bfdb59dff5f507 (patch)
tree77f796143980742d97a883f62ce339a270474801 /NetworkPkg/Udp4Dxe
parent2f88bd3a1296c522317f1c21377876de63de5be7 (diff)
downloadedk2-d1050b9dff1cace252aff86630bfdb59dff5f507.tar.gz
edk2-d1050b9dff1cace252aff86630bfdb59dff5f507.tar.bz2
edk2-d1050b9dff1cace252aff86630bfdb59dff5f507.zip
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>
Diffstat (limited to 'NetworkPkg/Udp4Dxe')
-rw-r--r--NetworkPkg/Udp4Dxe/ComponentName.c52
-rw-r--r--NetworkPkg/Udp4Dxe/Udp4Driver.c52
-rw-r--r--NetworkPkg/Udp4Dxe/Udp4Driver.h1
-rw-r--r--NetworkPkg/Udp4Dxe/Udp4Impl.c194
-rw-r--r--NetworkPkg/Udp4Dxe/Udp4Impl.h91
-rw-r--r--NetworkPkg/Udp4Dxe/Udp4Main.c69
6 files changed, 209 insertions, 250 deletions
diff --git a/NetworkPkg/Udp4Dxe/ComponentName.c b/NetworkPkg/Udp4Dxe/ComponentName.c
index 41bd834c6d..29e66e72c6 100644
--- a/NetworkPkg/Udp4Dxe/ComponentName.c
+++ b/NetworkPkg/Udp4Dxe/ComponentName.c
@@ -5,12 +5,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include "Udp4Impl.h"
//
// EFI Component Name Functions
//
+
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -58,7 +58,6 @@ UdpComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
-
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -130,14 +129,13 @@ UdpComponentNameGetDriverName (
EFI_STATUS
EFIAPI
UdpComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
);
-
//
// EFI Component Name Protocol
//
@@ -150,14 +148,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName =
//
// EFI Component Name 2 Protocol
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUdp4ComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UdpComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UdpComponentNameGetControllerName,
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUdp4ComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)UdpComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)UdpComponentNameGetControllerName,
"en"
};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUdpDriverNameTable[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUdpDriverNameTable[] = {
{
"eng;en",
L"UDP Network Service Driver"
@@ -168,7 +165,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUdpDriverNameTable[] = {
}
};
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gUdpControllerNameTable = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gUdpControllerNameTable = NULL;
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -238,12 +235,12 @@ UdpComponentNameGetDriverName (
**/
EFI_STATUS
UpdateName (
- EFI_UDP4_PROTOCOL *Udp4
+ EFI_UDP4_PROTOCOL *Udp4
)
{
- EFI_STATUS Status;
- CHAR16 HandleName[64];
- EFI_UDP4_CONFIG_DATA Udp4ConfigData;
+ EFI_STATUS Status;
+ CHAR16 HandleName[64];
+ EFI_UDP4_CONFIG_DATA Udp4ConfigData;
if (Udp4 == NULL) {
return EFI_INVALID_PARAMETER;
@@ -255,7 +252,9 @@ UpdateName (
//
Status = Udp4->GetModeData (Udp4, &Udp4ConfigData, NULL, NULL, NULL);
if (!EFI_ERROR (Status)) {
- UnicodeSPrint (HandleName, sizeof (HandleName),
+ UnicodeSPrint (
+ HandleName,
+ sizeof (HandleName),
L"UDPv4 (SrcPort=%d, DestPort=%d)",
Udp4ConfigData.StationPort,
Udp4ConfigData.RemotePort
@@ -366,15 +365,15 @@ UpdateName (
EFI_STATUS
EFIAPI
UdpComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
)
{
- EFI_STATUS Status;
- EFI_UDP4_PROTOCOL *Udp4;
+ EFI_STATUS Status;
+ EFI_UDP4_PROTOCOL *Udp4;
//
// Only provide names for child handles.
@@ -426,4 +425,3 @@ UdpComponentNameGetControllerName (
(BOOLEAN)(This == &gUdp4ComponentName)
);
}
-
diff --git a/NetworkPkg/Udp4Dxe/Udp4Driver.c b/NetworkPkg/Udp4Dxe/Udp4Driver.c
index 44032682e2..cb917fcfc9 100644
--- a/NetworkPkg/Udp4Dxe/Udp4Driver.c
+++ b/NetworkPkg/Udp4Dxe/Udp4Driver.c
@@ -5,10 +5,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include "Udp4Impl.h"
-EFI_DRIVER_BINDING_PROTOCOL gUdp4DriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL gUdp4DriverBinding = {
Udp4DriverBindingSupported,
Udp4DriverBindingStart,
Udp4DriverBindingStop,
@@ -17,7 +16,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUdp4DriverBinding = {
NULL
};
-EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding = {
+EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding = {
Udp4ServiceBindingCreateChild,
Udp4ServiceBindingDestroyChild
};
@@ -35,8 +34,8 @@ EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding = {
EFI_STATUS
EFIAPI
Udp4DestroyChildEntryInHandleBuffer (
- IN LIST_ENTRY *Entry,
- IN VOID *Context
+ IN LIST_ENTRY *Entry,
+ IN VOID *Context
)
{
UDP4_INSTANCE_DATA *Instance;
@@ -44,14 +43,14 @@ Udp4DestroyChildEntryInHandleBuffer (
UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
- if (Entry == NULL || Context == NULL) {
+ if ((Entry == NULL) || (Context == NULL)) {
return EFI_INVALID_PARAMETER;
}
- Instance = NET_LIST_USER_STRUCT_S (Entry, UDP4_INSTANCE_DATA, Link, UDP4_INSTANCE_DATA_SIGNATURE);
- ServiceBinding = ((UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;
- NumberOfChildren = ((UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;
- ChildHandleBuffer = ((UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;
+ Instance = NET_LIST_USER_STRUCT_S (Entry, UDP4_INSTANCE_DATA, Link, UDP4_INSTANCE_DATA_SIGNATURE);
+ ServiceBinding = ((UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ServiceBinding;
+ NumberOfChildren = ((UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->NumberOfChildren;
+ ChildHandleBuffer = ((UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ChildHandleBuffer;
if (!NetIsInHandleBuffer (Instance->ChildHandle, NumberOfChildren, ChildHandleBuffer)) {
return EFI_SUCCESS;
@@ -60,7 +59,6 @@ Udp4DestroyChildEntryInHandleBuffer (
return ServiceBinding->DestroyChild (ServiceBinding, Instance->ChildHandle);
}
-
/**
Test to see if this driver supports ControllerHandle. This service
is called by the EFI boot service ConnectController(). In
@@ -119,7 +117,6 @@ Udp4DriverBindingSupported (
return Status;
}
-
/**
Start this driver on ControllerHandle. This service is called by the
EFI boot service ConnectController(). In order to make
@@ -180,7 +177,6 @@ Udp4DriverBindingStart (
return Status;
}
-
/**
Stop this driver on ControllerHandle. This service is called by the
EFI boot service DisconnectController(). In order to
@@ -229,7 +225,7 @@ Udp4DriverBindingStop (
Status = gBS->OpenProtocol (
NicHandle,
&gEfiUdp4ServiceBindingProtocolGuid,
- (VOID **) &ServiceBinding,
+ (VOID **)&ServiceBinding,
This->DriverBindingHandle,
NicHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -243,16 +239,16 @@ Udp4DriverBindingStop (
//
// NumberOfChildren is not zero, destroy the children instances in ChildHandleBuffer.
//
- List = &Udp4Service->ChildrenList;
+ List = &Udp4Service->ChildrenList;
Context.ServiceBinding = ServiceBinding;
Context.NumberOfChildren = NumberOfChildren;
Context.ChildHandleBuffer = ChildHandleBuffer;
- Status = NetDestroyLinkList (
- List,
- Udp4DestroyChildEntryInHandleBuffer,
- &Context,
- NULL
- );
+ Status = NetDestroyLinkList (
+ List,
+ Udp4DestroyChildEntryInHandleBuffer,
+ &Context,
+ NULL
+ );
} else {
gBS->UninstallMultipleProtocolInterfaces (
NicHandle,
@@ -267,13 +263,13 @@ Udp4DriverBindingStop (
FreeUnicodeStringTable (gUdpControllerNameTable);
gUdpControllerNameTable = NULL;
}
+
FreePool (Udp4Service);
}
return Status;
}
-
/**
Creates a child handle and installs a protocol.
@@ -352,7 +348,7 @@ Udp4ServiceBindingCreateChild (
Status = gBS->OpenProtocol (
Udp4Service->IpIo->ChildHandle,
&gEfiIp4ProtocolGuid,
- (VOID **) &Ip4,
+ (VOID **)&Ip4,
gUdp4DriverBinding.DriverBindingHandle,
Instance->ChildHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -367,7 +363,7 @@ Udp4ServiceBindingCreateChild (
Status = gBS->OpenProtocol (
Instance->IpInfo->ChildHandle,
&gEfiIp4ProtocolGuid,
- (VOID **) &Ip4,
+ (VOID **)&Ip4,
gUdp4DriverBinding.DriverBindingHandle,
Instance->ChildHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -410,7 +406,6 @@ ON_ERROR:
return Status;
}
-
/**
Destroys a child handle with a protocol installed on it.
@@ -454,7 +449,7 @@ Udp4ServiceBindingDestroyChild (
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiUdp4ProtocolGuid,
- (VOID **) &Udp4Proto,
+ (VOID **)&Udp4Proto,
gUdp4DriverBinding.DriverBindingHandle,
ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -499,7 +494,7 @@ Udp4ServiceBindingDestroyChild (
Status = gBS->UninstallMultipleProtocolInterfaces (
ChildHandle,
&gEfiUdp4ProtocolGuid,
- (VOID *) &Instance->Udp4Proto,
+ (VOID *)&Instance->Udp4Proto,
NULL
);
if (EFI_ERROR (Status)) {
@@ -576,9 +571,8 @@ Udp4DriverEntryPoint (
//
// Initialize the UDP random port.
//
- mUdp4RandomPort = (UINT16) (((UINT16) NetRandomInitSeed ()) % UDP4_PORT_KNOWN + UDP4_PORT_KNOWN);
+ mUdp4RandomPort = (UINT16)(((UINT16)NetRandomInitSeed ()) % UDP4_PORT_KNOWN + UDP4_PORT_KNOWN);
}
return Status;
}
-
diff --git a/NetworkPkg/Udp4Dxe/Udp4Driver.h b/NetworkPkg/Udp4Dxe/Udp4Driver.h
index 741c839d57..a8cf3670ab 100644
--- a/NetworkPkg/Udp4Dxe/Udp4Driver.h
+++ b/NetworkPkg/Udp4Dxe/Udp4Driver.h
@@ -145,4 +145,3 @@ Udp4ServiceBindingDestroyChild (
);
#endif
-
diff --git a/NetworkPkg/Udp4Dxe/Udp4Impl.c b/NetworkPkg/Udp4Dxe/Udp4Impl.c
index dc2a324c11..28b064ff8e 100644
--- a/NetworkPkg/Udp4Dxe/Udp4Impl.c
+++ b/NetworkPkg/Udp4Dxe/Udp4Impl.c
@@ -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 (
)
{
}
-
diff --git a/NetworkPkg/Udp4Dxe/Udp4Impl.h b/NetworkPkg/Udp4Dxe/Udp4Impl.h
index 115f9ed878..246a91de5e 100644
--- a/NetworkPkg/Udp4Dxe/Udp4Impl.h
+++ b/NetworkPkg/Udp4Dxe/Udp4Impl.h
@@ -29,22 +29,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Udp4Driver.h"
-
-extern EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gUdp4ComponentName2;
-extern EFI_UNICODE_STRING_TABLE *gUdpControllerNameTable;
-extern EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding;
-extern EFI_UDP4_PROTOCOL mUdp4Protocol;
-extern UINT16 mUdp4RandomPort;
+extern EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gUdp4ComponentName2;
+extern EFI_UNICODE_STRING_TABLE *gUdpControllerNameTable;
+extern EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding;
+extern EFI_UDP4_PROTOCOL mUdp4Protocol;
+extern UINT16 mUdp4RandomPort;
#define ICMP_ERROR_PACKET_LENGTH 8
-#define UDP4_TIMEOUT_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
+#define UDP4_TIMEOUT_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
-#define UDP4_HEADER_SIZE sizeof (EFI_UDP_HEADER)
-#define UDP4_MAX_DATA_SIZE 65507
+#define UDP4_HEADER_SIZE sizeof (EFI_UDP_HEADER)
+#define UDP4_MAX_DATA_SIZE 65507
-#define UDP4_PORT_KNOWN 1024
+#define UDP4_PORT_KNOWN 1024
#define UDP4_SERVICE_DATA_SIGNATURE SIGNATURE_32('U', 'd', 'p', '4')
@@ -57,15 +56,15 @@ extern UINT16 mUdp4RandomPort;
)
typedef struct _UDP4_SERVICE_DATA_ {
- UINT32 Signature;
- EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
- EFI_HANDLE ImageHandle;
- EFI_HANDLE ControllerHandle;
- LIST_ENTRY ChildrenList;
- UINTN ChildrenNumber;
- IP_IO *IpIo;
-
- EFI_EVENT TimeoutEvent;
+ UINT32 Signature;
+ EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
+ EFI_HANDLE ImageHandle;
+ EFI_HANDLE ControllerHandle;
+ LIST_ENTRY ChildrenList;
+ UINTN ChildrenNumber;
+ IP_IO *IpIo;
+
+ EFI_EVENT TimeoutEvent;
} UDP4_SERVICE_DATA;
#define UDP4_INSTANCE_DATA_SIGNATURE SIGNATURE_32('U', 'd', 'p', 'I')
@@ -79,44 +78,44 @@ typedef struct _UDP4_SERVICE_DATA_ {
)
typedef struct _UDP4_INSTANCE_DATA_ {
- UINT32 Signature;
- LIST_ENTRY Link;
+ UINT32 Signature;
+ LIST_ENTRY Link;
- UDP4_SERVICE_DATA *Udp4Service;
- EFI_UDP4_PROTOCOL Udp4Proto;
- EFI_UDP4_CONFIG_DATA ConfigData;
- EFI_HANDLE ChildHandle;
- BOOLEAN Configured;
- BOOLEAN IsNoMapping;
+ UDP4_SERVICE_DATA *Udp4Service;
+ EFI_UDP4_PROTOCOL Udp4Proto;
+ EFI_UDP4_CONFIG_DATA ConfigData;
+ EFI_HANDLE ChildHandle;
+ BOOLEAN Configured;
+ BOOLEAN IsNoMapping;
- NET_MAP TxTokens;
- NET_MAP RxTokens;
+ NET_MAP TxTokens;
+ NET_MAP RxTokens;
- NET_MAP McastIps;
+ NET_MAP McastIps;
- LIST_ENTRY RcvdDgramQue;
- LIST_ENTRY DeliveredDgramQue;
+ LIST_ENTRY RcvdDgramQue;
+ LIST_ENTRY DeliveredDgramQue;
- UINT16 HeadSum;
+ UINT16 HeadSum;
- EFI_STATUS IcmpError;
+ EFI_STATUS IcmpError;
- IP_IO_IP_INFO *IpInfo;
+ IP_IO_IP_INFO *IpInfo;
- BOOLEAN InDestroy;
+ BOOLEAN InDestroy;
} UDP4_INSTANCE_DATA;
typedef struct _UDP4_RXDATA_WRAP_ {
- LIST_ENTRY Link;
- NET_BUF *Packet;
- UINT32 TimeoutTick;
- EFI_UDP4_RECEIVE_DATA RxData;
+ LIST_ENTRY Link;
+ NET_BUF *Packet;
+ UINT32 TimeoutTick;
+ EFI_UDP4_RECEIVE_DATA RxData;
} UDP4_RXDATA_WRAP;
typedef struct {
- EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
- UINTN NumberOfChildren;
- EFI_HANDLE *ChildHandleBuffer;
+ EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
+ UINTN NumberOfChildren;
+ EFI_HANDLE *ChildHandleBuffer;
} UDP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;
/**
@@ -582,8 +581,8 @@ Udp4TokenExist (
**/
UINT16
Udp4Checksum (
- IN NET_BUF *Packet,
- IN UINT16 HeadSum
+ IN NET_BUF *Packet,
+ IN UINT16 HeadSum
);
/**
diff --git a/NetworkPkg/Udp4Dxe/Udp4Main.c b/NetworkPkg/Udp4Dxe/Udp4Main.c
index 2a639f9547..b1e04f441f 100644
--- a/NetworkPkg/Udp4Dxe/Udp4Main.c
+++ b/NetworkPkg/Udp4Dxe/Udp4Main.c
@@ -19,7 +19,6 @@ EFI_UDP4_PROTOCOL mUdp4Protocol = {
Udp4Poll
};
-
/**
Reads the current operational settings.
@@ -86,7 +85,6 @@ Udp4GetModeData (
return Status;
}
-
/**
Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4
Protocol.
@@ -154,7 +152,6 @@ Udp4Configure (
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (UdpConfigData != NULL) {
-
CopyMem (&StationAddress, &UdpConfigData->StationAddress, sizeof (IP4_ADDR));
CopyMem (&SubnetMask, &UdpConfigData->SubnetMask, sizeof (IP4_ADDR));
CopyMem (&RemoteAddress, &UdpConfigData->RemoteAddress, sizeof (IP4_ADDR));
@@ -163,11 +160,11 @@ Udp4Configure (
SubnetMask = NTOHL (SubnetMask);
RemoteAddress = NTOHL (RemoteAddress);
-
if (!UdpConfigData->UseDefaultAddress &&
(!IP4_IS_VALID_NETMASK (SubnetMask) ||
- !((StationAddress == 0) || (SubnetMask != 0 && NetIp4IsUnicast (StationAddress, SubnetMask))) ||
- IP4_IS_LOCAL_BROADCAST (RemoteAddress))) {
+ !((StationAddress == 0) || ((SubnetMask != 0) && NetIp4IsUnicast (StationAddress, SubnetMask))) ||
+ IP4_IS_LOCAL_BROADCAST (RemoteAddress)))
+ {
//
// Don't use default address, and subnet mask is invalid or StationAddress is not
// a valid unicast IPv4 address or RemoteAddress is not a valid unicast IPv4 address
@@ -283,7 +280,6 @@ ON_EXIT:
return Status;
}
-
/**
Joins and leaves multicast groups.
@@ -370,10 +366,8 @@ Udp4Groups (
// the multicast datagrams destined to multicast IPs the other instances configured.
//
if (JoinFlag) {
-
- NetMapInsertTail (&Instance->McastIps, (VOID *) (UINTN) McastIp, NULL);
+ NetMapInsertTail (&Instance->McastIps, (VOID *)(UINTN)McastIp, NULL);
} else {
-
NetMapIterate (&Instance->McastIps, Udp4LeaveGroup, MulticastAddress);
}
@@ -384,7 +378,6 @@ ON_EXIT:
return Status;
}
-
/**
Adds and deletes routing table entries.
@@ -458,7 +451,6 @@ Udp4Routes (
return Ip->Routes (Ip, DeleteRoute, SubnetAddress, SubnetMask, GatewayAddress);
}
-
/**
Queues outgoing data packets into the transmit queue.
@@ -500,7 +492,7 @@ Udp4Transmit (
UDP4_INSTANCE_DATA *Instance;
EFI_TPL OldTpl;
NET_BUF *Packet;
- EFI_UDP_HEADER *Udp4Header;
+ EFI_UDP_HEADER *Udp4Header;
EFI_UDP4_CONFIG_DATA *ConfigData;
IP4_ADDR Source;
IP4_ADDR Destination;
@@ -536,7 +528,8 @@ Udp4Transmit (
}
if (EFI_ERROR (NetMapIterate (&Instance->TxTokens, Udp4TokenExist, Token)) ||
- EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp4TokenExist, Token))) {
+ EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp4TokenExist, Token)))
+ {
//
// Try to find a duplicate token in the two token maps, if found, return
// EFI_ACCESS_DENIED.
@@ -566,10 +559,10 @@ Udp4Transmit (
//
// Store the IpIo in ProtoData.
//
- Udp4Service = Instance->Udp4Service;
- *((UINTN *) &Packet->ProtoData[0]) = (UINTN) (Udp4Service->IpIo);
+ Udp4Service = Instance->Udp4Service;
+ *((UINTN *)&Packet->ProtoData[0]) = (UINTN)(Udp4Service->IpIo);
- Udp4Header = (EFI_UDP_HEADER *) NetbufAllocSpace (Packet, UDP4_HEADER_SIZE, TRUE);
+ Udp4Header = (EFI_UDP_HEADER *)NetbufAllocSpace (Packet, UDP4_HEADER_SIZE, TRUE);
ASSERT (Udp4Header != NULL);
ConfigData = &Instance->ConfigData;
@@ -577,10 +570,10 @@ Udp4Transmit (
//
// Fill the udp header.
//
- Udp4Header->SrcPort = HTONS (ConfigData->StationPort);
- Udp4Header->DstPort = HTONS (ConfigData->RemotePort);
- Udp4Header->Length = HTONS ((UINT16) Packet->TotalSize);
- Udp4Header->Checksum = 0;
+ Udp4Header->SrcPort = HTONS (ConfigData->StationPort);
+ Udp4Header->DstPort = HTONS (ConfigData->RemotePort);
+ Udp4Header->Length = HTONS ((UINT16)Packet->TotalSize);
+ Udp4Header->Checksum = 0;
UdpSessionData = TxData->UdpSessionData;
IP4_COPY_ADDRESS (&Override.Ip4OverrideData.SourceAddress, &ConfigData->StationAddress);
@@ -643,10 +636,10 @@ Udp4Transmit (
ZeroMem (&Override.Ip4OverrideData.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
}
- Override.Ip4OverrideData.Protocol = EFI_IP_PROTO_UDP;
- Override.Ip4OverrideData.TypeOfService = ConfigData->TypeOfService;
- Override.Ip4OverrideData.TimeToLive = ConfigData->TimeToLive;
- Override.Ip4OverrideData.DoNotFragment = ConfigData->DoNotFragment;
+ Override.Ip4OverrideData.Protocol = EFI_IP_PROTO_UDP;
+ Override.Ip4OverrideData.TypeOfService = ConfigData->TypeOfService;
+ Override.Ip4OverrideData.TimeToLive = ConfigData->TimeToLive;
+ Override.Ip4OverrideData.DoNotFragment = ConfigData->DoNotFragment;
//
// Save the token into the TxToken map.
@@ -660,15 +653,15 @@ Udp4Transmit (
// Send out this datagram through IpIo.
//
IpDestAddr.Addr[0] = Destination;
- Status = IpIoSend (
- Udp4Service->IpIo,
- Packet,
- Instance->IpInfo,
- Instance,
- Token,
- &IpDestAddr,
- &Override
- );
+ Status = IpIoSend (
+ Udp4Service->IpIo,
+ Packet,
+ Instance->IpInfo,
+ Instance,
+ Token,
+ &IpDestAddr,
+ &Override
+ );
if (EFI_ERROR (Status)) {
//
// Remove this token from the TxTokens.
@@ -687,7 +680,6 @@ ON_EXIT:
return Status;
}
-
/**
Places an asynchronous receive request into the receiving queue.
@@ -744,8 +736,9 @@ Udp4Receive (
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
- if (EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp4TokenExist, Token))||
- EFI_ERROR (NetMapIterate (&Instance->TxTokens, Udp4TokenExist, Token))) {
+ if (EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp4TokenExist, Token)) ||
+ EFI_ERROR (NetMapIterate (&Instance->TxTokens, Udp4TokenExist, Token)))
+ {
//
// Return EFI_ACCESS_DENIED if the specified token is already in the TxTokens or
// RxTokens map.
@@ -787,7 +780,6 @@ ON_EXIT:
return Status;
}
-
/**
Aborts an asynchronous transmit or receive request.
@@ -858,7 +850,6 @@ Udp4Cancel (
return Status;
}
-
/**
Polls for incoming data packets and processes outgoing data packets.