]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Udp4Dxe/Udp4Main.c
NetworkPkg: Apply uncrustify changes
[mirror_edk2.git] / NetworkPkg / Udp4Dxe / Udp4Main.c
index 2a639f954726a33dbb3e7131c1a75e2c924f6731..b1e04f441fc5aba1882a9bd8554bd91311ea06db 100644 (file)
@@ -19,7 +19,6 @@ EFI_UDP4_PROTOCOL  mUdp4Protocol = {
   Udp4Poll\r
 };\r
 \r
-\r
 /**\r
   Reads the current operational settings.\r
 \r
@@ -86,7 +85,6 @@ Udp4GetModeData (
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4\r
   Protocol.\r
@@ -154,7 +152,6 @@ Udp4Configure (
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   if (UdpConfigData != NULL) {\r
-\r
     CopyMem (&StationAddress, &UdpConfigData->StationAddress, sizeof (IP4_ADDR));\r
     CopyMem (&SubnetMask, &UdpConfigData->SubnetMask, sizeof (IP4_ADDR));\r
     CopyMem (&RemoteAddress, &UdpConfigData->RemoteAddress, sizeof (IP4_ADDR));\r
@@ -163,11 +160,11 @@ Udp4Configure (
     SubnetMask     = NTOHL (SubnetMask);\r
     RemoteAddress  = NTOHL (RemoteAddress);\r
 \r
-\r
     if (!UdpConfigData->UseDefaultAddress &&\r
         (!IP4_IS_VALID_NETMASK (SubnetMask) ||\r
-         !((StationAddress == 0) || (SubnetMask != 0 && NetIp4IsUnicast (StationAddress, SubnetMask))) ||\r
-         IP4_IS_LOCAL_BROADCAST (RemoteAddress))) {\r
+         !((StationAddress == 0) || ((SubnetMask != 0) && NetIp4IsUnicast (StationAddress, SubnetMask))) ||\r
+         IP4_IS_LOCAL_BROADCAST (RemoteAddress)))\r
+    {\r
       //\r
       // Don't use default address, and subnet mask is invalid or StationAddress is not\r
       // a valid unicast IPv4 address or RemoteAddress is not a valid unicast IPv4 address\r
@@ -283,7 +280,6 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Joins and leaves multicast groups.\r
 \r
@@ -370,10 +366,8 @@ Udp4Groups (
   // the multicast datagrams destined to multicast IPs the other instances configured.\r
   //\r
   if (JoinFlag) {\r
-\r
-    NetMapInsertTail (&Instance->McastIps, (VOID *) (UINTN) McastIp, NULL);\r
+    NetMapInsertTail (&Instance->McastIps, (VOID *)(UINTN)McastIp, NULL);\r
   } else {\r
-\r
     NetMapIterate (&Instance->McastIps, Udp4LeaveGroup, MulticastAddress);\r
   }\r
 \r
@@ -384,7 +378,6 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Adds and deletes routing table entries.\r
 \r
@@ -458,7 +451,6 @@ Udp4Routes (
   return Ip->Routes (Ip, DeleteRoute, SubnetAddress, SubnetMask, GatewayAddress);\r
 }\r
 \r
-\r
 /**\r
   Queues outgoing data packets into the transmit queue.\r
 \r
@@ -500,7 +492,7 @@ Udp4Transmit (
   UDP4_INSTANCE_DATA      *Instance;\r
   EFI_TPL                 OldTpl;\r
   NET_BUF                 *Packet;\r
-  EFI_UDP_HEADER         *Udp4Header;\r
+  EFI_UDP_HEADER          *Udp4Header;\r
   EFI_UDP4_CONFIG_DATA    *ConfigData;\r
   IP4_ADDR                Source;\r
   IP4_ADDR                Destination;\r
@@ -536,7 +528,8 @@ Udp4Transmit (
   }\r
 \r
   if (EFI_ERROR (NetMapIterate (&Instance->TxTokens, Udp4TokenExist, Token)) ||\r
-    EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp4TokenExist, Token))) {\r
+      EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp4TokenExist, Token)))\r
+  {\r
     //\r
     // Try to find a duplicate token in the two token maps, if found, return\r
     // EFI_ACCESS_DENIED.\r
@@ -566,10 +559,10 @@ Udp4Transmit (
   //\r
   // Store the IpIo in ProtoData.\r
   //\r
-  Udp4Service = Instance->Udp4Service;\r
-  *((UINTN *) &Packet->ProtoData[0]) = (UINTN) (Udp4Service->IpIo);\r
+  Udp4Service                       = Instance->Udp4Service;\r
+  *((UINTN *)&Packet->ProtoData[0]) = (UINTN)(Udp4Service->IpIo);\r
 \r
-  Udp4Header = (EFI_UDP_HEADER *) NetbufAllocSpace (Packet, UDP4_HEADER_SIZE, TRUE);\r
+  Udp4Header = (EFI_UDP_HEADER *)NetbufAllocSpace (Packet, UDP4_HEADER_SIZE, TRUE);\r
   ASSERT (Udp4Header != NULL);\r
 \r
   ConfigData = &Instance->ConfigData;\r
@@ -577,10 +570,10 @@ Udp4Transmit (
   //\r
   // Fill the udp header.\r
   //\r
-  Udp4Header->SrcPort      = HTONS (ConfigData->StationPort);\r
-  Udp4Header->DstPort      = HTONS (ConfigData->RemotePort);\r
-  Udp4Header->Length       = HTONS ((UINT16) Packet->TotalSize);\r
-  Udp4Header->Checksum     = 0;\r
+  Udp4Header->SrcPort  = HTONS (ConfigData->StationPort);\r
+  Udp4Header->DstPort  = HTONS (ConfigData->RemotePort);\r
+  Udp4Header->Length   = HTONS ((UINT16)Packet->TotalSize);\r
+  Udp4Header->Checksum = 0;\r
 \r
   UdpSessionData = TxData->UdpSessionData;\r
   IP4_COPY_ADDRESS (&Override.Ip4OverrideData.SourceAddress, &ConfigData->StationAddress);\r
@@ -643,10 +636,10 @@ Udp4Transmit (
     ZeroMem (&Override.Ip4OverrideData.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
   }\r
 \r
-  Override.Ip4OverrideData.Protocol                 = EFI_IP_PROTO_UDP;\r
-  Override.Ip4OverrideData.TypeOfService            = ConfigData->TypeOfService;\r
-  Override.Ip4OverrideData.TimeToLive               = ConfigData->TimeToLive;\r
-  Override.Ip4OverrideData.DoNotFragment            = ConfigData->DoNotFragment;\r
+  Override.Ip4OverrideData.Protocol      = EFI_IP_PROTO_UDP;\r
+  Override.Ip4OverrideData.TypeOfService = ConfigData->TypeOfService;\r
+  Override.Ip4OverrideData.TimeToLive    = ConfigData->TimeToLive;\r
+  Override.Ip4OverrideData.DoNotFragment = ConfigData->DoNotFragment;\r
 \r
   //\r
   // Save the token into the TxToken map.\r
@@ -660,15 +653,15 @@ Udp4Transmit (
   // Send out this datagram through IpIo.\r
   //\r
   IpDestAddr.Addr[0] = Destination;\r
-  Status = IpIoSend (\r
-             Udp4Service->IpIo,\r
-             Packet,\r
-             Instance->IpInfo,\r
-             Instance,\r
-             Token,\r
-             &IpDestAddr,\r
-             &Override\r
-             );\r
+  Status             = IpIoSend (\r
+                         Udp4Service->IpIo,\r
+                         Packet,\r
+                         Instance->IpInfo,\r
+                         Instance,\r
+                         Token,\r
+                         &IpDestAddr,\r
+                         &Override\r
+                         );\r
   if (EFI_ERROR (Status)) {\r
     //\r
     // Remove this token from the TxTokens.\r
@@ -687,7 +680,6 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Places an asynchronous receive request into the receiving queue.\r
 \r
@@ -744,8 +736,9 @@ Udp4Receive (
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  if (EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp4TokenExist, Token))||\r
-    EFI_ERROR (NetMapIterate (&Instance->TxTokens, Udp4TokenExist, Token))) {\r
+  if (EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp4TokenExist, Token)) ||\r
+      EFI_ERROR (NetMapIterate (&Instance->TxTokens, Udp4TokenExist, Token)))\r
+  {\r
     //\r
     // Return EFI_ACCESS_DENIED if the specified token is already in the TxTokens or\r
     // RxTokens map.\r
@@ -787,7 +780,6 @@ ON_EXIT:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Aborts an asynchronous transmit or receive request.\r
 \r
@@ -858,7 +850,6 @@ Udp4Cancel (
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Polls for incoming data packets and processes outgoing data packets.\r
 \r