]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Library / DxeIpIoLib / DxeIpIoLib.c
index 66c7fec6c54820b455603a8cb0b01648c78e9055..fafc26894dba2184f25d8776468ac700625ebbe5 100644 (file)
@@ -78,11 +78,11 @@ GLOBAL_REMOVE_IF_UNREFERENCED ICMP_ERROR_INFO  mIcmp6ErrMap[10] = {
   {FALSE, TRUE}, // ICMP6_ERR_UNREACH_NET\r
   {FALSE, TRUE}, // ICMP6_ERR_UNREACH_HOST\r
   {TRUE,  TRUE}, // ICMP6_ERR_UNREACH_PROTOCOL\r
-  {TRUE,  TRUE}, // ICMP6_ERR_UNREACH_PORT    \r
+  {TRUE,  TRUE}, // ICMP6_ERR_UNREACH_PORT\r
   {TRUE,  TRUE}, // ICMP6_ERR_PACKAGE_TOOBIG\r
   {FALSE, TRUE}, // ICMP6_ERR_TIMXCEED_HOPLIMIT\r
   {FALSE, TRUE}, // ICMP6_ERR_TIMXCEED_REASS\r
-  {FALSE, TRUE}, // ICMP6_ERR_PARAMPROB_HEADER    \r
+  {FALSE, TRUE}, // ICMP6_ERR_PARAMPROB_HEADER\r
   {FALSE, TRUE}, // ICMP6_ERR_PARAMPROB_NEXHEADER\r
   {FALSE, TRUE}  // ICMP6_ERR_PARAMPROB_IPV6OPTION\r
 };\r
@@ -258,7 +258,7 @@ IpIoCloseProtocolDestroyIpChild (
 }\r
 \r
 /**\r
-  This function handles ICMPv4 packets. It is the worker function of \r
+  This function handles ICMPv4 packets. It is the worker function of\r
   IpIoIcmpHandler.\r
 \r
   @param[in]       IpIo            Pointer to the IP_IO instance.\r
@@ -283,19 +283,19 @@ IpIoIcmpv4Handler (
   UINT8                Type;\r
   UINT8                Code;\r
   UINT32               TrimBytes;\r
-  \r
+\r
   ASSERT (IpIo != NULL);\r
   ASSERT (Pkt != NULL);\r
   ASSERT (Session != NULL);\r
   ASSERT (IpIo->IpVersion == IP_VERSION_4);\r
-  \r
+\r
   //\r
   // Check the ICMP packet length.\r
   //\r
   if (Pkt->TotalSize < sizeof (IP4_ICMP_ERROR_HEAD)) {\r
     return EFI_ABORTED;\r
   }\r
-  \r
+\r
   IcmpHdr = NET_PROTO_HDR (Pkt, IP4_ICMP_ERROR_HEAD);\r
   IpHdr   = (EFI_IP4_HEADER *) (&IcmpHdr->IpHead);\r
 \r
@@ -387,20 +387,20 @@ IpIoIcmpv4Handler (
   TrimBytes  = (UINT32) (PayLoadHdr - (UINT8 *) IcmpHdr);\r
 \r
   NetbufTrim (Pkt, TrimBytes, TRUE);\r
-  \r
+\r
   //\r
-  // If the input packet has invalid format, and TrimBytes is larger than \r
+  // If the input packet has invalid format, and TrimBytes is larger than\r
   // the packet size, the NetbufTrim might trim the packet to zero.\r
   //\r
   if (Pkt->TotalSize != 0) {\r
     IpIo->PktRcvdNotify (EFI_ICMP_ERROR, IcmpErr, Session, Pkt, IpIo->RcvdContext);\r
   }\r
 \r
-  return EFI_SUCCESS;  \r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
-  This function handles ICMPv6 packets. It is the worker function of \r
+  This function handles ICMPv6 packets. It is the worker function of\r
   IpIoIcmpHandler.\r
 \r
   @param[in]       IpIo            Pointer to the IP_IO instance.\r
@@ -447,7 +447,7 @@ IpIoIcmpv6Handler (
 \r
   //\r
   // Analyze the ICMPv6 Error in this ICMPv6 packet\r
-  // \r
+  //\r
   switch (Type) {\r
   case ICMP_V6_DEST_UNREACHABLE:\r
     switch (Code) {\r
@@ -506,7 +506,7 @@ IpIoIcmpv6Handler (
    default:\r
 \r
      return EFI_ABORTED;\r
-   } \r
+   }\r
 \r
   //\r
   // Notify user the ICMPv6 packet only containing payload except\r
@@ -517,7 +517,7 @@ IpIoIcmpv6Handler (
   NextHeader = IpHdr->NextHeader;\r
   PayLoadHdr = (UINT8 *) ((UINT8 *) IcmpHdr + sizeof (IP6_ICMP_ERROR_HEAD));\r
   Flag       = TRUE;\r
-  \r
+\r
   do {\r
     switch (NextHeader) {\r
     case EFI_IP_PROTO_UDP:\r
@@ -555,11 +555,11 @@ IpIoIcmpv6Handler (
   } while (Flag);\r
 \r
   TrimBytes = (UINT32) (PayLoadHdr - (UINT8 *) IcmpHdr);\r
-  \r
+\r
   NetbufTrim (Pkt, TrimBytes, TRUE);\r
 \r
   //\r
-  // If the input packet has invalid format, and TrimBytes is larger than \r
+  // If the input packet has invalid format, and TrimBytes is larger than\r
   // the packet size, the NetbufTrim might trim the packet to zero.\r
   //\r
   if (Pkt->TotalSize != 0) {\r
@@ -634,7 +634,7 @@ IpIoExtFree (
   @param[in]       Dest                 Pointer to the destination IP address.\r
   @param[in]       Override             Pointer to the overriden IP_IO data.\r
 \r
-  @return Pointer to the data structure created to wrap the packet. If any error occurs, \r
+  @return Pointer to the data structure created to wrap the packet. If any error occurs,\r
           then return NULL.\r
 \r
 **/\r
