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