VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/TlsDxe/TlsDriver.h@ 77662

Last change on this file since 77662 was 77662, checked in by vboxsync, 6 years ago

EFI: First step in UDK2018 merge. Does not build yet.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette