mirror of https://github.com/acidanthera/audk.git
StdLib: Fix more GCC warnings/errors caused by variables being set but not used.
Removed variables that had no effect on code behavior. Normalized comment formatting. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16284 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
4d5b818c78
commit
beaaa3b715
|
@ -1,22 +1,19 @@
|
|||
/** @file
|
||||
Implement the bind API.
|
||||
|
||||
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
|
||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that 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 <SocketInternals.h>
|
||||
|
||||
|
||||
/**
|
||||
Bind a name to a socket.
|
||||
/** Bind a name to a socket.
|
||||
|
||||
The bind routine connects a name (network address) to a socket on the local machine.
|
||||
|
||||
|
@ -40,7 +37,6 @@
|
|||
|
||||
@return The bind routine returns zero (0) if successful and -1 upon failure.
|
||||
In the case of an error, ::errno contains more information.
|
||||
|
||||
**/
|
||||
int
|
||||
bind (
|
||||
|
@ -51,25 +47,19 @@ bind (
|
|||
{
|
||||
int BindStatus;
|
||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Locate the context for this socket
|
||||
//
|
||||
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
||||
if ( NULL != pSocketProtocol ) {
|
||||
//
|
||||
|
||||
// Bind the socket
|
||||
//
|
||||
Status = pSocketProtocol->pfnBind ( pSocketProtocol,
|
||||
(void) pSocketProtocol->pfnBind ( pSocketProtocol,
|
||||
name,
|
||||
namelen,
|
||||
&errno );
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation stauts
|
||||
//
|
||||
BindStatus = ( 0 == errno ) ? 0 : -1;
|
||||
return BindStatus;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
/** @file
|
||||
Implement the getsockopt API.
|
||||
|
||||
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
|
||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that 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 <SocketInternals.h>
|
||||
|
||||
|
||||
/**
|
||||
Get the socket options
|
||||
/** Get the socket options
|
||||
|
||||
The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html#">POSIX</a>
|
||||
|
@ -31,7 +28,6 @@
|
|||
|
||||
@return This routine returns zero (0) if successful or -1 when an error occurs.
|
||||
In the case of an error, ::errno contains more details.
|
||||
|
||||
**/
|
||||
int
|
||||
getsockopt (
|
||||
|
@ -44,27 +40,19 @@ getsockopt (
|
|||
{
|
||||
int OptionStatus;
|
||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Locate the context for this socket
|
||||
//
|
||||
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
||||
if ( NULL != pSocketProtocol ) {
|
||||
//
|
||||
// Get the socket option
|
||||
//
|
||||
Status = pSocketProtocol->pfnOptionGet ( pSocketProtocol,
|
||||
(void) pSocketProtocol->pfnOptionGet ( pSocketProtocol,
|
||||
level,
|
||||
option_name,
|
||||
option_value,
|
||||
option_len,
|
||||
&errno );
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation stauts
|
||||
//
|
||||
OptionStatus = ( 0 == errno ) ? 0 : -1;
|
||||
return OptionStatus;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
/** @file
|
||||
Implement the listen API.
|
||||
|
||||
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
|
||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that 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 <SocketInternals.h>
|
||||
|
||||
|
||||
/**
|
||||
Establish the known port to listen for network connections.
|
||||
/** Establish the known port to listen for network connections.
|
||||
|
||||
The listen routine places the port into a state that enables connection
|
||||
attempts. Connections are placed into FIFO order in a queue to be serviced
|
||||
|
@ -35,7 +32,6 @@
|
|||
|
||||
@return This routine returns zero (0) if successful or -1 when an error occurs.
|
||||
In the case of an error, ::errno contains more details.
|
||||
|
||||
**/
|
||||
int
|
||||
listen (
|
||||
|
@ -45,24 +41,16 @@ listen (
|
|||
{
|
||||
int ListenStatus;
|
||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Locate the context for this socket
|
||||
//
|
||||
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
||||
if ( NULL != pSocketProtocol ) {
|
||||
//
|
||||
// Enable connections on the known port
|
||||
//
|
||||
Status = pSocketProtocol->pfnListen ( pSocketProtocol,
|
||||
(void) pSocketProtocol->pfnListen ( pSocketProtocol,
|
||||
backlog,
|
||||
&errno );
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation stauts
|
||||
//
|
||||
ListenStatus = ( 0 == errno ) ? 0 : -1;
|
||||
return ListenStatus;
|
||||
}
|
||||
|
|
|
@ -1,29 +1,24 @@
|
|||
/** @file
|
||||
Implement the poll API.
|
||||
|
||||
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
|
||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that 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 <SocketInternals.h>
|
||||
|
||||
|
||||
/**
|
||||
Poll the socket for activity
|
||||
/** Poll the socket for activity
|
||||
|
||||
@param [in] pDescriptor Descriptor address for the file
|
||||
|
||||
@param [in] Events Mask of events to detect
|
||||
|
||||
@return Detected events for the socket
|
||||
|
||||
**/
|
||||
short
|
||||
EFIAPI
|
||||
|
@ -34,25 +29,17 @@ BslSocketPoll (
|
|||
{
|
||||
short DetectedEvents;
|
||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Locate the socket protocol
|
||||
//
|
||||
DetectedEvents = 0;
|
||||
pSocketProtocol = BslValidateSocketFd ( pDescriptor, &errno );
|
||||
if ( NULL != pSocketProtocol ) {
|
||||
//
|
||||
// Poll the socket
|
||||
//
|
||||
Status = pSocketProtocol->pfnPoll ( pSocketProtocol,
|
||||
(void) pSocketProtocol->pfnPoll ( pSocketProtocol,
|
||||
Events,
|
||||
&DetectedEvents,
|
||||
&errno );
|
||||
}
|
||||
|
||||
//
|
||||
// Return the detected events
|
||||
//
|
||||
return DetectedEvents;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/** @file
|
||||
Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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.
|
||||
**/
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
|
@ -476,9 +486,9 @@ ans=%d, auth=%d, add=%d, rcode=%d\n",
|
|||
dname = zptr->z_ns[k].nsname;
|
||||
qtype = T_A;
|
||||
}
|
||||
|
||||
} /* while */
|
||||
}
|
||||
--ttl; // Suppress the "Set but not used" warning/error for ttl.
|
||||
|
||||
_res.options |= RES_DEBUG;
|
||||
for (zptr = zgrp_start; zptr; zptr = zptr->z_next) {
|
||||
|
@ -502,8 +512,7 @@ ans=%d, auth=%d, add=%d, rcode=%d\n",
|
|||
} else
|
||||
fprintf(stdout, "res_mkupdate: packet size = %d\n", n);
|
||||
|
||||
/*
|
||||
* Override the list of NS records from res_init() with
|
||||
/* Override the list of NS records from res_init() with
|
||||
* the authoritative nameservers for the zone being updated.
|
||||
* Sort primary to be the first in the list of nameservers.
|
||||
*/
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
/** @file
|
||||
Implement the setsockopt API.
|
||||
|
||||
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
|
||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that 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 <SocketInternals.h>
|
||||
|
||||
|
||||
/**
|
||||
Set the socket options
|
||||
/** Set the socket options
|
||||
|
||||
The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html">POSIX</a>
|
||||
|
@ -30,7 +27,6 @@
|
|||
|
||||
@return This routine returns zero (0) upon success and -1 when an error occurs.
|
||||
In the case of an error, ::errno contains more details.
|
||||
|
||||
**/
|
||||
int
|
||||
setsockopt (
|
||||
|
@ -43,27 +39,19 @@ setsockopt (
|
|||
{
|
||||
int OptionStatus;
|
||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Locate the context for this socket
|
||||
//
|
||||
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
||||
if ( NULL != pSocketProtocol ) {
|
||||
//
|
||||
// Set the socket option
|
||||
//
|
||||
Status = pSocketProtocol->pfnOptionSet ( pSocketProtocol,
|
||||
(void) pSocketProtocol->pfnOptionSet (pSocketProtocol,
|
||||
level,
|
||||
option_name,
|
||||
option_value,
|
||||
option_len,
|
||||
&errno );
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation stauts
|
||||
//
|
||||
OptionStatus = ( 0 == errno ) ? 0 : -1;
|
||||
return OptionStatus;
|
||||
}
|
||||
|
|
|
@ -9,14 +9,11 @@
|
|||
|
||||
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 "Socket.h"
|
||||
|
||||
|
||||
/**
|
||||
Get the local socket address
|
||||
/** Get the local socket address.
|
||||
|
||||
This routine returns the IPv4 address associated with the local
|
||||
socket.
|
||||
|
@ -25,9 +22,7 @@
|
|||
network address for the SOCK_RAW socket.
|
||||
|
||||
@param [in] pPort Address of an ::ESL_PORT structure.
|
||||
|
||||
@param [out] pAddress Network address to receive the local system address
|
||||
|
||||
**/
|
||||
VOID
|
||||
EslIp4LocalAddressGet (
|
||||
|
@ -40,9 +35,7 @@ EslIp4LocalAddressGet (
|
|||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Return the local address
|
||||
//
|
||||
pIp4 = &pPort->Context.Ip4;
|
||||
pLocalAddress = (struct sockaddr_in *)pAddress;
|
||||
pLocalAddress->sin_family = AF_INET;
|
||||
|
@ -54,8 +47,7 @@ EslIp4LocalAddressGet (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the local port address.
|
||||
/** Set the local port address.
|
||||
|
||||
This routine sets the local port address.
|
||||
|
||||
|
@ -75,7 +67,6 @@ EslIp4LocalAddressGet (
|
|||
@param [in] bBindTest TRUE = run bind testing
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslIp4LocalAddressSet (
|
||||
|
@ -91,23 +82,17 @@ EslIp4LocalAddressSet (
|
|||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Validate the address
|
||||
//
|
||||
pIpAddress = (struct sockaddr_in *)pSockAddr;
|
||||
if ( INADDR_BROADCAST == pIpAddress->sin_addr.s_addr ) {
|
||||
//
|
||||
// The local address must not be the broadcast address
|
||||
//
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
pPort->pSocket->errno = EADDRNOTAVAIL;
|
||||
}
|
||||
else {
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Set the local address
|
||||
//
|
||||
pIpAddress = (struct sockaddr_in *)pSockAddr;
|
||||
pIpv4Address = (UINT8 *)&pIpAddress->sin_addr.s_addr;
|
||||
pConfig = &pPort->Context.Ip4.ModeData.ConfigData;
|
||||
|
@ -116,14 +101,10 @@ EslIp4LocalAddressSet (
|
|||
pConfig->StationAddress.Addr[2] = pIpv4Address[2];
|
||||
pConfig->StationAddress.Addr[3] = pIpv4Address[3];
|
||||
|
||||
//
|
||||
// Determine if the default address is used
|
||||
//
|
||||
pConfig->UseDefaultAddress = (BOOLEAN)( 0 == pIpAddress->sin_addr.s_addr );
|
||||
|
||||
//
|
||||
// Display the local address
|
||||
//
|
||||
DEBUG (( DEBUG_BIND,
|
||||
"0x%08x: Port, Local IP4 Address: %d.%d.%d.%d\r\n",
|
||||
pPort,
|
||||
|
@ -132,9 +113,7 @@ EslIp4LocalAddressSet (
|
|||
pConfig->StationAddress.Addr[2],
|
||||
pConfig->StationAddress.Addr[3]));
|
||||
|
||||
//
|
||||
// Set the subnet mask
|
||||
//
|
||||
if ( pConfig->UseDefaultAddress ) {
|
||||
pConfig->SubnetMask.Addr[0] = 0;
|
||||
pConfig->SubnetMask.Addr[1] = 0;
|
||||
|
@ -148,17 +127,13 @@ EslIp4LocalAddressSet (
|
|||
pConfig->SubnetMask.Addr[3] = ( 224 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the option value
|
||||
/** Get the option value.
|
||||
|
||||
This routine handles the IPv4 level options.
|
||||
|
||||
|
@ -171,7 +146,6 @@ EslIp4LocalAddressSet (
|
|||
@param [out] pOptionLength Buffer to receive the option length
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslIp4OptionGet (
|
||||
|
@ -185,20 +159,14 @@ EslIp4OptionGet (
|
|||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Assume success
|
||||
//
|
||||
pSocket->errno = 0;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Attempt to get the option
|
||||
//
|
||||
switch ( OptionName ) {
|
||||
default:
|
||||
//
|
||||
// Option not supported
|
||||
//
|
||||
pSocket->errno = ENOPROTOOPT;
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
break;
|
||||
|
@ -208,17 +176,13 @@ EslIp4OptionGet (
|
|||
*pOptionLength = sizeof ( pSocket->bIncludeHeader );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the option value
|
||||
/** Set the option value.
|
||||
|
||||
This routine handles the IPv4 level options.
|
||||
|
||||
|
@ -231,7 +195,6 @@ EslIp4OptionGet (
|
|||
@param [in] OptionLength Length of the buffer in bytes
|
||||
|
||||
@retval EFI_SUCCESS - Option successfully set
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslIp4OptionSet (
|
||||
|
@ -242,28 +205,22 @@ EslIp4OptionSet (
|
|||
)
|
||||
{
|
||||
BOOLEAN bTrueFalse;
|
||||
socklen_t LengthInBytes;
|
||||
UINT8 * pOptionData;
|
||||
//socklen_t LengthInBytes;
|
||||
//UINT8 * pOptionData;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Assume success
|
||||
//
|
||||
pSocket->errno = 0;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Determine if the option protocol matches
|
||||
//
|
||||
LengthInBytes = 0;
|
||||
pOptionData = NULL;
|
||||
//LengthInBytes = 0;
|
||||
//pOptionData = NULL;
|
||||
switch ( OptionName ) {
|
||||
default:
|
||||
//
|
||||
// Protocol level not supported
|
||||
//
|
||||
DEBUG (( DEBUG_INFO | DEBUG_OPTION, "ERROR - Invalid protocol option\r\n" ));
|
||||
pSocket->errno = ENOTSUP;
|
||||
Status = EFI_UNSUPPORTED;
|
||||
|
@ -271,31 +228,22 @@ EslIp4OptionSet (
|
|||
|
||||
case IP_HDRINCL:
|
||||
|
||||
//
|
||||
// Validate the option length
|
||||
//
|
||||
if ( sizeof ( UINT32 ) == OptionLength ) {
|
||||
//
|
||||
// Restrict the input to TRUE or FALSE
|
||||
//
|
||||
bTrueFalse = TRUE;
|
||||
if ( 0 == *(UINT32 *)pOptionValue ) {
|
||||
bTrueFalse = FALSE;
|
||||
}
|
||||
pOptionValue = &bTrueFalse;
|
||||
|
||||
//
|
||||
// Set the option value
|
||||
//
|
||||
pOptionData = (UINT8 *)&pSocket->bIncludeHeader;
|
||||
LengthInBytes = sizeof ( pSocket->bIncludeHeader );
|
||||
//pOptionData = (UINT8 *)&pSocket->bIncludeHeader;
|
||||
//LengthInBytes = sizeof ( pSocket->bIncludeHeader );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -459,8 +459,7 @@
|
|||
#include "Socket.h"
|
||||
|
||||
|
||||
/**
|
||||
Socket driver connection points
|
||||
/** Socket driver connection points
|
||||
|
||||
List the network stack connection points for the socket driver.
|
||||
**/
|
||||
|
@ -509,9 +508,7 @@ CONST ESL_SOCKET_BINDING cEslSocketBinding[] = {
|
|||
|
||||
CONST UINTN cEslSocketBindingEntries = DIM ( cEslSocketBinding );
|
||||
|
||||
/**
|
||||
APIs to support the various socket types for the v4 network stack.
|
||||
**/
|
||||
/// APIs to support the various socket types for the v4 network stack.
|
||||
CONST ESL_PROTOCOL_API * cEslAfInetApi[] = {
|
||||
NULL, // 0
|
||||
&cEslTcp4Api, // SOCK_STREAM
|
||||
|
@ -521,15 +518,11 @@ CONST ESL_PROTOCOL_API * cEslAfInetApi[] = {
|
|||
&cEslTcp4Api // SOCK_SEQPACKET
|
||||
};
|
||||
|
||||
/**
|
||||
Number of entries in the v4 API array ::cEslAfInetApi.
|
||||
**/
|
||||
/// Number of entries in the v4 API array ::cEslAfInetApi.
|
||||
CONST int cEslAfInetApiSize = DIM ( cEslAfInetApi );
|
||||
|
||||
|
||||
/**
|
||||
APIs to support the various socket types for the v6 network stack.
|
||||
**/
|
||||
/// APIs to support the various socket types for the v6 network stack.
|
||||
CONST ESL_PROTOCOL_API * cEslAfInet6Api[] = {
|
||||
NULL, // 0
|
||||
&cEslTcp6Api, // SOCK_STREAM
|
||||
|
@ -539,20 +532,15 @@ CONST ESL_PROTOCOL_API * cEslAfInet6Api[] = {
|
|||
&cEslTcp6Api // SOCK_SEQPACKET
|
||||
};
|
||||
|
||||
/**
|
||||
Number of entries in the v6 API array ::cEslAfInet6Api.
|
||||
**/
|
||||
/// Number of entries in the v6 API array ::cEslAfInet6Api.
|
||||
CONST int cEslAfInet6ApiSize = DIM ( cEslAfInet6Api );
|
||||
|
||||
|
||||
/**
|
||||
Global management structure for the socket layer.
|
||||
**/
|
||||
/// Global management structure for the socket layer.
|
||||
ESL_LAYER mEslLayer;
|
||||
|
||||
|
||||
/**
|
||||
Initialize an endpoint for network communication.
|
||||
/** Initialize an endpoint for network communication.
|
||||
|
||||
This routine initializes the communication endpoint.
|
||||
|
||||
|
@ -572,7 +560,6 @@ ESL_LAYER mEslLayer;
|
|||
@retval EFI_INVALID_PARAMETER - Invalid domain value, errno = EAFNOSUPPORT
|
||||
@retval EFI_INVALID_PARAMETER - Invalid type value, errno = EINVAL
|
||||
@retval EFI_INVALID_PARAMETER - Invalid protocol value, errno = EINVAL
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocket (
|
||||
|
@ -593,31 +580,21 @@ EslSocket (
|
|||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Locate the socket
|
||||
//
|
||||
pSocket = SOCKET_FROM_PROTOCOL ( pSocketProtocol );
|
||||
|
||||
//
|
||||
// Set the default domain if necessary
|
||||
//
|
||||
if ( AF_UNSPEC == domain ) {
|
||||
domain = AF_INET;
|
||||
}
|
||||
|
||||
//
|
||||
// Assume success
|
||||
//
|
||||
errno = 0;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Use break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Validate the domain value
|
||||
//
|
||||
if (( AF_INET != domain )
|
||||
&& ( AF_INET6 != domain )
|
||||
&& ( AF_LOCAL != domain )) {
|
||||
|
@ -628,9 +605,7 @@ EslSocket (
|
|||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Determine the protocol APIs
|
||||
//
|
||||
ppApiArray = NULL;
|
||||
ApiArraySize = 0;
|
||||
if (( AF_INET == domain )
|
||||
|
@ -643,47 +618,35 @@ EslSocket (
|
|||
ApiArraySize = cEslAfInet6ApiSize;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the default type if necessary
|
||||
//
|
||||
if ( 0 == type ) {
|
||||
type = SOCK_STREAM;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate the type value
|
||||
//
|
||||
if (( type >= ApiArraySize )
|
||||
|| ( NULL == ppApiArray )
|
||||
|| ( NULL == ppApiArray[ type ])) {
|
||||
DEBUG (( DEBUG_ERROR | DEBUG_SOCKET,
|
||||
"ERROR - Invalid type value\r\n" ));
|
||||
//
|
||||
// The socket type is not supported
|
||||
//
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
errno = EPROTOTYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the default protocol if necessary
|
||||
//
|
||||
pApi = ppApiArray[ type ];
|
||||
if ( 0 == protocol ) {
|
||||
protocol = pApi->DefaultProtocol;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate the protocol value
|
||||
//
|
||||
if (( pApi->DefaultProtocol != protocol )
|
||||
&& ( SOCK_RAW != type )) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
|
||||
//
|
||||
// Assume that the driver supports this protocol
|
||||
//
|
||||
ppApiArray = &cEslAfInetApi[0];
|
||||
ppApiArrayEnd = &ppApiArray [ cEslAfInetApiSize ];
|
||||
while ( ppApiArrayEnd > ppApiArray ) {
|
||||
|
@ -694,9 +657,7 @@ EslSocket (
|
|||
ppApiArray += 1;
|
||||
}
|
||||
if ( ppApiArrayEnd <= ppApiArray ) {
|
||||
//
|
||||
// Verify against the IPv6 table
|
||||
//
|
||||
ppApiArray = &cEslAfInet6Api[0];
|
||||
ppApiArrayEnd = &ppApiArray [ cEslAfInet6ApiSize ];
|
||||
while ( ppApiArrayEnd > ppApiArray ) {
|
||||
|
@ -714,33 +675,23 @@ EslSocket (
|
|||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// The driver does not support this protocol
|
||||
//
|
||||
DEBUG (( DEBUG_ERROR | DEBUG_SOCKET,
|
||||
"ERROR - The protocol does not support this socket type!\r\n" ));
|
||||
errno = EPROTONOSUPPORT;
|
||||
errno = EPROTOTYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Save the socket attributes
|
||||
//
|
||||
pSocket->pApi = pApi;
|
||||
pSocket->Domain = domain;
|
||||
pSocket->Type = type;
|
||||
pSocket->Protocol = protocol;
|
||||
|
||||
//
|
||||
// Done
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
if ( NULL != pErrno ) {
|
||||
*pErrno = errno;
|
||||
}
|
||||
|
@ -749,8 +700,7 @@ EslSocket (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Accept a network connection.
|
||||
/** Accept a network connection.
|
||||
|
||||
This routine calls the network specific layer to remove the next
|
||||
connection from the FIFO.
|
||||
|
@ -762,23 +712,18 @@ EslSocket (
|
|||
if requested.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[in] pSockAddr Address of a buffer to receive the remote
|
||||
network address.
|
||||
|
||||
@param[in,out] pSockAddrLength Length in bytes of the address buffer.
|
||||
On output specifies the length of the
|
||||
remote network address.
|
||||
|
||||
@param[out] ppSocketProtocol Address of a buffer to receive the
|
||||
::EFI_SOCKET_PROTOCOL instance
|
||||
associated with the new socket.
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS New connection successfully created
|
||||
@retval EFI_NOT_READY No connection is available
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketAccept (
|
||||
|
@ -954,8 +899,7 @@ EslSocketAccept (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Allocate and initialize a ESL_SOCKET structure.
|
||||
/** Allocate and initialize a ESL_SOCKET structure.
|
||||
|
||||
This support function allocates an ::ESL_SOCKET structure
|
||||
and installs a protocol on ChildHandle. If pChildHandle is a
|
||||
|
@ -976,7 +920,6 @@ EslSocketAccept (
|
|||
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to create
|
||||
the child
|
||||
@retval other The child handle was not created
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@ -1096,8 +1039,7 @@ EslSocketAllocate (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Bind a name to a socket.
|
||||
/** Bind a name to a socket.
|
||||
|
||||
This routine calls the network specific layer to save the network
|
||||
address of the local connection point.
|
||||
|
@ -1106,7 +1048,6 @@ EslSocketAllocate (
|
|||
(network address and port) to a socket on the local machine.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[in] pSockAddr Address of a sockaddr structure that contains the
|
||||
connection point on the local machine. An IPv4 address
|
||||
of INADDR_ANY specifies that the connection is made to
|
||||
|
@ -1116,13 +1057,10 @@ EslSocketAllocate (
|
|||
for the port causes the network layer to assign a port
|
||||
number from the dynamic range. Specifying a specific
|
||||
port number causes the network layer to use that port.
|
||||
|
||||
@param[in] SockAddrLength Specifies the length in bytes of the sockaddr structure.
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully created
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketBind (
|
||||
|
@ -1306,15 +1244,13 @@ EslSocketBind (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Test the bind configuration.
|
||||
/** Test the bind configuration.
|
||||
|
||||
@param[in] pPort Address of the ::ESL_PORT structure.
|
||||
@param[in] ErrnoValue errno value if test fails
|
||||
|
||||
@retval EFI_SUCCESS The connection was successfully established.
|
||||
@retval Others The connection attempt failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketBindTest (
|
||||
|
@ -1381,8 +1317,7 @@ EslSocketBindTest (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Determine if the socket is closed
|
||||
/** Determine if the socket is closed.
|
||||
|
||||
This routine checks the state of the socket to determine if
|
||||
the network specific layer has completed the close operation.
|
||||
|
@ -1398,7 +1333,6 @@ EslSocketBindTest (
|
|||
@retval EFI_NOT_READY Close still in progress
|
||||
@retval EFI_ALREADY Close operation already in progress
|
||||
@retval Other Failed to close the socket
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketClosePoll (
|
||||
|
@ -1519,8 +1453,7 @@ EslSocketClosePoll (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Start the close operation on the socket
|
||||
/** Start the close operation on the socket.
|
||||
|
||||
This routine calls the network specific layer to initiate the
|
||||
close state machine. This routine then calls the network
|
||||
|
@ -1542,7 +1475,6 @@ EslSocketClosePoll (
|
|||
@retval EFI_NOT_READY Close still in progress
|
||||
@retval EFI_ALREADY Close operation already in progress
|
||||
@retval Other Failed to close the socket
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketCloseStart (
|
||||
|
@ -1633,8 +1565,7 @@ EslSocketCloseStart (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Connect to a remote system via the network.
|
||||
/** Connect to a remote system via the network.
|
||||
|
||||
This routine calls the network specific layer to establish
|
||||
the remote system address and establish the connection to
|
||||
|
@ -1646,17 +1577,13 @@ EslSocketCloseStart (
|
|||
of the network connection.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[in] pSockAddr Network address of the remote system.
|
||||
|
||||
@param[in] SockAddrLength Length in bytes of the network address.
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS The connection was successfully established.
|
||||
@retval EFI_NOT_READY The connection is in progress, call this routine again.
|
||||
@retval Others The connection attempt failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketConnect (
|
||||
|
@ -1873,25 +1800,19 @@ EslSocketConnect (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Copy a fragmented buffer into a destination buffer.
|
||||
/** Copy a fragmented buffer into a destination buffer.
|
||||
|
||||
This support routine copies a fragmented buffer to the caller specified buffer.
|
||||
|
||||
This routine is called by ::EslIp4Receive and ::EslUdp4Receive.
|
||||
|
||||
@param[in] FragmentCount Number of fragments in the table
|
||||
|
||||
@param[in] pFragmentTable Address of an EFI_IP4_FRAGMENT_DATA structure
|
||||
|
||||
@param[in] BufferLength Length of the the buffer
|
||||
|
||||
@param[in] pBuffer Address of a buffer to receive the data.
|
||||
|
||||
@param[in] pDataLength Number of received data bytes in the buffer.
|
||||
|
||||
@return Returns the address of the next free byte in the buffer.
|
||||
|
||||
**/
|
||||
UINT8 *
|
||||
EslSocketCopyFragmentedBuffer (
|
||||
|
@ -1954,8 +1875,7 @@ EslSocketCopyFragmentedBuffer (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Free the socket.
|
||||
/** Free the socket.
|
||||
|
||||
This routine frees the socket structure and handle resources.
|
||||
|
||||
|
@ -1964,11 +1884,9 @@ EslSocketCopyFragmentedBuffer (
|
|||
handle.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS The socket resources were returned successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketFree (
|
||||
|
@ -2116,8 +2034,7 @@ EslSocketFree (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the local address.
|
||||
/** Get the local address.
|
||||
|
||||
This routine calls the network specific layer to get the network
|
||||
address of the local host connection point.
|
||||
|
@ -2126,15 +2043,11 @@ EslSocketFree (
|
|||
address associated with the local host connection point.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[out] pAddress Network address to receive the local system address
|
||||
|
||||
@param[in,out] pAddressLength Length of the local network address structure
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Local address successfully returned
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketGetLocalAddress (
|
||||
|
@ -2254,8 +2167,7 @@ EslSocketGetLocalAddress (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the peer address.
|
||||
/** Get the peer address.
|
||||
|
||||
This routine calls the network specific layer to get the remote
|
||||
system connection point.
|
||||
|
@ -2264,15 +2176,11 @@ EslSocketGetLocalAddress (
|
|||
address of the remote connection point.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[out] pAddress Network address to receive the remote system address
|
||||
|
||||
@param[in,out] pAddressLength Length of the remote network address structure
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Remote address successfully returned
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketGetPeerAddress (
|
||||
|
@ -2393,8 +2301,7 @@ EslSocketGetPeerAddress (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Free the ESL_IO_MGMT event and structure
|
||||
/** Free the ESL_IO_MGMT event and structure.
|
||||
|
||||
This support routine walks the free list to close the event in
|
||||
the ESL_IO_MGMT structure and remove the structure from the free
|
||||
|
@ -2408,7 +2315,6 @@ EslSocketGetPeerAddress (
|
|||
@param[in] pEventName Zero terminated string containing the event name
|
||||
|
||||
@retval EFI_SUCCESS - The structures were properly initialized
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketIoFree (
|
||||
|
@ -2472,8 +2378,7 @@ EslSocketIoFree (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Initialize the ESL_IO_MGMT structures
|
||||
/** Initialize the ESL_IO_MGMT structures.
|
||||
|
||||
This support routine initializes the ESL_IO_MGMT structure and
|
||||
places them on to a free list.
|
||||
|
@ -2491,7 +2396,6 @@ EslSocketIoFree (
|
|||
@param[in] pfnCompletion Completion routine address
|
||||
|
||||
@retval EFI_SUCCESS - The structures were properly initialized
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketIoInit (
|
||||
|
@ -2578,8 +2482,7 @@ EslSocketIoInit (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Determine if the socket is configured
|
||||
/** Determine if the socket is configured.
|
||||
|
||||
This support routine is called to determine if the socket if the
|
||||
configuration call was made to the network layer. The following
|
||||
|
@ -2596,7 +2499,6 @@ EslSocketIoInit (
|
|||
@param[in] pSocket Address of an ::ESL_SOCKET structure
|
||||
|
||||
@retval EFI_SUCCESS - The socket is configured
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketIsConfigured (
|
||||
|
@ -2658,8 +2560,7 @@ EslSocketIsConfigured (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Establish the known port to listen for network connections.
|
||||
/** Establish the known port to listen for network connections.
|
||||
|
||||
This routine calls into the network protocol layer to establish
|
||||
a handler that is called upon connection completion. The handler
|
||||
|
@ -2673,17 +2574,14 @@ EslSocketIsConfigured (
|
|||
socket and address.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[in] Backlog Backlog specifies the maximum FIFO depth for
|
||||
the connections waiting for the application
|
||||
to call accept. Connection attempts received
|
||||
while the queue is full are refused.
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully created
|
||||
@retval Other - Failed to enable the socket for listen
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketListen (
|
||||
|
@ -2831,8 +2729,7 @@ EslSocketListen (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the socket options
|
||||
/** Get the socket options.
|
||||
|
||||
This routine handles the socket level options and passes the
|
||||
others to the network specific layer.
|
||||
|
@ -2849,7 +2746,6 @@ EslSocketListen (
|
|||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketOptionGet (
|
||||
|
@ -3053,8 +2949,7 @@ EslSocketOptionGet (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the socket options
|
||||
/** Set the socket options.
|
||||
|
||||
This routine handles the socket level options and passes the
|
||||
others to the network specific layer.
|
||||
|
@ -3070,7 +2965,6 @@ EslSocketOptionGet (
|
|||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Option successfully set
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketOptionSet (
|
||||
|
@ -3269,8 +3163,7 @@ EslSocketOptionSet (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Allocate a packet for a receive or transmit operation
|
||||
/** Allocate a packet for a receive or transmit operation.
|
||||
|
||||
This support routine is called by ::EslSocketRxStart and the
|
||||
network specific TxBuffer routines to get buffer space for the
|
||||
|
@ -3282,7 +3175,6 @@ EslSocketOptionSet (
|
|||
@param[in] DebugFlags Flags for debug messages
|
||||
|
||||
@retval EFI_SUCCESS - The packet was allocated successfully
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketPacketAllocate (
|
||||
|
@ -3336,8 +3228,7 @@ EslSocketPacketAllocate (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Free a packet used for receive or transmit operation
|
||||
/** Free a packet used for receive or transmit operation.
|
||||
|
||||
This support routine is called by the network specific Close
|
||||
and TxComplete routines and during error cases in RxComplete
|
||||
|
@ -3348,7 +3239,6 @@ EslSocketPacketAllocate (
|
|||
@param[in] DebugFlags Flags for debug messages
|
||||
|
||||
@retval EFI_SUCCESS - The packet was allocated successfully
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketPacketFree (
|
||||
|
@ -3387,8 +3277,7 @@ EslSocketPacketFree (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Poll a socket for pending activity.
|
||||
/** Poll a socket for pending activity.
|
||||
|
||||
This routine builds a detected event mask which is returned to
|
||||
the caller in the buffer provided.
|
||||
|
@ -3398,16 +3287,12 @@ EslSocketPacketFree (
|
|||
transmit activity.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[in] Events Events of interest for this socket
|
||||
|
||||
@param[in] pEvents Address to receive the detected events
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully polled
|
||||
@retval EFI_INVALID_PARAMETER - When pEvents is NULL
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketPoll (
|
||||
|
@ -3422,6 +3307,7 @@ EslSocketPoll (
|
|||
EFI_STATUS Status;
|
||||
EFI_TPL TplPrevious;
|
||||
short ValidEvents;
|
||||
int _errno = EINVAL;
|
||||
|
||||
DEBUG (( DEBUG_POLL, "Entering SocketPoll\r\n" ));
|
||||
|
||||
|
@ -3544,6 +3430,7 @@ EslSocketPoll (
|
|||
if ( EFI_ERROR ( pSocket->TxError )) {
|
||||
DetectedEvents |= POLLERR;
|
||||
}
|
||||
_errno = pSocket->errno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3554,7 +3441,9 @@ EslSocketPoll (
|
|||
| POLLERR
|
||||
| POLLHUP
|
||||
| POLLNVAL );
|
||||
|
||||
if ( NULL != pErrno ) {
|
||||
*pErrno = _errno;
|
||||
}
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
|
@ -3563,8 +3452,7 @@ EslSocketPoll (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Allocate and initialize a ESL_PORT structure.
|
||||
/** Allocate and initialize a ESL_PORT structure.
|
||||
|
||||
This routine initializes an ::ESL_PORT structure for use by
|
||||
the socket. This routine calls a routine via
|
||||
|
@ -3597,7 +3485,6 @@ EslSocketPoll (
|
|||
@param[out] ppPort Buffer to receive new ::ESL_PORT structure address
|
||||
|
||||
@retval EFI_SUCCESS - Socket successfully created
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketPortAllocate (
|
||||
|
@ -3830,8 +3717,7 @@ EslSocketPortAllocate (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Close a port.
|
||||
/** Close a port.
|
||||
|
||||
This routine releases the resources allocated by ::EslSocketPortAllocate.
|
||||
This routine calls ESL_PROTOCOL_API::pfnPortClose to release the network
|
||||
|
@ -3849,7 +3735,6 @@ EslSocketPortAllocate (
|
|||
|
||||
@retval EFI_SUCCESS The port is closed
|
||||
@retval other Port close error
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketPortClose (
|
||||
|
@ -4080,8 +3965,7 @@ EslSocketPortClose (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Port close state 3
|
||||
/** Port close state 3.
|
||||
|
||||
This routine attempts to complete the port close operation.
|
||||
|
||||
|
@ -4090,9 +3974,7 @@ EslSocketPortClose (
|
|||
See the \ref PortCloseStateMachine section.
|
||||
|
||||
@param[in] Event The close completion event
|
||||
|
||||
@param[in] pPort Address of an ::ESL_PORT structure.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EslSocketPortCloseComplete (
|
||||
|
@ -4106,17 +3988,13 @@ EslSocketPortCloseComplete (
|
|||
DBG_ENTER ( );
|
||||
VERIFY_AT_TPL ( TPL_SOCKETS );
|
||||
|
||||
//
|
||||
// Update the port state
|
||||
//
|
||||
pPort->State = PORT_STATE_CLOSE_DONE;
|
||||
DEBUG (( DEBUG_CLOSE | DEBUG_INFO,
|
||||
"0x%08x: Port Close State: PORT_STATE_CLOSE_DONE\r\n",
|
||||
pPort ));
|
||||
|
||||
//
|
||||
// Shutdown the receive operation on the port
|
||||
//
|
||||
if ( NULL != pPort->pfnRxCancel ) {
|
||||
pIo = pPort->pRxActive;
|
||||
while ( NULL != pIo ) {
|
||||
|
@ -4125,16 +4003,13 @@ EslSocketPortCloseComplete (
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Determine if the receive operation is pending
|
||||
//
|
||||
Status = EslSocketPortCloseRxDone ( pPort );
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Port close state 4
|
||||
/** Port close state 4.
|
||||
|
||||
This routine determines the state of the receive operations and
|
||||
continues the close operation after the pending receive operations
|
||||
|
@ -4155,7 +4030,6 @@ EslSocketPortCloseComplete (
|
|||
@retval EFI_NOT_READY The port is still closing
|
||||
@retval EFI_ALREADY_STARTED Error, the port is in the wrong state,
|
||||
most likely the routine was called already.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketPortCloseRxDone (
|
||||
|
@ -4225,8 +4099,7 @@ EslSocketPortCloseRxDone (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Start the close operation on a port, state 1.
|
||||
/** Start the close operation on a port, state 1.
|
||||
|
||||
This routine marks the port as closed and initiates the \ref
|
||||
PortCloseStateMachine. The first step is to allow the \ref
|
||||
|
@ -4243,7 +4116,6 @@ EslSocketPortCloseRxDone (
|
|||
@retval EFI_NOT_READY The port has started the closing process
|
||||
@retval EFI_ALREADY_STARTED Error, the port is in the wrong state,
|
||||
most likely the routine was called already.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketPortCloseStart (
|
||||
|
@ -4294,8 +4166,7 @@ EslSocketPortCloseStart (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Port close state 2
|
||||
/** Port close state 2.
|
||||
|
||||
This routine determines the state of the transmit engine and
|
||||
continue the close operation after the transmission is complete.
|
||||
|
@ -4448,8 +4319,7 @@ EslSocketPortCloseTxDone (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Receive data from a network connection.
|
||||
/** Receive data from a network connection.
|
||||
|
||||
This routine calls the network specific routine to remove the
|
||||
next portion of data from the receive queue and return it to the
|
||||
|
@ -4460,23 +4330,15 @@ EslSocketPortCloseTxDone (
|
|||
::recv and ::read are layered on top of ::recvfrom.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[in] Flags Message control flags
|
||||
|
||||
@param[in] BufferLength Length of the the buffer
|
||||
|
||||
@param[in] pBuffer Address of a buffer to receive the data.
|
||||
|
||||
@param[in] pDataLength Number of received data bytes in the buffer.
|
||||
|
||||
@param[out] pAddress Network address to receive the remote system address
|
||||
|
||||
@param[in,out] pAddressLength Length of the remote network address structure
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully received
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketReceive (
|
||||
|
@ -4817,8 +4679,7 @@ EslSocketReceive (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Cancel the receive operations
|
||||
/** Cancel the receive operations.
|
||||
|
||||
This routine cancels a pending receive operation.
|
||||
See the \ref ReceiveEngine section.
|
||||
|
@ -4828,7 +4689,6 @@ EslSocketReceive (
|
|||
|
||||
@param[in] pPort Address of an ::ESL_PORT structure
|
||||
@param[in] pIo Address of an ::ESL_IO_MGMT structure
|
||||
|
||||
**/
|
||||
VOID
|
||||
EslSocketRxCancel (
|
||||
|
@ -4862,8 +4722,7 @@ EslSocketRxCancel (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Process the receive completion
|
||||
/** Process the receive completion.
|
||||
|
||||
This routine queues the data in FIFO order in either the urgent
|
||||
or normal data queues depending upon the type of data received.
|
||||
|
@ -4881,7 +4740,6 @@ EslSocketRxCancel (
|
|||
@param[in] LengthInBytes Length of the receive data
|
||||
@param[in] bUrgent TRUE if urgent data is received and FALSE
|
||||
for normal data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EslSocketRxComplete (
|
||||
|
@ -5079,8 +4937,7 @@ EslSocketRxComplete (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Poll a socket for pending receive activity.
|
||||
/** Poll a socket for pending receive activity.
|
||||
|
||||
This routine is called at elivated TPL and extends the idle
|
||||
loop which polls a socket down into the LAN driver layer to
|
||||
|
@ -5090,7 +4947,6 @@ EslSocketRxComplete (
|
|||
routines call this routine when there is nothing to do.
|
||||
|
||||
@param[in] pSocket Address of an ::EFI_SOCKET structure.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EslSocketRxPoll (
|
||||
|
@ -5122,8 +4978,7 @@ EslSocketRxPoll (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Start a receive operation
|
||||
/** Start a receive operation.
|
||||
|
||||
This routine posts a receive buffer to the network adapter.
|
||||
See the \ref ReceiveEngine section.
|
||||
|
@ -5142,7 +4997,6 @@ EslSocketRxPoll (
|
|||
</ul>
|
||||
|
||||
@param[in] pPort Address of an ::ESL_PORT structure.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EslSocketRxStart (
|
||||
|
@ -5305,8 +5159,7 @@ EslSocketRxStart (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Shutdown the socket receive and transmit operations
|
||||
/** Shutdown the socket receive and transmit operations.
|
||||
|
||||
This routine sets a flag to stop future transmissions and calls
|
||||
the network specific layer to cancel the pending receive operation.
|
||||
|
@ -5315,13 +5168,10 @@ EslSocketRxStart (
|
|||
operations on the socket.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[in] How Which operations to stop
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket operations successfully shutdown
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketShutdown (
|
||||
|
@ -5440,8 +5290,7 @@ EslSocketShutdown (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Send data using a network connection.
|
||||
/** Send data using a network connection.
|
||||
|
||||
This routine calls the network specific layer to queue the data
|
||||
for transmission. Eventually the buffer will reach the head of
|
||||
|
@ -5454,23 +5303,15 @@ EslSocketShutdown (
|
|||
system. Note that ::send and ::write are layered on top of ::sendto.
|
||||
|
||||
@param[in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.
|
||||
|
||||
@param[in] Flags Message control flags
|
||||
|
||||
@param[in] BufferLength Length of the the buffer
|
||||
|
||||
@param[in] pBuffer Address of a buffer containing the data to send
|
||||
|
||||
@param[in] pDataLength Address to receive the number of data bytes sent
|
||||
|
||||
@param[in] pAddress Network address of the remote system address
|
||||
|
||||
@param[in] AddressLength Length of the remote network address structure
|
||||
|
||||
@param[out] pErrno Address to receive the errno value upon completion.
|
||||
|
||||
@retval EFI_SUCCESS - Socket data successfully queued for transmit
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EslSocketTransmit (
|
||||
|
@ -5618,8 +5459,7 @@ EslSocketTransmit (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Complete the transmit operation
|
||||
/** Complete the transmit operation.
|
||||
|
||||
This support routine handles the transmit completion processing for
|
||||
the various network layers. It frees the ::ESL_IO_MGMT structure
|
||||
|
@ -5643,7 +5483,6 @@ EslSocketTransmit (
|
|||
@param[in] ppQueueTail Transmit queue tail address
|
||||
@param[in] ppActive Active transmit queue address
|
||||
@param[in] ppFree Free transmit queue address
|
||||
|
||||
**/
|
||||
VOID
|
||||
EslSocketTxComplete (
|
||||
|
@ -5776,8 +5615,7 @@ EslSocketTxComplete (
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Transmit data using a network connection.
|
||||
/** Transmit data using a network connection.
|
||||
|
||||
This support routine starts a transmit operation on the
|
||||
underlying network layer.
|
||||
|
@ -5790,7 +5628,6 @@ EslSocketTxComplete (
|
|||
@param[in] ppQueueTail Transmit queue tail address
|
||||
@param[in] ppActive Active transmit queue address
|
||||
@param[in] ppFree Free transmit queue address
|
||||
|
||||
**/
|
||||
VOID
|
||||
EslSocketTxStart (
|
||||
|
|
Loading…
Reference in New Issue