]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.c
NetworkPkg/HttpDxe: HTTPS support over IPv4 and IPv6
[mirror_edk2.git] / NetworkPkg / HttpUtilitiesDxe / HttpUtilitiesDxe.c
CommitLineData
d933e70a
JW
1/** @file\r
2 The DriverEntryPoint and Unload for HttpUtilities driver.\r
3\r
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "HttpUtilitiesDxe.h"\r
17\r
18\r
19/**\r
20 Unloads an image.\r
21\r
22 @param ImageHandle Handle that identifies the image to be unloaded.\r
23\r
24 @retval EFI_SUCCESS The image has been unloaded.\r
25 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.\r
26\r
27**/\r
28EFI_STATUS \r
29EFIAPI\r
30HttpUtilitiesDxeUnload (\r
31 IN EFI_HANDLE ImageHandle\r
32 )\r
33{\r
34 EFI_STATUS Status;\r
35 UINTN HandleNum;\r
36 EFI_HANDLE *HandleBuffer;\r
37 UINT32 Index;\r
38 EFI_HTTP_UTILITIES_PROTOCOL *HttpUtilitiesProtocol;\r
39\r
40\r
41 HandleBuffer = NULL;\r
42\r
43 //\r
44 // Locate all the handles with HttpUtilities protocol.\r
45 //\r
46 Status = gBS->LocateHandleBuffer (\r
47 ByProtocol,\r
48 &gEfiHttpUtilitiesProtocolGuid,\r
49 NULL,\r
50 &HandleNum,\r
51 &HandleBuffer\r
52 );\r
53 if (EFI_ERROR (Status)) {\r
54 return Status;\r
55 }\r
56\r
57 for (Index = 0; Index < HandleNum; Index++) {\r
58 //\r
59 // Firstly, find HttpUtilitiesProtocol interface\r
60 //\r
61 Status = gBS->OpenProtocol (\r
62 HandleBuffer[Index], \r
63 &gEfiHttpUtilitiesProtocolGuid, \r
64 (VOID **) &HttpUtilitiesProtocol, \r
65 ImageHandle, \r
66 NULL, \r
67 EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL\r
68 );\r
69 if (EFI_ERROR (Status)) {\r
70 return Status;\r
71 }\r
72\r
73 //\r
74 // Then, uninstall HttpUtilities interface\r
75 // \r
76 Status = gBS->UninstallMultipleProtocolInterfaces (\r
77 HandleBuffer[Index],\r
78 &gEfiHttpUtilitiesProtocolGuid, HttpUtilitiesProtocol,\r
79 NULL\r
80 );\r
81 if (EFI_ERROR (Status)) {\r
82 return Status;\r
83 }\r
84 }\r
85\r
86 return EFI_SUCCESS;\r
87}\r
88\r
89\r
90/**\r
91 This is the declaration of an EFI image entry point. This entry point is\r
92 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
93 both device drivers and bus drivers.\r
94\r
95 @param ImageHandle The firmware allocated handle for the UEFI image.\r
96 @param SystemTable A pointer to the EFI System Table.\r
97\r
98 @retval EFI_SUCCESS The operation completed successfully.\r
99 @retval Others An unexpected error occurred.\r
100**/\r
101EFI_STATUS\r
102EFIAPI\r
103HttpUtilitiesDxeDriverEntryPoint (\r
104 IN EFI_HANDLE ImageHandle,\r
105 IN EFI_SYSTEM_TABLE *SystemTable\r
106 )\r
107{\r
108 EFI_STATUS Status;\r
109\r
110 EFI_HANDLE Handle;\r
111\r
112 Handle = NULL;\r
113\r
114 //\r
115 // Install the HttpUtilities Protocol onto Handle\r
116 //\r
117 Status = gBS->InstallMultipleProtocolInterfaces (\r
118 &Handle,\r
119 &gEfiHttpUtilitiesProtocolGuid,\r
120 &mHttpUtilitiesProtocol,\r
121 NULL\r
122 );\r
123 \r
124 return Status;\r
125}\r
126\r