2 The prototype of driver binding and service binding protocol for TCP driver.
4 Copyright (c) 2009 - 2010, 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 TcpDriverBindingSupported (
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 TcpDriverBindingStart (
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 TcpDriverBindingStop (
139 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
140 IN EFI_HANDLE ControllerHandle
,
141 IN UINTN NumberOfChildren
,
142 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
146 The Callback funtion called after the TCP socket is created.
148 @param[in] This Pointer to the socket just created.
149 @param[in] Context The context of the socket.
151 @retval EFI_SUCCESS This protocol is installed successfully.
152 @retval other An error occured.
156 TcpCreateSocketCallback (
162 The callback function called before the TCP socket is to be destroyed.
164 @param[in] This The TCP socket to be destroyed.
165 @param[in] Context The context of the socket.
169 TcpDestroySocketCallback (
175 // Function ptototypes for the ServiceBinding Prococol
179 Creates a child handle with a set of TCP services.
181 The CreateChild() function installs a protocol on ChildHandle.
182 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
183 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
185 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
186 @param[in, out] ChildHandle Pointer to the handle of the child to create.
187 If it is NULL, then a new handle is created.
188 If it is a pointer to an existing UEFI handle,
189 then the protocol is added to the existing UEFI handle.
191 @retval EFI_SUCCES The protocol was added to ChildHandle.
192 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
193 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create
195 @retval other The child handle was not created.
200 TcpServiceBindingCreateChild (
201 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
202 IN OUT EFI_HANDLE
*ChildHandle
206 Destroys a child handle with a set of TCP services.
208 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
209 that was installed by CreateChild() from ChildHandle. If the removed protocol is the
210 last protocol on ChildHandle, then ChildHandle is destroyed.
212 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
213 @param ChildHandle Handle of the child to destroy.
215 @retval EFI_SUCCES The protocol was removed from ChildHandle.
216 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
217 @retval EFI_INVALID_PARAMETER The child handle is not a valid UEFI Handle.
218 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
219 because its services are being used.
220 @retval other The child handle was not destroyed.
225 TcpServiceBindingDestroyChild (
226 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
227 IN EFI_HANDLE ChildHandle