2 The prototype of driver binding and service binding protocol for TCP driver.
4 Copyright (c) 2009 - 2013, 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
;
37 LIST_ENTRY SocketList
;
40 typedef struct _TCP_PROTO_DATA
{
41 TCP_SERVICE_DATA
*TcpService
;
45 #define TCP_SERVICE_FROM_THIS(a) \
50 TCP_DRIVER_SIGNATURE \
54 // Function prototype for the driver's entry point
58 The entry point for Tcp driver, used to install Tcp driver on the ImageHandle.
60 @param[in] ImageHandle The firmware allocated handle for this driver image.
61 @param[in] SystemTable Pointer to the EFI system table.
63 @retval EFI_SUCCESS The driver loaded.
64 @retval other The driver did not load.
70 IN EFI_HANDLE ImageHandle
,
71 IN EFI_SYSTEM_TABLE
*SystemTable
75 // Function prototypes for the Driver Binding Protocol
79 Test to see if this driver supports ControllerHandle.
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.
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.
93 Tcp4DriverBindingSupported (
94 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
95 IN EFI_HANDLE ControllerHandle
,
96 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
100 Start this driver on ControllerHandle.
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
107 @retval EFI_SUCCESS The driver was added to ControllerHandle.
108 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the
110 @retval other The driver cannot be added to ControllerHandle.
115 Tcp4DriverBindingStart (
116 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
117 IN EFI_HANDLE ControllerHandle
,
118 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
122 Stop this driver on ControllerHandle.
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.
132 @retval EFI_SUCCESS The device was stopped.
133 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
138 Tcp4DriverBindingStop (
139 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
140 IN EFI_HANDLE ControllerHandle
,
141 IN UINTN NumberOfChildren
,
142 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
146 Test to see if this driver supports ControllerHandle.
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.
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.
160 Tcp6DriverBindingSupported (
161 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
162 IN EFI_HANDLE ControllerHandle
,
163 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
167 Start this driver on ControllerHandle.
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
174 @retval EFI_SUCCESS The driver was added to ControllerHandle.
175 @retval EFI_OUT_OF_RESOURCES There are not enough resources to start the
177 @retval other The driver cannot be added to ControllerHandle.
182 Tcp6DriverBindingStart (
183 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
184 IN EFI_HANDLE ControllerHandle
,
185 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
189 Stop this driver on ControllerHandle.
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.
199 @retval EFI_SUCCESS The device was stopped.
200 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
205 Tcp6DriverBindingStop (
206 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
207 IN EFI_HANDLE ControllerHandle
,
208 IN UINTN NumberOfChildren
,
209 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
213 The Callback funtion called after the TCP socket is created.
215 @param[in] This Pointer to the socket just created.
216 @param[in] Context The context of the socket.
218 @retval EFI_SUCCESS This protocol is installed successfully.
219 @retval other An error occured.
223 TcpCreateSocketCallback (
229 The callback function called before the TCP socket is to be destroyed.
231 @param[in] This The TCP socket to be destroyed.
232 @param[in] Context The context of the socket.
236 TcpDestroySocketCallback (
242 // Function ptototypes for the ServiceBinding Prococol
246 Creates a child handle with a set of TCP services.
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.
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.
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
262 @retval other The child handle was not created.
267 TcpServiceBindingCreateChild (
268 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
269 IN OUT EFI_HANDLE
*ChildHandle
273 Destroys a child handle with a set of TCP services.
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.
279 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
280 @param ChildHandle Handle of the child to destroy.
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.
292 TcpServiceBindingDestroyChild (
293 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
294 IN EFI_HANDLE ChildHandle