]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Change HTTP API typos.
authorZhang Lubo <lubo.zhang@intel.com>
Thu, 28 Jan 2016 03:15:35 +0000 (03:15 +0000)
committerluobozhang <luobozhang@Edk2>
Thu, 28 Jan 2016 03:15:35 +0000 (03:15 +0000)
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

NetworkPkg/HttpDxe/HttpImpl.c
NetworkPkg/HttpDxe/HttpImpl.h

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