diff options
author | jiaxinwu <jiaxin.wu@intel.com> | 2015-07-08 03:12:58 +0000 |
---|---|---|
committer | jiaxinwu <jiaxinwu@Edk2> | 2015-07-08 03:12:58 +0000 |
commit | c581e5037dca6e1446972aed194f13c9cdd0b01b (patch) | |
tree | 3513f905f8a8172c91d2b14e21af88136b5cd12f /StdLib/EfiSocketLib/Tcp4.c | |
parent | 395616868f51df1aba68c6ae692b56082d754c10 (diff) | |
download | edk2-c581e5037dca6e1446972aed194f13c9cdd0b01b.tar.gz edk2-c581e5037dca6e1446972aed194f13c9cdd0b01b.tar.bz2 edk2-c581e5037dca6e1446972aed194f13c9cdd0b01b.zip |
StdLib: Remove EfiSocketLib and Ip4Config Protocol dependency.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: jiaxinwu <jiaxin.wu@intel.com>
Reviewed-by: "Leahy, Leroy P" <leroy.p.leahy@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17875 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib/EfiSocketLib/Tcp4.c')
-rw-r--r-- | StdLib/EfiSocketLib/Tcp4.c | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/StdLib/EfiSocketLib/Tcp4.c b/StdLib/EfiSocketLib/Tcp4.c index 943af946bc..68477fba6e 100644 --- a/StdLib/EfiSocketLib/Tcp4.c +++ b/StdLib/EfiSocketLib/Tcp4.c @@ -1,7 +1,7 @@ /** @file
Implement the TCP4 driver support for the socket layer.
- Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2011 - 2015, 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
@@ -2247,8 +2247,8 @@ EslTcp4VerifyLocalIpAddress ( {
UINTN DataSize;
EFI_TCP4_ACCESS_POINT * pAccess;
- EFI_IP4_IPCONFIG_DATA * pIpConfigData;
- EFI_IP4_CONFIG_PROTOCOL * pIpConfigProtocol;
+ EFI_IP4_CONFIG2_INTERFACE_INFO * pIfInfo;
+ EFI_IP4_CONFIG2_PROTOCOL * pIpConfig2Protocol;
ESL_SERVICE * pService;
EFI_STATUS Status;
@@ -2257,7 +2257,7 @@ EslTcp4VerifyLocalIpAddress ( //
// Use break instead of goto
//
- pIpConfigData = NULL;
+ pIfInfo = NULL;
for ( ; ; ) {
//
// Determine if the IP address is specified
@@ -2286,12 +2286,14 @@ EslTcp4VerifyLocalIpAddress ( // Open the configuration protocol
//
pService = pPort->pService;
- Status = gBS->OpenProtocol ( pService->Controller,
- &gEfiIp4ConfigProtocolGuid,
- (VOID **)&pIpConfigProtocol,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL );
+ Status = gBS->OpenProtocol (
+ pService->Controller,
+ &gEfiIp4Config2ProtocolGuid,
+ (VOID **)&pIpConfig2Protocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if ( EFI_ERROR ( Status )) {
DEBUG (( DEBUG_ERROR,
"ERROR - IP Configuration Protocol not available, Status: %r\r\n",
@@ -2300,39 +2302,45 @@ EslTcp4VerifyLocalIpAddress ( }
//
- // Get the IP configuration data size
+ // Get the interface information size.
//
DataSize = 0;
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- NULL );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ NULL
+ );
if ( EFI_BUFFER_TOO_SMALL != Status ) {
DEBUG (( DEBUG_ERROR,
- "ERROR - Failed to get IP Configuration data size, Status: %r\r\n",
+ "ERROR - Failed to get the interface information size, Status: %r\r\n",
Status ));
break;
}
//
- // Allocate the configuration data buffer
+ // Allocate the interface information buffer
//
- pIpConfigData = AllocatePool ( DataSize );
- if ( NULL == pIpConfigData ) {
+ pIfInfo = AllocatePool ( DataSize );
+ if ( NULL == pIfInfo ) {
DEBUG (( DEBUG_ERROR,
- "ERROR - Not enough memory to allocate IP Configuration data!\r\n" ));
+ "ERROR - Not enough memory to allocate the interface information buffer!\r\n" ));
Status = EFI_OUT_OF_RESOURCES;
break;
}
//
- // Get the IP configuration
+ // Get the interface info.
//
- Status = pIpConfigProtocol->GetData ( pIpConfigProtocol,
- &DataSize,
- pIpConfigData );
+ Status = pIpConfig2Protocol->GetData (
+ pIpConfig2Protocol,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ pIfInfo
+ );
if ( EFI_ERROR ( Status )) {
DEBUG (( DEBUG_ERROR,
- "ERROR - Failed to return IP Configuration data, Status: %r\r\n",
+ "ERROR - Failed to return the interface info, Status: %r\r\n",
Status ));
break;
}
@@ -2342,19 +2350,19 @@ EslTcp4VerifyLocalIpAddress ( //
DEBUG (( DEBUG_BIND,
"Actual adapter IP address: %d.%d.%d.%d\r\n",
- pIpConfigData->StationAddress.Addr [ 0 ],
- pIpConfigData->StationAddress.Addr [ 1 ],
- pIpConfigData->StationAddress.Addr [ 2 ],
- pIpConfigData->StationAddress.Addr [ 3 ]));
+ pIfInfo->StationAddress.Addr [ 0 ],
+ pIfInfo->StationAddress.Addr [ 1 ],
+ pIfInfo->StationAddress.Addr [ 2 ],
+ pIfInfo->StationAddress.Addr [ 3 ]));
//
// Assume the port is not configured
//
Status = EFI_SUCCESS;
- if (( pAccess->StationAddress.Addr [ 0 ] == pIpConfigData->StationAddress.Addr [ 0 ])
- && ( pAccess->StationAddress.Addr [ 1 ] == pIpConfigData->StationAddress.Addr [ 1 ])
- && ( pAccess->StationAddress.Addr [ 2 ] == pIpConfigData->StationAddress.Addr [ 2 ])
- && ( pAccess->StationAddress.Addr [ 3 ] == pIpConfigData->StationAddress.Addr [ 3 ])) {
+ if (( pAccess->StationAddress.Addr [ 0 ] == pIfInfo->StationAddress.Addr [ 0 ])
+ && ( pAccess->StationAddress.Addr [ 1 ] == pIfInfo->StationAddress.Addr [ 1 ])
+ && ( pAccess->StationAddress.Addr [ 2 ] == pIfInfo->StationAddress.Addr [ 2 ])
+ && ( pAccess->StationAddress.Addr [ 3 ] == pIfInfo->StationAddress.Addr [ 3 ])) {
break;
}
@@ -2368,8 +2376,8 @@ EslTcp4VerifyLocalIpAddress ( //
// Free the buffer if necessary
//
- if ( NULL != pIpConfigData ) {
- FreePool ( pIpConfigData );
+ if ( NULL != pIfInfo ) {
+ FreePool ( pIfInfo );
}
//
|