Got it, thanks -----Original Message----- From: Wu, Jiaxin Sent: Wednesday, January 27, 2016 3:44 PM To: Zhang, Lubo; [email protected] Cc: Fu, Siyuan; Ye, Ting Subject: RE: [patch] NetworkPkg: change HTTP API typos.
Lubo, You also need to update the corresponding copyright year. Others look good to me. Reviewed-by: Jiaxin Wu <[email protected]> Thanks. Jiaxin -----Original Message----- From: Zhang, Lubo Sent: Tuesday, January 26, 2016 5:27 PM To: [email protected] Cc: Fu, Siyuan; Ye, Ting; Wu, Jiaxin Subject: [patch] NetworkPkg: change HTTP API typos. change HTTP API typos and clarify returned status code in HTTP API. Cc: Fu Siyuan <[email protected]> Cc: Ye Ting <[email protected]> Cc: Wu Jiaxin <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <[email protected]> --- NetworkPkg/HttpDxe/HttpImpl.c | 47 ++++++++++++++++++++----------------------- NetworkPkg/HttpDxe/HttpImpl.h | 18 +++++++++-------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index aee3de5..b24670e 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -37,27 +37,33 @@ EFI_HTTP_PROTOCOL mEfiHttpTemplate = { @retval EFI_SUCCESS Operation succeeded. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: This is NULL. HttpConfigData is NULL. - HttpConfigData->AccessPoint is NULL. - @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. - @retval EFI_NOT_STARTED The HTTP instance is not configured. + HttpConfigData->LocalAddressIsIPv6 is FALSE and + HttpConfigData->IPv4Node is NULL. + HttpConfigData->LocalAddressIsIPv6 is TRUE and + HttpConfigData->IPv6Node is NULL. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. **/ EFI_STATUS EFIAPI EfiHttpGetModeData ( IN EFI_HTTP_PROTOCOL *This, OUT EFI_HTTP_CONFIG_DATA *HttpConfigData ) { HTTP_PROTOCOL *HttpInstance; - EFI_HTTPv4_ACCESS_POINT *Http4AccessPoint; - EFI_HTTPv6_ACCESS_POINT *Http6AccessPoint; - - if ((This == NULL) || (HttpConfigData == NULL)) { + + // + // Check input parameters. + // + if (This == NULL || + HttpConfigData == NULL || + (HttpConfigData != NULL && ((HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv6Node == NULL) || + (!HttpConfigData->LocalAddressIsIPv6 + && HttpConfigData->AccessPoint.IPv4Node == NULL)))) { return EFI_INVALID_PARAMETER; } HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This); ASSERT (HttpInstance != NULL); @@ -69,31 +75,21 @@ EfiHttpGetModeData ( HttpConfigData->HttpVersion = HttpInstance->HttpVersion; HttpConfigData->TimeOutMillisec = HttpInstance->TimeOutMillisec; HttpConfigData->LocalAddressIsIPv6 = HttpInstance->LocalAddressIsIPv6; if (HttpInstance->LocalAddressIsIPv6) { - Http6AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv6_ACCESS_POINT)); - if (Http6AccessPoint == NULL) { - return EFI_OUT_OF_RESOURCES; - } CopyMem ( - Http6AccessPoint, + HttpConfigData->AccessPoint.IPv6Node, &HttpInstance->Ipv6Node, sizeof (HttpInstance->Ipv6Node) ); - HttpConfigData->AccessPoint.IPv6Node = Http6AccessPoint; } else { - Http4AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv4_ACCESS_POINT)); - if (Http4AccessPoint == NULL) { - return EFI_OUT_OF_RESOURCES; - } CopyMem ( - Http4AccessPoint, + HttpConfigData->AccessPoint.IPv4Node, &HttpInstance->IPv4Node, sizeof (HttpInstance->IPv4Node) ); - HttpConfigData->AccessPoint.IPv4Node = Http4AccessPoint; } return EFI_SUCCESS; } @@ -105,19 +101,20 @@ EfiHttpGetModeData ( timeout, local address, port, etc. When HttpConfigData is NULL, reset this EFI HTTP instance by closing all active connections with remote hosts, canceling all asynchronous tokens, and flush request and response buffers without informing the appropriate hosts. - Except for GetModeData() and Configure(), No other EFI HTTP function can be executed - by this instance until the Configure() function is executed and returns successfully. + No other EFI HTTP function can be executed by this instance until the + Configure() function is executed and returns successfully. @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. @param[in] HttpConfigData Pointer to the configure data to configure the instance. @retval EFI_SUCCESS Operation succeeded. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: This is NULL. + HttpConfigData is NULL. HttpConfigData->LocalAddressIsIPv6 is FALSE and HttpConfigData->IPv4Node is NULL. HttpConfigData->LocalAddressIsIPv6 is TRUE and HttpConfigData->IPv6Node is NULL. @retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without calling @@ -139,11 +136,12 @@ EfiHttpConfigure ( EFI_STATUS Status; // // Check input parameters. // - if (This == NULL || + if (This == NULL || + HttpConfigData == NULL || (HttpConfigData != NULL && ((HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv6Node == NULL) || (!HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv4Node == NULL)))) { return EFI_INVALID_PARAMETER; } @@ -215,10 +213,11 @@ EfiHttpConfigure ( @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. @retval EFI_UNSUPPORTED The HTTP method is not supported in current implementation. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: This is NULL. + Token is NULL. Token->Message is NULL. Token->Message->Body is not NULL, Token->Message->BodyLength is non-zero, and Token->Message->Data is NULL, but a previous call to Request()has not been completed successfully. @@ -721,12 +720,10 @@ HttpCancel ( token. @retval EFI_SUCCESS Request and Response queues are successfully flushed. @retval EFI_INVALID_PARAMETER This is NULL. @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 found. @retval EFI_UNSUPPORTED The implementation does not support this function. **/ @@ -1145,11 +1142,11 @@ Error: } /** 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. The HTTP driver will queue a receive token to the underlying TCP instance. When data is received in the underlying TCP instance, the data will be parsed and Token will be populated with the response data. If the data received from the remote host diff --git a/NetworkPkg/HttpDxe/HttpImpl.h b/NetworkPkg/HttpDxe/HttpImpl.h index afbe982..bc16fb6 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.h +++ b/NetworkPkg/HttpDxe/HttpImpl.h @@ -41,13 +41,15 @@ @retval EFI_SUCCESS Operation succeeded. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: This is NULL. HttpConfigData is NULL. - HttpConfigData->AccessPoint is NULL. - @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. - @retval EFI_NOT_STARTED The HTTP instance is not configured. + HttpConfigData->LocalAddressIsIPv6 is FALSE and + HttpConfigData->IPv4Node is NULL. + HttpConfigData->LocalAddressIsIPv6 is TRUE and + HttpConfigData->IPv6Node is NULL. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. **/ EFI_STATUS EFIAPI EfiHttpGetModeData ( @@ -63,19 +65,20 @@ EfiHttpGetModeData ( timeout, local address, port, etc. When HttpConfigData is NULL, reset this EFI HTTP instance by closing all active connections with remote hosts, canceling all asynchronous tokens, and flush request and response buffers without informing the appropriate hosts. - Except for GetModeData() and Configure(), No other EFI HTTP function can be executed - by this instance until the Configure() function is executed and returns successfully. + No other EFI HTTP function can be executed by this instance until the + Configure() function is executed and returns successfully. @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. @param[in] HttpConfigData Pointer to the configure data to configure the instance. @retval EFI_SUCCESS Operation succeeded. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: This is NULL. + HttpConfigData is NULL. HttpConfigData->LocalAddressIsIPv6 is FALSE and HttpConfigData->IPv4Node is NULL. HttpConfigData->LocalAddressIsIPv6 is TRUE and HttpConfigData->IPv6Node is NULL. @retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without calling @@ -110,10 +113,11 @@ EfiHttpConfigure ( @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. @retval EFI_UNSUPPORTED The HTTP method is not supported in current implementation. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: This is NULL. + Token is NULL. Token->Message is NULL. Token->Message->Body is not NULL, Token->Message->BodyLength is non-zero, and Token->Message->Data is NULL, but a previous call to Request()has not been completed successfully. @@ -140,12 +144,10 @@ EfiHttpRequest ( token. @retval EFI_SUCCESS Request and Response queues are successfully flushed. @retval EFI_INVALID_PARAMETER This is NULL. @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 found. @retval EFI_UNSUPPORTED The implementation does not support this function. **/ EFI_STATUS @@ -155,11 +157,11 @@ EfiHttpCancel ( IN EFI_HTTP_TOKEN *Token ); /** 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. The HTTP driver will queue a receive token to the underlying TCP instance. When data is received in the underlying TCP instance, the data will be parsed and Token will be populated with the response data. If the data received from the remote host -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

