]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Sockets/DataSource/DataSource.c
AppPkg/Applications/Sockets/TftpServer: Make the include file names match the case...
[mirror_edk2.git] / AppPkg / Applications / Sockets / DataSource / DataSource.c
index 44605c86e24875b2cc2eedbb1014c6d3c587a9dc..0dcd882edf7e70ef9848934a371e0861cfba5617 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Data source for network testing.\r
 \r
-  Copyright (c) 2011, Intel Corporation\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
@@ -386,7 +386,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 +406,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 +441,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 +461,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 +479,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 +573,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 +639,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 +663,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 +725,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 +927,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 +1234,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 +1293,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
@@ -1318,6 +1323,7 @@ Tcp4Open (
   @param [in] pContext  Context for this routine\r
 **/\r
 VOID\r
+EFIAPI\r
 TimerCallback (\r
   IN EFI_EVENT Event,\r
   IN VOID * pContext\r