@@ -650,7 +650,7 @@ IpIoCreateSndEntry (
   )\r
 {\r
   IP_IO_SEND_ENTRY          *SndEntry;\r
-  EFI_EVENT                 Event;  \r
+  EFI_EVENT                 Event;\r
   EFI_STATUS                Status;\r
   NET_FRAGMENT              *ExtFragment;\r
   UINT32                    FragmentCount;\r
@@ -700,7 +700,7 @@ IpIoCreateSndEntry (
   }\r
 \r
   //\r
-  // Build a fragment table to contain the fragments in the packet. \r
+  // Build a fragment table to contain the fragments in the packet.\r
   //\r
   if (IpIo->IpVersion == IP_VERSION_4) {\r
     ExtFragment = (NET_FRAGMENT *) TxData->Ip4TxData.FragmentTable;\r
@@ -757,7 +757,7 @@ IpIoCreateSndEntry (
     Ip6TxData->FragmentCount = FragmentCount;\r
     Ip6TxData->ExtHdrsLength = 0;\r
     Ip6TxData->ExtHdrs       = NULL;\r
-    \r
+\r
     //\r
     // Set the fields of SndToken\r
     //\r
@@ -804,7 +804,7 @@ ON_ERROR:
 \r
 /**\r
   Destroy the SndEntry.\r
-  \r
+\r
   This function pairs with IpIoCreateSndEntry().\r
 \r
   @param[in]  SndEntry              Pointer to the send entry to be destroyed.\r
@@ -1120,19 +1120,19 @@ IpIoListenHandlerDpc (
     if (!NetIp6IsValidUnicast(&RxData->Ip6RxData.Header->SourceAddress)) {\r
       goto CleanUp;\r
     }\r
-    \r
+\r
     if (RxData->Ip6RxData.DataLength == 0) {\r
       //\r
       // Discard zero length data payload packet.\r
       //\r
       goto CleanUp;\r
     }\r
-    \r
+\r
     //\r
     // The fragment should always be valid for non-zero length packet.\r
     //\r
     ASSERT (RxData->Ip6RxData.FragmentCount != 0);\r
-    \r
+\r
     //\r
     // Create a netbuffer representing IPv6 packet\r
     //\r
@@ -1152,19 +1152,19 @@ IpIoListenHandlerDpc (
     // Create a net session\r
     //\r
     CopyMem (\r
-      &Session.Source, \r
+      &Session.Source,\r
       &RxData->Ip6RxData.Header->SourceAddress,\r
       sizeof(EFI_IPv6_ADDRESS)\r
       );\r
     CopyMem (\r
-      &Session.Dest, \r
-      &RxData->Ip6RxData.Header->DestinationAddress, \r
+      &Session.Dest,\r
+      &RxData->Ip6RxData.Header->DestinationAddress,\r
       sizeof(EFI_IPv6_ADDRESS)\r
       );\r
     Session.IpHdr.Ip6Hdr = RxData->Ip6RxData.Header;\r
     Session.IpHdrLen     = RxData->Ip6RxData.HeaderLength;\r
     Session.IpVersion    = IP_VERSION_6;\r
-  } \r
+  }\r
 \r
   if (EFI_SUCCESS == Status) {\r
 \r
@@ -1186,7 +1186,7 @@ CleanUp:
   if (IpIo->IpVersion == IP_VERSION_4){\r
     gBS->SignalEvent (RxData->Ip4RxData.RecycleSignal);\r
   } else {\r
-    gBS->SignalEvent (RxData->Ip6RxData.RecycleSignal); \r
+    gBS->SignalEvent (RxData->Ip6RxData.RecycleSignal);\r
   }\r
 \r
 Resume:\r
@@ -1223,7 +1223,7 @@ IpIoListenHandler (
   Create a new IP_IO instance.\r
 \r
   If IpVersion is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
-  \r
+\r
   This function uses IP4/IP6 service binding protocol in Controller to create\r
   an IP4/IP6 child (aka IP4/IP6 instance).\r
 \r
@@ -1232,7 +1232,7 @@ IpIoListenHandler (
   @param[in]  Controller        The controller handle that has IP4 or IP6 service\r
                                 binding protocol installed.\r
   @param[in]  IpVersion         The version of the IP protocol to use, either\r
-                                IPv4 or IPv6.                            \r
+                                IPv4 or IPv6.\r
 \r
   @return Pointer to a newly created IP_IO instance, or NULL if failed.\r
 \r
@@ -1287,7 +1287,7 @@ IpIoCreate (
              Controller,\r
              Image,\r
              &IpIo->ChildHandle,\r
-             IpVersion,             \r
+             IpVersion,\r
              (VOID **) & (IpIo->Ip)\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -1324,7 +1324,7 @@ ReleaseIpIo:
 \r
   @retval          EFI_SUCCESS            The IP_IO instance opened with OpenData\r
                                           successfully.\r
-  @retval          EFI_ACCESS_DENIED      The IP_IO instance is configured, avoid to \r
+  @retval          EFI_ACCESS_DENIED      The IP_IO instance is configured, avoid to\r
                                           reopen it.\r
   @retval          EFI_UNSUPPORTED        IPv4 RawData mode is no supported.\r
   @retval          EFI_INVALID_PARAMETER  Invalid input parameter.\r
@@ -1369,7 +1369,7 @@ IpIoOpen (
       IpIo->StationIp = EFI_NTOHL (OpenData->IpConfigData.Ip4CfgData.StationAddress);\r
       IpIo->SubnetMask = EFI_NTOHL (OpenData->IpConfigData.Ip4CfgData.SubnetMask);\r
     }\r
-    \r
+\r
     Status = IpIo->Ip.Ip4->Configure (\r
                              IpIo->Ip.Ip4,\r
                              &OpenData->IpConfigData.Ip4CfgData\r
@@ -1377,7 +1377,7 @@ IpIoOpen (
   } else {\r
 \r
     Status = IpIo->Ip.Ip6->Configure (\r
-                             IpIo->Ip.Ip6, \r
+                             IpIo->Ip.Ip6,\r
                              &OpenData->IpConfigData.Ip6CfgData\r
                              );\r
   }\r
@@ -1450,7 +1450,7 @@ IpIoOpen (
   Stop an IP_IO instance.\r
 \r
   If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
-  \r
+\r
   This function is paired with IpIoOpen(). The IP_IO will be unconfigured and all\r
   the pending send/receive tokens will be canceled.\r
 \r
@@ -1532,7 +1532,7 @@ IpIoStop (
 \r
 /**\r
   Destroy an IP_IO instance.\r
-  \r
+\r
   This function is paired with IpIoCreate(). The IP_IO will be closed first.\r
   Resource will be freed afterwards. See IpIoCloseProtocolDestroyIpChild().\r
 \r
@@ -1550,7 +1550,7 @@ IpIoDestroy (
   )\r
 {\r
   EFI_STATUS    Status;\r
-  \r
+\r
   //\r
   // Stop the IpIo.\r
   //\r
@@ -1580,7 +1580,7 @@ IpIoDestroy (
 \r
 /**\r
   Send out an IP packet.\r
-  \r
+\r
   This function is called after IpIoOpen(). The data to be sent is wrapped in\r
   Pkt. The IP instance wrapped in IpIo is used for sending by default but can be\r
   overriden by Sender. Other sending configs, like source address and gateway\r
@@ -1720,7 +1720,7 @@ IpIoCancelTxToken (
 \r
   If IpIo is NULL, then ASSERT().\r
   If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
-  \r
+\r
   The function is used to add the IP_IO to the IP_IO sending list. The caller\r
   can later use IpIoFindSender() to get the IP_IO and call IpIoSend() to send\r
   data.\r
@@ -1883,9 +1883,9 @@ IpIoConfigIp (
 \r
       if (((EFI_IP4_CONFIG_DATA *) IpConfigData)->UseDefaultAddress) {\r
         Status = Ip.Ip4->GetModeData (\r
-                           Ip.Ip4, \r
-                           &Ip4ModeData, \r
-                           NULL, \r
+                           Ip.Ip4,\r
+                           &Ip4ModeData,\r
+                           NULL,\r
                            NULL\r
                            );\r
         if (EFI_ERROR (Status)) {\r
@@ -1898,12 +1898,12 @@ IpIoConfigIp (
       }\r
 \r
       CopyMem (\r
-        &IpInfo->Addr.Addr, \r
-        &((EFI_IP4_CONFIG_DATA *) IpConfigData)->StationAddress, \r
+        &IpInfo->Addr.Addr,\r
+        &((EFI_IP4_CONFIG_DATA *) IpConfigData)->StationAddress,\r
         sizeof (IP4_ADDR)\r
         );\r
       CopyMem (\r
-        &IpInfo->PreMask.SubnetMask, \r
+        &IpInfo->PreMask.SubnetMask,\r
         &((EFI_IP4_CONFIG_DATA *) IpConfigData)->SubnetMask,\r
         sizeof (IP4_ADDR)\r
         );\r
@@ -1961,11 +1961,11 @@ IpIoConfigIp (
       } else {\r
         Status = EFI_NO_MAPPING;\r
         return Status;\r
-      } \r
+      }\r
 \r
       CopyMem (\r
-        &IpInfo->Addr, \r
-        &Ip6ModeData.ConfigData.StationAddress, \r
+        &IpInfo->Addr,\r
+        &Ip6ModeData.ConfigData.StationAddress,\r
         sizeof (EFI_IPv6_ADDRESS)\r
         );\r
 \r
@@ -1976,7 +1976,7 @@ IpIoConfigIp (
       if (EFI_ERROR (Status)) {\r
         Ip.Ip6->Configure (Ip.Ip6, NULL);\r
       }\r
-    }  \r
+    }\r
   } else {\r
     //\r
     // The IP instance is reset, set the stored Addr and SubnetMask to zero.\r
@@ -1994,7 +1994,7 @@ IpIoConfigIp (
   sending purpose.\r
 \r
   If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
-  \r
+\r
   This function pairs with IpIoAddIp(). The IpInfo is previously created by\r
   IpIoAddIp(). The IP_IO_IP_INFO::RefCnt is decremented and the IP instance\r
   will be dstroyed if the RefCnt is zero.\r
@@ -2012,7 +2012,7 @@ IpIoRemoveIp (
 {\r
 \r
   UINT8               IpVersion;\r
-  \r
+\r
   if (IpIo == NULL || IpInfo == NULL) {\r
     return;\r
   }\r
@@ -2070,7 +2070,7 @@ IpIoRemoveIp (
 /**\r
   Find the first IP protocol maintained in IpIo whose local\r
   address is the same as Src.\r
-  \r
+\r
   This function is called when the caller needs the IpIo to send data to the\r
   specified Src. The IpIo was added previously by IpIoAddIp().\r
 \r
@@ -2124,7 +2124,7 @@ IpIoFindSender (
 \r
         if (EFI_IP6_EQUAL (&IpInfo->Addr.v6, &Src->v6)) {\r
           *IpIo = IpIoPtr;\r
-          return IpInfo;       \r
+          return IpInfo;\r
         }\r
       }\r
     }\r
@@ -2139,13 +2139,13 @@ IpIoFindSender (
 \r
 /**\r
   Get the ICMP error map information.\r
-  \r
+\r
   The ErrorStatus will be returned. The IsHard and Notify are optional. If they\r
   are not NULL, this routine will fill them.\r
 \r
   @param[in]   IcmpError             IcmpError Type.\r
   @param[in]   IpVersion             The version of the IP protocol to use,\r
-                                     either IPv4 or IPv6. \r
+                                     either IPv4 or IPv6.\r
   @param[out]  IsHard                If TRUE, indicates that it is a hard error.\r
   @param[out]  Notify                If TRUE, SockError needs to be notified.\r
 \r
@@ -2217,12 +2217,12 @@ IpIoGetIcmpErrStatus (
 \r
     case ICMP6_ERR_UNREACH_HOST:\r
     case ICMP6_ERR_TIMXCEED_HOPLIMIT:\r
-    case ICMP6_ERR_TIMXCEED_REASS:       \r
+    case ICMP6_ERR_TIMXCEED_REASS:\r
       return EFI_HOST_UNREACHABLE;\r
 \r
     case ICMP6_ERR_UNREACH_PROTOCOL:\r
       return EFI_PROTOCOL_UNREACHABLE;\r
-      \r
+\r
     case ICMP6_ERR_UNREACH_PORT:\r
       return EFI_PORT_UNREACHABLE;\r
 \r
@@ -2251,23 +2251,23 @@ IpIoGetIcmpErrStatus (
   Refresh the remote peer's Neighbor Cache entries.\r
 \r
   This function is called when the caller needs the IpIo to refresh the existing\r
-  IPv6 neighbor cache entries since the neighbor is considered reachable by the \r
-  node has recently received a confirmation that packets sent recently to the \r
-  neighbor were received by its IP layer. \r
+  IPv6 neighbor cache entries since the neighbor is considered reachable by the\r
+  node has recently received a confirmation that packets sent recently to the\r
+  neighbor were received by its IP layer.\r
 \r
   @param[in]   IpIo                  Pointer to an IP_IO instance\r
   @param[in]   Neighbor              The IP address of the neighbor\r
   @param[in]   Timeout               Time in 100-ns units that this entry will\r
-                                     remain in the neighbor cache. A value of \r
-                                     zero means that the entry is permanent. \r
-                                     A value of non-zero means that the entry is \r
+                                     remain in the neighbor cache. A value of\r
+                                     zero means that the entry is permanent.\r
+                                     A value of non-zero means that the entry is\r
                                      dynamic and will be deleted after Timeout.\r
 \r
   @retval      EFI_SUCCESS           The operation is completed successfully.\r
   @retval      EFI_NOT_STARTED       The IpIo is not configured.\r
   @retval      EFI_INVALID_PARAMETER Neighbor Address is invalid.\r
-  @retval      EFI_NOT_FOUND         The neighbor cache entry is not in the \r
-                                     neighbor table.  \r
+  @retval      EFI_NOT_FOUND         The neighbor cache entry is not in the\r
+                                     neighbor table.\r
   @retval      EFI_UNSUPPORTED       IP version is IPv4, which doesn't support neighbor cache refresh.\r
   @retval      EFI_OUT_OF_RESOURCES  Failed due to resource limit.\r
 \r
@@ -2277,7 +2277,7 @@ EFIAPI
 IpIoRefreshNeighbor (\r
   IN IP_IO           *IpIo,\r
   IN EFI_IP_ADDRESS  *Neighbor,\r
-  IN UINT32          Timeout  \r
+  IN UINT32          Timeout\r
   )\r
 {\r
   EFI_IP6_PROTOCOL  *Ip;\r