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