struct sockaddr_in LocalAddress;\r
EFI_EVENT pTimer;\r
int ListenSocket;\r
-UINT8 Buffer [ DATA_BUFFER_SIZE ];\r
-struct pollfd PollFd [ MAX_CONNECTIONS ];\r
-DT_PORT Port [ MAX_CONNECTIONS ];\r
+UINT8 Buffer[ DATA_BUFFER_SIZE ];\r
+struct pollfd PollFd[ MAX_CONNECTIONS ];\r
+DT_PORT Port[ MAX_CONNECTIONS ];\r
nfds_t MaxPort;\r
\r
\r
// Allocate a port\r
//\r
Index = MaxPort++;\r
- PollFd [ Index ].fd = ListenSocket;\r
- PollFd [ Index ].events = POLLRDNORM | POLLHUP;\r
- PollFd [ Index ].revents = 0;\r
- Port [ Index ].BytesAverage = 0;\r
- Port [ Index ].BytesPrevious = 0;\r
- Port [ Index ].BytesTotal = 0;\r
- Port [ Index ].Samples = 0;\r
- Port [ Index ].RemoteAddress.sin_len = 0;\r
- Port [ Index ].RemoteAddress.sin_family = 0;\r
- Port [ Index ].RemoteAddress.sin_port = 0;\r
- Port [ Index ].RemoteAddress.sin_addr.s_addr= 0;\r
+ PollFd[ Index ].fd = ListenSocket;\r
+ PollFd[ Index ].events = POLLRDNORM | POLLHUP;\r
+ PollFd[ Index ].revents = 0;\r
+ Port[ Index ].BytesAverage = 0;\r
+ Port[ Index ].BytesPrevious = 0;\r
+ Port[ Index ].BytesTotal = 0;\r
+ Port[ Index ].Samples = 0;\r
+ Port[ Index ].RemoteAddress.sin_len = 0;\r
+ Port[ Index ].RemoteAddress.sin_family = 0;\r
+ Port[ Index ].RemoteAddress.sin_port = 0;\r
+ Port[ Index ].RemoteAddress.sin_addr.s_addr= 0;\r
}\r
}\r
\r
"0x%08x: Socket created\r\n",\r
ListenSocket ));\r
}\r
- else\r
- {\r
+ else {\r
Status = EFI_NOT_STARTED;\r
}\r
}\r
//\r
// Account for this descriptor\r
//\r
- if ( 0 != PollFd [ Index ].revents ) {\r
+ if ( 0 != PollFd[ Index ].revents ) {\r
FdCount -= 1;\r
}\r
\r
//\r
// Check for a broken connection\r
//\r
- if ( 0 != ( PollFd [ Index ].revents & POLLHUP )) {\r
+ if ( 0 != ( PollFd[ Index ].revents & POLLHUP )) {\r
bRemoveSocket = TRUE;\r
- if ( ListenSocket == PollFd [ Index ].fd ) {\r
+ if ( ListenSocket == PollFd[ Index ].fd ) {\r
bListenError = TRUE;\r
DEBUG (( DEBUG_ERROR,\r
"ERROR - Network closed on listen socket, errno: %d\r\n",\r
else {\r
DEBUG (( DEBUG_ERROR,\r
"ERROR - Network closed on socket %d.%d.%d.%d:%d, errno: %d\r\n",\r
- Port [ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
- htons ( Port [ Index ].RemoteAddress.sin_port ),\r
+ Port[ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
+ htons ( Port[ Index ].RemoteAddress.sin_port ),\r
errno ));\r
\r
//\r
// Close the socket\r
//\r
- CloseStatus = close ( PollFd [ Index ].fd );\r
+ CloseStatus = close ( PollFd[ Index ].fd );\r
if ( 0 == CloseStatus ) {\r
bRemoveSocket = TRUE;\r
DEBUG (( DEBUG_INFO,\r
"0x%08x: Socket closed for %d.%d.%d.%d:%d\r\n",\r
- PollFd [ Index ].fd,\r
- Port [ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
- htons ( Port [ Index ].RemoteAddress.sin_port )));\r
+ PollFd[ Index ].fd,\r
+ Port[ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
+ htons ( Port[ Index ].RemoteAddress.sin_port )));\r
}\r
else {\r
DEBUG (( DEBUG_ERROR,\r
"ERROR - Failed to close socket 0x%08x for %d.%d.%d.%d:%d, errno: %d\r\n",\r
- PollFd [ Index ].fd,\r
- Port [ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
- htons ( Port [ Index ].RemoteAddress.sin_port ),\r
+ PollFd[ Index ].fd,\r
+ Port[ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
+ htons ( Port[ Index ].RemoteAddress.sin_port ),\r
errno ));\r
}\r
}\r
//\r
// Check for a connection or read data\r
//\r
- if ( 0 != ( PollFd [ Index ].revents & POLLRDNORM )) {\r
+ if ( 0 != ( PollFd[ Index ].revents & POLLRDNORM )) {\r
//\r
// Check for a connection\r
//\r
- if ( ListenSocket == PollFd [ Index ].fd ) {\r
+ if ( ListenSocket == PollFd[ Index ].fd ) {\r
//\r
// Another client connection was received\r
//\r
bRemoveSocket = TRUE;\r
DEBUG (( DEBUG_INFO,\r
"0x%08x: Socket closed for %d.%d.%d.%d:%d\r\n",\r
- PollFd [ Index ].fd,\r
+ PollFd[ Index ].fd,\r
RemoteAddress.sin_addr.s_addr & 0xff,\r
( RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
( RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
else {\r
DEBUG (( DEBUG_ERROR,\r
"ERROR - Failed to close socket 0x%08x, errno: %d\r\n",\r
- PollFd [ Index ].fd,\r
+ PollFd[ Index ].fd,\r
errno ));\r
}\r
\r
//\r
Status = EFI_SUCCESS;\r
}\r
- else\r
- {\r
+ else {\r
//\r
// Display the connection\r
//\r
// Allocate the client connection\r
//\r
Index = MaxPort++;\r
- Port [ Index ].BytesAverage = 0;\r
- Port [ Index ].BytesPrevious = 0;\r
- Port [ Index ].BytesTotal = 0;\r
- Port [ Index ].Samples = 0;\r
- Port [ Index ].RemoteAddress.sin_len = RemoteAddress.sin_len;\r
- Port [ Index ].RemoteAddress.sin_family = RemoteAddress.sin_family;\r
- Port [ Index ].RemoteAddress.sin_port = RemoteAddress.sin_port;\r
- Port [ Index ].RemoteAddress.sin_addr = RemoteAddress.sin_addr;\r
- PollFd [ Index ].fd = Socket;\r
- PollFd [ Index ].events = POLLRDNORM | POLLHUP;\r
- PollFd [ Index ].revents = 0;\r
+ Port[ Index ].BytesAverage = 0;\r
+ Port[ Index ].BytesPrevious = 0;\r
+ Port[ Index ].BytesTotal = 0;\r
+ Port[ Index ].Samples = 0;\r
+ Port[ Index ].RemoteAddress.sin_len = RemoteAddress.sin_len;\r
+ Port[ Index ].RemoteAddress.sin_family = RemoteAddress.sin_family;\r
+ Port[ Index ].RemoteAddress.sin_port = RemoteAddress.sin_port;\r
+ Port[ Index ].RemoteAddress.sin_addr = RemoteAddress.sin_addr;\r
+ PollFd[ Index ].fd = Socket;\r
+ PollFd[ Index ].events = POLLRDNORM | POLLHUP;\r
+ PollFd[ Index ].revents = 0;\r
}\r
}\r
}\r
//\r
// Data received\r
//\r
- BytesReceived = read ( PollFd [ Index ].fd,\r
+ BytesReceived = read ( PollFd[ Index ].fd,\r
&Buffer,\r
sizeof ( Buffer ));\r
if ( 0 < BytesReceived ) {\r
//\r
DEBUG (( DEBUG_INFO,\r
"0x%08x: Socket received 0x%08x bytes from %d.%d.%d.%d:%d\r\n",\r
- PollFd [ Index ].fd,\r
+ PollFd[ Index ].fd,\r
BytesReceived,\r
- Port [ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
- htons ( Port [ Index ].RemoteAddress.sin_port )));\r
+ Port[ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
+ htons ( Port[ Index ].RemoteAddress.sin_port )));\r
\r
//\r
// Synchronize with the TimerCallback routine\r
//\r
// Account for the data received\r
//\r
- Port [ Index ].BytesTotal += BytesReceived;\r
+ Port[ Index ].BytesTotal += BytesReceived;\r
\r
//\r
// Release the synchronization with the TimerCallback routine\r
//\r
DEBUG (( DEBUG_INFO,\r
"ERROR - Receive failure for %d.%d.%d.%d:%d, errno: %d\r\n",\r
- Port [ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
- htons ( Port [ Index ].RemoteAddress.sin_port ),\r
+ Port[ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
+ htons ( Port[ Index ].RemoteAddress.sin_port ),\r
errno ));\r
- CloseStatus = close ( PollFd [ Index ].fd );\r
+ CloseStatus = close ( PollFd[ Index ].fd );\r
if ( 0 == CloseStatus ) {\r
bRemoveSocket = TRUE;\r
DEBUG (( DEBUG_INFO,\r
"0x%08x: Socket closed for %d.%d.%d.%d:%d\r\n",\r
- PollFd [ Index ].fd,\r
- Port [ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
- htons ( Port [ Index ].RemoteAddress.sin_port )));\r
+ PollFd[ Index ].fd,\r
+ Port[ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
+ htons ( Port[ Index ].RemoteAddress.sin_port )));\r
}\r
else {\r
DEBUG (( DEBUG_ERROR,\r
"ERROR - Failed to close socket 0x%08x for %d.%d.%d.%d:%d, errno: %d\r\n",\r
- PollFd [ Index ].fd,\r
- Port [ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
- ( Port [ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
- htons ( Port [ Index ].RemoteAddress.sin_port ),\r
+ PollFd[ Index ].fd,\r
+ Port[ Index ].RemoteAddress.sin_addr.s_addr & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 8 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 16 ) & 0xff,\r
+ ( Port[ Index ].RemoteAddress.sin_addr.s_addr >> 24 ) & 0xff,\r
+ htons ( Port[ Index ].RemoteAddress.sin_port ),\r
errno ));\r
}\r
}\r
if ( bRemoveSocket ) {\r
DEBUG (( DEBUG_INFO,\r
"0x%08x: Socket removed from polling\r\n",\r
- PollFd [ Index ].fd ));\r
+ PollFd[ Index ].fd ));\r
MaxPort -= 1;\r
for ( Entry = Index + 1; MaxPort >= Entry; Entry++ ) {\r
EntryPrevious = Entry;\r
- Port [ EntryPrevious ].BytesAverage = Port [ Entry ].BytesAverage;\r
- Port [ EntryPrevious ].BytesPrevious = Port [ Entry ].BytesPrevious;\r
- Port [ EntryPrevious ].BytesTotal = Port [ Entry ].BytesTotal;\r
- Port [ EntryPrevious ].RemoteAddress.sin_len = Port [ Entry ].RemoteAddress.sin_len;\r
- Port [ EntryPrevious ].RemoteAddress.sin_family = Port [ Entry ].RemoteAddress.sin_family;\r
- Port [ EntryPrevious ].RemoteAddress.sin_port = Port [ Entry ].RemoteAddress.sin_port;\r
- Port [ EntryPrevious ].RemoteAddress.sin_addr.s_addr = Port [ Entry ].RemoteAddress.sin_addr.s_addr;\r
- Port [ EntryPrevious ].Samples = Port [ Entry ].Samples;\r
- PollFd [ EntryPrevious ].events = PollFd [ Entry ].events;\r
- PollFd [ EntryPrevious ].fd = PollFd [ Entry ].fd;\r
- PollFd [ EntryPrevious ].revents = PollFd [ Entry ].revents;\r
+ Port[ EntryPrevious ].BytesAverage = Port[ Entry ].BytesAverage;\r
+ Port[ EntryPrevious ].BytesPrevious = Port[ Entry ].BytesPrevious;\r
+ Port[ EntryPrevious ].BytesTotal = Port[ Entry ].BytesTotal;\r
+ Port[ EntryPrevious ].RemoteAddress.sin_len = Port[ Entry ].RemoteAddress.sin_len;\r
+ Port[ EntryPrevious ].RemoteAddress.sin_family = Port[ Entry ].RemoteAddress.sin_family;\r
+ Port[ EntryPrevious ].RemoteAddress.sin_port = Port[ Entry ].RemoteAddress.sin_port;\r
+ Port[ EntryPrevious ].RemoteAddress.sin_addr.s_addr = Port[ Entry ].RemoteAddress.sin_addr.s_addr;\r
+ Port[ EntryPrevious ].Samples = Port[ Entry ].Samples;\r
+ PollFd[ EntryPrevious ].events = PollFd[ Entry ].events;\r
+ PollFd[ EntryPrevious ].fd = PollFd[ Entry ].fd;\r
+ PollFd[ EntryPrevious ].revents = PollFd[ Entry ].revents;\r
}\r
- PollFd [ MaxPort ].fd = -1;\r
+ PollFd[ MaxPort ].fd = -1;\r
Index -= 1;\r
}\r
\r
//\r
// Determine if any data was received\r
//\r
- BytesReceived = Port [ Index ].BytesTotal;\r
- if (( ListenSocket != PollFd [ Index ].fd )\r
+ BytesReceived = Port[ Index ].BytesTotal;\r
+ if (( ListenSocket != PollFd[ Index ].fd )\r
&& ( 0 != BytesReceived )) {\r
//\r
// Update the average bytes per second\r
//\r
- DeltaBytes = Port [ Index ].BytesAverage >> AVERAGE_SHIFT_COUNT;\r
- Port [ Index ].BytesAverage -= DeltaBytes;\r
- DeltaBytes = BytesReceived - Port [ Index ].BytesPrevious;\r
- Port [ Index ].BytesPrevious = BytesReceived;\r
- Port [ Index ].BytesAverage += DeltaBytes;\r
+ DeltaBytes = Port[ Index ].BytesAverage >> AVERAGE_SHIFT_COUNT;\r
+ Port[ Index ].BytesAverage -= DeltaBytes;\r
+ DeltaBytes = BytesReceived - Port[ Index ].BytesPrevious;\r
+ Port[ Index ].BytesPrevious = BytesReceived;\r
+ Port[ Index ].BytesAverage += DeltaBytes;\r
\r
//\r
// Separate the samples\r
//\r
- if (( 2 << AVERAGE_SHIFT_COUNT ) == Port [ Index ].Samples ) {\r
+ if (( 2 << AVERAGE_SHIFT_COUNT ) == Port[ Index ].Samples ) {\r
Print ( L"---------- Stable average ----------\r\n" );\r
}\r
- Port [ Index ].Samples += 1;\r
+ Port[ Index ].Samples += 1;\r
\r
//\r
// Display the data rate\r
//\r
Delta = (UINT32)( DeltaBytes >> DATA_RATE_UPDATE_SHIFT );\r
- Average = Port [ Index ].BytesAverage >> ( AVERAGE_SHIFT_COUNT + DATA_RATE_UPDATE_SHIFT );\r
+ Average = Port[ Index ].BytesAverage >> ( AVERAGE_SHIFT_COUNT + DATA_RATE_UPDATE_SHIFT );\r
if ( Average < RANGE_SWITCH ) {\r
Print ( L"%d Bytes/sec, Ave: %d Bytes/Sec\r\n",\r
Delta,\r
//\r
// Use for/break instead of goto\r
//\r
- for ( ; ; )\r
- {\r
+ for ( ; ; ) {\r
//\r
// Create the timer\r
//\r
UINT64 PreviousBytes;\r
UINT64 AverageBytes;\r
UINT64 Samples;\r
-UINT8 Buffer [ DATA_BUFFER_SIZE ];\r
+UINT8 Buffer[ DATA_BUFFER_SIZE ];\r
\r
\r
//\r
// Walk the digits\r
//\r
Value = 0;\r
- while (( '0' <= *pDigit ) && ( '9' >= *pDigit ))\r
- {\r
+ while (( '0' <= *pDigit ) && ( '9' >= *pDigit )) {\r
//\r
// Make room for the new least significant digit\r
//\r
//\r
// Check for user stop request\r
//\r
- while ( ! bTick ) {\r
+ while ( !bTick ) {\r
Status = ControlCCheck ( );\r
if ( EFI_ERROR ( Status )) {\r
break;\r
//\r
// Use do/while and break instead of goto\r
//\r
- do\r
- {\r
+ do {\r
//\r
// Wait for the network layer to initialize\r
//\r
//\r
// Open the network controller's service protocol\r
//\r
- Tcp4Controller = pHandles [ Tcp4Index++ ];\r
+ Tcp4Controller = pHandles[ Tcp4Index++ ];\r
Status = gBS->OpenProtocol (\r
Tcp4Controller,\r
&gEfiTcp4ServiceBindingProtocolGuid,\r
//\r
// Validate the command line\r
//\r
- if ( 2 != Argc ) {\r
- Print ( L"%s <remote IP address>\r\n", Argv[0] );\r
+ if ( 2 > Argc ) {\r
+ Print ( L"%s <remote IP address> [Use TCP]\r\n", Argv[0] );\r
return -1;\r
}\r
\r
-bTcp4 = TRUE;\r
+ //\r
+ // Determine if TCP should be used\r
+ //\r
+ bTcp4 = (BOOLEAN)( 2 < Argc );\r
\r
//\r
// Determine the support routines\r
//\r
// Use for/break instead of goto\r
//\r
- for ( ; ; )\r
- {\r
+ for ( ; ; ) {\r
//\r
// No bytes sent so far\r
//\r
RemoteHostAddress.sin_family = AF_INET;\r
RemoteHostAddress.sin_port = htons ( PcdGet16 ( DataSource_Port ));\r
\r
-Print ( L"Argc: %d\r\n", Argc);\r
-Print ( L"Argv[0]: %a\r\n", Argv[0]);\r
-Print ( L"Argv[1]: %a\r\n", Argv[1]);\r
-\r
//\r
// Get the IP address\r
//\r
- pRemoteHost = Argv [1];\r
+ pRemoteHost = Argv[1];\r
Status = IpAddress ( );\r
if ( EFI_ERROR ( Status )) {\r
break;\r
&RemoteAddress[1],\r
&RemoteAddress[2],\r
&RemoteAddress[3]))\r
- || ( 255 < RemoteAddress [0])\r
- || ( 255 < RemoteAddress [1])\r
- || ( 255 < RemoteAddress [2])\r
- || ( 255 < RemoteAddress [3])) {\r
+ || ( 255 < RemoteAddress[0])\r
+ || ( 255 < RemoteAddress[1])\r
+ || ( 255 < RemoteAddress[2])\r
+ || ( 255 < RemoteAddress[3])) {\r
Print ( L"%a <IPv4 Address>\r\n", Argv[0]);\r
}\r
else {\r
Print ( L"ERROR - host not found, errno: %d\r\n", errno );\r
}\r
else {\r
- pIpAddress = (UINT8 *)pHost->h_addr_list [ 0 ];\r
+ pIpAddress = (UINT8 *)pHost->h_addr_list[ 0 ];\r
Print ( L"%d.%d.%d.%d, %a\r\n",\r
pIpAddress[0],\r
pIpAddress[1],\r
\r
#include <sys/socket.h>\r
\r
-struct hostent * _gethostbydnsname(const char *, int);\r
+struct hostent * _gethostbydnsname (const char *, int);\r
\r
-char mBuffer [65536];\r
+char mBuffer[65536];\r
\r
\r
/**\r
\r
#include <sys/socket.h>\r
\r
-char mBuffer [65536];\r
+char mBuffer[65536];\r
\r
\r
/**\r
&RemoteAddress[1],\r
&RemoteAddress[2],\r
&RemoteAddress[3]))\r
- || ( 255 < RemoteAddress [0])\r
- || ( 255 < RemoteAddress [1])\r
- || ( 255 < RemoteAddress [2])\r
- || ( 255 < RemoteAddress [3])) {\r
+ || ( 255 < RemoteAddress[0])\r
+ || ( 255 < RemoteAddress[1])\r
+ || ( 255 < RemoteAddress[2])\r
+ || ( 255 < RemoteAddress[3])) {\r
Print ( L"%a <IPv4 Address>\r\n", Argv[0]);\r
}\r
else {\r
\r
#include <sys/socket.h>\r
\r
-char mBuffer [65536];\r
+char mBuffer[65536];\r
\r
\r
/**\r
\r
#include <sys/socket.h>\r
\r
-char mBuffer [65536];\r
+char mBuffer[65536];\r
\r
\r
/**\r
\r
#include <sys/socket.h>\r
\r
-char mBuffer [65536];\r
+char mBuffer[65536];\r
\r
\r
/**\r
--- /dev/null
+/** @file\r
+ Out-of-band receive test application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include <OobRx.h>\r
+\r
+\r
+/**\r
+ Receive out-of-band messages from the remote system.\r
+\r
+ @param [in] Argc The number of arguments\r
+ @param [in] Argv The argument value array\r
+\r
+ @retval 0 The application exited normally.\r
+ @retval Other An error occurred.\r
+**/\r
+int\r
+main (\r
+ IN int Argc,\r
+ IN char **Argv\r
+ )\r
+{\r
+ int RetVal;\r
+\r
+ //\r
+ // Run the application\r
+ //\r
+ RetVal = OobRx ( Argc, Argv );\r
+\r
+ //\r
+ // Return the operation status\r
+ //\r
+ return RetVal;\r
+}\r
--- /dev/null
+/** @file\r
+ Windows version of the OOB Receive application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include <OobRx.h>\r
+\r
+UINT8 mBuffer[65536];\r
+\r
+\r
+/**\r
+ Run the OOB receive application\r
+\r
+ @param [in] ArgC Argument count\r
+ @param [in] ArgV Argument value array\r
+\r
+ @retval 0 Successfully operation\r
+ **/\r
+int\r
+OobRx (\r
+ IN int ArgC,\r
+ IN char **ArgV\r
+ )\r
+{\r
+ SOCKET a;\r
+ ssize_t BytesReceived;\r
+ struct sockaddr_in LocalPort;\r
+ UINT32 OobInLine;\r
+ UINT16 PortNumber;\r
+ struct timeval ReceiveTimeout;\r
+ struct sockaddr_in RemotePort;\r
+ socklen_t RemotePortLength;\r
+ int RetVal;\r
+ SOCKET s;\r
+ UINT32 TransmittedBefore;\r
+ UINT32 TransmittedDuring;\r
+ UINT32 TransmittedOob;\r
+ UINT32 TransmittedAfter;\r
+ UINT32 * pTransmittedBytes;\r
+\r
+ //\r
+ // Create the socket\r
+ //\r
+ s = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP );\r
+ if ( -1 == s ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - socket error, errno: %d\r\n", RetVal );\r
+ }\r
+ else {\r
+ //\r
+ // Use for/break; instead of goto\r
+ //\r
+ for ( ; ; ) {\r
+ //\r
+ // Bind the socket to a known port\r
+ //\r
+ PortNumber = OOB_RX_PORT;\r
+ memset ( &LocalPort, 0, sizeof ( LocalPort ));\r
+ SIN_LEN ( LocalPort ) = sizeof ( LocalPort );\r
+ SIN_FAMILY ( LocalPort ) = AF_INET;\r
+ SIN_ADDR ( LocalPort ) = 0;\r
+ SIN_PORT ( LocalPort ) = htons ( PortNumber );\r
+ RetVal = bind ( s,\r
+ (struct sockaddr *)&LocalPort,\r
+ sizeof ( LocalPort ));\r
+ if ( -1 == RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - bind error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Make the port available on the server\r
+ //\r
+ RetVal = listen ( s, 2 );\r
+ if ( -1 == RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - listen error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Wait for a connection to the known port\r
+ //\r
+ RemotePortLength = sizeof ( RemotePort );\r
+ a = accept ( s,\r
+ (struct sockaddr *)&RemotePort,\r
+ &RemotePortLength );\r
+ if ( -1 == a ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - accept error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Use for/break instead of goto\r
+ //\r
+ for ( ; ; ) {\r
+ //\r
+ // Set the receive timeout\r
+ //\r
+ ReceiveTimeout.tv_sec = 0;\r
+ ReceiveTimeout.tv_usec = 20 * 1000;\r
+ RetVal = setsockopt ( a,\r
+ SOL_SOCKET,\r
+ SO_RCVTIMEO,\r
+ (char *)&ReceiveTimeout,\r
+ sizeof ( ReceiveTimeout ));\r
+ if ( -1 == RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - setsockopt RCVTIMEO error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Select the OOB processing\r
+ //\r
+ OobInLine = ( 1 < ArgC );\r
+ RetVal = setsockopt ( s,\r
+ SOL_SOCKET,\r
+ SO_OOBINLINE,\r
+ (char *)&OobInLine,\r
+ sizeof ( OobInLine ));\r
+ if ( -1 == RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - setsockopt OOBINLINE error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+ printf ( "%s\r\n", ( 0 != OobInLine ) ? "OOB messages are in-line"\r
+ : "OOB messages move to the head of the queue" );\r
+\r
+ //\r
+ // Receive data from the remote system\r
+ //\r
+ TransmittedBefore = 0;\r
+ TransmittedOob = 0;\r
+ TransmittedDuring = 0;\r
+ TransmittedAfter = 0;\r
+ pTransmittedBytes = &TransmittedBefore;\r
+ do {\r
+ //\r
+ // Attempt to receive OOB data\r
+ //\r
+ BytesReceived = recv ( a, &mBuffer[0], sizeof ( mBuffer ), MSG_OOB );\r
+ RetVal = (UINT32)BytesReceived;\r
+ if ( 0 < BytesReceived ) {\r
+ //\r
+ // Display the received OOB data\r
+ //\r
+ printf ( "%5Ld OOB bytes received\r\n", (UINT64)BytesReceived );\r
+\r
+ //\r
+ // Account for the bytes received\r
+ //\r
+ TransmittedOob += RetVal;\r
+ *pTransmittedBytes += TransmittedAfter;\r
+ TransmittedAfter = 0;\r
+ pTransmittedBytes = &TransmittedDuring;\r
+ }\r
+ else if ( -1 == BytesReceived ) {\r
+ //\r
+ // Check for connection timeout\r
+ //\r
+ RetVal = GET_ERRNO;\r
+ if ( RX_TIMEOUT_ERROR != RetVal ) {\r
+ //\r
+ // Receive error\r
+ //\r
+ printf ( "ERROR - recv OOB error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Ignore the timeout\r
+ // Try to receive normal data instead\r
+ //\r
+ BytesReceived = recv ( a, &mBuffer[0], sizeof ( mBuffer ), 0 );\r
+ RetVal = (UINT32)BytesReceived;\r
+ if ( 0 < BytesReceived ) {\r
+ //\r
+ // Display the received data\r
+ //\r
+ printf ( "%4Ld bytes received\r\n", (UINT64)BytesReceived );\r
+\r
+ //\r
+ // Account for the bytes received\r
+ //\r
+ TransmittedAfter += RetVal;\r
+ }\r
+ else if ( -1 == BytesReceived ) {\r
+ //\r
+ // Check for a timeout\r
+ //\r
+ RetVal = GET_ERRNO;\r
+ if ( RX_TIMEOUT_ERROR != RetVal ) {\r
+ printf ( "ERROR - recv error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ } while ( 0 != RetVal );\r
+\r
+ //\r
+ // Display the bytes received\r
+ //\r
+ if ( 0 == RetVal ) {\r
+ printf ( "Bytes before OOB: %8d\r\n", TransmittedBefore );\r
+ if ( 0 != TransmittedDuring ) {\r
+ printf ( "Bytes during OOB: %8d\r\n", TransmittedDuring );\r
+ }\r
+ printf ( "Out-of-band bytes: %8d\r\n", TransmittedOob );\r
+ printf ( "Bytes after OOB: %8d\r\n", TransmittedAfter );\r
+ printf ( " --------\r\n" );\r
+ printf ( "Total Bytes: %8d\r\n", TransmittedBefore\r
+ + TransmittedDuring\r
+ + TransmittedOob\r
+ + TransmittedAfter );\r
+ }\r
+\r
+ //\r
+ // Test complete\r
+ //\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Close the test socket\r
+ //\r
+ CLOSE_SOCKET ( a );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Close the socket\r
+ //\r
+ CLOSE_SOCKET ( s );\r
+ printf ( "Socket closed\r\n" );\r
+ }\r
+\r
+ //\r
+ // Return the operation status\r
+ //\r
+ return RetVal;\r
+}\r
--- /dev/null
+/** @file\r
+ Definitions for the OOB Receive application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#ifndef _OOB_RX_H_\r
+#define _OOB_RX_H_\r
+\r
+//------------------------------------------------------------------------------\r
+// Include Files\r
+//------------------------------------------------------------------------------\r
+\r
+#ifdef BUILD_FOR_WINDOWS\r
+//\r
+// Build for Windows environment\r
+//\r
+\r
+#include <winsock2.h>\r
+\r
+#define CLOSE_SOCKET closesocket\r
+#define SIN_ADDR(port) port.sin_addr.S_un.S_addr\r
+#define SIN_FAMILY(port) port.sin_family\r
+#define SIN_LEN(port) port.sin_family\r
+#define SIN_PORT(port) port.sin_port\r
+#define GET_ERRNO WSAGetLastError ( )\r
+\r
+#define RX_TIMEOUT_ERROR WSAETIMEDOUT\r
+#define ssize_t int\r
+#define socklen_t int\r
+\r
+#else // BUILD_FOR_WINDOWS\r
+//\r
+// Build for EFI environment\r
+//\r
+\r
+#include <Uefi.h>\r
+#include <errno.h>\r
+#include <stdlib.h>\r
+\r
+#include <netinet/in.h>\r
+\r
+#include <sys/EfiSysCall.h>\r
+#include <sys/endian.h>\r
+#include <sys/socket.h>\r
+#include <sys/time.h>\r
+\r
+#define CLOSE_SOCKET close\r
+#define SIN_ADDR(port) port.sin_addr.s_addr\r
+#define SIN_FAMILY(port) port.sin_family\r
+#define SIN_LEN(port) port.sin_len\r
+#define SIN_PORT(port) port.sin_port\r
+#define SOCKET int\r
+#define GET_ERRNO errno\r
+#define RX_TIMEOUT_ERROR ETIMEDOUT\r
+\r
+#endif // BUILD_FOR_WINDOWS\r
+\r
+#include <stdio.h>\r
+\r
+//------------------------------------------------------------------------------\r
+// Constants\r
+//------------------------------------------------------------------------------\r
+\r
+#define OOB_RX_PORT 12344\r
+\r
+//------------------------------------------------------------------------------\r
+// API\r
+//------------------------------------------------------------------------------\r
+\r
+/**\r
+ Run the OOB receive application\r
+\r
+ @param [in] ArgC Argument count\r
+ @param [in] ArgV Argument value array\r
+\r
+ @retval 0 Successfully operation\r
+ **/\r
+\r
+int\r
+OobRx (\r
+ IN int ArgC,\r
+ IN char **ArgV\r
+ );\r
+\r
+//------------------------------------------------------------------------------\r
+\r
+#endif // _OOB_RX_H_\r
--- /dev/null
+#/** @file\r
+# OobRx Application\r
+#\r
+# This file contains an 'Intel Peripheral Driver' and is \r
+# licensed for Intel CPUs and chipsets under the terms of your\r
+# license agreement with Intel or your vendor. This file may \r
+# be modified by the user, subject to additional terms of the \r
+# license agreement \r
+#\r
+#\r
+# Copyright (c) 20011 Intel Corporation. All rights reserved\r
+# This software and associated documentation (if any) is furnished\r
+# under a license and may only be used or copied in accordance\r
+# with the terms of the license. Except as permitted by such\r
+# license, no part of this software or documentation may be\r
+# reproduced, stored in a retrieval system, or transmitted in any\r
+# form or by any means without the express written consent of\r
+# Intel Corporation.\r
+#\r
+##\r
+\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = OobRx\r
+ FILE_GUID = 79DED328-7FCE-4909-9AFD-D66176AF97A6\r
+ MODULE_TYPE = UEFI_APPLICATION\r
+ VERSION_STRING = 1.0\r
+ ENTRY_POINT = ShellCEntryLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+ Main.c\r
+ OobRx.c\r
+\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ ShellPkg/ShellPkg.dec\r
+ StdLib/StdLib.dec\r
+\r
+\r
+[LibraryClasses]\r
+ BaseMemoryLib\r
+ BsdSocketLib\r
+ DebugLib\r
+ EfiSocketLib\r
+ LibC\r
+ LibMath\r
+ ShellCEntryLib\r
+ UefiBootServicesTableLib\r
+ UefiLib\r
+# UseSocketDxe\r
+\r
+[BuildOptions]\r
+ INTEL:*_*_*_CC_FLAGS = /Qdiag-disable:181,186\r
+ MSFT:*_*_*_CC_FLAGS = /Od\r
+ GCC:*_*_*_CC_FLAGS = -O0 -Wno-unused-variable\r
+\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 9.00\r
+# Visual Studio 2005\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OobRx", "OobRx.vcproj", "{FA34A77A-5034-4065-B4BD-B74984DEB2F7}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Win32 = Debug|Win32\r
+ Release|Win32 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {FA34A77A-5034-4065-B4BD-B74984DEB2F7}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {FA34A77A-5034-4065-B4BD-B74984DEB2F7}.Debug|Win32.Build.0 = Debug|Win32\r
+ {FA34A77A-5034-4065-B4BD-B74984DEB2F7}.Release|Win32.ActiveCfg = Release|Win32\r
+ {FA34A77A-5034-4065-B4BD-B74984DEB2F7}.Release|Win32.Build.0 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="8.00"\r
+ Name="OobRx"\r
+ ProjectGUID="{FA34A77A-5034-4065-B4BD-B74984DEB2F7}"\r
+ RootNamespace="OobRx"\r
+ Keyword="Win32Proj"\r
+ >\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"\r
+ />\r
+ </Platforms>\r
+ <ToolFiles>\r
+ </ToolFiles>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="1"\r
+ CharacterSet="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories=".."\r
+ PreprocessorDefinitions="BUILD_FOR_WINDOWS"\r
+ MinimalRebuild="true"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ UsePrecompiledHeader="0"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="4"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="ws2_32.lib"\r
+ LinkIncremental="2"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="1"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="1"\r
+ CharacterSet="1"\r
+ WholeProgramOptimization="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=".."\r
+ PreprocessorDefinitions="BUILD_FOR_WINDOWS"\r
+ RuntimeLibrary="2"\r
+ UsePrecompiledHeader="0"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="3"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="ws2_32.lib"\r
+ LinkIncremental="1"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="1"\r
+ OptimizeReferences="2"\r
+ EnableCOMDATFolding="2"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <Filter\r
+ Name="Source Files"\r
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+ >\r
+ <File\r
+ RelativePath=".\main.c"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\OobRx.c"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Header Files"\r
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+ >\r
+ <File\r
+ RelativePath="..\OobRx.h"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Resource Files"\r
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+ >\r
+ </Filter>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
--- /dev/null
+/** @file\r
+ Windows version of the OOB Receive application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include <OobRx.h>\r
+\r
+\r
+/**\r
+ Receive out-of-band messages from the remote system.\r
+\r
+ @param [in] argc The number of arguments\r
+ @param [in] argv The argument value array\r
+\r
+ @retval 0 The application exited normally.\r
+ @retval Other An error occurred.\r
+**/\r
+int\r
+main(\r
+ int argc,\r
+ char ** argv\r
+ )\r
+{\r
+ int RetVal;\r
+ WSADATA WsaData;\r
+\r
+ //\r
+ // Initialize the WinSock layer\r
+ //\r
+ RetVal = WSAStartup ( MAKEWORD ( 2, 2 ), &WsaData );\r
+ if ( 0 == RetVal ) {\r
+ //\r
+ // Start the application\r
+ //\r
+ RetVal = OobRx ( argc, argv );\r
+\r
+ //\r
+ // Done with the WinSock layer\r
+ //\r
+ WSACleanup ( );\r
+ }\r
+\r
+ //\r
+ // Return the final result\r
+ //\r
+ return RetVal; \r
+}\r
--- /dev/null
+/** @file\r
+ Out-of-band transmit test application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include <OobTx.h>\r
+\r
+\r
+/**\r
+ Transmit out-of-band messages to the remote system.\r
+\r
+ @param [in] Argc The number of arguments\r
+ @param [in] Argv The argument value array\r
+\r
+ @retval 0 The application exited normally.\r
+ @retval Other An error occurred.\r
+**/\r
+int\r
+main (\r
+ IN int Argc,\r
+ IN char **Argv\r
+ )\r
+{\r
+ int RetVal;\r
+\r
+ //\r
+ // Run the application\r
+ //\r
+ RetVal = OobTx ( Argc, Argv );\r
+\r
+ //\r
+ // Return the operation status\r
+ //\r
+ return RetVal;\r
+}\r
--- /dev/null
+/** @file\r
+ Windows version of the OOB Transmit application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include <OobTx.h>\r
+\r
+UINT8 mBuffer[8192];\r
+UINT8 mOob[512];\r
+\r
+/**\r
+ Transmit out-of-band messages to the remote system.\r
+\r
+ @param [in] ArgC Argument count\r
+ @param [in] ArgV Argument value array\r
+\r
+ @retval 0 Successfully operation\r
+ **/\r
+\r
+int\r
+OobTx (\r
+ IN int ArgC,\r
+ IN char **ArgV\r
+ )\r
+{\r
+ UINT32 BytesSent;\r
+ ssize_t BytesTransmitted;\r
+ UINT32 Index;\r
+ struct sockaddr_in LocalPort;\r
+ UINT32 OobInLine;\r
+ UINT16 PortNumber;\r
+ UINT32 RemoteAddress[4];\r
+ struct sockaddr_in RemotePort;\r
+ int RetVal;\r
+ UINT32 TransmittedAfter;\r
+ UINT32 TransmittedBefore;\r
+ UINT32 TransmittedOob;\r
+ SOCKET s;\r
+\r
+ //\r
+ // Create the socket\r
+ //\r
+ s = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP );\r
+ if ( -1 == s ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - socket error, errno: %d\r\n", RetVal );\r
+ }\r
+ else {\r
+ //\r
+ // Use for/break; instead of goto\r
+ //\r
+ for ( ; ; ) {\r
+ //\r
+ // Validate the arguments\r
+ //\r
+ if (( 2 > ArgC )\r
+ || ( 4 != sscanf ( ArgV[1],\r
+ "%d.%d.%d.%d",\r
+ &RemoteAddress[0],\r
+ &RemoteAddress[1],\r
+ &RemoteAddress[2],\r
+ &RemoteAddress[3]))\r
+ || ( 224 < RemoteAddress[0])\r
+ || ( 255 < RemoteAddress[1])\r
+ || ( 255 < RemoteAddress[2])\r
+ || ( 255 < RemoteAddress[3])\r
+ || (( 0 == RemoteAddress[0])\r
+ && ( 0 == RemoteAddress[1])\r
+ && ( 0 == RemoteAddress[2])\r
+ && ( 0 == RemoteAddress[3]))) {\r
+ printf ( "%s <remote IP address> [optional: enables in-line OOB]\r\n", ArgV[0]);\r
+ RetVal = EINVAL;\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Bind the socket to a local port\r
+ //\r
+ memset ( &LocalPort, 0, sizeof ( LocalPort ));\r
+ SIN_LEN ( LocalPort ) = sizeof ( LocalPort );\r
+ SIN_FAMILY ( LocalPort ) = AF_INET;\r
+ SIN_ADDR ( LocalPort ) = 0;\r
+ SIN_PORT ( LocalPort ) = 0;\r
+ RetVal = bind ( s,\r
+ (struct sockaddr *)&LocalPort,\r
+ sizeof ( LocalPort ));\r
+ if ( -1 == RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - bind error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Specify the remote port\r
+ //\r
+ PortNumber = OOB_RX_PORT;\r
+ memset ( &RemotePort, 0, sizeof ( RemotePort ));\r
+ SIN_LEN ( RemotePort ) = sizeof ( RemotePort );\r
+ SIN_FAMILY ( RemotePort ) = AF_INET;\r
+ SIN_ADDR ( RemotePort ) = ( RemoteAddress[3] << 24 )\r
+ | ( RemoteAddress[2] << 16 )\r
+ | ( RemoteAddress[1] << 8 )\r
+ | RemoteAddress[0];\r
+ SIN_PORT ( RemotePort ) = htons ( PortNumber );\r
+\r
+ //\r
+ // Connect to the remote server\r
+ //\r
+ RetVal = connect ( s, (struct sockaddr *)&RemotePort, sizeof ( RemotePort ));\r
+ if ( -1 == RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - connect error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Select the OOB processing\r
+ //\r
+ OobInLine = ( 2 < ArgC );\r
+ RetVal = setsockopt ( s,\r
+ SOL_SOCKET,\r
+ SO_OOBINLINE,\r
+ (char *)&OobInLine,\r
+ sizeof ( OobInLine ));\r
+ if ( -1 == RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - setsockopt OOBINLINE error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+ printf ( "%s\r\n", ( 0 != OobInLine ) ? "OOB messages are in-line"\r
+ : "OOB messages move to the head of the queue" );\r
+\r
+ //\r
+ // Initialize the messages\r
+ //\r
+ memset ( &mBuffer[0], 0, sizeof ( mBuffer ));\r
+ memset ( &mOob[0], 0x11, sizeof ( mOob ));\r
+\r
+ //\r
+ // Send the data before the out-of-band message\r
+ //\r
+ TransmittedBefore = 0;\r
+ for ( Index = 0; TX_MSGS_BEFORE > Index; Index++ ) {\r
+ BytesSent = 0;\r
+ do {\r
+ BytesTransmitted = send ( s,\r
+ &mBuffer[BytesSent],\r
+ sizeof ( mBuffer ) - BytesSent,\r
+ 0 );\r
+ if ( -1 == BytesTransmitted ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - send before error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+ BytesSent += (UINT32)BytesTransmitted;\r
+ RetVal = 0;\r
+ } while ( sizeof ( mBuffer ) > BytesSent );\r
+ if ( 0 != RetVal ) {\r
+ break;\r
+ }\r
+ TransmittedBefore += BytesSent;\r
+ }\r
+ if ( 0 != RetVal ) {\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Send the out-of-band message\r
+ //\r
+ BytesSent = 0;\r
+ do {\r
+ BytesTransmitted = send ( s,\r
+ &mOob[BytesSent],\r
+ sizeof ( mOob ) - BytesSent,\r
+ MSG_OOB );\r
+ if ( -1 == BytesTransmitted ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - send OOB error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+ BytesSent += (UINT32)BytesTransmitted;\r
+ RetVal = 0;\r
+ } while ( sizeof ( mOob ) > BytesSent );\r
+ if ( 0 != RetVal ) {\r
+ break;\r
+ }\r
+ TransmittedOob = BytesSent;\r
+\r
+ //\r
+ // Send the data after the out-of-band message\r
+ //\r
+ TransmittedAfter = 0;\r
+ for ( Index = 0; TX_MSGS_AFTER > Index; Index++ ) {\r
+ BytesSent = 0;\r
+ do {\r
+ BytesTransmitted = send ( s,\r
+ &mBuffer[BytesSent],\r
+ sizeof ( mBuffer ) - BytesSent,\r
+ 0 );\r
+ if ( -1 == BytesTransmitted ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - send after error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+ BytesSent += (UINT32)BytesTransmitted;\r
+ RetVal = 0;\r
+ } while ( sizeof ( mBuffer ) > BytesSent );\r
+ if ( 0 != RetVal ) {\r
+ break;\r
+ }\r
+ TransmittedAfter += BytesSent;\r
+ }\r
+\r
+ //\r
+ // Test completed successfully\r
+ //\r
+ if ( 0 == RetVal ) {\r
+ printf ( "Bytes before OOB: %8d\r\n", TransmittedBefore );\r
+ printf ( "Out-of-band bytes: %8d\r\n", TransmittedOob );\r
+ printf ( "Bytes after OOB: %8d\r\n", TransmittedAfter );\r
+ printf ( " --------\r\n" );\r
+ printf ( "Total Bytes: %8d\r\n", TransmittedBefore\r
+ + TransmittedOob\r
+ + TransmittedAfter );\r
+ }\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Close the socket\r
+ //\r
+ CLOSE_SOCKET ( s );\r
+ }\r
+\r
+ //\r
+ // Return the operation status\r
+ //\r
+ return RetVal;\r
+}\r
--- /dev/null
+/** @file\r
+ Definitions for the OOB Transmit application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#ifndef _OOB_TX_H_\r
+#define _OOB_TX_H_\r
+\r
+//------------------------------------------------------------------------------\r
+// Include Files\r
+//------------------------------------------------------------------------------\r
+\r
+#ifdef BUILD_FOR_WINDOWS\r
+//\r
+// Build for Windows environment\r
+//\r
+\r
+#include <winsock2.h>\r
+\r
+#define CHAR8 char\r
+#define CLOSE_SOCKET closesocket\r
+#define EINVAL 22 // Invalid argument\r
+#define GET_ERRNO WSAGetLastError ( )\r
+#define SIN_ADDR(port) port.sin_addr.S_un.S_addr\r
+#define SIN_FAMILY(port) port.sin_family\r
+#define SIN_LEN(port) port.sin_family\r
+#define SIN_PORT(port) port.sin_port\r
+#define socklen_t int\r
+#define ssize_t int\r
+\r
+#else // BUILD_FOR_WINDOWS\r
+//\r
+// Build for EFI environment\r
+//\r
+\r
+#include <Uefi.h>\r
+#include <errno.h>\r
+#include <stdlib.h>\r
+\r
+#include <netinet/in.h>\r
+\r
+#include <sys/EfiSysCall.h>\r
+#include <sys/endian.h>\r
+#include <sys/socket.h>\r
+\r
+#define CLOSE_SOCKET close\r
+#define GET_ERRNO errno\r
+#define SIN_ADDR(port) port.sin_addr.s_addr\r
+#define SIN_FAMILY(port) port.sin_family\r
+#define SIN_LEN(port) port.sin_len\r
+#define SIN_PORT(port) port.sin_port\r
+#define SOCKET int\r
+\r
+#endif // BUILD_FOR_WINDOWS\r
+\r
+#include <stdio.h>\r
+\r
+//------------------------------------------------------------------------------\r
+// Constants\r
+//------------------------------------------------------------------------------\r
+\r
+#define OOB_RX_PORT 12344\r
+\r
+#define TX_MSGS_BEFORE 32\r
+#define TX_MSGS_AFTER 8\r
+\r
+//------------------------------------------------------------------------------\r
+// API\r
+//------------------------------------------------------------------------------\r
+\r
+/**\r
+ Transmit out-of-band messages to the remote system.\r
+\r
+ @param [in] ArgC Argument count\r
+ @param [in] ArgV Argument value array\r
+\r
+ @retval 0 Successfully operation\r
+ **/\r
+\r
+int\r
+OobTx (\r
+ IN int ArgC,\r
+ IN char **ArgV\r
+ );\r
+\r
+//------------------------------------------------------------------------------\r
+\r
+#endif // _OOB_TX_H_\r
--- /dev/null
+#/** @file\r
+# OobTx Application\r
+#\r
+# This file contains an 'Intel Peripheral Driver' and is \r
+# licensed for Intel CPUs and chipsets under the terms of your\r
+# license agreement with Intel or your vendor. This file may \r
+# be modified by the user, subject to additional terms of the \r
+# license agreement \r
+#\r
+#\r
+# Copyright (c) 20011 Intel Corporation. All rights reserved\r
+# This software and associated documentation (if any) is furnished\r
+# under a license and may only be used or copied in accordance\r
+# with the terms of the license. Except as permitted by such\r
+# license, no part of this software or documentation may be\r
+# reproduced, stored in a retrieval system, or transmitted in any\r
+# form or by any means without the express written consent of\r
+# Intel Corporation.\r
+#\r
+##\r
+\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = OobTx\r
+ FILE_GUID = EB740091-A494-44d7-8D96-C192F95A6394\r
+ MODULE_TYPE = UEFI_APPLICATION\r
+ VERSION_STRING = 1.0\r
+ ENTRY_POINT = ShellCEntryLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+ Main.c\r
+ OobTx.c\r
+\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ ShellPkg/ShellPkg.dec\r
+ StdLib/StdLib.dec\r
+\r
+\r
+[LibraryClasses]\r
+ BaseMemoryLib\r
+ BsdSocketLib\r
+ DebugLib\r
+ EfiSocketLib\r
+ LibC\r
+ LibMath\r
+ ShellCEntryLib\r
+ UefiBootServicesTableLib\r
+ UefiLib\r
+# UseSocketDxe\r
+\r
+[BuildOptions]\r
+ INTEL:*_*_*_CC_FLAGS = /Qdiag-disable:181,186\r
+ MSFT:*_*_*_CC_FLAGS = /Od\r
+ GCC:*_*_*_CC_FLAGS = -O0 -Wno-unused-variable\r
+\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 9.00\r
+# Visual Studio 2005\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OobTx", "OobTx.vcproj", "{C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Win32 = Debug|Win32\r
+ Release|Win32 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}.Debug|Win32.Build.0 = Debug|Win32\r
+ {C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}.Release|Win32.ActiveCfg = Release|Win32\r
+ {C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}.Release|Win32.Build.0 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="8.00"\r
+ Name="OobTx"\r
+ ProjectGUID="{C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}"\r
+ RootNamespace="OobTx"\r
+ Keyword="Win32Proj"\r
+ >\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"\r
+ />\r
+ </Platforms>\r
+ <ToolFiles>\r
+ </ToolFiles>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="1"\r
+ CharacterSet="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories=".."\r
+ PreprocessorDefinitions="BUILD_FOR_WINDOWS; _CRT_SECURE_NO_DEPRECATE"\r
+ MinimalRebuild="true"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ UsePrecompiledHeader="0"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="4"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="ws2_32.lib"\r
+ LinkIncremental="2"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="1"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="1"\r
+ CharacterSet="1"\r
+ WholeProgramOptimization="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=".."\r
+ PreprocessorDefinitions="BUILD_FOR_WINDOWS; _CRT_SECURE_NO_DEPRECATE"\r
+ RuntimeLibrary="2"\r
+ UsePrecompiledHeader="0"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="3"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="ws2_32.lib"\r
+ LinkIncremental="1"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="1"\r
+ OptimizeReferences="2"\r
+ EnableCOMDATFolding="2"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <Filter\r
+ Name="Source Files"\r
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+ >\r
+ <File\r
+ RelativePath=".\main.c"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\OobTx.c"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Header Files"\r
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+ >\r
+ <File\r
+ RelativePath="..\OobTx.h"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Resource Files"\r
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+ >\r
+ </Filter>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
--- /dev/null
+/** @file\r
+ Windows version of the OOB Transmit application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include <OobTx.h>\r
+\r
+\r
+/**\r
+ Transmit out-of-band messages to the remote system.\r
+\r
+ @param [in] Argc The number of arguments\r
+ @param [in] Argv The argument value array\r
+\r
+ @retval 0 The application exited normally.\r
+ @retval Other An error occurred.\r
+**/\r
+int\r
+main(\r
+ int argc,\r
+ char ** argv\r
+ )\r
+{\r
+ int RetVal;\r
+ WSADATA WsaData;\r
+\r
+ //\r
+ // Initialize the WinSock layer\r
+ //\r
+ RetVal = WSAStartup ( MAKEWORD ( 2, 2 ), &WsaData );\r
+ if ( 0 == RetVal ) {\r
+ //\r
+ // Start the application\r
+ //\r
+ RetVal = OobTx ( argc, argv );\r
+\r
+ //\r
+ // Done with the WinSock layer\r
+ //\r
+ WSACleanup ( );\r
+ }\r
+\r
+ //\r
+ // Return the final result\r
+ //\r
+ return RetVal; \r
+}\r
--- /dev/null
+/** @file\r
+ Raw IP4 receive test application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include "RawIp4Rx.h"\r
+\r
+\r
+/**\r
+ Receive raw datagrams from a remote system.\r
+\r
+ @param [in] Argc The number of arguments\r
+ @param [in] Argv The argument value array\r
+\r
+ @retval 0 The application exited normally.\r
+ @retval Other An error occurred.\r
+**/\r
+int\r
+main (\r
+ IN int Argc,\r
+ IN char **Argv\r
+ )\r
+{\r
+ int RetVal;\r
+\r
+ //\r
+ // Run the application\r
+ //\r
+ RetVal = RawIp4Rx ( Argc, Argv );\r
+\r
+ //\r
+ // Return the operation status\r
+ //\r
+ return RetVal;\r
+}\r
--- /dev/null
+/** @file\r
+ Raw IP4 receive application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include "RawIp4Rx.h"\r
+\r
+UINT8 mBuffer[65536];\r
+\r
+\r
+/**\r
+ Run the raw IP4 receive application\r
+\r
+ @param [in] ArgC Argument count\r
+ @param [in] ArgV Argument value array\r
+\r
+ @retval 0 Successfully operation\r
+ **/\r
+int\r
+RawIp4Rx (\r
+ IN int ArgC,\r
+ IN char **ArgV\r
+ )\r
+{\r
+ ssize_t BytesReceived;\r
+ struct sockaddr_in LocalPort;\r
+ socklen_t LocalPortLength;\r
+ struct sockaddr_in RemotePort;\r
+ socklen_t RemotePortLength;\r
+ int RetVal;\r
+ SOCKET s;\r
+ UINT64 TotalBytesReceived;\r
+\r
+ //\r
+ // Create the socket\r
+ //\r
+ s = socket ( AF_INET, SOCK_RAW, RAW_PROTOCOL );\r
+ if ( -1 == s ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - socket error, errno: %d\r\n", RetVal );\r
+ }\r
+ else {\r
+ //\r
+ // Use for/break; instead of goto\r
+ //\r
+ for ( ; ; ) {\r
+ //\r
+ // Bind the socket to a known port\r
+ //\r
+ memset ( &LocalPort, 0, sizeof ( LocalPort ));\r
+ SIN_LEN ( LocalPort ) = sizeof ( LocalPort );\r
+ SIN_FAMILY ( LocalPort ) = AF_INET;\r
+ SIN_ADDR ( LocalPort ) = 0;\r
+ SIN_PORT ( LocalPort ) = 0;\r
+ RetVal = bind ( s,\r
+ (struct sockaddr *)&LocalPort,\r
+ sizeof ( LocalPort ));\r
+ if ( -1 == RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - bind error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Display the local address and protocol\r
+ //\r
+ LocalPortLength = sizeof ( LocalPort );\r
+ RetVal = getsockname ( s, (struct sockaddr *)&LocalPort, &LocalPortLength );\r
+ if ( 0 != RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - getsockname error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+ printf ( "Local Address: %d.%d.%d.%d, Protocol: %d\r\n",\r
+ (UINT8)SIN_ADDR ( LocalPort ),\r
+ (UINT8)( SIN_ADDR ( LocalPort ) >> 8 ),\r
+ (UINT8)( SIN_ADDR ( LocalPort ) >> 16 ),\r
+ (UINT8)( SIN_ADDR ( LocalPort ) >> 24 ),\r
+ RAW_PROTOCOL );\r
+\r
+ //\r
+ // Use for/break instead of goto\r
+ //\r
+ TotalBytesReceived = 0;\r
+ for ( ; ; ) {\r
+ //\r
+ // Receive data from the remote system\r
+ //\r
+ do {\r
+ //\r
+ // Attempt to receive a packet\r
+ //\r
+ RemotePortLength = sizeof ( RemotePort );\r
+ BytesReceived = recvfrom ( s,\r
+ &mBuffer[0],\r
+ sizeof ( mBuffer ),\r
+ 0,\r
+ (struct sockaddr *)&RemotePort,\r
+ &RemotePortLength );\r
+ RetVal = (UINT32)BytesReceived;\r
+ if ( 0 < BytesReceived ) {\r
+ //\r
+ // Display the received data\r
+ //\r
+ printf ( "%4d bytes received from %d.%d.%d.%d:%d\r\n"\r
+ "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\r\n"\r
+ "%02x %02x %02x %02x\r\n",\r
+ (UINT32)BytesReceived,\r
+ (UINT8)SIN_ADDR ( RemotePort ),\r
+ (UINT8)( SIN_ADDR ( RemotePort ) >> 8 ),\r
+ (UINT8)( SIN_ADDR ( RemotePort ) >> 16 ),\r
+ (UINT8)( SIN_ADDR ( RemotePort ) >> 24 ),\r
+ SIN_PORT ( RemotePort ),\r
+ mBuffer[0],\r
+ mBuffer[1],\r
+ mBuffer[2],\r
+ mBuffer[3],\r
+ mBuffer[4],\r
+ mBuffer[5],\r
+ mBuffer[6],\r
+ mBuffer[7],\r
+ mBuffer[8],\r
+ mBuffer[9],\r
+ mBuffer[10],\r
+ mBuffer[11],\r
+ mBuffer[12],\r
+ mBuffer[13],\r
+ mBuffer[14],\r
+ mBuffer[15],\r
+ mBuffer[16],\r
+ mBuffer[17],\r
+ mBuffer[18],\r
+ mBuffer[19]);\r
+ TotalBytesReceived += BytesReceived;\r
+\r
+ //\r
+ // All done when the correct packet is received\r
+ //\r
+ if ( mBuffer[9] == RAW_PROTOCOL ) {\r
+ break;\r
+ }\r
+ }\r
+ else if ( -1 == BytesReceived ) {\r
+ //\r
+ // Check for a timeout\r
+ //\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - recv error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+ } while ( 0 != RetVal );\r
+\r
+ //\r
+ // Display the bytes received\r
+ //\r
+ if ( 0 == RetVal ) {\r
+ printf ( "Total Bytes Received: %Ld\r\n", TotalBytesReceived );\r
+ }\r
+\r
+ //\r
+ // Test complete\r
+ //\r
+ break;\r
+ }\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Close the socket\r
+ //\r
+ CLOSE_SOCKET ( s );\r
+ printf ( "Socket closed\r\n" );\r
+ }\r
+\r
+ //\r
+ // Return the operation status\r
+ //\r
+ return RetVal;\r
+}\r
--- /dev/null
+/** @file\r
+ Definitions for the raw IP4 receive application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#ifndef _RAW_IP4_RX_H_\r
+#define _RAW_IP4_RX_H_\r
+\r
+//------------------------------------------------------------------------------\r
+// Include Files\r
+//------------------------------------------------------------------------------\r
+\r
+#ifdef BUILD_FOR_WINDOWS\r
+//\r
+// Build for Windows environment\r
+//\r
+\r
+#include <winsock2.h>\r
+\r
+#define CLOSE_SOCKET closesocket\r
+#define SIN_ADDR(port) port.sin_addr.S_un.S_addr\r
+#define SIN_FAMILY(port) port.sin_family\r
+#define SIN_LEN(port) port.sin_family\r
+#define SIN_PORT(port) port.sin_port\r
+#define GET_ERRNO WSAGetLastError ( )\r
+\r
+#define ssize_t int\r
+#define socklen_t int\r
+\r
+#else // BUILD_FOR_WINDOWS\r
+//\r
+// Build for EFI environment\r
+//\r
+\r
+#include <Uefi.h>\r
+#include <errno.h>\r
+#include <stdlib.h>\r
+\r
+#include <netinet/in.h>\r
+\r
+#include <sys/EfiSysCall.h>\r
+#include <sys/endian.h>\r
+#include <sys/socket.h>\r
+#include <sys/time.h>\r
+\r
+#define CLOSE_SOCKET close\r
+#define SIN_ADDR(port) port.sin_addr.s_addr\r
+#define SIN_FAMILY(port) port.sin_family\r
+#define SIN_LEN(port) port.sin_len\r
+#define SIN_PORT(port) port.sin_port\r
+#define SOCKET int\r
+#define GET_ERRNO errno\r
+\r
+#endif // BUILD_FOR_WINDOWS\r
+\r
+#include <stdio.h>\r
+\r
+//------------------------------------------------------------------------------\r
+// Constants\r
+//------------------------------------------------------------------------------\r
+\r
+//\r
+// See http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml\r
+// and http://tools.ietf.org/html/rfc3692\r
+//\r
+#define RAW_PROTOCOL 253\r
+\r
+//------------------------------------------------------------------------------\r
+// API\r
+//------------------------------------------------------------------------------\r
+\r
+/**\r
+ Run the raw IP4 receive application\r
+\r
+ @param [in] ArgC Argument count\r
+ @param [in] ArgV Argument value array\r
+\r
+ @retval 0 Successfully operation\r
+ **/\r
+\r
+int\r
+RawIp4Rx (\r
+ IN int ArgC,\r
+ IN char **ArgV\r
+ );\r
+\r
+//------------------------------------------------------------------------------\r
+\r
+#endif // _RAW_IP4_RX_H_\r
--- /dev/null
+#/** @file\r
+# RawIp4 Application\r
+#\r
+# This file contains an 'Intel Peripheral Driver' and is \r
+# licensed for Intel CPUs and chipsets under the terms of your\r
+# license agreement with Intel or your vendor. This file may \r
+# be modified by the user, subject to additional terms of the \r
+# license agreement \r
+#\r
+#\r
+# Copyright (c) 20011 Intel Corporation. All rights reserved\r
+# This software and associated documentation (if any) is furnished\r
+# under a license and may only be used or copied in accordance\r
+# with the terms of the license. Except as permitted by such\r
+# license, no part of this software or documentation may be\r
+# reproduced, stored in a retrieval system, or transmitted in any\r
+# form or by any means without the express written consent of\r
+# Intel Corporation.\r
+#\r
+##\r
+\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = RawIp4Rx\r
+ FILE_GUID = 8D7AE6A9-B490-45e1-8795-C2BEAADC3814\r
+ MODULE_TYPE = UEFI_APPLICATION\r
+ VERSION_STRING = 1.0\r
+ ENTRY_POINT = ShellCEntryLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+ Main.c\r
+ RawIp4Rx.c\r
+\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ ShellPkg/ShellPkg.dec\r
+ StdLib/StdLib.dec\r
+\r
+\r
+[LibraryClasses]\r
+ BaseMemoryLib\r
+ BsdSocketLib\r
+ DebugLib\r
+ EfiSocketLib\r
+ LibC\r
+ LibMath\r
+ ShellCEntryLib\r
+ UefiBootServicesTableLib\r
+ UefiLib\r
+# UseSocketDxe\r
+\r
+[BuildOptions]\r
+ INTEL:*_*_*_CC_FLAGS = /Qdiag-disable:181,186\r
+ MSFT:*_*_*_CC_FLAGS = /Od\r
+ GCC:*_*_*_CC_FLAGS = -O0 -Wno-unused-variable\r
+\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 9.00\r
+# Visual Studio 2005\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RawIp4Rx", "RawIp4Rx.vcproj", "{FAD3909F-E05E-4A2A-9681-7C474EAC5025}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Win32 = Debug|Win32\r
+ Release|Win32 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {FAD3909F-E05E-4A2A-9681-7C474EAC5025}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {FAD3909F-E05E-4A2A-9681-7C474EAC5025}.Debug|Win32.Build.0 = Debug|Win32\r
+ {FAD3909F-E05E-4A2A-9681-7C474EAC5025}.Release|Win32.ActiveCfg = Release|Win32\r
+ {FAD3909F-E05E-4A2A-9681-7C474EAC5025}.Release|Win32.Build.0 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="8.00"\r
+ Name="RawIp4Rx"\r
+ ProjectGUID="{FAD3909F-E05E-4A2A-9681-7C474EAC5025}"\r
+ RootNamespace="RawIp4Rx"\r
+ Keyword="Win32Proj"\r
+ >\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"\r
+ />\r
+ </Platforms>\r
+ <ToolFiles>\r
+ </ToolFiles>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="1"\r
+ CharacterSet="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories=".."\r
+ PreprocessorDefinitions="BUILD_FOR_WINDOWS"\r
+ MinimalRebuild="true"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ UsePrecompiledHeader="0"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="4"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="ws2_32.lib"\r
+ LinkIncremental="2"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="1"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="1"\r
+ CharacterSet="1"\r
+ WholeProgramOptimization="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=".."\r
+ PreprocessorDefinitions="BUILD_FOR_WINDOWS"\r
+ RuntimeLibrary="2"\r
+ UsePrecompiledHeader="0"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="3"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="ws2_32.lib"\r
+ LinkIncremental="1"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="1"\r
+ OptimizeReferences="2"\r
+ EnableCOMDATFolding="2"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <Filter\r
+ Name="Source Files"\r
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+ >\r
+ <File\r
+ RelativePath=".\main.c"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\RawIp4Rx.c"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Header Files"\r
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+ >\r
+ <File\r
+ RelativePath="..\RawIp4Rx.h"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Resource Files"\r
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+ >\r
+ </Filter>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
--- /dev/null
+/** @file\r
+ Windows version of the raw IP4 receive application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include <RawIp4Rx.h>\r
+\r
+\r
+/**\r
+ Receive raw IP4 packets from a remote system.\r
+\r
+ Please note that this program must be run with administrator privileges!\r
+\r
+ @param [in] argc The number of arguments\r
+ @param [in] argv The argument value array\r
+\r
+ @retval 0 The application exited normally.\r
+ @retval Other An error occurred.\r
+**/\r
+int\r
+main(\r
+ int argc,\r
+ char ** argv\r
+ )\r
+{\r
+ int RetVal;\r
+ WSADATA WsaData;\r
+\r
+ //\r
+ // Initialize the WinSock layer\r
+ //\r
+ RetVal = WSAStartup ( MAKEWORD ( 2, 2 ), &WsaData );\r
+ if ( 0 == RetVal ) {\r
+ //\r
+ // Start the application\r
+ //\r
+ RetVal = RawIp4Rx ( argc, argv );\r
+ if ( WSAEACCES == RetVal ) {\r
+ printf ( "Requires administrator privileges to run!\r\n" );\r
+ }\r
+\r
+ //\r
+ // Done with the WinSock layer\r
+ //\r
+ WSACleanup ( );\r
+ }\r
+\r
+ //\r
+ // Return the final result\r
+ //\r
+ return RetVal; \r
+}\r
--- /dev/null
+/** @file\r
+ Raw IP4 transmit test application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include "RawIp4Tx.h"\r
+\r
+\r
+/**\r
+ Transmit raw IP4 packets to the remote system.\r
+\r
+ @param [in] Argc The number of arguments\r
+ @param [in] Argv The argument value array\r
+\r
+ @retval 0 The application exited normally.\r
+ @retval Other An error occurred.\r
+**/\r
+int\r
+main (\r
+ IN int Argc,\r
+ IN char **Argv\r
+ )\r
+{\r
+ int RetVal;\r
+\r
+ //\r
+ // Run the application\r
+ //\r
+ RetVal = RawIp4Tx ( Argc, Argv );\r
+\r
+ //\r
+ // Return the operation status\r
+ //\r
+ return RetVal;\r
+}\r
--- /dev/null
+/** @file\r
+ Raw IP4 transmit application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include "RawIp4Tx.h"\r
+\r
+UINT8 mBuffer[1024];\r
+\r
+/**\r
+ Transmit raw IP4 packets to the remote system.\r
+\r
+ @param [in] ArgC Argument count\r
+ @param [in] ArgV Argument value array\r
+\r
+ @retval 0 Successfully operation\r
+ **/\r
+\r
+int\r
+RawIp4Tx (\r
+ IN int ArgC,\r
+ IN char **ArgV\r
+ )\r
+{\r
+ UINT32 BytesSent;\r
+ ssize_t BytesTransmitted;\r
+ struct sockaddr_in LocalPort;\r
+ UINT32 RemoteAddress[4];\r
+ struct sockaddr_in RemotePort;\r
+ int RetVal;\r
+ UINT32 TotalSent;\r
+ SOCKET s;\r
+\r
+ //\r
+ // Create the socket\r
+ //\r
+ s = socket ( AF_INET, SOCK_RAW, RAW_PROTOCOL );\r
+ if ( -1 == s ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - socket error, errno: %d\r\n", RetVal );\r
+ }\r
+ else {\r
+ //\r
+ // Use for/break; instead of goto\r
+ //\r
+ for ( ; ; ) {\r
+ //\r
+ // Validate the arguments\r
+ //\r
+ if (( 2 > ArgC )\r
+ || ( 4 != sscanf ( ArgV[1],\r
+ "%d.%d.%d.%d",\r
+ &RemoteAddress[0],\r
+ &RemoteAddress[1],\r
+ &RemoteAddress[2],\r
+ &RemoteAddress[3]))\r
+ || ( 224 < RemoteAddress[0])\r
+ || ( 255 < RemoteAddress[1])\r
+ || ( 255 < RemoteAddress[2])\r
+ || ( 255 < RemoteAddress[3])\r
+ || (( 0 == RemoteAddress[0])\r
+ && ( 0 == RemoteAddress[1])\r
+ && ( 0 == RemoteAddress[2])\r
+ && ( 0 == RemoteAddress[3]))) {\r
+ printf ( "%s <remote IP address>\r\n", ArgV[0]);\r
+ RetVal = EINVAL;\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Bind the socket to a local port\r
+ //\r
+ memset ( &LocalPort, 0, sizeof ( LocalPort ));\r
+ SIN_LEN ( LocalPort ) = sizeof ( LocalPort );\r
+ SIN_FAMILY ( LocalPort ) = AF_INET;\r
+ SIN_ADDR ( LocalPort ) = 0;\r
+ SIN_PORT ( LocalPort ) = 0;\r
+ RetVal = bind ( s,\r
+ (struct sockaddr *)&LocalPort,\r
+ sizeof ( LocalPort ));\r
+ if ( -1 == RetVal ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - bind error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Specify the remote port\r
+ //\r
+ memset ( &RemotePort, 0, sizeof ( RemotePort ));\r
+ SIN_LEN ( RemotePort ) = sizeof ( RemotePort );\r
+ SIN_FAMILY ( RemotePort ) = AF_INET;\r
+ SIN_ADDR ( RemotePort ) = ( RemoteAddress[3] << 24 )\r
+ | ( RemoteAddress[2] << 16 )\r
+ | ( RemoteAddress[1] << 8 )\r
+ | RemoteAddress[0];\r
+ SIN_PORT ( RemotePort ) = 0;\r
+\r
+ //\r
+ // Initialize the messages\r
+ //\r
+ memset ( &mBuffer[0], 0, sizeof ( mBuffer ));\r
+\r
+ //\r
+ // Send the data before the out-of-band message\r
+ //\r
+ TotalSent = 0;\r
+ BytesSent = 0;\r
+ do {\r
+ BytesTransmitted = sendto ( s,\r
+ &mBuffer[BytesSent],\r
+ sizeof ( mBuffer ) - BytesSent,\r
+ 0,\r
+ (struct sockaddr *)&RemotePort,\r
+ sizeof ( RemotePort ));\r
+ if ( -1 == BytesTransmitted ) {\r
+ RetVal = GET_ERRNO;\r
+ printf ( "ERROR - send before error, errno: %d\r\n", RetVal );\r
+ break;\r
+ }\r
+ BytesSent += (UINT32)BytesTransmitted;\r
+ RetVal = 0;\r
+ } while ( sizeof ( mBuffer ) > BytesSent );\r
+ if ( 0 != RetVal ) {\r
+ break;\r
+ }\r
+ TotalSent += BytesSent;\r
+\r
+ //\r
+ // Test completed successfully\r
+ //\r
+ if ( 0 == RetVal ) {\r
+ printf ( "Bytes sent: %8d\r\n", TotalSent );\r
+ }\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Close the socket\r
+ //\r
+ CLOSE_SOCKET ( s );\r
+ }\r
+\r
+ //\r
+ // Return the operation status\r
+ //\r
+ return RetVal;\r
+}\r
--- /dev/null
+/** @file\r
+ Definitions for the raw IP4 transmit application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#ifndef _RAW_IP4_TX_H_\r
+#define _RAW_IP4_TX_H_\r
+\r
+//------------------------------------------------------------------------------\r
+// Include Files\r
+//------------------------------------------------------------------------------\r
+\r
+#ifdef BUILD_FOR_WINDOWS\r
+//\r
+// Build for Windows environment\r
+//\r
+\r
+#include <winsock2.h>\r
+\r
+#define CHAR8 char\r
+#define CLOSE_SOCKET closesocket\r
+#define EINVAL 22 // Invalid argument\r
+#define GET_ERRNO WSAGetLastError ( )\r
+#define SIN_ADDR(port) port.sin_addr.S_un.S_addr\r
+#define SIN_FAMILY(port) port.sin_family\r
+#define SIN_LEN(port) port.sin_family\r
+#define SIN_PORT(port) port.sin_port\r
+#define socklen_t int\r
+#define ssize_t int\r
+\r
+#else // BUILD_FOR_WINDOWS\r
+//\r
+// Build for EFI environment\r
+//\r
+\r
+#include <Uefi.h>\r
+#include <errno.h>\r
+#include <stdlib.h>\r
+\r
+#include <netinet/in.h>\r
+\r
+#include <sys/EfiSysCall.h>\r
+#include <sys/endian.h>\r
+#include <sys/socket.h>\r
+\r
+#define CLOSE_SOCKET close\r
+#define GET_ERRNO errno\r
+#define SIN_ADDR(port) port.sin_addr.s_addr\r
+#define SIN_FAMILY(port) port.sin_family\r
+#define SIN_LEN(port) port.sin_len\r
+#define SIN_PORT(port) port.sin_port\r
+#define SOCKET int\r
+\r
+#endif // BUILD_FOR_WINDOWS\r
+\r
+#include <stdio.h>\r
+\r
+//------------------------------------------------------------------------------\r
+// Constants\r
+//------------------------------------------------------------------------------\r
+\r
+//\r
+// See http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml\r
+// and http://tools.ietf.org/html/rfc3692\r
+//\r
+#define RAW_PROTOCOL 253\r
+\r
+//------------------------------------------------------------------------------\r
+// API\r
+//------------------------------------------------------------------------------\r
+\r
+/**\r
+ Transmit raw IP4 packets to the remote system.\r
+\r
+ @param [in] ArgC Argument count\r
+ @param [in] ArgV Argument value array\r
+\r
+ @retval 0 Successfully operation\r
+ **/\r
+\r
+int\r
+RawIp4Tx (\r
+ IN int ArgC,\r
+ IN char **ArgV\r
+ );\r
+\r
+//------------------------------------------------------------------------------\r
+\r
+#endif // _RAW_IP4_TX_H_
\ No newline at end of file
--- /dev/null
+#/** @file\r
+# RawIp4Tx Application\r
+#\r
+# This file contains an 'Intel Peripheral Driver' and is \r
+# licensed for Intel CPUs and chipsets under the terms of your\r
+# license agreement with Intel or your vendor. This file may \r
+# be modified by the user, subject to additional terms of the \r
+# license agreement \r
+#\r
+#\r
+# Copyright (c) 20011 Intel Corporation. All rights reserved\r
+# This software and associated documentation (if any) is furnished\r
+# under a license and may only be used or copied in accordance\r
+# with the terms of the license. Except as permitted by such\r
+# license, no part of this software or documentation may be\r
+# reproduced, stored in a retrieval system, or transmitted in any\r
+# form or by any means without the express written consent of\r
+# Intel Corporation.\r
+#\r
+##\r
+\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = RawIp4Tx\r
+ FILE_GUID = 3DFE0FAB-70C7-4b53-9855-985F14DB2DDA\r
+ MODULE_TYPE = UEFI_APPLICATION\r
+ VERSION_STRING = 1.0\r
+ ENTRY_POINT = ShellCEntryLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+ Main.c\r
+ RawIp4Tx.c\r
+\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ ShellPkg/ShellPkg.dec\r
+ StdLib/StdLib.dec\r
+\r
+\r
+[LibraryClasses]\r
+ BaseMemoryLib\r
+ BsdSocketLib\r
+ DebugLib\r
+ EfiSocketLib\r
+ LibC\r
+ LibMath\r
+ ShellCEntryLib\r
+ UefiBootServicesTableLib\r
+ UefiLib\r
+# UseSocketDxe\r
+\r
+[BuildOptions]\r
+ INTEL:*_*_*_CC_FLAGS = /Qdiag-disable:181,186\r
+ MSFT:*_*_*_CC_FLAGS = /Od\r
+ GCC:*_*_*_CC_FLAGS = -O0 -Wno-unused-variable\r
+\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 9.00\r
+# Visual Studio 2005\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RawIp4Tx", "RawIp4Tx.vcproj", "{11018D35-F3E3-40F4-9213-7D277AF01A17}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Win32 = Debug|Win32\r
+ Release|Win32 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {11018D35-F3E3-40F4-9213-7D277AF01A17}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {11018D35-F3E3-40F4-9213-7D277AF01A17}.Debug|Win32.Build.0 = Debug|Win32\r
+ {11018D35-F3E3-40F4-9213-7D277AF01A17}.Release|Win32.ActiveCfg = Release|Win32\r
+ {11018D35-F3E3-40F4-9213-7D277AF01A17}.Release|Win32.Build.0 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="8.00"\r
+ Name="RawIp4Tx"\r
+ ProjectGUID="{11018D35-F3E3-40F4-9213-7D277AF01A17}"\r
+ RootNamespace="RawIp4Tx"\r
+ Keyword="Win32Proj"\r
+ >\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"\r
+ />\r
+ </Platforms>\r
+ <ToolFiles>\r
+ </ToolFiles>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="1"\r
+ CharacterSet="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ AdditionalIncludeDirectories=".."\r
+ PreprocessorDefinitions="BUILD_FOR_WINDOWS; _CRT_SECURE_NO_DEPRECATE"\r
+ MinimalRebuild="true"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="3"\r
+ UsePrecompiledHeader="0"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="4"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="WS2_32.lib"\r
+ LinkIncremental="2"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="1"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+ IntermediateDirectory="$(ConfigurationName)"\r
+ ConfigurationType="1"\r
+ CharacterSet="1"\r
+ WholeProgramOptimization="1"\r
+ >\r
+ <Tool\r
+ Name="VCPreBuildEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCCustomBuildTool"\r
+ />\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"\r
+ />\r
+ <Tool\r
+ Name="VCMIDLTool"\r
+ />\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ AdditionalIncludeDirectories=".."\r
+ PreprocessorDefinitions="BUILD_FOR_WINDOWS; _CRT_SECURE_NO_DEPRECATE"\r
+ RuntimeLibrary="2"\r
+ UsePrecompiledHeader="0"\r
+ BrowseInformation="1"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="true"\r
+ DebugInformationFormat="3"\r
+ />\r
+ <Tool\r
+ Name="VCManagedResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCResourceCompilerTool"\r
+ />\r
+ <Tool\r
+ Name="VCPreLinkEventTool"\r
+ />\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ AdditionalDependencies="WS2_32.lib"\r
+ LinkIncremental="1"\r
+ GenerateDebugInformation="true"\r
+ SubSystem="1"\r
+ OptimizeReferences="2"\r
+ EnableCOMDATFolding="2"\r
+ TargetMachine="1"\r
+ />\r
+ <Tool\r
+ Name="VCALinkTool"\r
+ />\r
+ <Tool\r
+ Name="VCManifestTool"\r
+ />\r
+ <Tool\r
+ Name="VCXDCMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCBscMakeTool"\r
+ />\r
+ <Tool\r
+ Name="VCFxCopTool"\r
+ />\r
+ <Tool\r
+ Name="VCAppVerifierTool"\r
+ />\r
+ <Tool\r
+ Name="VCWebDeploymentTool"\r
+ />\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ />\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <Filter\r
+ Name="Source Files"\r
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+ >\r
+ <File\r
+ RelativePath=".\main.c"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\RawIp4Tx.c"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Header Files"\r
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+ >\r
+ <File\r
+ RelativePath="..\RawIp4Tx.h"\r
+ >\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Resource Files"\r
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+ >\r
+ </Filter>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
--- /dev/null
+/** @file\r
+ Windows version of the raw IP4 transmit application\r
+\r
+ Copyright (c) 2011, 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
+\r
+**/\r
+\r
+#include <RawIp4Tx.h>\r
+\r
+\r
+/**\r
+ Transmit raw IP4 packets to the remote system.\r
+\r
+ Please note that this program must be run with administrator privileges!\r
+\r
+ @param [in] argc The number of arguments\r
+ @param [in] argv The argument value array\r
+\r
+ @retval 0 The application exited normally.\r
+ @retval Other An error occurred.\r
+**/\r
+int\r
+main(\r
+ int argc,\r
+ char ** argv\r
+ )\r
+{\r
+ int RetVal;\r
+ WSADATA WsaData;\r
+\r
+ //\r
+ // Initialize the WinSock layer\r
+ //\r
+ RetVal = WSAStartup ( MAKEWORD ( 2, 2 ), &WsaData );\r
+ if ( 0 == RetVal ) {\r
+ //\r
+ // Start the application\r
+ // See http://msdn.microsoft.com/en-us/library/ms740548(v=vs.85).aspx\r
+ //\r
+ RetVal = RawIp4Tx ( argc, argv );\r
+ if ( WSAEACCES == RetVal ) {\r
+ printf ( "Requires administrator privileges to run!\r\n" );\r
+ }\r
+\r
+ //\r
+ // Done with the WinSock layer\r
+ //\r
+ WSACleanup ( );\r
+ }\r
+\r
+ //\r
+ // Return the final result\r
+ //\r
+ return RetVal; \r
+}\r
--- /dev/null
+Users of the socket library need to do the following:\r
+\r
+\95 Use the development branch: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/EADK/\r
+\95 Create an Efi\etc directory on their system or USB flash device\r
+\95 Copy the files from StdLib\Efi\etc into that directory\r
+\95 Edit the files appropriately\r
+ o Set the correct DNS servers in resolv.conf\r
+ o Set the search order in host.conf\r
+\95 At the EFI shell\r
+ o Set the device containing the \Efi directory as the default device\r
+ o Run the socket application\r
#include <sys/socket.h>\r
#include <sys/time.h>\r
\r
-UINT8 mBuffer [ 65536 ];\r
+UINT8 mBuffer[ 65536 ];\r
\r
/**\r
Receive a datagram\r
\r
#include <sys/socket.h>\r
\r
-char mBuffer [65536];\r
+char mBuffer[65536];\r
\r
\r
/**\r
DATA_TYPE DataType;\r
} OPTIONS;\r
\r
-CONST OPTIONS mOptions [] = {\r
+CONST OPTIONS mOptions[] = {\r
{ "SO_ACCEPTCONN", SO_ACCEPTCONN, SOL_SOCKET, FALSE, DATA_TYPE_UNKNOWN },\r
{ "SO_BROADCAST", SO_BROADCAST, SOL_SOCKET, TRUE, DATA_TYPE_UNKNOWN },\r
{ "SO_DEBUG", SO_DEBUG, SOL_SOCKET, TRUE, DATA_TYPE_UNKNOWN },\r
};\r
\r
\r
-UINT8 mBuffer [ 65536 ];\r
-UINT8 mValue [ 65536 ];\r
-char * mSocketType [] = {\r
+UINT8 mBuffer[ 65536 ];\r
+UINT8 mValue[ 65536 ];\r
+char * mSocketType[] = {\r
"SOCK_STREAM",\r
"SOCK_DGRAM",\r
"SOCK_RAW",\r
// Display the value\r
//\r
Value.u8 = &mBuffer[0];\r
- switch ( pOption->DataType )\r
- {\r
+ switch ( pOption->DataType ) {\r
case DATA_TYPE_UNKNOWN:\r
Print ( L"%a:", pOption->pOptionName );\r
- pEnd = &Value.u8 [ LengthInBytes ];\r
+ pEnd = &Value.u8[ LengthInBytes ];\r
while ( pEnd > Value.u8 ) {\r
Print ( L" %02x", *Value.u8 );\r
Value.u8 += 1;\r
case DATA_TYPE_SOCKET_TYPE:\r
if ( 4 == LengthInBytes ) {\r
if (( SOCK_STREAM <= *Value.i32 ) && ( SOCK_SEQPACKET >= *Value.i32 )) {\r
- pString = mSocketType [ *Value.i32 - SOCK_STREAM ];\r
+ pString = mSocketType[ *Value.i32 - SOCK_STREAM ];\r
Print ( L"%a", pString );\r
}\r
else {\r
//\r
BytesToWrite = 0;\r
if (( 3 > Argc )\r
- || ( 0 < ( BytesToWrite = GetOptionValue ( pOption, Argv [2])))) {\r
+ || ( 0 < ( BytesToWrite = GetOptionValue ( pOption, Argv[2])))) {\r
//\r
// Get the socket\r
//\r
AppPkg/Applications/Sockets/GetNetByName/GetNetByName.inf\r
AppPkg/Applications/Sockets/GetServByName/GetServByName.inf\r
AppPkg/Applications/Sockets/GetServByPort/GetServByPort.inf\r
+ AppPkg/Applications/Sockets/OobRx/OobRx.inf\r
+ AppPkg/Applications/Sockets/OobTx/OobTx.inf\r
+ AppPkg/Applications/Sockets/RawIp4Rx/RawIp4Rx.inf\r
+ AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.inf\r
AppPkg/Applications/Sockets/RecvDgram/RecvDgram.inf\r
AppPkg/Applications/Sockets/SetHostName/SetHostName.inf\r
AppPkg/Applications/Sockets/SetSockOpt/SetSockOpt.inf\r
bIgnorePacket = TRUE;\r
break;\r
}\r
- if ( pTftpServer->RxBytes > (ssize_t)( pContext->BlockSize + 2 + 2 ))\r
- {\r
+ if ( pTftpServer->RxBytes > (ssize_t)( pContext->BlockSize + 2 + 2 )) {\r
DEBUG (( DEBUG_ERROR,\r
"ERROR - Receive data length of %d > %d bytes (maximum block size) for pContext 0x%08x\r\n",\r
pTftpServer->RxBytes - 2 - 2,\r
"ACK for block 0x%04x received\r\n",\r
BlockNumber ));\r
if (( !pContext->bExpectAck )\r
- || ( BlockNumber != pContext->AckNext ))\r
- {\r
+ || ( BlockNumber != pContext->AckNext )) {\r
DEBUG (( DEBUG_WARN | DEBUG_TFTP_ACK,\r
"WARNING - Expecting ACK 0x%0x4 not received ACK 0x%08x\r\n",\r
pContext->AckNext,\r
pTftpServer->TftpPort.fd = socket ( AF_INET,\r
SOCK_DGRAM,\r
IPPROTO_UDP );\r
- if ( -1 != pTftpServer->TftpPort.fd )\r
- {\r
+ if ( -1 != pTftpServer->TftpPort.fd ) {\r
//\r
// Set the socket address\r
//\r
// Constants\r
//------------------------------------------------------------------------------\r
\r
-#define DEBUG_SOCKET_POLL 0x40000000 ///< Display the socket poll messages\r
-#define DEBUG_PORT_WORK 0x20000000 ///< Display the port work messages\r
-#define DEBUG_SERVER_TIMER 0x10000000 ///< Display the socket poll messages\r
-#define DEBUG_TFTP_PORT 0x08000000 ///< Display the TFTP port messages\r
-#define DEBUG_TFTP_REQUEST 0x04000000 ///< Display the TFTP request messages\r
-#define DEBUG_TX 0x02000000 ///< Display transmit messages\r
+#define DEBUG_PORT_WORK 0x40000000 ///< Display the port work messages\r
+#define DEBUG_SERVER_TIMER 0x20000000 ///< Display the socket poll messages\r
+#define DEBUG_TFTP_PORT 0x10000000 ///< Display the TFTP port messages\r
+#define DEBUG_TFTP_REQUEST 0x08000000 ///< Display the TFTP request messages\r
+#define DEBUG_TX 0x04000000 ///< Display transmit messages\r
+#define DEBUG_SOCKET_POLL 0x02000000 ///< Display the socket poll messages\r
#define DEBUG_RX 0x01000000 ///< Display receive messages\r
#define DEBUG_TFTP_ACK 0x00800000 ///< Display the TFTP ACK messages\r
\r
BOOLEAN bEofSent; ///< End of file sent\r
UINT8 * pBuffer; ///< Pointer into the file data\r
UINT8 * pEnd; ///< End of the file data\r
- UINT8 FileData [ 64 * TFTP_MAX_BLOCK_SIZE ]; ///< File data to send\r
+ UINT8 FileData[ 64 * TFTP_MAX_BLOCK_SIZE ]; ///< File data to send\r
\r
//\r
// Buffer management\r
//\r
ssize_t TxBytes; ///< Bytes in the TX buffer\r
- UINT8 TxBuffer [ 2 + 2 + TFTP_MAX_BLOCK_SIZE ]; ///< Transmit buffer\r
+ UINT8 TxBuffer[ 2 + 2 + TFTP_MAX_BLOCK_SIZE ]; ///< Transmit buffer\r
}GCC_TSDT_CONNECTION_CONTEXT;\r
\r
/**\r
//\r
struct sockaddr_in RemoteAddress; ///< Remote address\r
ssize_t RxBytes; ///< Receive data length in bytes\r
- UINT8 RxBuffer [ 2 + 2 + TFTP_MAX_BLOCK_SIZE ]; ///< Receive buffer\r
+ UINT8 RxBuffer[ 2 + 2 + TFTP_MAX_BLOCK_SIZE ]; ///< Receive buffer\r
\r
//\r
// Client port management\r
UINT16 IapcBootArch; // 109\r
UINT8 Reserved2; // 111\r
UINT32 Flags; // 112\r
- UINT32 ResetReg [3]; // 116\r
+ UINT32 ResetReg[3]; // 116\r
UINT8 ResetValue; // 128\r
- UINT8 Reserved3 [3]; // 129\r
+ UINT8 Reserved3[3]; // 129\r
UINT64 XFirmwareCtrl; // 132\r
UINT64 XDsdt; // 140\r
- UINT32 XPm1aEvtBlk [3]; // 148\r
- UINT32 XPm1bEvtBlk [3]; // 160\r
- UINT32 XPm1aCntBlk [3]; // 172\r
- UINT32 XPm1bCntBlk [3]; // 184\r
- UINT32 XPm2CntBlk [3]; // 196\r
- UINT32 XPmTmrBlk [3]; // 208\r
- UINT32 XGpe0Blk [3]; // 220\r
- UINT32 XGpe1Blk [3]; // 232\r
+ UINT32 XPm1aEvtBlk[3]; // 148\r
+ UINT32 XPm1bEvtBlk[3]; // 160\r
+ UINT32 XPm1aCntBlk[3]; // 172\r
+ UINT32 XPm1bCntBlk[3]; // 184\r
+ UINT32 XPm2CntBlk[3]; // 196\r
+ UINT32 XPmTmrBlk[3]; // 208\r
+ UINT32 XGpe0Blk[3]; // 220\r
+ UINT32 XGpe1Blk[3]; // 232\r
} ACPI_FADT;\r
\r
\r
} TABLE_SIGNATURE;\r
\r
\r
-CONST TABLE_SIGNATURE mTableId [] = {\r
+CONST TABLE_SIGNATURE mTableId[] = {\r
{ DSDT_SIGNATURE, "DSDT", PAGE_ACPI_DSDT },\r
{ FADT_SIGNATURE, "FADT", PAGE_ACPI_FADT }\r
};\r
//\r
// Walk the list of entries\r
//\r
- pEntry = &pRsdt->Entry [ 0 ];\r
- pEnd = &pEntry [(( pRsdt->Length - sizeof ( *pRsdt )) >> 2 ) + 1 ];\r
+ pEntry = &pRsdt->Entry[ 0 ];\r
+ pEnd = &pEntry[(( pRsdt->Length - sizeof ( *pRsdt )) >> 2 ) + 1 ];\r
while ( pEnd > pEntry ) {\r
//\r
// The entry is actually a 32-bit physical table address\r
// Display the characters\r
//\r
pData = pChar;\r
- pEnd = &pChar [ Length ];\r
+ pEnd = &pChar[ Length ];\r
while ( pEnd > pData ) {\r
Status = HttpSendCharacter ( SocketFD,\r
pPort,\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
- pEnd = &pData [ ByteCount ];\r
+ pEnd = &pData[ ByteCount ];\r
while ( pEnd > pData ) {\r
Status = HttpSendHexBits ( SocketFD,\r
pPort,\r
// Walk the list of tables\r
//\r
Signature = *pSignature;\r
- pTableId = &mTableId [ 0 ];\r
- pEnd = &pTableId [ sizeof ( mTableId ) / sizeof ( mTableId [ 0 ])];\r
+ pTableId = &mTableId[ 0 ];\r
+ pEnd = &pTableId[ sizeof ( mTableId ) / sizeof ( mTableId[ 0 ])];\r
while ( pEnd > pTableId ) {\r
//\r
// Attempt to locate the table signature\r
pPort,\r
"OEMID",\r
sizeof ( pDsdt->OemId ),\r
- &pDsdt->OemId [ 0 ]);\r
+ &pDsdt->OemId[ 0 ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
pPort,\r
"OEM Table ID",\r
sizeof ( pDsdt->OemTableId ),\r
- &pDsdt->OemTableId [ 0 ]);\r
+ &pDsdt->OemTableId[ 0 ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
pPort,\r
"OEMID",\r
sizeof ( pFadt->OemId ),\r
- &pFadt->OemId [ 0 ]);\r
+ &pFadt->OemId[ 0 ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
pPort,\r
"OEM Table ID",\r
sizeof ( pFadt->OemTableId ),\r
- &pFadt->OemTableId [ 0 ]);\r
+ &pFadt->OemTableId[ 0 ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
pPort,\r
"OemId",\r
sizeof ( pRsdp10b->OemId ),\r
- &pRsdp10b->OemId [ 0 ]);\r
+ &pRsdp10b->OemId[ 0 ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
pPort,\r
"OemId",\r
sizeof ( pRsdp30->OemId ),\r
- &pRsdp30->OemId [ 0 ]);\r
+ &pRsdp30->OemId[ 0 ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
pPort,\r
"Reserved",\r
sizeof ( pRsdp30->Reserved ),\r
- &pRsdp30->Reserved [ 0 ]);\r
+ &pRsdp30->Reserved[ 0 ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
CONST CHAR8 * pTableName;\r
CONST CHAR16 * pWebPage;\r
EFI_STATUS Status;\r
- UINT32 TableName [ 2 ];\r
+ UINT32 TableName[ 2 ];\r
\r
DBG_ENTER ( );\r
\r
pPort,\r
"OEMID",\r
sizeof ( pRsdt->OemId ),\r
- &pRsdt->OemId [ 0 ]);\r
+ &pRsdt->OemId[ 0 ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
pPort,\r
"OEM Table ID",\r
sizeof ( pRsdt->OemTableId ),\r
- &pRsdt->OemTableId [ 0 ]);\r
+ &pRsdt->OemTableId[ 0 ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
//\r
// Walk the list of entries\r
//\r
- pEntry = &pRsdt->Entry [ 0 ];\r
- pEnd = &pEntry [(( pRsdt->Length - sizeof ( *pRsdt )) >> 2 ) + 1 ];\r
- TableName [ 1 ] = 0;\r
+ pEntry = &pRsdt->Entry[ 0 ];\r
+ pEnd = &pEntry[(( pRsdt->Length - sizeof ( *pRsdt )) >> 2 ) + 1 ];\r
+ TableName[ 1 ] = 0;\r
while ( pEnd > pEntry ) {\r
//\r
// The entry is actually a 32-bit physical table address\r
// The first entry in the table is the 32-bit table signature\r
//\r
- TableName [ 0 ] = *(UINT32 *)*pEntry;\r
- pWebPage = SignatureLookup ( &TableName [ 0 ], &pTableName );\r
+ TableName[ 0 ] = *(UINT32 *)*pEntry;\r
+ pWebPage = SignatureLookup ( &TableName[ 0 ], &pTableName );\r
\r
//\r
// Display the table address\r
CHAR16 * pWebPage;
} GUID_NAME;
-CONST GUID_NAME mGuidName [] = {
+CONST GUID_NAME mGuidName[] = {
{ L"gEfiAcpi10TableGuid", &gEfiAcpi10TableGuid, PAGE_ACPI_RSDP_10B },
{ L"gEfiAcpiTableGuid", &gEfiAcpiTableGuid, PAGE_ACPI_RSDP_30 },
{ L"gEfiDebugImageInfoTableGuid", &gEfiDebugImageInfoTableGuid, NULL },
// Determine if this is a known GUID
//
pGuidName = &mGuidName[0];
- pGuidNameEnd = &pGuidName [ sizeof ( mGuidName ) / sizeof ( mGuidName[0])];
+ pGuidNameEnd = &pGuidName[ sizeof ( mGuidName ) / sizeof ( mGuidName[0])];
while ( pGuidNameEnd > pGuidName ) {
if ( CompareGuid ( pGuidName->pGuid, pGuid )) {
//
// Determine the location of the configuration tables
//
pTable = gST->ConfigurationTable;
- pEnd = &pTable [ gST->NumberOfTableEntries ];
+ pEnd = &pTable[ gST->NumberOfTableEntries ];
while ( pEnd > pTable ) {
Status = RowGuid ( SocketFD,
pPort,
// Attempt to parse the command\r
//\r
pData = &pPort->Request[0];\r
- pEnd = &pData [ pPort->RequestLength ];\r
+ pEnd = &pData[ pPort->RequestLength ];\r
pVerb = pData;\r
pWebPage = HttpReplaceSpace ( pVerb, pEnd );\r
if ( pEnd <= pWebPage ) {\r
// Walk the page table\r
//\r
pPage = &mPageList[0];\r
- pPageEnd = &pPage [ mPageCount ];\r
+ pPageEnd = &pPage[ mPageCount ];\r
while ( pPageEnd > pPage ) {\r
//\r
// Determine if the page was located\r
//\r
MaxBytes = sizeof ( pPort->TxBuffer );\r
DataBytes = MaxBytes - pPort->TxBytes;\r
- if ( DataBytes > LengthInBytes )\r
- {\r
+ if ( DataBytes > LengthInBytes ) {\r
DataBytes = LengthInBytes;\r
}\r
\r
//\r
// Copy the data into the buffer\r
//\r
- CopyMem ( &pPort->TxBuffer [ pPort->TxBytes ],\r
+ CopyMem ( &pPort->TxBuffer[ pPort->TxBytes ],\r
pBuffer,\r
DataBytes );\r
\r
//\r
// Walk the bytes to be displayed\r
//\r
- pEnd = &pData [ ByteCount ];\r
+ pEnd = &pData[ ByteCount ];\r
while ( pEnd > pData ) {\r
//\r
// Display the address\r
if (( BYTES_ON_A_LINE - InitialSpaces ) < BytesToDisplay ) {\r
BytesToDisplay = BYTES_ON_A_LINE - InitialSpaces;\r
}\r
- pDataEnd = &pData [ BytesToDisplay ];\r
+ pDataEnd = &pData[ BytesToDisplay ];\r
pTemp = pData;\r
while ( pDataEnd > pTemp ) {\r
Status = HttpSendHexBits ( SocketFD,\r
Status = HttpSendHexBits ( SocketFD,\r
pPort,\r
8,\r
- pGuid->Data4 [ Index ]);\r
+ pGuid->Data4[ Index ]);\r
if ( EFI_ERROR ( Status )) {\r
break;\r
}\r
UINT64 Digit;\r
CONST UINT64 * pEnd;\r
CONST UINT64 * pDivisor;\r
- CONST UINT64 pDivisors [ ] = {\r
+ CONST UINT64 pDivisors[ ] = {\r
10000000000000000000L,\r
1000000000000000000L,\r
100000000000000000L,\r
//\r
bDisplayZeros = FALSE;\r
pDivisor = &pDivisors[0];\r
- pEnd = &pDivisor [ sizeof ( pDivisors ) / sizeof ( pDivisors [0])];\r
+ pEnd = &pDivisor[ sizeof ( pDivisors ) / sizeof ( pDivisors[0])];\r
while ( pEnd > pDivisor ) {\r
//\r
// Determine the next digit\r
/**
List of pages in the system
**/
-CONST DT_PAGE mPageList [] = {
+CONST DT_PAGE mPageList[] = {
//
// The index page must be first
// Initialize the new entries in the FD list
//
for ( ; MaxEntriesNew > Index; Index++ ) {
- pFdListNew [ Index ].fd = -1;
- pFdListNew [ Index ].events = 0;
- pFdListNew [ Index ].revents = 0;
+ pFdListNew[ Index ].fd = -1;
+ pFdListNew[ Index ].events = 0;
+ pFdListNew[ Index ].revents = 0;
}
//
// Initialize the new entries in the port list
//
for ( ; MaxEntriesNew > Index; Index++ ) {
- ppPortListNew [ Index ] = NULL;
+ ppPortListNew[ Index ] = NULL;
}
//
//
// Add the socket to the FD list
//
- pFdList [ pWebServer->Entries ].fd = SocketFD;
- pFdList [ pWebServer->Entries ].events = POLLRDNORM
+ pFdList[ pWebServer->Entries ].fd = SocketFD;
+ pFdList[ pWebServer->Entries ].events = POLLRDNORM
| POLLHUP;
- pFdList [ pWebServer->Entries ].revents = 0;
+ pFdList[ pWebServer->Entries ].revents = 0;
//
// Add the port to the port list
//
- pWebServer->ppPortList [ pWebServer->Entries ] = pPort;
+ pWebServer->ppPortList[ pWebServer->Entries ] = pPort;
//
// Account for the new entry
//
// Locate the specified socket file descriptor
//
- if ( SocketFD == pFdList [ Index ].fd ) {
+ if ( SocketFD == pFdList[ Index ].fd ) {
//
// Determine if this is the listen port
//
//
// Free the port structure
//
- gBS->FreePool ( ppPortList [ Index ]);
+ gBS->FreePool ( ppPortList[ Index ]);
//
// Remove this port from the list by copying
//
Entries -= 1;
for ( ; Entries > Index; Index++ ) {
- pFdList [ Index ] = pFdList [ Index + 1 ];
- ppPortList [ Index ] = ppPortList [ Index + 1 ];
+ pFdList[ Index ] = pFdList[ Index + 1 ];
+ ppPortList[ Index ] = ppPortList[ Index + 1 ];
}
- pFdList [ Index ].fd = -1;
- pFdList [ Index ].events = 0;
- pFdList [ Index ].revents = 0;
- ppPortList [ Index ] = NULL;
+ pFdList[ Index ].fd = -1;
+ pFdList[ Index ].events = 0;
+ pFdList[ Index ].revents = 0;
+ ppPortList[ Index ] = NULL;
//
// Update the number of entries in the list
}
}
}
- else
- {
+ else {
//
// Receive the file data
//
pWebServer->HttpListenPort = socket ( AF_INET,
SOCK_STREAM,
IPPROTO_TCP );
- if ( -1 != pWebServer->HttpListenPort )
- {
+ if ( -1 != pWebServer->HttpListenPort ) {
//
// Set the socket address
//
\r
#endif // MDEPKG_NDEBUG\r
\r
-#define WEB_SERVER_SIGNATURE SIGNATURE_32('W','e','b','S') ///< DT_WEB_SERVER memory signature\r
+#define WEB_SERVER_SIGNATURE SIGNATURE_32 ('W','e','b','S') ///< DT_WEB_SERVER memory signature\r
\r
#define SPACES_ADDRESS_TO_DATA 2\r
#define BYTES_ON_A_LINE 16\r
//\r
size_t RequestLength; ///< Request length in bytes\r
size_t TxBytes; ///< Bytes in the TX buffer\r
- UINT8 Request [ 65536 ]; ///< Page request\r
- UINT8 RxBuffer [ 65536 ]; ///< Receive buffer\r
- UINT8 TxBuffer [ 65536 ]; ///< Transmit buffer\r
+ UINT8 Request[ 65536 ]; ///< Page request\r
+ UINT8 RxBuffer[ 65536 ]; ///< Receive buffer\r
+ UINT8 TxBuffer[ 65536 ]; ///< Transmit buffer\r
} WSDT_PORT;\r
\r
/**\r
WSDT_PORT ** ppPortList; ///< List of port management structures\r
} DT_WEB_SERVER;\r
\r
-//#define SERVER_FROM_SERVICE(a) CR(a, DT_WEB_SERVER, ServiceBinding, WEB_SERVER_SIGNATURE) ///< Locate DT_LAYER from service binding\r
+//#define SERVER_FROM_SERVICE(a) CR (a, DT_WEB_SERVER, ServiceBinding, WEB_SERVER_SIGNATURE) ///< Locate DT_LAYER from service binding\r
\r
extern DT_WEB_SERVER mWebServer;\r
\r
UINT16 * pDescription; ///< Description of the page\r
} DT_PAGE;\r
\r
-extern CONST DT_PAGE mPageList []; ///< List of pages\r
+extern CONST DT_PAGE mPageList[]; ///< List of pages\r
extern CONST UINTN mPageCount; ///< Number of pages\r
\r
//------------------------------------------------------------------------------\r