]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/TlsDxe/TlsDriver.h
NetworkPkg: Apply uncrustify changes
[mirror_edk2.git] / NetworkPkg / TlsDxe / TlsDriver.h
CommitLineData
7618784b
HW
1/** @file\r
2 Header file of the Driver Binding and Service Binding Protocol for TlsDxe driver.\r
3\r
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
5\r
ecf98fbc 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7618784b
HW
7\r
8**/\r
9\r
10#ifndef __EFI_TLS_DRIVER_H__\r
11#define __EFI_TLS_DRIVER_H__\r
12\r
13#include <Uefi.h>\r
14\r
15//\r
16// Driver Protocols\r
17//\r
18#include <Protocol/ServiceBinding.h>\r
19\r
20//\r
21// Driver Version\r
22//\r
23#define TLS_VERSION 0x00000000\r
24\r
d1050b9d 25#define TLS_SERVICE_SIGNATURE SIGNATURE_32 ('T', 'L', 'S', 'S')\r
7618784b 26\r
d1050b9d 27#define TLS_INSTANCE_SIGNATURE SIGNATURE_32 ('T', 'L', 'S', 'I')\r
7618784b
HW
28\r
29///\r
30/// TLS Service Data\r
31///\r
d1050b9d 32typedef struct _TLS_SERVICE TLS_SERVICE;\r
7618784b
HW
33\r
34///\r
35/// TLS Instance Data\r
36///\r
37typedef struct _TLS_INSTANCE TLS_INSTANCE;\r
38\r
7618784b
HW
39struct _TLS_SERVICE {\r
40 UINT32 Signature;\r
41 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
42\r
43 UINT16 TlsChildrenNum;\r
44 LIST_ENTRY TlsChildrenList;\r
45\r
46 //\r
47 // Handle to install TlsServiceBinding protocol.\r
48 //\r
49 EFI_HANDLE Handle;\r
50 EFI_HANDLE ImageHandle;\r
51\r
52 //\r
53 // Main SSL Context object which is created by a server or client once per program\r
54 // life-time and which holds mainly default values for the SSL object which are later\r
55 // created for the connections.\r
56 //\r
57 VOID *TlsCtx;\r
58};\r
59\r
60struct _TLS_INSTANCE {\r
d1050b9d
MK
61 UINT32 Signature;\r
62 LIST_ENTRY Link;\r
7618784b 63\r
d1050b9d 64 BOOLEAN InDestroy;\r
7618784b 65\r
d1050b9d
MK
66 TLS_SERVICE *Service;\r
67 EFI_HANDLE ChildHandle;\r
7618784b 68\r
d1050b9d
MK
69 EFI_TLS_PROTOCOL Tls;\r
70 EFI_TLS_CONFIGURATION_PROTOCOL TlsConfig;\r
7618784b 71\r
d1050b9d 72 EFI_TLS_SESSION_STATE TlsSessionState;\r
7618784b
HW
73\r
74 //\r
75 // Main SSL Connection which is created by a server or a client\r
76 // per established connection.\r
77 //\r
d1050b9d 78 VOID *TlsConn;\r
7618784b
HW
79};\r
80\r
7618784b
HW
81#define TLS_SERVICE_FROM_THIS(a) \\r
82 CR (a, TLS_SERVICE, ServiceBinding, TLS_SERVICE_SIGNATURE)\r
83\r
84#define TLS_INSTANCE_FROM_PROTOCOL(a) \\r
85 CR (a, TLS_INSTANCE, Tls, TLS_INSTANCE_SIGNATURE)\r
86\r
87#define TLS_INSTANCE_FROM_CONFIGURATION(a) \\r
88 CR (a, TLS_INSTANCE, TlsConfig, TLS_INSTANCE_SIGNATURE)\r
89\r
7618784b
HW
90/**\r
91 Release all the resources used by the TLS instance.\r
92\r
93 @param[in] Instance The TLS instance data.\r
94\r
95**/\r
96VOID\r
97TlsCleanInstance (\r
d1050b9d 98 IN TLS_INSTANCE *Instance\r
7618784b
HW
99 );\r
100\r
101/**\r
102 Create the TLS instance and initialize it.\r
103\r
104 @param[in] Service The pointer to the TLS service.\r
105 @param[out] Instance The pointer to the TLS instance.\r
106\r
107 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r
108 @retval EFI_SUCCESS The TLS instance is created.\r
109\r
110**/\r
111EFI_STATUS\r
112TlsCreateInstance (\r
d1050b9d
MK
113 IN TLS_SERVICE *Service,\r
114 OUT TLS_INSTANCE **Instance\r
7618784b
HW
115 );\r
116\r
117/**\r
118 Release all the resources used by the TLS service binding instance.\r
119\r
120 @param[in] Service The TLS service data.\r
121\r
122**/\r
123VOID\r
124TlsCleanService (\r
d1050b9d 125 IN TLS_SERVICE *Service\r
7618784b
HW
126 );\r
127\r
128/**\r
129 Create then initialize a TLS service.\r
130\r
131 @param[in] Image ImageHandle of the TLS driver\r
132 @param[out] Service The service for TLS driver\r
133\r
134 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to create the service.\r
135 @retval EFI_SUCCESS The service is created for the driver.\r
136\r
137**/\r
138EFI_STATUS\r
139TlsCreateService (\r
d1050b9d
MK
140 IN EFI_HANDLE Image,\r
141 OUT TLS_SERVICE **Service\r
7618784b
HW
142 );\r
143\r
144/**\r
145 Unloads an image.\r
146\r
147 @param[in] ImageHandle Handle that identifies the image to be unloaded.\r
148\r
149 @retval EFI_SUCCESS The image has been unloaded.\r
150 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.\r
151\r
152**/\r
153EFI_STATUS\r
154EFIAPI\r
155TlsUnload (\r
156 IN EFI_HANDLE ImageHandle\r
157 );\r
158\r
159/**\r
160 This is the declaration of an EFI image entry point. This entry point is\r
161 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
162 both device drivers and bus drivers.\r
163\r
164 @param ImageHandle The firmware allocated handle for the UEFI image.\r
165 @param SystemTable A pointer to the EFI System Table.\r
166\r
167 @retval EFI_SUCCESS The operation completed successfully.\r
168 @retval Others An unexpected error occurred.\r
169**/\r
170EFI_STATUS\r
171EFIAPI\r
172TlsDriverEntryPoint (\r
173 IN EFI_HANDLE ImageHandle,\r
174 IN EFI_SYSTEM_TABLE *SystemTable\r
175 );\r
176\r
177/**\r
178 Creates a child handle and installs a protocol.\r
179\r
180 The CreateChild() function installs a protocol on ChildHandle.\r
181 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r
182 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
183\r
184 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
185 @param[in] ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
186 then a new handle is created. If it is a pointer to an existing UEFI handle,\r
187 then the protocol is added to the existing UEFI handle.\r
188\r
dad13c80 189 @retval EFI_SUCCESS The protocol was added to ChildHandle.\r
7618784b
HW
190 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
191 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r
192 the child.\r
193 @retval other The child handle was not created.\r
194\r
195**/\r
196EFI_STATUS\r
197EFIAPI\r
198TlsServiceBindingCreateChild (\r
199 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
200 IN EFI_HANDLE *ChildHandle\r
201 );\r
202\r
203/**\r
204 Destroys a child handle with a protocol installed on it.\r
205\r
206 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
207 that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
208 last protocol on ChildHandle, then ChildHandle is destroyed.\r
209\r
210 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
211 @param ChildHandle Handle of the child to destroy.\r
212\r
dad13c80 213 @retval EFI_SUCCESS The protocol was removed from ChildHandle.\r
7618784b
HW
214 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r
215 @retval EFI_INVALID_PARAMETER Child handle is NULL.\r
216 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle\r
217 because its services are being used.\r
218 @retval other The child handle was not destroyed.\r
219\r
220**/\r
221EFI_STATUS\r
222EFIAPI\r
223TlsServiceBindingDestroyChild (\r
224 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
225 IN EFI_HANDLE ChildHandle\r
226 );\r
227\r
228#endif\r