Re: [edk2] [Patch 2/3] NetworkPkg: Add HTTP utilities driver

2015-08-21 Thread Wu, Jiaxin
Thanks Ting, I will create another patch for HttpDxe to consume 
HttpUtilitiesProtocol. /Jiaxin

-Original Message-
From: Ye, Ting 
Sent: Friday, August 21, 2015 1:55 PM
To: Wu, Jiaxin; edk2-devel@lists.01.org
Cc: Fu, Siyuan
Subject: RE: [Patch 2/3] NetworkPkg: Add HTTP utilities driver

I think the below protocol attribute is incorrect. Should be updated to 
PRODUCES.

gEfiHttpUtilitiesProtocolGuid   ## BY_START

Also, I expect a following patch to update HttpDxe driver to remove internal 
functions and consume this protocol.

Other parts are good to me.

Reviewed-by: Ye Ting ting...@intel.com

Best Regards,
Ye Ting

-Original Message-
From: Wu, Jiaxin
Sent: Friday, August 21, 2015 9:37 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting; Fu, Siyuan
Subject: [Patch 2/3] NetworkPkg: Add HTTP utilities driver

This patch is used to add HTTP utilities driver.

Cc: Ye Ting ting...@intel.com
Cc: Siyuan Fu siyuan...@intel.com
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu jiaxin...@intel.com
---
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c | 126 +++
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.h | 212 +++
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf   |  51 +++
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesImpl.c| 279 +++
 .../HttpUtilitiesDxe/HttpUtilitiesProtocol.c   | 393 +
 NetworkPkg/NetworkPkg.dsc  |   2 +
 6 files changed, 1063 insertions(+)
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.h
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesImpl.c
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c

