2 The prototype of driver binding and service binding protocol for TCP driver.
4 Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
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.
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.
16 #ifndef _TCP_DRIVER_H_
17 #define _TCP_DRIVER_H_
19 #define TCP_DRIVER_SIGNATURE SIGNATURE_32 ('T', 'C', 'P', 'D')
21 #define TCP_PORT_KNOWN 1024
22 #define TCP_PORT_USER_RESERVED 65535
24 typedef struct _TCP_HEARTBEAT_TIMER
{
27 } TCP_HEARTBEAT_TIMER
;
29 typedef struct _TCP_SERVICE_DATA
{
31 EFI_HANDLE ControllerHandle
;
32 EFI_HANDLE DriverBindingHandle
;
35 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding
;
36 LIST_ENTRY SocketList
;
39 typedef struct _TCP_PROTO_DATA
{
40 TCP_SERVICE_DATA
*TcpService
;
44 #define TCP_SERVICE_FROM_THIS(a) \
49 TCP_DRIVER_SIGNATURE \
53 // Function prototype for the driver's entry point
57 The entry point for Tcp driver, used to install Tcp driver on the ImageHandle.
59 @param[in] ImageHandle The firmware allocated handle for this driver image.
60 @param[in] SystemTable Pointer to the EFI system table.
62 @retval EFI_SUCCESS The driver loaded.
63 @retval other The driver did not load.
69 IN EFI_HANDLE ImageHandle
,
70 IN EFI_SYSTEM_TABLE
*SystemTable
74 // Function prototypes for the Driver Binding Protocol
78 Test to see if this driver supports ControllerHandle.
80 @param[in] This Protocol instance pointer.
81 @param[in] ControllerHandle Handle of the device to test.
82 @param[in] RemainingDevicePath Optional parameter use to pick a specific
83 child device to start.
85 @retval EFI_SUCCESS This driver supports this device.
86 @retval EFI_ALREADY_STARTED This driver is already running on this device.
87 @retval other This driver does not support this device.
92 Tcp4DriverBindingSupported (
93 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
94 IN EFI_HANDLE ControllerHandle
,
95 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
99 Start this driver on ControllerHandle.
101 @param[in] This Protocol instance pointer.
102 @param[in] ControllerHandle Handle of device to bind driver to.
103 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
106 @retval EFI_SUCCESS The driver was added to ControllerHandle.
107 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the
109 @retval other The driver cannot be added to ControllerHandle.
114 Tcp4DriverBindingStart (
115 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
116 IN EFI_HANDLE ControllerHandle
,
117 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
121 Stop this driver on ControllerHandle.
123 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
124 @param[in] ControllerHandle A handle to the device being stopped. The handle must
125 support a bus specific I/O protocol for the driver
126 to use to stop the device.
127 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
128 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
129 if NumberOfChildren is 0.
131 @retval EFI_SUCCESS The device was stopped.
132 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
137 Tcp4DriverBindingStop (
138 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
139 IN EFI_HANDLE ControllerHandle
,
140 IN UINTN NumberOfChildren
,
141 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
145 Test to see if this driver supports ControllerHandle.
147 @param[in] This Protocol instance pointer.
148 @param[in] ControllerHandle Handle of the device to test.
149 @param[in] RemainingDevicePath Optional parameter use to pick a specific
150 child device to start.
152 @retval EFI_SUCCESS This driver supports this device.
153 @retval EFI_ALREADY_STARTED This driver is already running on this device.
154 @retval other This driver does not support this device.
159 Tcp6DriverBindingSupported (
160 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
161 IN EFI_HANDLE ControllerHandle
,
162 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
166 Start this driver on ControllerHandle.
168 @param[in] This Protocol instance pointer.
169 @param[in] ControllerHandle Handle of device to bind driver to.
170 @param[in] RemainingDevicePath Optional parameter use to pick a specific child
173 @retval EFI_SUCCESS The driver was added to ControllerHandle.
174 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the
176 @retval other The driver cannot be added to ControllerHandle.
181 Tcp6DriverBindingStart (
182 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
183 IN EFI_HANDLE ControllerHandle
,
184 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
188 Stop this driver on ControllerHandle.
190 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
191 @param[in] ControllerHandle A handle to the device being stopped. The handle must
192 support a bus specific I/O protocol for the driver
193 to use to stop the device.
194 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
195 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
196 if NumberOfChildren is 0.
198 @retval EFI_SUCCESS The device was stopped.
199 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
204 Tcp6DriverBindingStop (
205 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
206 IN EFI_HANDLE ControllerHandle
,
207 IN UINTN NumberOfChildren
,
208 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
212 The Callback funtion called after the TCP socket is created.
214 @param[in] This Pointer to the socket just created.
215 @param[in] Context The context of the socket.
217 @retval EFI_SUCCESS This protocol is installed successfully.
218 @retval other An error occured.
222 TcpCreateSocketCallback (
228 The callback function called before the TCP socket is to be destroyed.
230 @param[in] This The TCP socket to be destroyed.
231 @param[in] Context The context of the socket.
235 TcpDestroySocketCallback (
241 // Function prototypes for the ServiceBinding Protocol
245 Creates a child handle with a set of TCP services.
247 The CreateChild() function installs a protocol on ChildHandle.
248 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
249 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
251 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
252 @param[in, out] ChildHandle Pointer to the handle of the child to create.
253 If it is NULL, then a new handle is created.
254 If it is a pointer to an existing UEFI handle,
255 then the protocol is added to the existing UEFI handle.
257 @retval EFI_SUCCES The protocol was added to ChildHandle.
258 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
259 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create
261 @retval other The child handle was not created.
266 TcpServiceBindingCreateChild (
267 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
268 IN OUT EFI_HANDLE
*ChildHandle
272 Destroys a child handle with a set of TCP services.
274 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
275 that was installed by CreateChild() from ChildHandle. If the removed protocol is the
276 last protocol on ChildHandle, then ChildHandle is destroyed.
278 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
279 @param ChildHandle Handle of the child to destroy.
281 @retval EFI_SUCCES The protocol was removed from ChildHandle.
282 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
283 @retval EFI_INVALID_PARAMETER The child handle is NULL.
284 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
285 because its services are being used.
286 @retval other The child handle was not destroyed.
291 TcpServiceBindingDestroyChild (
292 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
293 IN EFI_HANDLE ChildHandle