]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/TcpDxe/TcpDriver.h
Update dual network stack drivers to produce multiple Driver Binding Protocol.
[mirror_edk2.git] / NetworkPkg / TcpDxe / TcpDriver.h
CommitLineData
a3bcde70
HT
1/** @file\r
2 The prototype of driver binding and service binding protocol for TCP driver.\r
3\r
6879581d 4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
a3bcde70
HT
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#ifndef _TCP_DRIVER_H_\r
17#define _TCP_DRIVER_H_\r
18\r
19#define TCP_DRIVER_SIGNATURE SIGNATURE_32 ('T', 'C', 'P', 'D')\r
20\r
21#define TCP_PORT_KNOWN 1024\r
22#define TCP_PORT_USER_RESERVED 65535\r
23\r
24typedef struct _TCP_HEARTBEAT_TIMER {\r
25 EFI_EVENT TimerEvent;\r
26 INTN RefCnt;\r
27} TCP_HEARTBEAT_TIMER;\r
28\r
29typedef struct _TCP_SERVICE_DATA {\r
30 UINT32 Signature;\r
31 EFI_HANDLE ControllerHandle;\r
32 EFI_HANDLE DriverBindingHandle;\r
33 UINT8 IpVersion;\r
34 IP_IO *IpIo;\r
35 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
36 CHAR16 *MacString;\r
37 LIST_ENTRY SocketList;\r
38} TCP_SERVICE_DATA;\r
39\r
40typedef struct _TCP_PROTO_DATA {\r
41 TCP_SERVICE_DATA *TcpService;\r
42 TCP_CB *TcpPcb;\r
43} TCP_PROTO_DATA;\r
44\r
45#define TCP_SERVICE_FROM_THIS(a) \\r
46 CR ( \\r
47 (a), \\r
48 TCP_SERVICE_DATA, \\r
49 ServiceBinding, \\r
50 TCP_DRIVER_SIGNATURE \\r
51 )\r
52\r
53//\r
54// Function prototype for the driver's entry point\r
55//\r
56\r
57/**\r
58 The entry point for Tcp driver, used to install Tcp driver on the ImageHandle.\r
59\r
60 @param[in] ImageHandle The firmware allocated handle for this driver image.\r
61 @param[in] SystemTable Pointer to the EFI system table.\r
62\r
63 @retval EFI_SUCCESS The driver loaded.\r
64 @retval other The driver did not load.\r
65\r
66**/\r
67EFI_STATUS\r
68EFIAPI\r
69TcpDriverEntryPoint (\r
70 IN EFI_HANDLE ImageHandle,\r
71 IN EFI_SYSTEM_TABLE *SystemTable\r
72 );\r
73\r
74//\r
75// Function prototypes for the Driver Binding Protocol\r
76//\r
77\r
78/**\r
79 Test to see if this driver supports ControllerHandle.\r
80\r
81 @param[in] This Protocol instance pointer.\r
82 @param[in] ControllerHandle Handle of the device to test.\r
83 @param[in] RemainingDevicePath Optional parameter use to pick a specific\r
84 child device to start.\r
85\r
86 @retval EFI_SUCCESS This driver supports this device.\r
87 @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
88 @retval other This driver does not support this device.\r
89\r
90**/\r
91EFI_STATUS\r
92EFIAPI\r
6879581d 93Tcp4DriverBindingSupported (\r
a3bcde70
HT
94 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
95 IN EFI_HANDLE ControllerHandle,\r
96 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
97 );\r
98\r
99/**\r
100 Start this driver on ControllerHandle.\r
101\r
102 @param[in] This Protocol instance pointer.\r
103 @param[in] ControllerHandle Handle of device to bind driver to.\r
104 @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r
105 device to start.\r
106\r
107 @retval EFI_SUCCESS The driver was added to ControllerHandle.\r
108 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the\r
109 driver.\r
110 @retval other The driver cannot be added to ControllerHandle.\r
111\r
112**/\r
113EFI_STATUS\r
114EFIAPI\r
6879581d 115Tcp4DriverBindingStart (\r
a3bcde70
HT
116 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
117 IN EFI_HANDLE ControllerHandle,\r
118 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
119 );\r
120\r
121/**\r
122 Stop this driver on ControllerHandle.\r
123\r
124 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
125 @param[in] ControllerHandle A handle to the device being stopped. The handle must\r
126 support a bus specific I/O protocol for the driver\r
127 to use to stop the device.\r
128 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
129 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r
130 if NumberOfChildren is 0.\r
131\r
132 @retval EFI_SUCCESS The device was stopped.\r
133 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
134\r
135**/\r
136EFI_STATUS\r
137EFIAPI\r
6879581d 138Tcp4DriverBindingStop (\r
139 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
140 IN EFI_HANDLE ControllerHandle,\r
141 IN UINTN NumberOfChildren,\r
142 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
143 );\r
144\r
145/**\r
146 Test to see if this driver supports ControllerHandle.\r
147\r
148 @param[in] This Protocol instance pointer.\r
149 @param[in] ControllerHandle Handle of the device to test.\r
150 @param[in] RemainingDevicePath Optional parameter use to pick a specific\r
151 child device to start.\r
152\r
153 @retval EFI_SUCCESS This driver supports this device.\r
154 @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
155 @retval other This driver does not support this device.\r
156\r
157**/\r
158EFI_STATUS\r
159EFIAPI\r
160Tcp6DriverBindingSupported (\r
161 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
162 IN EFI_HANDLE ControllerHandle,\r
163 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
164 );\r
165\r
166/**\r
167 Start this driver on ControllerHandle.\r
168\r
169 @param[in] This Protocol instance pointer.\r
170 @param[in] ControllerHandle Handle of device to bind driver to.\r
171 @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r
172 device to start.\r
173\r
174 @retval EFI_SUCCESS The driver was added to ControllerHandle.\r
175 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the\r
176 driver.\r
177 @retval other The driver cannot be added to ControllerHandle.\r
178\r
179**/\r
180EFI_STATUS\r
181EFIAPI\r
182Tcp6DriverBindingStart (\r
183 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
184 IN EFI_HANDLE ControllerHandle,\r
185 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
186 );\r
187\r
188/**\r
189 Stop this driver on ControllerHandle.\r
190\r
191 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
192 @param[in] ControllerHandle A handle to the device being stopped. The handle must\r
193 support a bus specific I/O protocol for the driver\r
194 to use to stop the device.\r
195 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
196 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r
197 if NumberOfChildren is 0.\r
198\r
199 @retval EFI_SUCCESS The device was stopped.\r
200 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
201\r
202**/\r
203EFI_STATUS\r
204EFIAPI\r
205Tcp6DriverBindingStop (\r
a3bcde70
HT
206 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
207 IN EFI_HANDLE ControllerHandle,\r
208 IN UINTN NumberOfChildren,\r
209 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
210 );\r
211\r
212/**\r
213 The Callback funtion called after the TCP socket is created.\r
214\r
215 @param[in] This Pointer to the socket just created.\r
216 @param[in] Context The context of the socket.\r
217\r
218 @retval EFI_SUCCESS This protocol is installed successfully.\r
219 @retval other An error occured.\r
220\r
221**/\r
222EFI_STATUS\r
223TcpCreateSocketCallback (\r
224 IN SOCKET *This,\r
225 IN VOID *Context\r
226 );\r
227\r
228/**\r
229 The callback function called before the TCP socket is to be destroyed.\r
230\r
231 @param[in] This The TCP socket to be destroyed.\r
232 @param[in] Context The context of the socket.\r
233\r
234**/\r
235VOID\r
236TcpDestroySocketCallback (\r
237 IN SOCKET *This,\r
238 IN VOID *Context\r
239 );\r
240\r
241//\r
242// Function ptototypes for the ServiceBinding Prococol\r
243//\r
244\r
245/**\r
246 Creates a child handle with a set of TCP services.\r
247\r
248 The CreateChild() function installs a protocol on ChildHandle.\r
249 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r
250 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
251\r
252 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
253 @param[in, out] ChildHandle Pointer to the handle of the child to create.\r
254 If it is NULL, then a new handle is created.\r
255 If it is a pointer to an existing UEFI handle,\r
256 then the protocol is added to the existing UEFI handle.\r
257\r
258 @retval EFI_SUCCES The protocol was added to ChildHandle.\r
259 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
260 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r
261 the child.\r
262 @retval other The child handle was not created.\r
263\r
264**/\r
265EFI_STATUS\r
266EFIAPI\r
267TcpServiceBindingCreateChild (\r
268 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
269 IN OUT EFI_HANDLE *ChildHandle\r
270 );\r
271\r
272/**\r
273 Destroys a child handle with a set of TCP services.\r
274\r
275 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
276 that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
277 last protocol on ChildHandle, then ChildHandle is destroyed.\r
278\r
279 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
280 @param ChildHandle Handle of the child to destroy.\r
281\r
282 @retval EFI_SUCCES The protocol was removed from ChildHandle.\r
283 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r
15ee13fc 284 @retval EFI_INVALID_PARAMETER The child handle is NULL.\r
a3bcde70
HT
285 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle\r
286 because its services are being used.\r
287 @retval other The child handle was not destroyed.\r
288\r
289**/\r
290EFI_STATUS\r
291EFIAPI\r
292TcpServiceBindingDestroyChild (\r
293 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
294 IN EFI_HANDLE ChildHandle\r
295 );\r
296\r
297#endif\r