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