NetworkPkg: Change HTTP API typos.

Change HTTP API typos and clarify returned status code in HTTP API.


Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19761 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Zhang Lubo
2016-01-28 03:15:35 +00:00
committed by luobozhang
parent 34d0017244
commit f0ab5a81b4
2 changed files with 38 additions and 37 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Implementation of EFI_HTTP_PROTOCOL protocol interfaces. Implementation of EFI_HTTP_PROTOCOL protocol interfaces.
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials This program and the accompanying materials
@ -39,9 +39,11 @@ EFI_HTTP_PROTOCOL mEfiHttpTemplate = {
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. This is NULL.
HttpConfigData is NULL. HttpConfigData is NULL.
HttpConfigData->AccessPoint is NULL. HttpInstance->LocalAddressIsIPv6 is FALSE and
@retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. HttpConfigData->IPv4Node is NULL.
@retval EFI_NOT_STARTED The HTTP instance is not configured. HttpInstance->LocalAddressIsIPv6 is TRUE and
HttpConfigData->IPv6Node is NULL.
@retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.
**/ **/
EFI_STATUS EFI_STATUS
@ -52,16 +54,22 @@ EfiHttpGetModeData (
) )
{ {
HTTP_PROTOCOL *HttpInstance; HTTP_PROTOCOL *HttpInstance;
EFI_HTTPv4_ACCESS_POINT *Http4AccessPoint;
EFI_HTTPv6_ACCESS_POINT *Http6AccessPoint;
//
// Check input parameters.
//
if ((This == NULL) || (HttpConfigData == NULL)) { if ((This == NULL) || (HttpConfigData == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This); HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
ASSERT (HttpInstance != NULL); ASSERT (HttpInstance != NULL);
if ((HttpInstance->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv6Node == NULL) ||
(!HttpInstance->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv4Node == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (HttpInstance->State < HTTP_STATE_HTTP_CONFIGED) { if (HttpInstance->State < HTTP_STATE_HTTP_CONFIGED) {
return EFI_NOT_STARTED; return EFI_NOT_STARTED;
} }
@ -71,27 +79,17 @@ EfiHttpGetModeData (
HttpConfigData->LocalAddressIsIPv6 = HttpInstance->LocalAddressIsIPv6; HttpConfigData->LocalAddressIsIPv6 = HttpInstance->LocalAddressIsIPv6;
if (HttpInstance->LocalAddressIsIPv6) { if (HttpInstance->LocalAddressIsIPv6) {
Http6AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv6_ACCESS_POINT));
if (Http6AccessPoint == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CopyMem ( CopyMem (
Http6AccessPoint, HttpConfigData->AccessPoint.IPv6Node,
&HttpInstance->Ipv6Node, &HttpInstance->Ipv6Node,
sizeof (HttpInstance->Ipv6Node) sizeof (HttpInstance->Ipv6Node)
); );
HttpConfigData->AccessPoint.IPv6Node = Http6AccessPoint;
} else { } else {
Http4AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv4_ACCESS_POINT));
if (Http4AccessPoint == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CopyMem ( CopyMem (
Http4AccessPoint, HttpConfigData->AccessPoint.IPv4Node,
&HttpInstance->IPv4Node, &HttpInstance->IPv4Node,
sizeof (HttpInstance->IPv4Node) sizeof (HttpInstance->IPv4Node)
); );
HttpConfigData->AccessPoint.IPv4Node = Http4AccessPoint;
} }
return EFI_SUCCESS; return EFI_SUCCESS;
@ -107,8 +105,8 @@ EfiHttpGetModeData (
connections with remote hosts, canceling all asynchronous tokens, and flush request connections with remote hosts, canceling all asynchronous tokens, and flush request
and response buffers without informing the appropriate hosts. and response buffers without informing the appropriate hosts.
Except for GetModeData() and Configure(), No other EFI HTTP function can be executed No other EFI HTTP function can be executed by this instance until the Configure()
by this instance until the Configure() function is executed and returns successfully. function is executed and returns successfully.
@param[in] This Pointer to EFI_HTTP_PROTOCOL instance. @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.
@param[in] HttpConfigData Pointer to the configure data to configure the instance. @param[in] HttpConfigData Pointer to the configure data to configure the instance.
@ -116,6 +114,7 @@ EfiHttpGetModeData (
@retval EFI_SUCCESS Operation succeeded. @retval EFI_SUCCESS Operation succeeded.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. This is NULL.
HttpConfigData is NULL.
HttpConfigData->LocalAddressIsIPv6 is FALSE and HttpConfigData->LocalAddressIsIPv6 is FALSE and
HttpConfigData->IPv4Node is NULL. HttpConfigData->IPv4Node is NULL.
HttpConfigData->LocalAddressIsIPv6 is TRUE and HttpConfigData->LocalAddressIsIPv6 is TRUE and
@ -141,9 +140,10 @@ EfiHttpConfigure (
// //
// Check input parameters. // Check input parameters.
// //
if (This == NULL || if (This == NULL ||
(HttpConfigData != NULL && ((HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv6Node == NULL) || HttpConfigData == NULL ||
(!HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv4Node == NULL)))) { ((HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv6Node == NULL) ||
(!HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv4Node == NULL))) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -217,6 +217,7 @@ EfiHttpConfigure (
implementation. implementation.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. This is NULL.
Token is NULL.
Token->Message is NULL. Token->Message is NULL.
Token->Message->Body is not NULL, Token->Message->Body is not NULL,
Token->Message->BodyLength is non-zero, and Token->Message->BodyLength is non-zero, and
@ -723,8 +724,6 @@ HttpCancel (
@retval EFI_SUCCESS Request and Response queues are successfully flushed. @retval EFI_SUCCESS Request and Response queues are successfully flushed.
@retval EFI_INVALID_PARAMETER This is NULL. @retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NOT_STARTED This instance hasn't been configured. @retval EFI_NOT_STARTED This instance hasn't been configured.
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP,
BOOTP, RARP, etc.) hasn't finished yet.
@retval EFI_NOT_FOUND The asynchronous request or response token is not @retval EFI_NOT_FOUND The asynchronous request or response token is not
found. found.
@retval EFI_UNSUPPORTED The implementation does not support this function. @retval EFI_UNSUPPORTED The implementation does not support this function.
@ -1147,7 +1146,7 @@ Error:
/** /**
The Response() function queues an HTTP response to this HTTP instance, similar to The Response() function queues an HTTP response to this HTTP instance, similar to
Receive() function in the EFI TCP driver. When the HTTP request is sent successfully, Receive() function in the EFI TCP driver. When the HTTP response is received successfully,
or if there is an error, Status in token will be updated and Event will be signaled. or if there is an error, Status in token will be updated and Event will be signaled.
The HTTP driver will queue a receive token to the underlying TCP instance. When data The HTTP driver will queue a receive token to the underlying TCP instance. When data

View File

@ -1,7 +1,7 @@
/** @file /** @file
The header files of implementation of EFI_HTTP_PROTOCOL protocol interfaces. The header files of implementation of EFI_HTTP_PROTOCOL protocol interfaces.
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -43,9 +43,11 @@
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. This is NULL.
HttpConfigData is NULL. HttpConfigData is NULL.
HttpConfigData->AccessPoint is NULL. HttpInstance->LocalAddressIsIPv6 is FALSE and
@retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. HttpConfigData->IPv4Node is NULL.
@retval EFI_NOT_STARTED The HTTP instance is not configured. HttpInstance->LocalAddressIsIPv6 is TRUE and
HttpConfigData->IPv6Node is NULL.
@retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.
**/ **/
EFI_STATUS EFI_STATUS
@ -65,8 +67,8 @@ EfiHttpGetModeData (
connections with remote hosts, canceling all asynchronous tokens, and flush request connections with remote hosts, canceling all asynchronous tokens, and flush request
and response buffers without informing the appropriate hosts. and response buffers without informing the appropriate hosts.
Except for GetModeData() and Configure(), No other EFI HTTP function can be executed No other EFI HTTP function can be executed by this instance until the Configure()
by this instance until the Configure() function is executed and returns successfully. function is executed and returns successfully.
@param[in] This Pointer to EFI_HTTP_PROTOCOL instance. @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.
@param[in] HttpConfigData Pointer to the configure data to configure the instance. @param[in] HttpConfigData Pointer to the configure data to configure the instance.
@ -74,6 +76,7 @@ EfiHttpGetModeData (
@retval EFI_SUCCESS Operation succeeded. @retval EFI_SUCCESS Operation succeeded.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. This is NULL.
HttpConfigData is NULL.
HttpConfigData->LocalAddressIsIPv6 is FALSE and HttpConfigData->LocalAddressIsIPv6 is FALSE and
HttpConfigData->IPv4Node is NULL. HttpConfigData->IPv4Node is NULL.
HttpConfigData->LocalAddressIsIPv6 is TRUE and HttpConfigData->LocalAddressIsIPv6 is TRUE and
@ -112,6 +115,7 @@ EfiHttpConfigure (
implementation. implementation.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. This is NULL.
Token is NULL.
Token->Message is NULL. Token->Message is NULL.
Token->Message->Body is not NULL, Token->Message->Body is not NULL,
Token->Message->BodyLength is non-zero, and Token->Message->BodyLength is non-zero, and
@ -142,8 +146,6 @@ EfiHttpRequest (
@retval EFI_SUCCESS Request and Response queues are successfully flushed. @retval EFI_SUCCESS Request and Response queues are successfully flushed.
@retval EFI_INVALID_PARAMETER This is NULL. @retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NOT_STARTED This instance hasn't been configured. @retval EFI_NOT_STARTED This instance hasn't been configured.
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP,
BOOTP, RARP, etc.) hasn't finished yet.
@retval EFI_NOT_FOUND The asynchronous request or response token is not @retval EFI_NOT_FOUND The asynchronous request or response token is not
found. found.
@retval EFI_UNSUPPORTED The implementation does not support this function. @retval EFI_UNSUPPORTED The implementation does not support this function.
@ -157,7 +159,7 @@ EfiHttpCancel (
/** /**
The Response() function queues an HTTP response to this HTTP instance, similar to The Response() function queues an HTTP response to this HTTP instance, similar to
Receive() function in the EFI TCP driver. When the HTTP request is sent successfully, Receive() function in the EFI TCP driver. When the HTTP response is received successfully,
or if there is an error, Status in token will be updated and Event will be signaled. or if there is an error, Status in token will be updated and Event will be signaled.
The HTTP driver will queue a receive token to the underlying TCP instance. When data The HTTP driver will queue a receive token to the underlying TCP instance. When data