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