Update the sockets applications
* Builds with GCC 4.4 compiler. Signed-off by: lpleahy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12498 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -242,8 +242,7 @@ SocketNew (
|
|||||||
"0x%08x: Socket created\r\n",
|
"0x%08x: Socket created\r\n",
|
||||||
ListenSocket ));
|
ListenSocket ));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
Status = EFI_NOT_STARTED;
|
Status = EFI_NOT_STARTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,8 +435,7 @@ SocketPoll (
|
|||||||
//
|
//
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Display the connection
|
// Display the connection
|
||||||
//
|
//
|
||||||
@ -919,8 +917,7 @@ main (
|
|||||||
//
|
//
|
||||||
// Use for/break instead of goto
|
// Use for/break instead of goto
|
||||||
//
|
//
|
||||||
for ( ; ; )
|
for ( ; ; ) {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Create the timer
|
// Create the timer
|
||||||
//
|
//
|
||||||
|
@ -146,8 +146,7 @@ GetDigit (
|
|||||||
// Walk the digits
|
// Walk the digits
|
||||||
//
|
//
|
||||||
Value = 0;
|
Value = 0;
|
||||||
while (( '0' <= *pDigit ) && ( '9' >= *pDigit ))
|
while (( '0' <= *pDigit ) && ( '9' >= *pDigit )) {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Make room for the new least significant digit
|
// Make room for the new least significant digit
|
||||||
//
|
//
|
||||||
@ -494,8 +493,7 @@ SocketOpen (
|
|||||||
//
|
//
|
||||||
// Use do/while and break instead of goto
|
// Use do/while and break instead of goto
|
||||||
//
|
//
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Wait for the network layer to initialize
|
// Wait for the network layer to initialize
|
||||||
//
|
//
|
||||||
@ -1499,12 +1497,15 @@ main (
|
|||||||
//
|
//
|
||||||
// Validate the command line
|
// Validate the command line
|
||||||
//
|
//
|
||||||
if ( 2 != Argc ) {
|
if ( 2 > Argc ) {
|
||||||
Print ( L"%s <remote IP address>\r\n", Argv[0] );
|
Print ( L"%s <remote IP address> [Use TCP]\r\n", Argv[0] );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bTcp4 = TRUE;
|
//
|
||||||
|
// Determine if TCP should be used
|
||||||
|
//
|
||||||
|
bTcp4 = (BOOLEAN)( 2 < Argc );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine the support routines
|
// Determine the support routines
|
||||||
@ -1522,8 +1523,7 @@ bTcp4 = TRUE;
|
|||||||
//
|
//
|
||||||
// Use for/break instead of goto
|
// Use for/break instead of goto
|
||||||
//
|
//
|
||||||
for ( ; ; )
|
for ( ; ; ) {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// No bytes sent so far
|
// No bytes sent so far
|
||||||
//
|
//
|
||||||
@ -1540,10 +1540,6 @@ bTcp4 = TRUE;
|
|||||||
RemoteHostAddress.sin_family = AF_INET;
|
RemoteHostAddress.sin_family = AF_INET;
|
||||||
RemoteHostAddress.sin_port = htons ( PcdGet16 ( DataSource_Port ));
|
RemoteHostAddress.sin_port = htons ( PcdGet16 ( DataSource_Port ));
|
||||||
|
|
||||||
Print ( L"Argc: %d\r\n", Argc);
|
|
||||||
Print ( L"Argv[0]: %a\r\n", Argv[0]);
|
|
||||||
Print ( L"Argv[1]: %a\r\n", Argv[1]);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the IP address
|
// Get the IP address
|
||||||
//
|
//
|
||||||
|
44
AppPkg/Applications/Sockets/OobRx/Main.c
Normal file
44
AppPkg/Applications/Sockets/OobRx/Main.c
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/** @file
|
||||||
|
Out-of-band receive test application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <OobRx.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Receive out-of-band messages from the remote system.
|
||||||
|
|
||||||
|
@param [in] Argc The number of arguments
|
||||||
|
@param [in] Argv The argument value array
|
||||||
|
|
||||||
|
@retval 0 The application exited normally.
|
||||||
|
@retval Other An error occurred.
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
main (
|
||||||
|
IN int Argc,
|
||||||
|
IN char **Argv
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int RetVal;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Run the application
|
||||||
|
//
|
||||||
|
RetVal = OobRx ( Argc, Argv );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the operation status
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
253
AppPkg/Applications/Sockets/OobRx/OobRx.c
Normal file
253
AppPkg/Applications/Sockets/OobRx/OobRx.c
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
/** @file
|
||||||
|
Windows version of the OOB Receive application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <OobRx.h>
|
||||||
|
|
||||||
|
UINT8 mBuffer[65536];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Run the OOB receive application
|
||||||
|
|
||||||
|
@param [in] ArgC Argument count
|
||||||
|
@param [in] ArgV Argument value array
|
||||||
|
|
||||||
|
@retval 0 Successfully operation
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
OobRx (
|
||||||
|
IN int ArgC,
|
||||||
|
IN char **ArgV
|
||||||
|
)
|
||||||
|
{
|
||||||
|
SOCKET a;
|
||||||
|
ssize_t BytesReceived;
|
||||||
|
struct sockaddr_in LocalPort;
|
||||||
|
UINT32 OobInLine;
|
||||||
|
UINT16 PortNumber;
|
||||||
|
struct timeval ReceiveTimeout;
|
||||||
|
struct sockaddr_in RemotePort;
|
||||||
|
socklen_t RemotePortLength;
|
||||||
|
int RetVal;
|
||||||
|
SOCKET s;
|
||||||
|
UINT32 TransmittedBefore;
|
||||||
|
UINT32 TransmittedDuring;
|
||||||
|
UINT32 TransmittedOob;
|
||||||
|
UINT32 TransmittedAfter;
|
||||||
|
UINT32 * pTransmittedBytes;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create the socket
|
||||||
|
//
|
||||||
|
s = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP );
|
||||||
|
if ( -1 == s ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - socket error, errno: %d\r\n", RetVal );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//
|
||||||
|
// Use for/break; instead of goto
|
||||||
|
//
|
||||||
|
for ( ; ; ) {
|
||||||
|
//
|
||||||
|
// Bind the socket to a known port
|
||||||
|
//
|
||||||
|
PortNumber = OOB_RX_PORT;
|
||||||
|
memset ( &LocalPort, 0, sizeof ( LocalPort ));
|
||||||
|
SIN_LEN ( LocalPort ) = sizeof ( LocalPort );
|
||||||
|
SIN_FAMILY ( LocalPort ) = AF_INET;
|
||||||
|
SIN_ADDR ( LocalPort ) = 0;
|
||||||
|
SIN_PORT ( LocalPort ) = htons ( PortNumber );
|
||||||
|
RetVal = bind ( s,
|
||||||
|
(struct sockaddr *)&LocalPort,
|
||||||
|
sizeof ( LocalPort ));
|
||||||
|
if ( -1 == RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - bind error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make the port available on the server
|
||||||
|
//
|
||||||
|
RetVal = listen ( s, 2 );
|
||||||
|
if ( -1 == RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - listen error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Wait for a connection to the known port
|
||||||
|
//
|
||||||
|
RemotePortLength = sizeof ( RemotePort );
|
||||||
|
a = accept ( s,
|
||||||
|
(struct sockaddr *)&RemotePort,
|
||||||
|
&RemotePortLength );
|
||||||
|
if ( -1 == a ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - accept error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Use for/break instead of goto
|
||||||
|
//
|
||||||
|
for ( ; ; ) {
|
||||||
|
//
|
||||||
|
// Set the receive timeout
|
||||||
|
//
|
||||||
|
ReceiveTimeout.tv_sec = 0;
|
||||||
|
ReceiveTimeout.tv_usec = 20 * 1000;
|
||||||
|
RetVal = setsockopt ( a,
|
||||||
|
SOL_SOCKET,
|
||||||
|
SO_RCVTIMEO,
|
||||||
|
(char *)&ReceiveTimeout,
|
||||||
|
sizeof ( ReceiveTimeout ));
|
||||||
|
if ( -1 == RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - setsockopt RCVTIMEO error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select the OOB processing
|
||||||
|
//
|
||||||
|
OobInLine = ( 1 < ArgC );
|
||||||
|
RetVal = setsockopt ( s,
|
||||||
|
SOL_SOCKET,
|
||||||
|
SO_OOBINLINE,
|
||||||
|
(char *)&OobInLine,
|
||||||
|
sizeof ( OobInLine ));
|
||||||
|
if ( -1 == RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - setsockopt OOBINLINE error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf ( "%s\r\n", ( 0 != OobInLine ) ? "OOB messages are in-line"
|
||||||
|
: "OOB messages move to the head of the queue" );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Receive data from the remote system
|
||||||
|
//
|
||||||
|
TransmittedBefore = 0;
|
||||||
|
TransmittedOob = 0;
|
||||||
|
TransmittedDuring = 0;
|
||||||
|
TransmittedAfter = 0;
|
||||||
|
pTransmittedBytes = &TransmittedBefore;
|
||||||
|
do {
|
||||||
|
//
|
||||||
|
// Attempt to receive OOB data
|
||||||
|
//
|
||||||
|
BytesReceived = recv ( a, &mBuffer[0], sizeof ( mBuffer ), MSG_OOB );
|
||||||
|
RetVal = (UINT32)BytesReceived;
|
||||||
|
if ( 0 < BytesReceived ) {
|
||||||
|
//
|
||||||
|
// Display the received OOB data
|
||||||
|
//
|
||||||
|
printf ( "%5Ld OOB bytes received\r\n", (UINT64)BytesReceived );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Account for the bytes received
|
||||||
|
//
|
||||||
|
TransmittedOob += RetVal;
|
||||||
|
*pTransmittedBytes += TransmittedAfter;
|
||||||
|
TransmittedAfter = 0;
|
||||||
|
pTransmittedBytes = &TransmittedDuring;
|
||||||
|
}
|
||||||
|
else if ( -1 == BytesReceived ) {
|
||||||
|
//
|
||||||
|
// Check for connection timeout
|
||||||
|
//
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
if ( RX_TIMEOUT_ERROR != RetVal ) {
|
||||||
|
//
|
||||||
|
// Receive error
|
||||||
|
//
|
||||||
|
printf ( "ERROR - recv OOB error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ignore the timeout
|
||||||
|
// Try to receive normal data instead
|
||||||
|
//
|
||||||
|
BytesReceived = recv ( a, &mBuffer[0], sizeof ( mBuffer ), 0 );
|
||||||
|
RetVal = (UINT32)BytesReceived;
|
||||||
|
if ( 0 < BytesReceived ) {
|
||||||
|
//
|
||||||
|
// Display the received data
|
||||||
|
//
|
||||||
|
printf ( "%4Ld bytes received\r\n", (UINT64)BytesReceived );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Account for the bytes received
|
||||||
|
//
|
||||||
|
TransmittedAfter += RetVal;
|
||||||
|
}
|
||||||
|
else if ( -1 == BytesReceived ) {
|
||||||
|
//
|
||||||
|
// Check for a timeout
|
||||||
|
//
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
if ( RX_TIMEOUT_ERROR != RetVal ) {
|
||||||
|
printf ( "ERROR - recv error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while ( 0 != RetVal );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Display the bytes received
|
||||||
|
//
|
||||||
|
if ( 0 == RetVal ) {
|
||||||
|
printf ( "Bytes before OOB: %8d\r\n", TransmittedBefore );
|
||||||
|
if ( 0 != TransmittedDuring ) {
|
||||||
|
printf ( "Bytes during OOB: %8d\r\n", TransmittedDuring );
|
||||||
|
}
|
||||||
|
printf ( "Out-of-band bytes: %8d\r\n", TransmittedOob );
|
||||||
|
printf ( "Bytes after OOB: %8d\r\n", TransmittedAfter );
|
||||||
|
printf ( " --------\r\n" );
|
||||||
|
printf ( "Total Bytes: %8d\r\n", TransmittedBefore
|
||||||
|
+ TransmittedDuring
|
||||||
|
+ TransmittedOob
|
||||||
|
+ TransmittedAfter );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test complete
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Close the test socket
|
||||||
|
//
|
||||||
|
CLOSE_SOCKET ( a );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Close the socket
|
||||||
|
//
|
||||||
|
CLOSE_SOCKET ( s );
|
||||||
|
printf ( "Socket closed\r\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the operation status
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
96
AppPkg/Applications/Sockets/OobRx/OobRx.h
Normal file
96
AppPkg/Applications/Sockets/OobRx/OobRx.h
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/** @file
|
||||||
|
Definitions for the OOB Receive application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _OOB_RX_H_
|
||||||
|
#define _OOB_RX_H_
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Include Files
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef BUILD_FOR_WINDOWS
|
||||||
|
//
|
||||||
|
// Build for Windows environment
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <winsock2.h>
|
||||||
|
|
||||||
|
#define CLOSE_SOCKET closesocket
|
||||||
|
#define SIN_ADDR(port) port.sin_addr.S_un.S_addr
|
||||||
|
#define SIN_FAMILY(port) port.sin_family
|
||||||
|
#define SIN_LEN(port) port.sin_family
|
||||||
|
#define SIN_PORT(port) port.sin_port
|
||||||
|
#define GET_ERRNO WSAGetLastError ( )
|
||||||
|
|
||||||
|
#define RX_TIMEOUT_ERROR WSAETIMEDOUT
|
||||||
|
#define ssize_t int
|
||||||
|
#define socklen_t int
|
||||||
|
|
||||||
|
#else // BUILD_FOR_WINDOWS
|
||||||
|
//
|
||||||
|
// Build for EFI environment
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include <sys/EfiSysCall.h>
|
||||||
|
#include <sys/endian.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#define CLOSE_SOCKET close
|
||||||
|
#define SIN_ADDR(port) port.sin_addr.s_addr
|
||||||
|
#define SIN_FAMILY(port) port.sin_family
|
||||||
|
#define SIN_LEN(port) port.sin_len
|
||||||
|
#define SIN_PORT(port) port.sin_port
|
||||||
|
#define SOCKET int
|
||||||
|
#define GET_ERRNO errno
|
||||||
|
#define RX_TIMEOUT_ERROR ETIMEDOUT
|
||||||
|
|
||||||
|
#endif // BUILD_FOR_WINDOWS
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Constants
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define OOB_RX_PORT 12344
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// API
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
Run the OOB receive application
|
||||||
|
|
||||||
|
@param [in] ArgC Argument count
|
||||||
|
@param [in] ArgV Argument value array
|
||||||
|
|
||||||
|
@retval 0 Successfully operation
|
||||||
|
**/
|
||||||
|
|
||||||
|
int
|
||||||
|
OobRx (
|
||||||
|
IN int ArgC,
|
||||||
|
IN char **ArgV
|
||||||
|
);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#endif // _OOB_RX_H_
|
64
AppPkg/Applications/Sockets/OobRx/OobRx.inf
Normal file
64
AppPkg/Applications/Sockets/OobRx/OobRx.inf
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#/** @file
|
||||||
|
# OobRx Application
|
||||||
|
#
|
||||||
|
# This file contains an 'Intel Peripheral Driver' and is
|
||||||
|
# licensed for Intel CPUs and chipsets under the terms of your
|
||||||
|
# license agreement with Intel or your vendor. This file may
|
||||||
|
# be modified by the user, subject to additional terms of the
|
||||||
|
# license agreement
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Copyright (c) 20011 Intel Corporation. All rights reserved
|
||||||
|
# This software and associated documentation (if any) is furnished
|
||||||
|
# under a license and may only be used or copied in accordance
|
||||||
|
# with the terms of the license. Except as permitted by such
|
||||||
|
# license, no part of this software or documentation may be
|
||||||
|
# reproduced, stored in a retrieval system, or transmitted in any
|
||||||
|
# form or by any means without the express written consent of
|
||||||
|
# Intel Corporation.
|
||||||
|
#
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = OobRx
|
||||||
|
FILE_GUID = 79DED328-7FCE-4909-9AFD-D66176AF97A6
|
||||||
|
MODULE_TYPE = UEFI_APPLICATION
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
ENTRY_POINT = ShellCEntryLib
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
Main.c
|
||||||
|
OobRx.c
|
||||||
|
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
ShellPkg/ShellPkg.dec
|
||||||
|
StdLib/StdLib.dec
|
||||||
|
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
BaseMemoryLib
|
||||||
|
BsdSocketLib
|
||||||
|
DebugLib
|
||||||
|
EfiSocketLib
|
||||||
|
LibC
|
||||||
|
LibMath
|
||||||
|
ShellCEntryLib
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
UefiLib
|
||||||
|
# UseSocketDxe
|
||||||
|
|
||||||
|
[BuildOptions]
|
||||||
|
INTEL:*_*_*_CC_FLAGS = /Qdiag-disable:181,186
|
||||||
|
MSFT:*_*_*_CC_FLAGS = /Od
|
||||||
|
GCC:*_*_*_CC_FLAGS = -O0 -Wno-unused-variable
|
||||||
|
|
20
AppPkg/Applications/Sockets/OobRx/Windows/OobRx.sln
Normal file
20
AppPkg/Applications/Sockets/OobRx/Windows/OobRx.sln
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
|
# Visual Studio 2005
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OobRx", "OobRx.vcproj", "{FA34A77A-5034-4065-B4BD-B74984DEB2F7}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{FA34A77A-5034-4065-B4BD-B74984DEB2F7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{FA34A77A-5034-4065-B4BD-B74984DEB2F7}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{FA34A77A-5034-4065-B4BD-B74984DEB2F7}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{FA34A77A-5034-4065-B4BD-B74984DEB2F7}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
BIN
AppPkg/Applications/Sockets/OobRx/Windows/OobRx.suo
Normal file
BIN
AppPkg/Applications/Sockets/OobRx/Windows/OobRx.suo
Normal file
Binary file not shown.
211
AppPkg/Applications/Sockets/OobRx/Windows/OobRx.vcproj
Normal file
211
AppPkg/Applications/Sockets/OobRx/Windows/OobRx.vcproj
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="OobRx"
|
||||||
|
ProjectGUID="{FA34A77A-5034-4065-B4BD-B74984DEB2F7}"
|
||||||
|
RootNamespace="OobRx"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=".."
|
||||||
|
PreprocessorDefinitions="BUILD_FOR_WINDOWS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="ws2_32.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=".."
|
||||||
|
PreprocessorDefinitions="BUILD_FOR_WINDOWS"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="ws2_32.lib"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\main.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\OobRx.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\OobRx.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||||
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
56
AppPkg/Applications/Sockets/OobRx/Windows/main.c
Normal file
56
AppPkg/Applications/Sockets/OobRx/Windows/main.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/** @file
|
||||||
|
Windows version of the OOB Receive application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <OobRx.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Receive out-of-band messages from the remote system.
|
||||||
|
|
||||||
|
@param [in] argc The number of arguments
|
||||||
|
@param [in] argv The argument value array
|
||||||
|
|
||||||
|
@retval 0 The application exited normally.
|
||||||
|
@retval Other An error occurred.
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
main(
|
||||||
|
int argc,
|
||||||
|
char ** argv
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int RetVal;
|
||||||
|
WSADATA WsaData;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the WinSock layer
|
||||||
|
//
|
||||||
|
RetVal = WSAStartup ( MAKEWORD ( 2, 2 ), &WsaData );
|
||||||
|
if ( 0 == RetVal ) {
|
||||||
|
//
|
||||||
|
// Start the application
|
||||||
|
//
|
||||||
|
RetVal = OobRx ( argc, argv );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Done with the WinSock layer
|
||||||
|
//
|
||||||
|
WSACleanup ( );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the final result
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
44
AppPkg/Applications/Sockets/OobTx/Main.c
Normal file
44
AppPkg/Applications/Sockets/OobTx/Main.c
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/** @file
|
||||||
|
Out-of-band transmit test application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <OobTx.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transmit out-of-band messages to the remote system.
|
||||||
|
|
||||||
|
@param [in] Argc The number of arguments
|
||||||
|
@param [in] Argv The argument value array
|
||||||
|
|
||||||
|
@retval 0 The application exited normally.
|
||||||
|
@retval Other An error occurred.
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
main (
|
||||||
|
IN int Argc,
|
||||||
|
IN char **Argv
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int RetVal;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Run the application
|
||||||
|
//
|
||||||
|
RetVal = OobTx ( Argc, Argv );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the operation status
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
248
AppPkg/Applications/Sockets/OobTx/OobTx.c
Normal file
248
AppPkg/Applications/Sockets/OobTx/OobTx.c
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
/** @file
|
||||||
|
Windows version of the OOB Transmit application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <OobTx.h>
|
||||||
|
|
||||||
|
UINT8 mBuffer[8192];
|
||||||
|
UINT8 mOob[512];
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transmit out-of-band messages to the remote system.
|
||||||
|
|
||||||
|
@param [in] ArgC Argument count
|
||||||
|
@param [in] ArgV Argument value array
|
||||||
|
|
||||||
|
@retval 0 Successfully operation
|
||||||
|
**/
|
||||||
|
|
||||||
|
int
|
||||||
|
OobTx (
|
||||||
|
IN int ArgC,
|
||||||
|
IN char **ArgV
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT32 BytesSent;
|
||||||
|
ssize_t BytesTransmitted;
|
||||||
|
UINT32 Index;
|
||||||
|
struct sockaddr_in LocalPort;
|
||||||
|
UINT32 OobInLine;
|
||||||
|
UINT16 PortNumber;
|
||||||
|
UINT32 RemoteAddress[4];
|
||||||
|
struct sockaddr_in RemotePort;
|
||||||
|
int RetVal;
|
||||||
|
UINT32 TransmittedAfter;
|
||||||
|
UINT32 TransmittedBefore;
|
||||||
|
UINT32 TransmittedOob;
|
||||||
|
SOCKET s;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create the socket
|
||||||
|
//
|
||||||
|
s = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP );
|
||||||
|
if ( -1 == s ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - socket error, errno: %d\r\n", RetVal );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//
|
||||||
|
// Use for/break; instead of goto
|
||||||
|
//
|
||||||
|
for ( ; ; ) {
|
||||||
|
//
|
||||||
|
// Validate the arguments
|
||||||
|
//
|
||||||
|
if (( 2 > ArgC )
|
||||||
|
|| ( 4 != sscanf ( ArgV[1],
|
||||||
|
"%d.%d.%d.%d",
|
||||||
|
&RemoteAddress[0],
|
||||||
|
&RemoteAddress[1],
|
||||||
|
&RemoteAddress[2],
|
||||||
|
&RemoteAddress[3]))
|
||||||
|
|| ( 224 < RemoteAddress[0])
|
||||||
|
|| ( 255 < RemoteAddress[1])
|
||||||
|
|| ( 255 < RemoteAddress[2])
|
||||||
|
|| ( 255 < RemoteAddress[3])
|
||||||
|
|| (( 0 == RemoteAddress[0])
|
||||||
|
&& ( 0 == RemoteAddress[1])
|
||||||
|
&& ( 0 == RemoteAddress[2])
|
||||||
|
&& ( 0 == RemoteAddress[3]))) {
|
||||||
|
printf ( "%s <remote IP address> [optional: enables in-line OOB]\r\n", ArgV[0]);
|
||||||
|
RetVal = EINVAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bind the socket to a local port
|
||||||
|
//
|
||||||
|
memset ( &LocalPort, 0, sizeof ( LocalPort ));
|
||||||
|
SIN_LEN ( LocalPort ) = sizeof ( LocalPort );
|
||||||
|
SIN_FAMILY ( LocalPort ) = AF_INET;
|
||||||
|
SIN_ADDR ( LocalPort ) = 0;
|
||||||
|
SIN_PORT ( LocalPort ) = 0;
|
||||||
|
RetVal = bind ( s,
|
||||||
|
(struct sockaddr *)&LocalPort,
|
||||||
|
sizeof ( LocalPort ));
|
||||||
|
if ( -1 == RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - bind error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Specify the remote port
|
||||||
|
//
|
||||||
|
PortNumber = OOB_RX_PORT;
|
||||||
|
memset ( &RemotePort, 0, sizeof ( RemotePort ));
|
||||||
|
SIN_LEN ( RemotePort ) = sizeof ( RemotePort );
|
||||||
|
SIN_FAMILY ( RemotePort ) = AF_INET;
|
||||||
|
SIN_ADDR ( RemotePort ) = ( RemoteAddress[3] << 24 )
|
||||||
|
| ( RemoteAddress[2] << 16 )
|
||||||
|
| ( RemoteAddress[1] << 8 )
|
||||||
|
| RemoteAddress[0];
|
||||||
|
SIN_PORT ( RemotePort ) = htons ( PortNumber );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Connect to the remote server
|
||||||
|
//
|
||||||
|
RetVal = connect ( s, (struct sockaddr *)&RemotePort, sizeof ( RemotePort ));
|
||||||
|
if ( -1 == RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - connect error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select the OOB processing
|
||||||
|
//
|
||||||
|
OobInLine = ( 2 < ArgC );
|
||||||
|
RetVal = setsockopt ( s,
|
||||||
|
SOL_SOCKET,
|
||||||
|
SO_OOBINLINE,
|
||||||
|
(char *)&OobInLine,
|
||||||
|
sizeof ( OobInLine ));
|
||||||
|
if ( -1 == RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - setsockopt OOBINLINE error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf ( "%s\r\n", ( 0 != OobInLine ) ? "OOB messages are in-line"
|
||||||
|
: "OOB messages move to the head of the queue" );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the messages
|
||||||
|
//
|
||||||
|
memset ( &mBuffer[0], 0, sizeof ( mBuffer ));
|
||||||
|
memset ( &mOob[0], 0x11, sizeof ( mOob ));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Send the data before the out-of-band message
|
||||||
|
//
|
||||||
|
TransmittedBefore = 0;
|
||||||
|
for ( Index = 0; TX_MSGS_BEFORE > Index; Index++ ) {
|
||||||
|
BytesSent = 0;
|
||||||
|
do {
|
||||||
|
BytesTransmitted = send ( s,
|
||||||
|
&mBuffer[BytesSent],
|
||||||
|
sizeof ( mBuffer ) - BytesSent,
|
||||||
|
0 );
|
||||||
|
if ( -1 == BytesTransmitted ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - send before error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BytesSent += (UINT32)BytesTransmitted;
|
||||||
|
RetVal = 0;
|
||||||
|
} while ( sizeof ( mBuffer ) > BytesSent );
|
||||||
|
if ( 0 != RetVal ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
TransmittedBefore += BytesSent;
|
||||||
|
}
|
||||||
|
if ( 0 != RetVal ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Send the out-of-band message
|
||||||
|
//
|
||||||
|
BytesSent = 0;
|
||||||
|
do {
|
||||||
|
BytesTransmitted = send ( s,
|
||||||
|
&mOob[BytesSent],
|
||||||
|
sizeof ( mOob ) - BytesSent,
|
||||||
|
MSG_OOB );
|
||||||
|
if ( -1 == BytesTransmitted ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - send OOB error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BytesSent += (UINT32)BytesTransmitted;
|
||||||
|
RetVal = 0;
|
||||||
|
} while ( sizeof ( mOob ) > BytesSent );
|
||||||
|
if ( 0 != RetVal ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
TransmittedOob = BytesSent;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Send the data after the out-of-band message
|
||||||
|
//
|
||||||
|
TransmittedAfter = 0;
|
||||||
|
for ( Index = 0; TX_MSGS_AFTER > Index; Index++ ) {
|
||||||
|
BytesSent = 0;
|
||||||
|
do {
|
||||||
|
BytesTransmitted = send ( s,
|
||||||
|
&mBuffer[BytesSent],
|
||||||
|
sizeof ( mBuffer ) - BytesSent,
|
||||||
|
0 );
|
||||||
|
if ( -1 == BytesTransmitted ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - send after error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BytesSent += (UINT32)BytesTransmitted;
|
||||||
|
RetVal = 0;
|
||||||
|
} while ( sizeof ( mBuffer ) > BytesSent );
|
||||||
|
if ( 0 != RetVal ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
TransmittedAfter += BytesSent;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test completed successfully
|
||||||
|
//
|
||||||
|
if ( 0 == RetVal ) {
|
||||||
|
printf ( "Bytes before OOB: %8d\r\n", TransmittedBefore );
|
||||||
|
printf ( "Out-of-band bytes: %8d\r\n", TransmittedOob );
|
||||||
|
printf ( "Bytes after OOB: %8d\r\n", TransmittedAfter );
|
||||||
|
printf ( " --------\r\n" );
|
||||||
|
printf ( "Total Bytes: %8d\r\n", TransmittedBefore
|
||||||
|
+ TransmittedOob
|
||||||
|
+ TransmittedAfter );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Close the socket
|
||||||
|
//
|
||||||
|
CLOSE_SOCKET ( s );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the operation status
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
97
AppPkg/Applications/Sockets/OobTx/OobTx.h
Normal file
97
AppPkg/Applications/Sockets/OobTx/OobTx.h
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/** @file
|
||||||
|
Definitions for the OOB Transmit application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _OOB_TX_H_
|
||||||
|
#define _OOB_TX_H_
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Include Files
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef BUILD_FOR_WINDOWS
|
||||||
|
//
|
||||||
|
// Build for Windows environment
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <winsock2.h>
|
||||||
|
|
||||||
|
#define CHAR8 char
|
||||||
|
#define CLOSE_SOCKET closesocket
|
||||||
|
#define EINVAL 22 // Invalid argument
|
||||||
|
#define GET_ERRNO WSAGetLastError ( )
|
||||||
|
#define SIN_ADDR(port) port.sin_addr.S_un.S_addr
|
||||||
|
#define SIN_FAMILY(port) port.sin_family
|
||||||
|
#define SIN_LEN(port) port.sin_family
|
||||||
|
#define SIN_PORT(port) port.sin_port
|
||||||
|
#define socklen_t int
|
||||||
|
#define ssize_t int
|
||||||
|
|
||||||
|
#else // BUILD_FOR_WINDOWS
|
||||||
|
//
|
||||||
|
// Build for EFI environment
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include <sys/EfiSysCall.h>
|
||||||
|
#include <sys/endian.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#define CLOSE_SOCKET close
|
||||||
|
#define GET_ERRNO errno
|
||||||
|
#define SIN_ADDR(port) port.sin_addr.s_addr
|
||||||
|
#define SIN_FAMILY(port) port.sin_family
|
||||||
|
#define SIN_LEN(port) port.sin_len
|
||||||
|
#define SIN_PORT(port) port.sin_port
|
||||||
|
#define SOCKET int
|
||||||
|
|
||||||
|
#endif // BUILD_FOR_WINDOWS
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Constants
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define OOB_RX_PORT 12344
|
||||||
|
|
||||||
|
#define TX_MSGS_BEFORE 32
|
||||||
|
#define TX_MSGS_AFTER 8
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// API
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transmit out-of-band messages to the remote system.
|
||||||
|
|
||||||
|
@param [in] ArgC Argument count
|
||||||
|
@param [in] ArgV Argument value array
|
||||||
|
|
||||||
|
@retval 0 Successfully operation
|
||||||
|
**/
|
||||||
|
|
||||||
|
int
|
||||||
|
OobTx (
|
||||||
|
IN int ArgC,
|
||||||
|
IN char **ArgV
|
||||||
|
);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#endif // _OOB_TX_H_
|
64
AppPkg/Applications/Sockets/OobTx/OobTx.inf
Normal file
64
AppPkg/Applications/Sockets/OobTx/OobTx.inf
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#/** @file
|
||||||
|
# OobTx Application
|
||||||
|
#
|
||||||
|
# This file contains an 'Intel Peripheral Driver' and is
|
||||||
|
# licensed for Intel CPUs and chipsets under the terms of your
|
||||||
|
# license agreement with Intel or your vendor. This file may
|
||||||
|
# be modified by the user, subject to additional terms of the
|
||||||
|
# license agreement
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Copyright (c) 20011 Intel Corporation. All rights reserved
|
||||||
|
# This software and associated documentation (if any) is furnished
|
||||||
|
# under a license and may only be used or copied in accordance
|
||||||
|
# with the terms of the license. Except as permitted by such
|
||||||
|
# license, no part of this software or documentation may be
|
||||||
|
# reproduced, stored in a retrieval system, or transmitted in any
|
||||||
|
# form or by any means without the express written consent of
|
||||||
|
# Intel Corporation.
|
||||||
|
#
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = OobTx
|
||||||
|
FILE_GUID = EB740091-A494-44d7-8D96-C192F95A6394
|
||||||
|
MODULE_TYPE = UEFI_APPLICATION
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
ENTRY_POINT = ShellCEntryLib
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
Main.c
|
||||||
|
OobTx.c
|
||||||
|
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
ShellPkg/ShellPkg.dec
|
||||||
|
StdLib/StdLib.dec
|
||||||
|
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
BaseMemoryLib
|
||||||
|
BsdSocketLib
|
||||||
|
DebugLib
|
||||||
|
EfiSocketLib
|
||||||
|
LibC
|
||||||
|
LibMath
|
||||||
|
ShellCEntryLib
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
UefiLib
|
||||||
|
# UseSocketDxe
|
||||||
|
|
||||||
|
[BuildOptions]
|
||||||
|
INTEL:*_*_*_CC_FLAGS = /Qdiag-disable:181,186
|
||||||
|
MSFT:*_*_*_CC_FLAGS = /Od
|
||||||
|
GCC:*_*_*_CC_FLAGS = -O0 -Wno-unused-variable
|
||||||
|
|
20
AppPkg/Applications/Sockets/OobTx/Windows/OobTx.sln
Normal file
20
AppPkg/Applications/Sockets/OobTx/Windows/OobTx.sln
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
|
# Visual Studio 2005
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OobTx", "OobTx.vcproj", "{C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
BIN
AppPkg/Applications/Sockets/OobTx/Windows/OobTx.suo
Normal file
BIN
AppPkg/Applications/Sockets/OobTx/Windows/OobTx.suo
Normal file
Binary file not shown.
211
AppPkg/Applications/Sockets/OobTx/Windows/OobTx.vcproj
Normal file
211
AppPkg/Applications/Sockets/OobTx/Windows/OobTx.vcproj
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="OobTx"
|
||||||
|
ProjectGUID="{C5B91ED2-C2BA-4EE7-A789-F6621CE601B9}"
|
||||||
|
RootNamespace="OobTx"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=".."
|
||||||
|
PreprocessorDefinitions="BUILD_FOR_WINDOWS; _CRT_SECURE_NO_DEPRECATE"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="ws2_32.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=".."
|
||||||
|
PreprocessorDefinitions="BUILD_FOR_WINDOWS; _CRT_SECURE_NO_DEPRECATE"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="ws2_32.lib"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\main.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\OobTx.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\OobTx.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||||
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
56
AppPkg/Applications/Sockets/OobTx/Windows/main.c
Normal file
56
AppPkg/Applications/Sockets/OobTx/Windows/main.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/** @file
|
||||||
|
Windows version of the OOB Transmit application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <OobTx.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transmit out-of-band messages to the remote system.
|
||||||
|
|
||||||
|
@param [in] Argc The number of arguments
|
||||||
|
@param [in] Argv The argument value array
|
||||||
|
|
||||||
|
@retval 0 The application exited normally.
|
||||||
|
@retval Other An error occurred.
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
main(
|
||||||
|
int argc,
|
||||||
|
char ** argv
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int RetVal;
|
||||||
|
WSADATA WsaData;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the WinSock layer
|
||||||
|
//
|
||||||
|
RetVal = WSAStartup ( MAKEWORD ( 2, 2 ), &WsaData );
|
||||||
|
if ( 0 == RetVal ) {
|
||||||
|
//
|
||||||
|
// Start the application
|
||||||
|
//
|
||||||
|
RetVal = OobTx ( argc, argv );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Done with the WinSock layer
|
||||||
|
//
|
||||||
|
WSACleanup ( );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the final result
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
44
AppPkg/Applications/Sockets/RawIp4Rx/Main.c
Normal file
44
AppPkg/Applications/Sockets/RawIp4Rx/Main.c
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/** @file
|
||||||
|
Raw IP4 receive test application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "RawIp4Rx.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Receive raw datagrams from a remote system.
|
||||||
|
|
||||||
|
@param [in] Argc The number of arguments
|
||||||
|
@param [in] Argv The argument value array
|
||||||
|
|
||||||
|
@retval 0 The application exited normally.
|
||||||
|
@retval Other An error occurred.
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
main (
|
||||||
|
IN int Argc,
|
||||||
|
IN char **Argv
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int RetVal;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Run the application
|
||||||
|
//
|
||||||
|
RetVal = RawIp4Rx ( Argc, Argv );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the operation status
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
188
AppPkg/Applications/Sockets/RawIp4Rx/RawIp4Rx.c
Normal file
188
AppPkg/Applications/Sockets/RawIp4Rx/RawIp4Rx.c
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
/** @file
|
||||||
|
Raw IP4 receive application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "RawIp4Rx.h"
|
||||||
|
|
||||||
|
UINT8 mBuffer[65536];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Run the raw IP4 receive application
|
||||||
|
|
||||||
|
@param [in] ArgC Argument count
|
||||||
|
@param [in] ArgV Argument value array
|
||||||
|
|
||||||
|
@retval 0 Successfully operation
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
RawIp4Rx (
|
||||||
|
IN int ArgC,
|
||||||
|
IN char **ArgV
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ssize_t BytesReceived;
|
||||||
|
struct sockaddr_in LocalPort;
|
||||||
|
socklen_t LocalPortLength;
|
||||||
|
struct sockaddr_in RemotePort;
|
||||||
|
socklen_t RemotePortLength;
|
||||||
|
int RetVal;
|
||||||
|
SOCKET s;
|
||||||
|
UINT64 TotalBytesReceived;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create the socket
|
||||||
|
//
|
||||||
|
s = socket ( AF_INET, SOCK_RAW, RAW_PROTOCOL );
|
||||||
|
if ( -1 == s ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - socket error, errno: %d\r\n", RetVal );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//
|
||||||
|
// Use for/break; instead of goto
|
||||||
|
//
|
||||||
|
for ( ; ; ) {
|
||||||
|
//
|
||||||
|
// Bind the socket to a known port
|
||||||
|
//
|
||||||
|
memset ( &LocalPort, 0, sizeof ( LocalPort ));
|
||||||
|
SIN_LEN ( LocalPort ) = sizeof ( LocalPort );
|
||||||
|
SIN_FAMILY ( LocalPort ) = AF_INET;
|
||||||
|
SIN_ADDR ( LocalPort ) = 0;
|
||||||
|
SIN_PORT ( LocalPort ) = 0;
|
||||||
|
RetVal = bind ( s,
|
||||||
|
(struct sockaddr *)&LocalPort,
|
||||||
|
sizeof ( LocalPort ));
|
||||||
|
if ( -1 == RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - bind error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Display the local address and protocol
|
||||||
|
//
|
||||||
|
LocalPortLength = sizeof ( LocalPort );
|
||||||
|
RetVal = getsockname ( s, (struct sockaddr *)&LocalPort, &LocalPortLength );
|
||||||
|
if ( 0 != RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - getsockname error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf ( "Local Address: %d.%d.%d.%d, Protocol: %d\r\n",
|
||||||
|
(UINT8)SIN_ADDR ( LocalPort ),
|
||||||
|
(UINT8)( SIN_ADDR ( LocalPort ) >> 8 ),
|
||||||
|
(UINT8)( SIN_ADDR ( LocalPort ) >> 16 ),
|
||||||
|
(UINT8)( SIN_ADDR ( LocalPort ) >> 24 ),
|
||||||
|
RAW_PROTOCOL );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Use for/break instead of goto
|
||||||
|
//
|
||||||
|
TotalBytesReceived = 0;
|
||||||
|
for ( ; ; ) {
|
||||||
|
//
|
||||||
|
// Receive data from the remote system
|
||||||
|
//
|
||||||
|
do {
|
||||||
|
//
|
||||||
|
// Attempt to receive a packet
|
||||||
|
//
|
||||||
|
RemotePortLength = sizeof ( RemotePort );
|
||||||
|
BytesReceived = recvfrom ( s,
|
||||||
|
&mBuffer[0],
|
||||||
|
sizeof ( mBuffer ),
|
||||||
|
0,
|
||||||
|
(struct sockaddr *)&RemotePort,
|
||||||
|
&RemotePortLength );
|
||||||
|
RetVal = (UINT32)BytesReceived;
|
||||||
|
if ( 0 < BytesReceived ) {
|
||||||
|
//
|
||||||
|
// Display the received data
|
||||||
|
//
|
||||||
|
printf ( "%4d bytes received from %d.%d.%d.%d:%d\r\n"
|
||||||
|
"%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\r\n"
|
||||||
|
"%02x %02x %02x %02x\r\n",
|
||||||
|
(UINT32)BytesReceived,
|
||||||
|
(UINT8)SIN_ADDR ( RemotePort ),
|
||||||
|
(UINT8)( SIN_ADDR ( RemotePort ) >> 8 ),
|
||||||
|
(UINT8)( SIN_ADDR ( RemotePort ) >> 16 ),
|
||||||
|
(UINT8)( SIN_ADDR ( RemotePort ) >> 24 ),
|
||||||
|
SIN_PORT ( RemotePort ),
|
||||||
|
mBuffer[0],
|
||||||
|
mBuffer[1],
|
||||||
|
mBuffer[2],
|
||||||
|
mBuffer[3],
|
||||||
|
mBuffer[4],
|
||||||
|
mBuffer[5],
|
||||||
|
mBuffer[6],
|
||||||
|
mBuffer[7],
|
||||||
|
mBuffer[8],
|
||||||
|
mBuffer[9],
|
||||||
|
mBuffer[10],
|
||||||
|
mBuffer[11],
|
||||||
|
mBuffer[12],
|
||||||
|
mBuffer[13],
|
||||||
|
mBuffer[14],
|
||||||
|
mBuffer[15],
|
||||||
|
mBuffer[16],
|
||||||
|
mBuffer[17],
|
||||||
|
mBuffer[18],
|
||||||
|
mBuffer[19]);
|
||||||
|
TotalBytesReceived += BytesReceived;
|
||||||
|
|
||||||
|
//
|
||||||
|
// All done when the correct packet is received
|
||||||
|
//
|
||||||
|
if ( mBuffer[9] == RAW_PROTOCOL ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( -1 == BytesReceived ) {
|
||||||
|
//
|
||||||
|
// Check for a timeout
|
||||||
|
//
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - recv error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while ( 0 != RetVal );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Display the bytes received
|
||||||
|
//
|
||||||
|
if ( 0 == RetVal ) {
|
||||||
|
printf ( "Total Bytes Received: %Ld\r\n", TotalBytesReceived );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test complete
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Close the socket
|
||||||
|
//
|
||||||
|
CLOSE_SOCKET ( s );
|
||||||
|
printf ( "Socket closed\r\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the operation status
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
98
AppPkg/Applications/Sockets/RawIp4Rx/RawIp4Rx.h
Normal file
98
AppPkg/Applications/Sockets/RawIp4Rx/RawIp4Rx.h
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
/** @file
|
||||||
|
Definitions for the raw IP4 receive application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _RAW_IP4_RX_H_
|
||||||
|
#define _RAW_IP4_RX_H_
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Include Files
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef BUILD_FOR_WINDOWS
|
||||||
|
//
|
||||||
|
// Build for Windows environment
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <winsock2.h>
|
||||||
|
|
||||||
|
#define CLOSE_SOCKET closesocket
|
||||||
|
#define SIN_ADDR(port) port.sin_addr.S_un.S_addr
|
||||||
|
#define SIN_FAMILY(port) port.sin_family
|
||||||
|
#define SIN_LEN(port) port.sin_family
|
||||||
|
#define SIN_PORT(port) port.sin_port
|
||||||
|
#define GET_ERRNO WSAGetLastError ( )
|
||||||
|
|
||||||
|
#define ssize_t int
|
||||||
|
#define socklen_t int
|
||||||
|
|
||||||
|
#else // BUILD_FOR_WINDOWS
|
||||||
|
//
|
||||||
|
// Build for EFI environment
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include <sys/EfiSysCall.h>
|
||||||
|
#include <sys/endian.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#define CLOSE_SOCKET close
|
||||||
|
#define SIN_ADDR(port) port.sin_addr.s_addr
|
||||||
|
#define SIN_FAMILY(port) port.sin_family
|
||||||
|
#define SIN_LEN(port) port.sin_len
|
||||||
|
#define SIN_PORT(port) port.sin_port
|
||||||
|
#define SOCKET int
|
||||||
|
#define GET_ERRNO errno
|
||||||
|
|
||||||
|
#endif // BUILD_FOR_WINDOWS
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Constants
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//
|
||||||
|
// See http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml
|
||||||
|
// and http://tools.ietf.org/html/rfc3692
|
||||||
|
//
|
||||||
|
#define RAW_PROTOCOL 253
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// API
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
Run the raw IP4 receive application
|
||||||
|
|
||||||
|
@param [in] ArgC Argument count
|
||||||
|
@param [in] ArgV Argument value array
|
||||||
|
|
||||||
|
@retval 0 Successfully operation
|
||||||
|
**/
|
||||||
|
|
||||||
|
int
|
||||||
|
RawIp4Rx (
|
||||||
|
IN int ArgC,
|
||||||
|
IN char **ArgV
|
||||||
|
);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#endif // _RAW_IP4_RX_H_
|
64
AppPkg/Applications/Sockets/RawIp4Rx/RawIp4Rx.inf
Normal file
64
AppPkg/Applications/Sockets/RawIp4Rx/RawIp4Rx.inf
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#/** @file
|
||||||
|
# RawIp4 Application
|
||||||
|
#
|
||||||
|
# This file contains an 'Intel Peripheral Driver' and is
|
||||||
|
# licensed for Intel CPUs and chipsets under the terms of your
|
||||||
|
# license agreement with Intel or your vendor. This file may
|
||||||
|
# be modified by the user, subject to additional terms of the
|
||||||
|
# license agreement
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Copyright (c) 20011 Intel Corporation. All rights reserved
|
||||||
|
# This software and associated documentation (if any) is furnished
|
||||||
|
# under a license and may only be used or copied in accordance
|
||||||
|
# with the terms of the license. Except as permitted by such
|
||||||
|
# license, no part of this software or documentation may be
|
||||||
|
# reproduced, stored in a retrieval system, or transmitted in any
|
||||||
|
# form or by any means without the express written consent of
|
||||||
|
# Intel Corporation.
|
||||||
|
#
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = RawIp4Rx
|
||||||
|
FILE_GUID = 8D7AE6A9-B490-45e1-8795-C2BEAADC3814
|
||||||
|
MODULE_TYPE = UEFI_APPLICATION
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
ENTRY_POINT = ShellCEntryLib
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
Main.c
|
||||||
|
RawIp4Rx.c
|
||||||
|
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
ShellPkg/ShellPkg.dec
|
||||||
|
StdLib/StdLib.dec
|
||||||
|
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
BaseMemoryLib
|
||||||
|
BsdSocketLib
|
||||||
|
DebugLib
|
||||||
|
EfiSocketLib
|
||||||
|
LibC
|
||||||
|
LibMath
|
||||||
|
ShellCEntryLib
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
UefiLib
|
||||||
|
# UseSocketDxe
|
||||||
|
|
||||||
|
[BuildOptions]
|
||||||
|
INTEL:*_*_*_CC_FLAGS = /Qdiag-disable:181,186
|
||||||
|
MSFT:*_*_*_CC_FLAGS = /Od
|
||||||
|
GCC:*_*_*_CC_FLAGS = -O0 -Wno-unused-variable
|
||||||
|
|
20
AppPkg/Applications/Sockets/RawIp4Rx/Windows/RawIp4Rx.sln
Normal file
20
AppPkg/Applications/Sockets/RawIp4Rx/Windows/RawIp4Rx.sln
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
|
# Visual Studio 2005
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RawIp4Rx", "RawIp4Rx.vcproj", "{FAD3909F-E05E-4A2A-9681-7C474EAC5025}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{FAD3909F-E05E-4A2A-9681-7C474EAC5025}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{FAD3909F-E05E-4A2A-9681-7C474EAC5025}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{FAD3909F-E05E-4A2A-9681-7C474EAC5025}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{FAD3909F-E05E-4A2A-9681-7C474EAC5025}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
211
AppPkg/Applications/Sockets/RawIp4Rx/Windows/RawIp4Rx.vcproj
Normal file
211
AppPkg/Applications/Sockets/RawIp4Rx/Windows/RawIp4Rx.vcproj
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="RawIp4Rx"
|
||||||
|
ProjectGUID="{FAD3909F-E05E-4A2A-9681-7C474EAC5025}"
|
||||||
|
RootNamespace="RawIp4Rx"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=".."
|
||||||
|
PreprocessorDefinitions="BUILD_FOR_WINDOWS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="ws2_32.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=".."
|
||||||
|
PreprocessorDefinitions="BUILD_FOR_WINDOWS"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="ws2_32.lib"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\main.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\RawIp4Rx.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\RawIp4Rx.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||||
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
61
AppPkg/Applications/Sockets/RawIp4Rx/Windows/main.c
Normal file
61
AppPkg/Applications/Sockets/RawIp4Rx/Windows/main.c
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/** @file
|
||||||
|
Windows version of the raw IP4 receive application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <RawIp4Rx.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Receive raw IP4 packets from a remote system.
|
||||||
|
|
||||||
|
Please note that this program must be run with administrator privileges!
|
||||||
|
|
||||||
|
@param [in] argc The number of arguments
|
||||||
|
@param [in] argv The argument value array
|
||||||
|
|
||||||
|
@retval 0 The application exited normally.
|
||||||
|
@retval Other An error occurred.
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
main(
|
||||||
|
int argc,
|
||||||
|
char ** argv
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int RetVal;
|
||||||
|
WSADATA WsaData;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the WinSock layer
|
||||||
|
//
|
||||||
|
RetVal = WSAStartup ( MAKEWORD ( 2, 2 ), &WsaData );
|
||||||
|
if ( 0 == RetVal ) {
|
||||||
|
//
|
||||||
|
// Start the application
|
||||||
|
//
|
||||||
|
RetVal = RawIp4Rx ( argc, argv );
|
||||||
|
if ( WSAEACCES == RetVal ) {
|
||||||
|
printf ( "Requires administrator privileges to run!\r\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Done with the WinSock layer
|
||||||
|
//
|
||||||
|
WSACleanup ( );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the final result
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
44
AppPkg/Applications/Sockets/RawIp4Tx/Main.c
Normal file
44
AppPkg/Applications/Sockets/RawIp4Tx/Main.c
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/** @file
|
||||||
|
Raw IP4 transmit test application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "RawIp4Tx.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transmit raw IP4 packets to the remote system.
|
||||||
|
|
||||||
|
@param [in] Argc The number of arguments
|
||||||
|
@param [in] Argv The argument value array
|
||||||
|
|
||||||
|
@retval 0 The application exited normally.
|
||||||
|
@retval Other An error occurred.
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
main (
|
||||||
|
IN int Argc,
|
||||||
|
IN char **Argv
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int RetVal;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Run the application
|
||||||
|
//
|
||||||
|
RetVal = RawIp4Tx ( Argc, Argv );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the operation status
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
157
AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.c
Normal file
157
AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.c
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
/** @file
|
||||||
|
Raw IP4 transmit application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "RawIp4Tx.h"
|
||||||
|
|
||||||
|
UINT8 mBuffer[1024];
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transmit raw IP4 packets to the remote system.
|
||||||
|
|
||||||
|
@param [in] ArgC Argument count
|
||||||
|
@param [in] ArgV Argument value array
|
||||||
|
|
||||||
|
@retval 0 Successfully operation
|
||||||
|
**/
|
||||||
|
|
||||||
|
int
|
||||||
|
RawIp4Tx (
|
||||||
|
IN int ArgC,
|
||||||
|
IN char **ArgV
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT32 BytesSent;
|
||||||
|
ssize_t BytesTransmitted;
|
||||||
|
struct sockaddr_in LocalPort;
|
||||||
|
UINT32 RemoteAddress[4];
|
||||||
|
struct sockaddr_in RemotePort;
|
||||||
|
int RetVal;
|
||||||
|
UINT32 TotalSent;
|
||||||
|
SOCKET s;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create the socket
|
||||||
|
//
|
||||||
|
s = socket ( AF_INET, SOCK_RAW, RAW_PROTOCOL );
|
||||||
|
if ( -1 == s ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - socket error, errno: %d\r\n", RetVal );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//
|
||||||
|
// Use for/break; instead of goto
|
||||||
|
//
|
||||||
|
for ( ; ; ) {
|
||||||
|
//
|
||||||
|
// Validate the arguments
|
||||||
|
//
|
||||||
|
if (( 2 > ArgC )
|
||||||
|
|| ( 4 != sscanf ( ArgV[1],
|
||||||
|
"%d.%d.%d.%d",
|
||||||
|
&RemoteAddress[0],
|
||||||
|
&RemoteAddress[1],
|
||||||
|
&RemoteAddress[2],
|
||||||
|
&RemoteAddress[3]))
|
||||||
|
|| ( 224 < RemoteAddress[0])
|
||||||
|
|| ( 255 < RemoteAddress[1])
|
||||||
|
|| ( 255 < RemoteAddress[2])
|
||||||
|
|| ( 255 < RemoteAddress[3])
|
||||||
|
|| (( 0 == RemoteAddress[0])
|
||||||
|
&& ( 0 == RemoteAddress[1])
|
||||||
|
&& ( 0 == RemoteAddress[2])
|
||||||
|
&& ( 0 == RemoteAddress[3]))) {
|
||||||
|
printf ( "%s <remote IP address>\r\n", ArgV[0]);
|
||||||
|
RetVal = EINVAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bind the socket to a local port
|
||||||
|
//
|
||||||
|
memset ( &LocalPort, 0, sizeof ( LocalPort ));
|
||||||
|
SIN_LEN ( LocalPort ) = sizeof ( LocalPort );
|
||||||
|
SIN_FAMILY ( LocalPort ) = AF_INET;
|
||||||
|
SIN_ADDR ( LocalPort ) = 0;
|
||||||
|
SIN_PORT ( LocalPort ) = 0;
|
||||||
|
RetVal = bind ( s,
|
||||||
|
(struct sockaddr *)&LocalPort,
|
||||||
|
sizeof ( LocalPort ));
|
||||||
|
if ( -1 == RetVal ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - bind error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Specify the remote port
|
||||||
|
//
|
||||||
|
memset ( &RemotePort, 0, sizeof ( RemotePort ));
|
||||||
|
SIN_LEN ( RemotePort ) = sizeof ( RemotePort );
|
||||||
|
SIN_FAMILY ( RemotePort ) = AF_INET;
|
||||||
|
SIN_ADDR ( RemotePort ) = ( RemoteAddress[3] << 24 )
|
||||||
|
| ( RemoteAddress[2] << 16 )
|
||||||
|
| ( RemoteAddress[1] << 8 )
|
||||||
|
| RemoteAddress[0];
|
||||||
|
SIN_PORT ( RemotePort ) = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the messages
|
||||||
|
//
|
||||||
|
memset ( &mBuffer[0], 0, sizeof ( mBuffer ));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Send the data before the out-of-band message
|
||||||
|
//
|
||||||
|
TotalSent = 0;
|
||||||
|
BytesSent = 0;
|
||||||
|
do {
|
||||||
|
BytesTransmitted = sendto ( s,
|
||||||
|
&mBuffer[BytesSent],
|
||||||
|
sizeof ( mBuffer ) - BytesSent,
|
||||||
|
0,
|
||||||
|
(struct sockaddr *)&RemotePort,
|
||||||
|
sizeof ( RemotePort ));
|
||||||
|
if ( -1 == BytesTransmitted ) {
|
||||||
|
RetVal = GET_ERRNO;
|
||||||
|
printf ( "ERROR - send before error, errno: %d\r\n", RetVal );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BytesSent += (UINT32)BytesTransmitted;
|
||||||
|
RetVal = 0;
|
||||||
|
} while ( sizeof ( mBuffer ) > BytesSent );
|
||||||
|
if ( 0 != RetVal ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
TotalSent += BytesSent;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test completed successfully
|
||||||
|
//
|
||||||
|
if ( 0 == RetVal ) {
|
||||||
|
printf ( "Bytes sent: %8d\r\n", TotalSent );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Close the socket
|
||||||
|
//
|
||||||
|
CLOSE_SOCKET ( s );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the operation status
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
98
AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.h
Normal file
98
AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.h
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
/** @file
|
||||||
|
Definitions for the raw IP4 transmit application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _RAW_IP4_TX_H_
|
||||||
|
#define _RAW_IP4_TX_H_
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Include Files
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef BUILD_FOR_WINDOWS
|
||||||
|
//
|
||||||
|
// Build for Windows environment
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <winsock2.h>
|
||||||
|
|
||||||
|
#define CHAR8 char
|
||||||
|
#define CLOSE_SOCKET closesocket
|
||||||
|
#define EINVAL 22 // Invalid argument
|
||||||
|
#define GET_ERRNO WSAGetLastError ( )
|
||||||
|
#define SIN_ADDR(port) port.sin_addr.S_un.S_addr
|
||||||
|
#define SIN_FAMILY(port) port.sin_family
|
||||||
|
#define SIN_LEN(port) port.sin_family
|
||||||
|
#define SIN_PORT(port) port.sin_port
|
||||||
|
#define socklen_t int
|
||||||
|
#define ssize_t int
|
||||||
|
|
||||||
|
#else // BUILD_FOR_WINDOWS
|
||||||
|
//
|
||||||
|
// Build for EFI environment
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include <sys/EfiSysCall.h>
|
||||||
|
#include <sys/endian.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#define CLOSE_SOCKET close
|
||||||
|
#define GET_ERRNO errno
|
||||||
|
#define SIN_ADDR(port) port.sin_addr.s_addr
|
||||||
|
#define SIN_FAMILY(port) port.sin_family
|
||||||
|
#define SIN_LEN(port) port.sin_len
|
||||||
|
#define SIN_PORT(port) port.sin_port
|
||||||
|
#define SOCKET int
|
||||||
|
|
||||||
|
#endif // BUILD_FOR_WINDOWS
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Constants
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//
|
||||||
|
// See http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml
|
||||||
|
// and http://tools.ietf.org/html/rfc3692
|
||||||
|
//
|
||||||
|
#define RAW_PROTOCOL 253
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// API
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transmit raw IP4 packets to the remote system.
|
||||||
|
|
||||||
|
@param [in] ArgC Argument count
|
||||||
|
@param [in] ArgV Argument value array
|
||||||
|
|
||||||
|
@retval 0 Successfully operation
|
||||||
|
**/
|
||||||
|
|
||||||
|
int
|
||||||
|
RawIp4Tx (
|
||||||
|
IN int ArgC,
|
||||||
|
IN char **ArgV
|
||||||
|
);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#endif // _RAW_IP4_TX_H_
|
64
AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.inf
Normal file
64
AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.inf
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#/** @file
|
||||||
|
# RawIp4Tx Application
|
||||||
|
#
|
||||||
|
# This file contains an 'Intel Peripheral Driver' and is
|
||||||
|
# licensed for Intel CPUs and chipsets under the terms of your
|
||||||
|
# license agreement with Intel or your vendor. This file may
|
||||||
|
# be modified by the user, subject to additional terms of the
|
||||||
|
# license agreement
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Copyright (c) 20011 Intel Corporation. All rights reserved
|
||||||
|
# This software and associated documentation (if any) is furnished
|
||||||
|
# under a license and may only be used or copied in accordance
|
||||||
|
# with the terms of the license. Except as permitted by such
|
||||||
|
# license, no part of this software or documentation may be
|
||||||
|
# reproduced, stored in a retrieval system, or transmitted in any
|
||||||
|
# form or by any means without the express written consent of
|
||||||
|
# Intel Corporation.
|
||||||
|
#
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = RawIp4Tx
|
||||||
|
FILE_GUID = 3DFE0FAB-70C7-4b53-9855-985F14DB2DDA
|
||||||
|
MODULE_TYPE = UEFI_APPLICATION
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
ENTRY_POINT = ShellCEntryLib
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
Main.c
|
||||||
|
RawIp4Tx.c
|
||||||
|
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
ShellPkg/ShellPkg.dec
|
||||||
|
StdLib/StdLib.dec
|
||||||
|
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
BaseMemoryLib
|
||||||
|
BsdSocketLib
|
||||||
|
DebugLib
|
||||||
|
EfiSocketLib
|
||||||
|
LibC
|
||||||
|
LibMath
|
||||||
|
ShellCEntryLib
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
UefiLib
|
||||||
|
# UseSocketDxe
|
||||||
|
|
||||||
|
[BuildOptions]
|
||||||
|
INTEL:*_*_*_CC_FLAGS = /Qdiag-disable:181,186
|
||||||
|
MSFT:*_*_*_CC_FLAGS = /Od
|
||||||
|
GCC:*_*_*_CC_FLAGS = -O0 -Wno-unused-variable
|
||||||
|
|
20
AppPkg/Applications/Sockets/RawIp4Tx/Windows/RawIp4Tx.sln
Normal file
20
AppPkg/Applications/Sockets/RawIp4Tx/Windows/RawIp4Tx.sln
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
|
# Visual Studio 2005
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RawIp4Tx", "RawIp4Tx.vcproj", "{11018D35-F3E3-40F4-9213-7D277AF01A17}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{11018D35-F3E3-40F4-9213-7D277AF01A17}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{11018D35-F3E3-40F4-9213-7D277AF01A17}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{11018D35-F3E3-40F4-9213-7D277AF01A17}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{11018D35-F3E3-40F4-9213-7D277AF01A17}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
211
AppPkg/Applications/Sockets/RawIp4Tx/Windows/RawIp4Tx.vcproj
Normal file
211
AppPkg/Applications/Sockets/RawIp4Tx/Windows/RawIp4Tx.vcproj
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="RawIp4Tx"
|
||||||
|
ProjectGUID="{11018D35-F3E3-40F4-9213-7D277AF01A17}"
|
||||||
|
RootNamespace="RawIp4Tx"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=".."
|
||||||
|
PreprocessorDefinitions="BUILD_FOR_WINDOWS; _CRT_SECURE_NO_DEPRECATE"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="WS2_32.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=".."
|
||||||
|
PreprocessorDefinitions="BUILD_FOR_WINDOWS; _CRT_SECURE_NO_DEPRECATE"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="WS2_32.lib"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\main.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\RawIp4Tx.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\RawIp4Tx.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||||
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
62
AppPkg/Applications/Sockets/RawIp4Tx/Windows/main.c
Normal file
62
AppPkg/Applications/Sockets/RawIp4Tx/Windows/main.c
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/** @file
|
||||||
|
Windows version of the raw IP4 transmit application
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <RawIp4Tx.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Transmit raw IP4 packets to the remote system.
|
||||||
|
|
||||||
|
Please note that this program must be run with administrator privileges!
|
||||||
|
|
||||||
|
@param [in] argc The number of arguments
|
||||||
|
@param [in] argv The argument value array
|
||||||
|
|
||||||
|
@retval 0 The application exited normally.
|
||||||
|
@retval Other An error occurred.
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
main(
|
||||||
|
int argc,
|
||||||
|
char ** argv
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int RetVal;
|
||||||
|
WSADATA WsaData;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the WinSock layer
|
||||||
|
//
|
||||||
|
RetVal = WSAStartup ( MAKEWORD ( 2, 2 ), &WsaData );
|
||||||
|
if ( 0 == RetVal ) {
|
||||||
|
//
|
||||||
|
// Start the application
|
||||||
|
// See http://msdn.microsoft.com/en-us/library/ms740548(v=vs.85).aspx
|
||||||
|
//
|
||||||
|
RetVal = RawIp4Tx ( argc, argv );
|
||||||
|
if ( WSAEACCES == RetVal ) {
|
||||||
|
printf ( "Requires administrator privileges to run!\r\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Done with the WinSock layer
|
||||||
|
//
|
||||||
|
WSACleanup ( );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the final result
|
||||||
|
//
|
||||||
|
return RetVal;
|
||||||
|
}
|
11
AppPkg/Applications/Sockets/ReadMe.txt
Normal file
11
AppPkg/Applications/Sockets/ReadMe.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Users of the socket library need to do the following:
|
||||||
|
|
||||||
|
<EFBFBD> Use the development branch: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/EADK/
|
||||||
|
<EFBFBD> Create an Efi\etc directory on their system or USB flash device
|
||||||
|
<EFBFBD> Copy the files from StdLib\Efi\etc into that directory
|
||||||
|
<EFBFBD> Edit the files appropriately
|
||||||
|
o Set the correct DNS servers in resolv.conf
|
||||||
|
o Set the search order in host.conf
|
||||||
|
<EFBFBD> At the EFI shell
|
||||||
|
o Set the device containing the \Efi directory as the default device
|
||||||
|
o Run the socket application
|
@ -103,8 +103,7 @@ DisplayOption (
|
|||||||
// Display the value
|
// Display the value
|
||||||
//
|
//
|
||||||
Value.u8 = &mBuffer[0];
|
Value.u8 = &mBuffer[0];
|
||||||
switch ( pOption->DataType )
|
switch ( pOption->DataType ) {
|
||||||
{
|
|
||||||
case DATA_TYPE_UNKNOWN:
|
case DATA_TYPE_UNKNOWN:
|
||||||
Print ( L"%a:", pOption->pOptionName );
|
Print ( L"%a:", pOption->pOptionName );
|
||||||
pEnd = &Value.u8[ LengthInBytes ];
|
pEnd = &Value.u8[ LengthInBytes ];
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
AppPkg/Applications/Sockets/GetNetByName/GetNetByName.inf
|
AppPkg/Applications/Sockets/GetNetByName/GetNetByName.inf
|
||||||
AppPkg/Applications/Sockets/GetServByName/GetServByName.inf
|
AppPkg/Applications/Sockets/GetServByName/GetServByName.inf
|
||||||
AppPkg/Applications/Sockets/GetServByPort/GetServByPort.inf
|
AppPkg/Applications/Sockets/GetServByPort/GetServByPort.inf
|
||||||
|
AppPkg/Applications/Sockets/OobRx/OobRx.inf
|
||||||
|
AppPkg/Applications/Sockets/OobTx/OobTx.inf
|
||||||
|
AppPkg/Applications/Sockets/RawIp4Rx/RawIp4Rx.inf
|
||||||
|
AppPkg/Applications/Sockets/RawIp4Tx/RawIp4Tx.inf
|
||||||
AppPkg/Applications/Sockets/RecvDgram/RecvDgram.inf
|
AppPkg/Applications/Sockets/RecvDgram/RecvDgram.inf
|
||||||
AppPkg/Applications/Sockets/SetHostName/SetHostName.inf
|
AppPkg/Applications/Sockets/SetHostName/SetHostName.inf
|
||||||
AppPkg/Applications/Sockets/SetSockOpt/SetSockOpt.inf
|
AppPkg/Applications/Sockets/SetSockOpt/SetSockOpt.inf
|
||||||
|
@ -846,8 +846,7 @@ Print ( L"TFTP Opcode: 0x%08x\r\n", Opcode );
|
|||||||
bIgnorePacket = TRUE;
|
bIgnorePacket = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( pTftpServer->RxBytes > (ssize_t)( pContext->BlockSize + 2 + 2 ))
|
if ( pTftpServer->RxBytes > (ssize_t)( pContext->BlockSize + 2 + 2 )) {
|
||||||
{
|
|
||||||
DEBUG (( DEBUG_ERROR,
|
DEBUG (( DEBUG_ERROR,
|
||||||
"ERROR - Receive data length of %d > %d bytes (maximum block size) for pContext 0x%08x\r\n",
|
"ERROR - Receive data length of %d > %d bytes (maximum block size) for pContext 0x%08x\r\n",
|
||||||
pTftpServer->RxBytes - 2 - 2,
|
pTftpServer->RxBytes - 2 - 2,
|
||||||
@ -1049,8 +1048,7 @@ pContext->File = (EFI_HANDLE)1;
|
|||||||
"ACK for block 0x%04x received\r\n",
|
"ACK for block 0x%04x received\r\n",
|
||||||
BlockNumber ));
|
BlockNumber ));
|
||||||
if (( !pContext->bExpectAck )
|
if (( !pContext->bExpectAck )
|
||||||
|| ( BlockNumber != pContext->AckNext ))
|
|| ( BlockNumber != pContext->AckNext )) {
|
||||||
{
|
|
||||||
DEBUG (( DEBUG_WARN | DEBUG_TFTP_ACK,
|
DEBUG (( DEBUG_WARN | DEBUG_TFTP_ACK,
|
||||||
"WARNING - Expecting ACK 0x%0x4 not received ACK 0x%08x\r\n",
|
"WARNING - Expecting ACK 0x%0x4 not received ACK 0x%08x\r\n",
|
||||||
pContext->AckNext,
|
pContext->AckNext,
|
||||||
@ -1248,8 +1246,7 @@ TftpServerTimer (
|
|||||||
pTftpServer->TftpPort.fd = socket ( AF_INET,
|
pTftpServer->TftpPort.fd = socket ( AF_INET,
|
||||||
SOCK_DGRAM,
|
SOCK_DGRAM,
|
||||||
IPPROTO_UDP );
|
IPPROTO_UDP );
|
||||||
if ( -1 != pTftpServer->TftpPort.fd )
|
if ( -1 != pTftpServer->TftpPort.fd ) {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Set the socket address
|
// Set the socket address
|
||||||
//
|
//
|
||||||
|
@ -62,12 +62,12 @@
|
|||||||
// Constants
|
// Constants
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#define DEBUG_SOCKET_POLL 0x40000000 ///< Display the socket poll messages
|
#define DEBUG_PORT_WORK 0x40000000 ///< Display the port work messages
|
||||||
#define DEBUG_PORT_WORK 0x20000000 ///< Display the port work messages
|
#define DEBUG_SERVER_TIMER 0x20000000 ///< Display the socket poll messages
|
||||||
#define DEBUG_SERVER_TIMER 0x10000000 ///< Display the socket poll messages
|
#define DEBUG_TFTP_PORT 0x10000000 ///< Display the TFTP port messages
|
||||||
#define DEBUG_TFTP_PORT 0x08000000 ///< Display the TFTP port messages
|
#define DEBUG_TFTP_REQUEST 0x08000000 ///< Display the TFTP request messages
|
||||||
#define DEBUG_TFTP_REQUEST 0x04000000 ///< Display the TFTP request messages
|
#define DEBUG_TX 0x04000000 ///< Display transmit messages
|
||||||
#define DEBUG_TX 0x02000000 ///< Display transmit messages
|
#define DEBUG_SOCKET_POLL 0x02000000 ///< Display the socket poll messages
|
||||||
#define DEBUG_RX 0x01000000 ///< Display receive messages
|
#define DEBUG_RX 0x01000000 ///< Display receive messages
|
||||||
#define DEBUG_TFTP_ACK 0x00800000 ///< Display the TFTP ACK messages
|
#define DEBUG_TFTP_ACK 0x00800000 ///< Display the TFTP ACK messages
|
||||||
|
|
||||||
|
@ -668,8 +668,7 @@ HttpSend (
|
|||||||
//
|
//
|
||||||
MaxBytes = sizeof ( pPort->TxBuffer );
|
MaxBytes = sizeof ( pPort->TxBuffer );
|
||||||
DataBytes = MaxBytes - pPort->TxBytes;
|
DataBytes = MaxBytes - pPort->TxBytes;
|
||||||
if ( DataBytes > LengthInBytes )
|
if ( DataBytes > LengthInBytes ) {
|
||||||
{
|
|
||||||
DataBytes = LengthInBytes;
|
DataBytes = LengthInBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,8 +439,7 @@ PortWork (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Receive the file data
|
// Receive the file data
|
||||||
//
|
//
|
||||||
@ -610,8 +609,7 @@ WebServerTimer (
|
|||||||
pWebServer->HttpListenPort = socket ( AF_INET,
|
pWebServer->HttpListenPort = socket ( AF_INET,
|
||||||
SOCK_STREAM,
|
SOCK_STREAM,
|
||||||
IPPROTO_TCP );
|
IPPROTO_TCP );
|
||||||
if ( -1 != pWebServer->HttpListenPort )
|
if ( -1 != pWebServer->HttpListenPort ) {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Set the socket address
|
// Set the socket address
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user