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:
committed by
darylm503
parent
4d5b818c78
commit
beaaa3b715
@ -1,22 +1,19 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implement the bind API.
|
Implement the bind API.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation
|
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
This program and the accompanying materials are licensed and made available under
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
the terms and conditions of the BSD License that accompanies this distribution.
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <SocketInternals.h>
|
#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.
|
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.
|
@return The bind routine returns zero (0) if successful and -1 upon failure.
|
||||||
In the case of an error, ::errno contains more information.
|
In the case of an error, ::errno contains more information.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
bind (
|
bind (
|
||||||
@ -51,25 +47,19 @@ bind (
|
|||||||
{
|
{
|
||||||
int BindStatus;
|
int BindStatus;
|
||||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Locate the context for this socket
|
// Locate the context for this socket
|
||||||
//
|
|
||||||
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
||||||
if ( NULL != pSocketProtocol ) {
|
if ( NULL != pSocketProtocol ) {
|
||||||
//
|
|
||||||
// Bind the socket
|
// Bind the socket
|
||||||
//
|
(void) pSocketProtocol->pfnBind ( pSocketProtocol,
|
||||||
Status = pSocketProtocol->pfnBind ( pSocketProtocol,
|
|
||||||
name,
|
name,
|
||||||
namelen,
|
namelen,
|
||||||
&errno );
|
&errno );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the operation stauts
|
// Return the operation stauts
|
||||||
//
|
|
||||||
BindStatus = ( 0 == errno ) ? 0 : -1;
|
BindStatus = ( 0 == errno ) ? 0 : -1;
|
||||||
return BindStatus;
|
return BindStatus;
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implement the getsockopt API.
|
Implement the getsockopt API.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation
|
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
This program and the accompanying materials are licensed and made available under
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
the terms and conditions of the BSD License that accompanies this distribution.
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <SocketInternals.h>
|
#include <SocketInternals.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** Get the socket options
|
||||||
Get the socket options
|
|
||||||
|
|
||||||
The
|
The
|
||||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html#">POSIX</a>
|
<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.
|
@return This routine returns zero (0) if successful or -1 when an error occurs.
|
||||||
In the case of an error, ::errno contains more details.
|
In the case of an error, ::errno contains more details.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
getsockopt (
|
getsockopt (
|
||||||
@ -44,27 +40,19 @@ getsockopt (
|
|||||||
{
|
{
|
||||||
int OptionStatus;
|
int OptionStatus;
|
||||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Locate the context for this socket
|
// Locate the context for this socket
|
||||||
//
|
|
||||||
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
||||||
if ( NULL != pSocketProtocol ) {
|
if ( NULL != pSocketProtocol ) {
|
||||||
//
|
|
||||||
// Get the socket option
|
// Get the socket option
|
||||||
//
|
(void) pSocketProtocol->pfnOptionGet ( pSocketProtocol,
|
||||||
Status = pSocketProtocol->pfnOptionGet ( pSocketProtocol,
|
|
||||||
level,
|
level,
|
||||||
option_name,
|
option_name,
|
||||||
option_value,
|
option_value,
|
||||||
option_len,
|
option_len,
|
||||||
&errno );
|
&errno );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the operation stauts
|
// Return the operation stauts
|
||||||
//
|
|
||||||
OptionStatus = ( 0 == errno ) ? 0 : -1;
|
OptionStatus = ( 0 == errno ) ? 0 : -1;
|
||||||
return OptionStatus;
|
return OptionStatus;
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implement the listen API.
|
Implement the listen API.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation
|
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
This program and the accompanying materials are licensed and made available under
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
the terms and conditions of the BSD License that accompanies this distribution.
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <SocketInternals.h>
|
#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
|
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
|
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.
|
@return This routine returns zero (0) if successful or -1 when an error occurs.
|
||||||
In the case of an error, ::errno contains more details.
|
In the case of an error, ::errno contains more details.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
listen (
|
listen (
|
||||||
@ -45,24 +41,16 @@ listen (
|
|||||||
{
|
{
|
||||||
int ListenStatus;
|
int ListenStatus;
|
||||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Locate the context for this socket
|
// Locate the context for this socket
|
||||||
//
|
|
||||||
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
||||||
if ( NULL != pSocketProtocol ) {
|
if ( NULL != pSocketProtocol ) {
|
||||||
//
|
|
||||||
// Enable connections on the known port
|
// Enable connections on the known port
|
||||||
//
|
(void) pSocketProtocol->pfnListen ( pSocketProtocol,
|
||||||
Status = pSocketProtocol->pfnListen ( pSocketProtocol,
|
|
||||||
backlog,
|
backlog,
|
||||||
&errno );
|
&errno );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the operation stauts
|
// Return the operation stauts
|
||||||
//
|
|
||||||
ListenStatus = ( 0 == errno ) ? 0 : -1;
|
ListenStatus = ( 0 == errno ) ? 0 : -1;
|
||||||
return ListenStatus;
|
return ListenStatus;
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,24 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implement the poll API.
|
Implement the poll API.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation
|
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
This program and the accompanying materials are licensed and made available under
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
the terms and conditions of the BSD License that accompanies this distribution.
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <SocketInternals.h>
|
#include <SocketInternals.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** Poll the socket for activity
|
||||||
Poll the socket for activity
|
|
||||||
|
|
||||||
@param [in] pDescriptor Descriptor address for the file
|
@param [in] pDescriptor Descriptor address for the file
|
||||||
|
|
||||||
@param [in] Events Mask of events to detect
|
@param [in] Events Mask of events to detect
|
||||||
|
|
||||||
@return Detected events for the socket
|
@return Detected events for the socket
|
||||||
|
|
||||||
**/
|
**/
|
||||||
short
|
short
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -32,27 +27,19 @@ BslSocketPoll (
|
|||||||
IN short Events
|
IN short Events
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
short DetectedEvents;
|
short DetectedEvents;
|
||||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Locate the socket protocol
|
// Locate the socket protocol
|
||||||
//
|
|
||||||
DetectedEvents = 0;
|
DetectedEvents = 0;
|
||||||
pSocketProtocol = BslValidateSocketFd ( pDescriptor, &errno );
|
pSocketProtocol = BslValidateSocketFd ( pDescriptor, &errno );
|
||||||
if ( NULL != pSocketProtocol ) {
|
if ( NULL != pSocketProtocol ) {
|
||||||
//
|
|
||||||
// Poll the socket
|
// Poll the socket
|
||||||
//
|
(void) pSocketProtocol->pfnPoll ( pSocketProtocol,
|
||||||
Status = pSocketProtocol->pfnPoll ( pSocketProtocol,
|
Events,
|
||||||
Events,
|
&DetectedEvents,
|
||||||
&DetectedEvents,
|
&errno );
|
||||||
&errno );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the detected events
|
// Return the detected events
|
||||||
//
|
|
||||||
return DetectedEvents;
|
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.
|
* 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;
|
dname = zptr->z_ns[k].nsname;
|
||||||
qtype = T_A;
|
qtype = T_A;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* while */
|
} /* while */
|
||||||
}
|
}
|
||||||
|
--ttl; // Suppress the "Set but not used" warning/error for ttl.
|
||||||
|
|
||||||
_res.options |= RES_DEBUG;
|
_res.options |= RES_DEBUG;
|
||||||
for (zptr = zgrp_start; zptr; zptr = zptr->z_next) {
|
for (zptr = zgrp_start; zptr; zptr = zptr->z_next) {
|
||||||
@ -502,8 +512,7 @@ ans=%d, auth=%d, add=%d, rcode=%d\n",
|
|||||||
} else
|
} else
|
||||||
fprintf(stdout, "res_mkupdate: packet size = %d\n", n);
|
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.
|
* the authoritative nameservers for the zone being updated.
|
||||||
* Sort primary to be the first in the list of nameservers.
|
* Sort primary to be the first in the list of nameservers.
|
||||||
*/
|
*/
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implement the setsockopt API.
|
Implement the setsockopt API.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation
|
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
This program and the accompanying materials are licensed and made available under
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
the terms and conditions of the BSD License that accompanies this distribution.
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <SocketInternals.h>
|
#include <SocketInternals.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** Set the socket options
|
||||||
Set the socket options
|
|
||||||
|
|
||||||
The
|
The
|
||||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html">POSIX</a>
|
<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.
|
@return This routine returns zero (0) upon success and -1 when an error occurs.
|
||||||
In the case of an error, ::errno contains more details.
|
In the case of an error, ::errno contains more details.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
setsockopt (
|
setsockopt (
|
||||||
@ -43,27 +39,19 @@ setsockopt (
|
|||||||
{
|
{
|
||||||
int OptionStatus;
|
int OptionStatus;
|
||||||
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
EFI_SOCKET_PROTOCOL * pSocketProtocol;
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Locate the context for this socket
|
// Locate the context for this socket
|
||||||
//
|
|
||||||
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
|
||||||
if ( NULL != pSocketProtocol ) {
|
if ( NULL != pSocketProtocol ) {
|
||||||
//
|
|
||||||
// Set the socket option
|
// Set the socket option
|
||||||
//
|
(void) pSocketProtocol->pfnOptionSet (pSocketProtocol,
|
||||||
Status = pSocketProtocol->pfnOptionSet ( pSocketProtocol,
|
level,
|
||||||
level,
|
option_name,
|
||||||
option_name,
|
option_value,
|
||||||
option_value,
|
option_len,
|
||||||
option_len,
|
&errno );
|
||||||
&errno );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the operation stauts
|
// Return the operation stauts
|
||||||
//
|
|
||||||
OptionStatus = ( 0 == errno ) ? 0 : -1;
|
OptionStatus = ( 0 == errno ) ? 0 : -1;
|
||||||
return OptionStatus;
|
return OptionStatus;
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,11 @@
|
|||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "Socket.h"
|
#include "Socket.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** Get the local socket address.
|
||||||
Get the local socket address
|
|
||||||
|
|
||||||
This routine returns the IPv4 address associated with the local
|
This routine returns the IPv4 address associated with the local
|
||||||
socket.
|
socket.
|
||||||
@ -25,9 +22,7 @@
|
|||||||
network address for the SOCK_RAW socket.
|
network address for the SOCK_RAW socket.
|
||||||
|
|
||||||
@param [in] pPort Address of an ::ESL_PORT structure.
|
@param [in] pPort Address of an ::ESL_PORT structure.
|
||||||
|
|
||||||
@param [out] pAddress Network address to receive the local system address
|
@param [out] pAddress Network address to receive the local system address
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EslIp4LocalAddressGet (
|
EslIp4LocalAddressGet (
|
||||||
@ -40,9 +35,7 @@ EslIp4LocalAddressGet (
|
|||||||
|
|
||||||
DBG_ENTER ( );
|
DBG_ENTER ( );
|
||||||
|
|
||||||
//
|
|
||||||
// Return the local address
|
// Return the local address
|
||||||
//
|
|
||||||
pIp4 = &pPort->Context.Ip4;
|
pIp4 = &pPort->Context.Ip4;
|
||||||
pLocalAddress = (struct sockaddr_in *)pAddress;
|
pLocalAddress = (struct sockaddr_in *)pAddress;
|
||||||
pLocalAddress->sin_family = AF_INET;
|
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.
|
This routine sets the local port address.
|
||||||
|
|
||||||
@ -75,7 +67,6 @@ EslIp4LocalAddressGet (
|
|||||||
@param [in] bBindTest TRUE = run bind testing
|
@param [in] bBindTest TRUE = run bind testing
|
||||||
|
|
||||||
@retval EFI_SUCCESS The operation was successful
|
@retval EFI_SUCCESS The operation was successful
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EslIp4LocalAddressSet (
|
EslIp4LocalAddressSet (
|
||||||
@ -91,23 +82,17 @@ EslIp4LocalAddressSet (
|
|||||||
|
|
||||||
DBG_ENTER ( );
|
DBG_ENTER ( );
|
||||||
|
|
||||||
//
|
|
||||||
// Validate the address
|
// Validate the address
|
||||||
//
|
|
||||||
pIpAddress = (struct sockaddr_in *)pSockAddr;
|
pIpAddress = (struct sockaddr_in *)pSockAddr;
|
||||||
if ( INADDR_BROADCAST == pIpAddress->sin_addr.s_addr ) {
|
if ( INADDR_BROADCAST == pIpAddress->sin_addr.s_addr ) {
|
||||||
//
|
|
||||||
// The local address must not be the broadcast address
|
// The local address must not be the broadcast address
|
||||||
//
|
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
pPort->pSocket->errno = EADDRNOTAVAIL;
|
pPort->pSocket->errno = EADDRNOTAVAIL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
//
|
|
||||||
// Set the local address
|
// Set the local address
|
||||||
//
|
|
||||||
pIpAddress = (struct sockaddr_in *)pSockAddr;
|
pIpAddress = (struct sockaddr_in *)pSockAddr;
|
||||||
pIpv4Address = (UINT8 *)&pIpAddress->sin_addr.s_addr;
|
pIpv4Address = (UINT8 *)&pIpAddress->sin_addr.s_addr;
|
||||||
pConfig = &pPort->Context.Ip4.ModeData.ConfigData;
|
pConfig = &pPort->Context.Ip4.ModeData.ConfigData;
|
||||||
@ -116,14 +101,10 @@ EslIp4LocalAddressSet (
|
|||||||
pConfig->StationAddress.Addr[2] = pIpv4Address[2];
|
pConfig->StationAddress.Addr[2] = pIpv4Address[2];
|
||||||
pConfig->StationAddress.Addr[3] = pIpv4Address[3];
|
pConfig->StationAddress.Addr[3] = pIpv4Address[3];
|
||||||
|
|
||||||
//
|
|
||||||
// Determine if the default address is used
|
// Determine if the default address is used
|
||||||
//
|
|
||||||
pConfig->UseDefaultAddress = (BOOLEAN)( 0 == pIpAddress->sin_addr.s_addr );
|
pConfig->UseDefaultAddress = (BOOLEAN)( 0 == pIpAddress->sin_addr.s_addr );
|
||||||
|
|
||||||
//
|
|
||||||
// Display the local address
|
// Display the local address
|
||||||
//
|
|
||||||
DEBUG (( DEBUG_BIND,
|
DEBUG (( DEBUG_BIND,
|
||||||
"0x%08x: Port, Local IP4 Address: %d.%d.%d.%d\r\n",
|
"0x%08x: Port, Local IP4 Address: %d.%d.%d.%d\r\n",
|
||||||
pPort,
|
pPort,
|
||||||
@ -132,9 +113,7 @@ EslIp4LocalAddressSet (
|
|||||||
pConfig->StationAddress.Addr[2],
|
pConfig->StationAddress.Addr[2],
|
||||||
pConfig->StationAddress.Addr[3]));
|
pConfig->StationAddress.Addr[3]));
|
||||||
|
|
||||||
//
|
|
||||||
// Set the subnet mask
|
// Set the subnet mask
|
||||||
//
|
|
||||||
if ( pConfig->UseDefaultAddress ) {
|
if ( pConfig->UseDefaultAddress ) {
|
||||||
pConfig->SubnetMask.Addr[0] = 0;
|
pConfig->SubnetMask.Addr[0] = 0;
|
||||||
pConfig->SubnetMask.Addr[1] = 0;
|
pConfig->SubnetMask.Addr[1] = 0;
|
||||||
@ -148,17 +127,13 @@ EslIp4LocalAddressSet (
|
|||||||
pConfig->SubnetMask.Addr[3] = ( 224 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
|
pConfig->SubnetMask.Addr[3] = ( 224 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the operation status
|
// Return the operation status
|
||||||
//
|
|
||||||
DBG_EXIT_STATUS ( Status );
|
DBG_EXIT_STATUS ( Status );
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** Get the option value.
|
||||||
Get the option value
|
|
||||||
|
|
||||||
This routine handles the IPv4 level options.
|
This routine handles the IPv4 level options.
|
||||||
|
|
||||||
@ -171,7 +146,6 @@ EslIp4LocalAddressSet (
|
|||||||
@param [out] pOptionLength Buffer to receive the option length
|
@param [out] pOptionLength Buffer to receive the option length
|
||||||
|
|
||||||
@retval EFI_SUCCESS - Socket data successfully received
|
@retval EFI_SUCCESS - Socket data successfully received
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EslIp4OptionGet (
|
EslIp4OptionGet (
|
||||||
@ -185,20 +159,14 @@ EslIp4OptionGet (
|
|||||||
|
|
||||||
DBG_ENTER ( );
|
DBG_ENTER ( );
|
||||||
|
|
||||||
//
|
|
||||||
// Assume success
|
// Assume success
|
||||||
//
|
|
||||||
pSocket->errno = 0;
|
pSocket->errno = 0;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
//
|
|
||||||
// Attempt to get the option
|
// Attempt to get the option
|
||||||
//
|
|
||||||
switch ( OptionName ) {
|
switch ( OptionName ) {
|
||||||
default:
|
default:
|
||||||
//
|
|
||||||
// Option not supported
|
// Option not supported
|
||||||
//
|
|
||||||
pSocket->errno = ENOPROTOOPT;
|
pSocket->errno = ENOPROTOOPT;
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
break;
|
break;
|
||||||
@ -208,17 +176,13 @@ EslIp4OptionGet (
|
|||||||
*pOptionLength = sizeof ( pSocket->bIncludeHeader );
|
*pOptionLength = sizeof ( pSocket->bIncludeHeader );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the operation status
|
// Return the operation status
|
||||||
//
|
|
||||||
DBG_EXIT_STATUS ( Status );
|
DBG_EXIT_STATUS ( Status );
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** Set the option value.
|
||||||
Set the option value
|
|
||||||
|
|
||||||
This routine handles the IPv4 level options.
|
This routine handles the IPv4 level options.
|
||||||
|
|
||||||
@ -231,7 +195,6 @@ EslIp4OptionGet (
|
|||||||
@param [in] OptionLength Length of the buffer in bytes
|
@param [in] OptionLength Length of the buffer in bytes
|
||||||
|
|
||||||
@retval EFI_SUCCESS - Option successfully set
|
@retval EFI_SUCCESS - Option successfully set
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EslIp4OptionSet (
|
EslIp4OptionSet (
|
||||||
@ -242,28 +205,22 @@ EslIp4OptionSet (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOLEAN bTrueFalse;
|
BOOLEAN bTrueFalse;
|
||||||
socklen_t LengthInBytes;
|
//socklen_t LengthInBytes;
|
||||||
UINT8 * pOptionData;
|
//UINT8 * pOptionData;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
DBG_ENTER ( );
|
DBG_ENTER ( );
|
||||||
|
|
||||||
//
|
|
||||||
// Assume success
|
// Assume success
|
||||||
//
|
|
||||||
pSocket->errno = 0;
|
pSocket->errno = 0;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
//
|
|
||||||
// Determine if the option protocol matches
|
// Determine if the option protocol matches
|
||||||
//
|
//LengthInBytes = 0;
|
||||||
LengthInBytes = 0;
|
//pOptionData = NULL;
|
||||||
pOptionData = NULL;
|
|
||||||
switch ( OptionName ) {
|
switch ( OptionName ) {
|
||||||
default:
|
default:
|
||||||
//
|
|
||||||
// Protocol level not supported
|
// Protocol level not supported
|
||||||
//
|
|
||||||
DEBUG (( DEBUG_INFO | DEBUG_OPTION, "ERROR - Invalid protocol option\r\n" ));
|
DEBUG (( DEBUG_INFO | DEBUG_OPTION, "ERROR - Invalid protocol option\r\n" ));
|
||||||
pSocket->errno = ENOTSUP;
|
pSocket->errno = ENOTSUP;
|
||||||
Status = EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
@ -271,31 +228,22 @@ EslIp4OptionSet (
|
|||||||
|
|
||||||
case IP_HDRINCL:
|
case IP_HDRINCL:
|
||||||
|
|
||||||
//
|
|
||||||
// Validate the option length
|
// Validate the option length
|
||||||
//
|
|
||||||
if ( sizeof ( UINT32 ) == OptionLength ) {
|
if ( sizeof ( UINT32 ) == OptionLength ) {
|
||||||
//
|
|
||||||
// Restrict the input to TRUE or FALSE
|
// Restrict the input to TRUE or FALSE
|
||||||
//
|
|
||||||
bTrueFalse = TRUE;
|
bTrueFalse = TRUE;
|
||||||
if ( 0 == *(UINT32 *)pOptionValue ) {
|
if ( 0 == *(UINT32 *)pOptionValue ) {
|
||||||
bTrueFalse = FALSE;
|
bTrueFalse = FALSE;
|
||||||
}
|
}
|
||||||
pOptionValue = &bTrueFalse;
|
pOptionValue = &bTrueFalse;
|
||||||
|
|
||||||
//
|
|
||||||
// Set the option value
|
// Set the option value
|
||||||
//
|
//pOptionData = (UINT8 *)&pSocket->bIncludeHeader;
|
||||||
pOptionData = (UINT8 *)&pSocket->bIncludeHeader;
|
//LengthInBytes = sizeof ( pSocket->bIncludeHeader );
|
||||||
LengthInBytes = sizeof ( pSocket->bIncludeHeader );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Return the operation status
|
// Return the operation status
|
||||||
//
|
|
||||||
DBG_EXIT_STATUS ( Status );
|
DBG_EXIT_STATUS ( Status );
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user