]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Sockets/DataSource/DataSource.c
AppPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / AppPkg / Applications / Sockets / DataSource / DataSource.c
index cf4caa2b45f47e1fabdbcfaa4321a99746806789..360689e15653b5a8d4276bea9071c81421d2acc8 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   Data source for network testing.\r
 \r
-  Copyright (c) 2011-2012, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2011-2012, Intel Corporation. All rights reserved.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -386,7 +380,7 @@ SocketConnect (
             ( pRemoteAddress4->sin_addr.s_addr >> 8 ) & 0xff,\r
             ( pRemoteAddress4->sin_addr.s_addr >> 16 ) & 0xff,\r
             ( pRemoteAddress4->sin_addr.s_addr >> 24 ) & 0xff,\r
-            htons ( pRemoteAddress4->sin_port ));\r
+            ntohs ( pRemoteAddress4->sin_port ));\r
   }\r
   else {\r
     Print ( L"Connecting to remote system [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",\r
@@ -406,7 +400,7 @@ SocketConnect (
             pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],\r
             pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],\r
             pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],\r
-            htons ( pRemoteAddress6->sin6_port ));\r
+            ntohs ( pRemoteAddress6->sin6_port ));\r
   }\r
 \r
   //\r
@@ -441,7 +435,7 @@ SocketConnect (
                 ( pRemoteAddress4->sin_addr.s_addr >> 8 ) & 0xff,\r
                 ( pRemoteAddress4->sin_addr.s_addr >> 16 ) & 0xff,\r
                 ( pRemoteAddress4->sin_addr.s_addr >> 24 ) & 0xff,\r
-                htons ( pRemoteAddress4->sin_port ));\r
+                ntohs ( pRemoteAddress4->sin_port ));\r
       }\r
       else {\r
         Print ( L"Connected to remote system [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",\r
@@ -461,8 +455,9 @@ SocketConnect (
                 pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],\r
                 pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],\r
                 pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],\r
-                htons ( pRemoteAddress6->sin6_port ));\r
+                ntohs ( pRemoteAddress6->sin6_port ));\r
       }\r
+Print ( L"ConnectStatus: %d, Status: %r\r\n", ConnectStatus, Status );\r
     }\r
     else {\r
       //\r
@@ -478,6 +473,7 @@ SocketConnect (
   //\r
   //  Return the operation status\r
   //\r
+Print ( L"SocketConnect returning Status: %r\r\n", Status );\r
   return Status;\r
 }\r
 \r
@@ -571,6 +567,7 @@ SocketSend (
       DEBUG (( DEBUG_INFO,\r
                 "ERROR: send failed, errno: %d\r\n",\r
                 errno ));\r
+Print ( L"ERROR: send failed, errno: %d\r\n", errno );\r
 \r
       //\r
       //  Try again\r
@@ -636,6 +633,7 @@ SocketOpen (
     //  Wait for the remote network application to start\r
     //\r
     Status = SocketConnect ( );\r
+Print ( L"Status: %r\r\n", Status );\r
     if ( EFI_NOT_STARTED == Status ) {\r
       Status = SocketClose ( );\r
       continue;\r
@@ -659,6 +657,7 @@ SocketOpen (
   //\r
   //  Return the operation status\r
   //\r
+Print ( L"Returning Status: %r\r\n", Status );\r
   return Status;\r
 }\r
 \r
@@ -720,7 +719,7 @@ Tcp4Close (
                   pIpAddress[1],\r
                   pIpAddress[2],\r
                   pIpAddress[3],\r
-                  htons ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));\r
+                  ntohs ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));\r
         }\r
       }\r
     }\r
@@ -922,7 +921,7 @@ Tcp4Locate (
               pIpAddress[1],\r
               pIpAddress[2],\r
               pIpAddress[3],\r
-              htons ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));\r
+              ntohs ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));\r
       bTcp4Connecting = FALSE;\r
     }\r
 \r
@@ -1229,7 +1228,7 @@ Tcp4Open (
     Tcp4ConfigData.AccessPoint.RemoteAddress.Addr[1] = (UINT8)( ((struct sockaddr_in *)&RemoteHostAddress)->sin_addr.s_addr >> 8 );\r
     Tcp4ConfigData.AccessPoint.RemoteAddress.Addr[2] = (UINT8)( ((struct sockaddr_in *)&RemoteHostAddress)->sin_addr.s_addr >> 16 );\r
     Tcp4ConfigData.AccessPoint.RemoteAddress.Addr[3] = (UINT8)( ((struct sockaddr_in *)&RemoteHostAddress)->sin_addr.s_addr >> 24 );\r
-    Tcp4ConfigData.AccessPoint.RemotePort = ((struct sockaddr_in *)&RemoteHostAddress)->sin_port;\r
+    Tcp4ConfigData.AccessPoint.RemotePort = ntohs (((struct sockaddr_in *)&RemoteHostAddress)->sin_port);\r
     Tcp4ConfigData.AccessPoint.UseDefaultAddress = TRUE;\r
     Tcp4ConfigData.AccessPoint.SubnetMask.Addr[0] = 0;\r
     Tcp4ConfigData.AccessPoint.SubnetMask.Addr[1] = 0;\r
@@ -1288,7 +1287,7 @@ Tcp4Open (
             pIpAddress[1],\r
             pIpAddress[2],\r
             pIpAddress[3],\r
-            htons ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));\r
+            ntohs ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));\r
   } while ( 0 );\r
 \r
   if ( EFI_ERROR ( Status )) {\r