diff --git a/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c 
b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c
new file mode 100644
index 000..6bd5b6c
--- /dev/null
+++ b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c
@@ -0,0 +1,126 @@
+/** @file
+  The DriverEntryPoint and Unload for HttpUtilities driver.
+
+  Copyright (c) 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  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.
+
+**/
+
+#include HttpUtilitiesDxe.h
+
+
+/**
+  Unloads an image.
+
+  @param  ImageHandle   Handle that identifies the image to be 
unloaded.
+
+  @retval EFI_SUCCESS   The image has been unloaded.
+  @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
+
+**/
+EFI_STATUS
+EFIAPI
+HttpUtilitiesDxeUnload (
+  IN EFI_HANDLE  ImageHandle
+  )
+{
+  EFI_STATUS  Status;
+  UINTN   HandleNum;
+  EFI_HANDLE  *HandleBuffer;
+  UINT32  Index;
+  EFI_HTTP_UTILITIES_PROTOCOL *HttpUtilitiesProtocol;
+
+
+  HandleBuffer   = NULL;
+
+  //
+  // Locate all the handles with HttpUtilities protocol.
+  //
+  Status = gBS-LocateHandleBuffer (
+  ByProtocol,
+  gEfiHttpUtilitiesProtocolGuid,
+  NULL,
+  HandleNum,
+  HandleBuffer
+  );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  for (Index = 0; Index  HandleNum; Index++) {
+//
+// Firstly, find HttpUtilitiesProtocol interface
+//
+Status = gBS-OpenProtocol (
+HandleBuffer[Index], 
+gEfiHttpUtilitiesProtocolGuid, 
+(VOID **) HttpUtilitiesProtocol, 
+ImageHandle, 
+NULL, 
+EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
+);
+if (EFI_ERROR (Status)) {
+  return Status;
+}
+
+//
+// Then, uninstall HttpUtilities interface
+// 
+Status = gBS-UninstallMultipleProtocolInterfaces (
+HandleBuffer[Index],
+gEfiHttpUtilitiesProtocolGuid, HttpUtilitiesProtocol,
+NULL
+);
+if (EFI_ERROR (Status)) {
+  return Status;
+}
+  }
+
+  return EFI_SUCCESS;
+}
+
+
+/**
+  This is the declaration of an EFI image entry point. This entry point 
+is
+  the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers 
+including
+  both device drivers and bus drivers.
+
+  @param  ImageHandle   The firmware allocated handle for the UEFI 
image.
+  @param  SystemTable   A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS   The operation completed successfully.
+  

Re: [edk2] [Patch 2/3] NetworkPkg: Add HTTP utilities driver

2015-08-20 Thread Ye, Ting
I think the below protocol attribute is incorrect. Should be updated to 
PRODUCES.

gEfiHttpUtilitiesProtocolGuid   ## BY_START

Also, I expect a following patch to update HttpDxe driver to remove internal 
functions and consume this protocol.

Other parts are good to me.

Reviewed-by: Ye Ting ting...@intel.com

Best Regards,
Ye Ting

-Original Message-
From: Wu, Jiaxin 
Sent: Friday, August 21, 2015 9:37 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting; Fu, Siyuan
Subject: [Patch 2/3] NetworkPkg: Add HTTP utilities driver

This patch is used to add HTTP utilities driver.

Cc: Ye Ting ting...@intel.com
Cc: Siyuan Fu siyuan...@intel.com
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu jiaxin...@intel.com
---
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c | 126 +++
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.h | 212 +++
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf   |  51 +++
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesImpl.c| 279 +++
 .../HttpUtilitiesDxe/HttpUtilitiesProtocol.c   | 393 +
 NetworkPkg/NetworkPkg.dsc  |   2 +
 6 files changed, 1063 insertions(+)
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.h
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesImpl.c
 create mode 100644 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c

diff --git a/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c 
b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c
new file mode 100644
index 000..6bd5b6c
--- /dev/null
+++ b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c
@@ -0,0 +1,126 @@
+/** @file
+  The DriverEntryPoint and Unload for HttpUtilities driver.
+
+  Copyright (c) 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
+  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.
+
+**/
+
+#include HttpUtilitiesDxe.h
+
+
+/**
+  Unloads an image.
+
+  @param  ImageHandle   Handle that identifies the image to be 
unloaded.
+
+  @retval EFI_SUCCESS   The image has been unloaded.
+  @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
+
+**/
+EFI_STATUS 
+EFIAPI
+HttpUtilitiesDxeUnload (
+  IN EFI_HANDLE  ImageHandle
+  )
+{
+  EFI_STATUS  Status;
+  UINTN   HandleNum;
+  EFI_HANDLE  *HandleBuffer;
+  UINT32  Index;
+  EFI_HTTP_UTILITIES_PROTOCOL *HttpUtilitiesProtocol;
+
+
+  HandleBuffer   = NULL;
+
+  //
+  // Locate all the handles with HttpUtilities protocol.
+  //
+  Status = gBS-LocateHandleBuffer (
+  ByProtocol,
+  gEfiHttpUtilitiesProtocolGuid,
+  NULL,
+  HandleNum,
+  HandleBuffer
+  );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  for (Index = 0; Index  HandleNum; Index++) {
+//
+// Firstly, find HttpUtilitiesProtocol interface
+//
+Status = gBS-OpenProtocol (
+HandleBuffer[Index], 
+gEfiHttpUtilitiesProtocolGuid, 
+(VOID **) HttpUtilitiesProtocol, 
+ImageHandle, 
+NULL, 
+EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
+);
+if (EFI_ERROR (Status)) {
+  return Status;
+}
+
+//
+// Then, uninstall HttpUtilities interface
+// 
+Status = gBS-UninstallMultipleProtocolInterfaces (
+HandleBuffer[Index],
+gEfiHttpUtilitiesProtocolGuid, HttpUtilitiesProtocol,
+NULL
+);
+if (EFI_ERROR (Status)) {
+  return Status;
+}
+  }
+
+  return EFI_SUCCESS;
+}
+
+
+/**
+  This is the declaration of an EFI image entry point. This entry point is
+  the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
+  both device drivers and bus drivers.
+
+  @param  ImageHandle   The firmware allocated handle for the UEFI 
image.
+  @param  SystemTable   A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS   The operation completed successfully.
+  @retval OthersAn unexpected error occurred.
+**/
+EFI_STATUS
+EFIAPI
+HttpUtilitiesDxeDriverEntryPoint (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS Status;
+
+  EFI_HANDLE Handle;
+
+  Handle = NULL;
+
+  //
+