]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/TcpDxe/TcpDriver.h
Add NetworkPkg (P.UDK2010.UP3.Network.P1)
[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 - 2010, 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 TcpDriverBindingSupported (
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 TcpDriverBindingStart (
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 TcpDriverBindingStop (
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 The Callback funtion called after the TCP socket is created.
147
148 @param[in] This Pointer to the socket just created.
149 @param[in] Context The context of the socket.
150
151 @retval EFI_SUCCESS This protocol is installed successfully.
152 @retval other An error occured.
153
154 **/
155 EFI_STATUS
156 TcpCreateSocketCallback (
157 IN SOCKET *This,
158 IN VOID *Context
159 );
160
161 /**
162 The callback function called before the TCP socket is to be destroyed.
163
164 @param[in] This The TCP socket to be destroyed.
165 @param[in] Context The context of the socket.
166
167 **/
168 VOID
169 TcpDestroySocketCallback (
170 IN SOCKET *This,
171 IN VOID *Context
172 );
173
174 //
175 // Function ptototypes for the ServiceBinding Prococol
176 //
177
178 /**
179 Creates a child handle with a set of TCP services.
180
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.
184
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.
190
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
194 the child.
195 @retval other The child handle was not created.
196
197 **/
198 EFI_STATUS
199 EFIAPI
200 TcpServiceBindingCreateChild (
201 IN EFI_SERVICE_BINDING_PROTOCOL *This,
202 IN OUT EFI_HANDLE *ChildHandle
203 );
204
205 /**
206 Destroys a child handle with a set of TCP services.
207
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.
211
212 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
213 @param ChildHandle Handle of the child to destroy.
214
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.
221
222 **/
223 EFI_STATUS
224 EFIAPI
225 TcpServiceBindingDestroyChild (
226 IN EFI_SERVICE_BINDING_PROTOCOL *This,
227 IN EFI_HANDLE ChildHandle
228 );
229
230 #endif