]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Declaration of protocol interfaces in EFI_TCP4_PROTOCOL and EFI_TCP6_PROTOCOL.\r | |
3 | It is the common head file for all Tcp*.c in TCP driver.\r | |
4 | \r | |
5 | Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r | |
6 | \r | |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php.\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #ifndef _TCP_MAIN_H_\r | |
18 | #define _TCP_MAIN_H_\r | |
19 | \r | |
20 | #include <Protocol/ServiceBinding.h>\r | |
21 | #include <Protocol/DriverBinding.h>\r | |
22 | #include <Library/IpIoLib.h>\r | |
23 | #include <Library/DevicePathLib.h>\r | |
24 | #include <Library/PrintLib.h>\r | |
25 | \r | |
26 | #include "Socket.h"\r | |
27 | #include "TcpProto.h"\r | |
28 | #include "TcpDriver.h"\r | |
29 | #include "TcpFunc.h"\r | |
30 | \r | |
31 | extern UINT16 mTcp4RandomPort;\r | |
32 | extern UINT16 mTcp6RandomPort;\r | |
33 | extern CHAR16 *mTcpStateName[];\r | |
34 | extern EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName;\r | |
35 | extern EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2;\r | |
36 | extern EFI_UNICODE_STRING_TABLE *gTcpControllerNameTable;\r | |
37 | \r | |
38 | extern LIST_ENTRY mTcpRunQue;\r | |
39 | extern LIST_ENTRY mTcpListenQue;\r | |
40 | extern TCP_SEQNO mTcpGlobalIss;\r | |
41 | extern UINT32 mTcpTick;\r | |
42 | \r | |
43 | ///\r | |
44 | /// 30 seconds.\r | |
45 | ///\r | |
46 | #define TCP6_KEEP_NEIGHBOR_TIME 30\r | |
47 | ///\r | |
48 | /// 5 seconds, since 1 tick equals 200ms.\r | |
49 | ///\r | |
50 | #define TCP6_REFRESH_NEIGHBOR_TICK 25\r | |
51 | \r | |
52 | #define TCP_EXPIRE_TIME 65535\r | |
53 | \r | |
54 | ///\r | |
55 | /// The implementation selects the initial send sequence number and the unit to\r | |
56 | /// be added when it is increased.\r | |
57 | ///\r | |
58 | #define TCP_BASE_ISS 0x4d7e980b\r | |
59 | #define TCP_ISS_INCREMENT_1 2048\r | |
60 | #define TCP_ISS_INCREMENT_2 100\r | |
61 | \r | |
62 | typedef union {\r | |
63 | EFI_TCP4_CONFIG_DATA Tcp4CfgData;\r | |
64 | EFI_TCP6_CONFIG_DATA Tcp6CfgData;\r | |
65 | } TCP_CONFIG_DATA;\r | |
66 | \r | |
67 | typedef union {\r | |
68 | EFI_TCP4_ACCESS_POINT Tcp4Ap;\r | |
69 | EFI_TCP6_ACCESS_POINT Tcp6Ap;\r | |
70 | } TCP_ACCESS_POINT;\r | |
71 | \r | |
72 | typedef struct _TCP4_MODE_DATA {\r | |
73 | EFI_TCP4_CONNECTION_STATE *Tcp4State;\r | |
74 | EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;\r | |
75 | EFI_IP4_MODE_DATA *Ip4ModeData;\r | |
76 | EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;\r | |
77 | EFI_SIMPLE_NETWORK_MODE *SnpModeData;\r | |
78 | } TCP4_MODE_DATA;\r | |
79 | \r | |
80 | typedef struct _TCP6_MODE_DATA {\r | |
81 | EFI_TCP6_CONNECTION_STATE *Tcp6State;\r | |
82 | EFI_TCP6_CONFIG_DATA *Tcp6ConfigData;\r | |
83 | EFI_IP6_MODE_DATA *Ip6ModeData;\r | |
84 | EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;\r | |
85 | EFI_SIMPLE_NETWORK_MODE *SnpModeData;\r | |
86 | } TCP6_MODE_DATA;\r | |
87 | \r | |
88 | typedef struct _TCP4_ROUTE_INFO {\r | |
89 | BOOLEAN DeleteRoute;\r | |
90 | EFI_IPv4_ADDRESS *SubnetAddress;\r | |
91 | EFI_IPv4_ADDRESS *SubnetMask;\r | |
92 | EFI_IPv4_ADDRESS *GatewayAddress;\r | |
93 | } TCP4_ROUTE_INFO;\r | |
94 | \r | |
95 | typedef struct {\r | |
96 | EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;\r | |
97 | UINTN NumberOfChildren;\r | |
98 | EFI_HANDLE *ChildHandleBuffer;\r | |
99 | } TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;\r | |
100 | \r | |
101 | //\r | |
102 | // EFI_TCP4_PROTOCOL definitions.\r | |
103 | //\r | |
104 | \r | |
105 | /**\r | |
106 | Get the current operational status.\r | |
107 | \r | |
108 | @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
109 | @param[out] Tcp4State Pointer to the buffer to receive the current TCP\r | |
110 | state. Optional parameter that may be NULL.\r | |
111 | @param[out] Tcp4ConfigData Pointer to the buffer to receive the current TCP\r | |
112 | configuration. Optional parameter that may be NULL.\r | |
113 | @param[out] Ip4ModeData Pointer to the buffer to receive the current\r | |
114 | IPv4 configuration. Optional parameter that may be NULL.\r | |
115 | @param[out] MnpConfigData Pointer to the buffer to receive the current MNP\r | |
116 | configuration data indirectly used by the TCPv4\r | |
117 | Instance. Optional parameter that may be NULL.\r | |
118 | @param[out] SnpModeData Pointer to the buffer to receive the current SNP\r | |
119 | configuration data indirectly used by the TCPv4\r | |
120 | Instance. Optional parameter that may be NULL.\r | |
121 | \r | |
122 | @retval EFI_SUCCESS The mode data was read.\r | |
123 | @retval EFI_NOT_STARTED No configuration data is available because this\r | |
124 | instance hasn't been started.\r | |
125 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
126 | \r | |
127 | **/\r | |
128 | EFI_STATUS\r | |
129 | EFIAPI\r | |
130 | Tcp4GetModeData (\r | |
131 | IN EFI_TCP4_PROTOCOL *This,\r | |
132 | OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,\r | |
133 | OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,\r | |
134 | OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,\r | |
135 | OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r | |
136 | OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r | |
137 | );\r | |
138 | \r | |
139 | /**\r | |
140 | Initialize or brutally reset the operational parameters for\r | |
141 | this EFI TCPv4 instance.\r | |
142 | \r | |
143 | @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
144 | @param[in] TcpConfigData Pointer to the configure data to configure the\r | |
145 | instance. Optional parameter that may be NULL.\r | |
146 | \r | |
147 | @retval EFI_SUCCESS The operational settings are set, changed, or\r | |
148 | reset successfully.\r | |
149 | @retval EFI_NO_MAPPING When using a default address, configuration\r | |
150 | (through DHCP, BOOTP, RARP, etc.) is not\r | |
151 | finished.\r | |
152 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
153 | @retval EFI_ACCESS_DENIED Configuring the TCP instance when it is already\r | |
154 | configured.\r | |
155 | @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r | |
156 | @retval EFI_UNSUPPORTED One or more of the control options are not\r | |
157 | supported in the implementation.\r | |
158 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.\r | |
159 | \r | |
160 | **/\r | |
161 | EFI_STATUS\r | |
162 | EFIAPI\r | |
163 | Tcp4Configure (\r | |
164 | IN EFI_TCP4_PROTOCOL * This,\r | |
165 | IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL\r | |
166 | );\r | |
167 | \r | |
168 | /**\r | |
169 | Add or delete routing entries.\r | |
170 | \r | |
171 | @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
172 | @param[in] DeleteRoute If TRUE, delete the specified route from routing\r | |
173 | table; if FALSE, add the specified route to\r | |
174 | routing table.\r | |
175 | @param[in] SubnetAddress The destination network.\r | |
176 | @param[in] SubnetMask The subnet mask for the destination network.\r | |
177 | @param[in] GatewayAddress The gateway address for this route.\r | |
178 | \r | |
179 | @retval EFI_SUCCESS The operation completed successfully.\r | |
180 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been\r | |
181 | configured.\r | |
182 | @retval EFI_NO_MAPPING When using a default address, configuration\r | |
183 | (through DHCP, BOOTP, RARP, etc.) is not\r | |
184 | finished.\r | |
185 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
186 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the\r | |
187 | entry to the routing table.\r | |
188 | @retval EFI_NOT_FOUND This route is not in the routing table.\r | |
189 | @retval EFI_ACCESS_DENIED This route is already in the routing table.\r | |
190 | @retval EFI_UNSUPPORTED The TCP driver does not support this operation.\r | |
191 | \r | |
192 | **/\r | |
193 | EFI_STATUS\r | |
194 | EFIAPI\r | |
195 | Tcp4Routes (\r | |
196 | IN EFI_TCP4_PROTOCOL *This,\r | |
197 | IN BOOLEAN DeleteRoute,\r | |
198 | IN EFI_IPv4_ADDRESS *SubnetAddress,\r | |
199 | IN EFI_IPv4_ADDRESS *SubnetMask,\r | |
200 | IN EFI_IPv4_ADDRESS *GatewayAddress\r | |
201 | );\r | |
202 | \r | |
203 | /**\r | |
204 | Initiate a nonblocking TCP connection request for an active TCP instance.\r | |
205 | \r | |
206 | @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
207 | @param[in] ConnectionToken Pointer to the connection token to return when\r | |
208 | the TCP three way handshake finishes.\r | |
209 | \r | |
210 | @retval EFI_SUCCESS The connection request is successfully\r | |
211 | initiated.\r | |
212 | @retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been\r | |
213 | configured.\r | |
214 | @retval EFI_ACCESS_DENIED The instance is not configured as an active one\r | |
215 | or it is not in Tcp4StateClosed state.\r | |
216 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
217 | @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to\r | |
218 | initiate the active open.\r | |
219 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
220 | \r | |
221 | **/\r | |
222 | EFI_STATUS\r | |
223 | EFIAPI\r | |
224 | Tcp4Connect (\r | |
225 | IN EFI_TCP4_PROTOCOL *This,\r | |
226 | IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken\r | |
227 | );\r | |
228 | \r | |
229 | /**\r | |
230 | Listen on the passive instance to accept an incoming connection request.\r | |
231 | \r | |
232 | @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
233 | @param[in] ListenToken Pointer to the listen token to return when\r | |
234 | operation finishes.\r | |
235 | \r | |
236 | @retval EFI_SUCCESS The listen token has been queued successfully.\r | |
237 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r | |
238 | configured.\r | |
239 | @retval EFI_ACCESS_DENIED The instatnce is not a passive one or it is not\r | |
240 | in Tcp4StateListen state, or a same listen token\r | |
241 | has already existed in the listen token queue of\r | |
242 | this TCP instance.\r | |
243 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
244 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish\r | |
245 | the operation.\r | |
246 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
247 | \r | |
248 | **/\r | |
249 | EFI_STATUS\r | |
250 | EFIAPI\r | |
251 | Tcp4Accept (\r | |
252 | IN EFI_TCP4_PROTOCOL *This,\r | |
253 | IN EFI_TCP4_LISTEN_TOKEN *ListenToken\r | |
254 | );\r | |
255 | \r | |
256 | /**\r | |
257 | Queues outgoing data into the transmit queue\r | |
258 | \r | |
259 | @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance\r | |
260 | @param[in] Token Pointer to the completion token to queue to the\r | |
261 | transmit queue\r | |
262 | \r | |
263 | @retval EFI_SUCCESS The data has been queued for transmission\r | |
264 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r | |
265 | configured.\r | |
266 | @retval EFI_NO_MAPPING When using a default address, configuration\r | |
267 | (DHCP, BOOTP, RARP, etc.) is not finished yet.\r | |
268 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid\r | |
269 | @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r | |
270 | * A transmit completion token with the same\r | |
271 | Token-> CompletionToken.Event was already in the\r | |
272 | transmission queue. * The current instance is in\r | |
273 | Tcp4StateClosed state * The current instance is\r | |
274 | a passive one and it is in Tcp4StateListen\r | |
275 | state. * User has called Close() to disconnect\r | |
276 | this connection.\r | |
277 | @retval EFI_NOT_READY The completion token could not be queued because\r | |
278 | the transmit queue is full.\r | |
279 | @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a\r | |
280 | resource shortage.\r | |
281 | @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or\r | |
282 | address.\r | |
283 | \r | |
284 | **/\r | |
285 | EFI_STATUS\r | |
286 | EFIAPI\r | |
287 | Tcp4Transmit (\r | |
288 | IN EFI_TCP4_PROTOCOL *This,\r | |
289 | IN EFI_TCP4_IO_TOKEN *Token\r | |
290 | );\r | |
291 | \r | |
292 | /**\r | |
293 | Place an asynchronous receive request into the receiving queue.\r | |
294 | \r | |
295 | @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
296 | @param[in] Token Pointer to a token that is associated with the\r | |
297 | receive data descriptor.\r | |
298 | \r | |
299 | @retval EFI_SUCCESS The receive completion token was cached.\r | |
300 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r | |
301 | configured.\r | |
302 | @retval EFI_NO_MAPPING When using a default address, configuration\r | |
303 | (DHCP, BOOTP, RARP, etc.) is not finished yet.\r | |
304 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
305 | @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued\r | |
306 | due to a lack of system resources.\r | |
307 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
308 | @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r | |
309 | * A receive completion token with the same\r | |
310 | Token->CompletionToken.Event was already in the\r | |
311 | receive queue. * The current instance is in\r | |
312 | Tcp4StateClosed state. * The current instance is\r | |
313 | a passive one and it is in Tcp4StateListen\r | |
314 | state. * User has called Close() to disconnect\r | |
315 | this connection.\r | |
316 | @retval EFI_CONNECTION_FIN The communication peer has closed the connection\r | |
317 | and there is no buffered data in the receive\r | |
318 | buffer of this instance.\r | |
319 | @retval EFI_NOT_READY The receive request could not be queued because\r | |
320 | the receive queue is full.\r | |
321 | \r | |
322 | **/\r | |
323 | EFI_STATUS\r | |
324 | EFIAPI\r | |
325 | Tcp4Receive (\r | |
326 | IN EFI_TCP4_PROTOCOL *This,\r | |
327 | IN EFI_TCP4_IO_TOKEN *Token\r | |
328 | );\r | |
329 | \r | |
330 | /**\r | |
331 | Disconnecting a TCP connection gracefully or reset a TCP connection.\r | |
332 | \r | |
333 | @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
334 | @param[in] CloseToken Pointer to the close token to return when\r | |
335 | operation finishes.\r | |
336 | \r | |
337 | @retval EFI_SUCCESS The operation completed successfully.\r | |
338 | @retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r | |
339 | configured.\r | |
340 | @retval EFI_ACCESS_DENIED One or more of the following are TRUE: *\r | |
341 | Configure() has been called with TcpConfigData\r | |
342 | set to NULL and this function has not returned.\r | |
343 | * Previous Close() call on this instance has not\r | |
344 | finished.\r | |
345 | @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.\r | |
346 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the\r | |
347 | operation.\r | |
348 | @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error\r | |
349 | categories given above.\r | |
350 | \r | |
351 | **/\r | |
352 | EFI_STATUS\r | |
353 | EFIAPI\r | |
354 | Tcp4Close (\r | |
355 | IN EFI_TCP4_PROTOCOL *This,\r | |
356 | IN EFI_TCP4_CLOSE_TOKEN *CloseToken\r | |
357 | );\r | |
358 | \r | |
359 | /**\r | |
360 | Abort an asynchronous connection, listen, transmission or receive request.\r | |
361 | \r | |
362 | @param This The pointer to the EFI_TCP4_PROTOCOL instance.\r | |
363 | @param Token The pointer to a token that has been issued by\r | |
364 | EFI_TCP4_PROTOCOL.Connect(),\r | |
365 | EFI_TCP4_PROTOCOL.Accept(),\r | |
366 | EFI_TCP4_PROTOCOL.Transmit() or\r | |
367 | EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending\r | |
368 | tokens issued by above four functions will be aborted. Type\r | |
369 | EFI_TCP4_COMPLETION_TOKEN is defined in\r | |
370 | EFI_TCP4_PROTOCOL.Connect().\r | |
371 | \r | |
372 | @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event\r | |
373 | is signaled.\r | |
374 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
375 | @retval EFI_NOT_STARTED This instance hasn't been configured.\r | |
376 | @retval EFI_NO_MAPPING When using the default address, configuration\r | |
377 | (DHCP, BOOTP,RARP, etc.) hasn't finished yet.\r | |
378 | @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the\r | |
379 | transmission or receive queue. It has either\r | |
380 | completed or wasn't issued by Transmit() and Receive().\r | |
381 | \r | |
382 | **/\r | |
383 | EFI_STATUS\r | |
384 | EFIAPI\r | |
385 | Tcp4Cancel (\r | |
386 | IN EFI_TCP4_PROTOCOL *This,\r | |
387 | IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r | |
388 | );\r | |
389 | \r | |
390 | /**\r | |
391 | Poll to receive incoming data and transmit outgoing segments.\r | |
392 | \r | |
393 | @param[in] This Pointer to the EFI_TCP4_PROTOCOL instance.\r | |
394 | \r | |
395 | @retval EFI_SUCCESS Incoming or outgoing data was processed.\r | |
396 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
397 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
398 | @retval EFI_NOT_READY No incoming or outgoing data was processed.\r | |
399 | @retval EFI_TIMEOUT Data was dropped out of the transmission or\r | |
400 | receive queue. Consider increasing the polling\r | |
401 | rate.\r | |
402 | \r | |
403 | **/\r | |
404 | EFI_STATUS\r | |
405 | EFIAPI\r | |
406 | Tcp4Poll (\r | |
407 | IN EFI_TCP4_PROTOCOL *This\r | |
408 | );\r | |
409 | \r | |
410 | //\r | |
411 | // EFI_TCP6_PROTOCOL definitions.\r | |
412 | //\r | |
413 | \r | |
414 | /**\r | |
415 | Get the current operational status.\r | |
416 | \r | |
417 | The GetModeData() function copies the current operational settings of this EFI TCPv6\r | |
418 | Protocol instance into user-supplied buffers. This function can also be used to retrieve\r | |
419 | the operational setting of underlying drivers such as IPv6, MNP, or SNP.\r | |
420 | \r | |
421 | @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r | |
422 | @param[out] Tcp6State The buffer in which the current TCP state is\r | |
423 | returned. Optional parameter that may be NULL.\r | |
424 | @param[out] Tcp6ConfigData The buffer in which the current TCP configuration\r | |
425 | is returned. Optional parameter that may be NULL.\r | |
426 | @param[out] Ip6ModeData The buffer in which the current IPv6 configuration\r | |
427 | data used by the TCP instance is returned.\r | |
428 | Optional parameter that may be NULL.\r | |
429 | @param[out] MnpConfigData The buffer in which the current MNP configuration\r | |
430 | data used indirectly by the TCP instance is returned.\r | |
431 | Optional parameter that may be NULL.\r | |
432 | @param[out] SnpModeData The buffer in which the current SNP mode data\r | |
433 | used indirectly by the TCP instance is returned.\r | |
434 | Optional parameter that may be NULL.\r | |
435 | \r | |
436 | @retval EFI_SUCCESS The mode data was read.\r | |
437 | @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't\r | |
438 | been started.\r | |
439 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
440 | \r | |
441 | **/\r | |
442 | EFI_STATUS\r | |
443 | EFIAPI\r | |
444 | Tcp6GetModeData (\r | |
445 | IN EFI_TCP6_PROTOCOL *This,\r | |
446 | OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL,\r | |
447 | OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL,\r | |
448 | OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,\r | |
449 | OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r | |
450 | OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r | |
451 | );\r | |
452 | \r | |
453 | /**\r | |
454 | Initialize or brutally reset the operational parameters for this EFI TCPv6 instance.\r | |
455 | \r | |
456 | The Configure() function does the following:\r | |
457 | - Initialize this TCP instance, i.e., initialize the communication end settings and\r | |
458 | specify active open or passive open for an instance.\r | |
459 | - Reset this TCP instance brutally, i.e., cancel all pending asynchronous tokens, flush\r | |
460 | transmission and receiving buffer directly without informing the communication peer.\r | |
461 | \r | |
462 | No other TCPv6 Protocol operation except Poll() can be executed by this instance until\r | |
463 | it is configured properly. For an active TCP instance, after a proper configuration it\r | |
464 | may call Connect() to initiates the three-way handshake. For a passive TCP instance,\r | |
465 | its state will transit to Tcp6StateListen after configuration, and Accept() may be\r | |
466 | called to listen the incoming TCP connection requests. If Tcp6ConfigData is set to NULL,\r | |
467 | the instance is reset. Resetting process will be done brutally, the state machine will\r | |
468 | be set to Tcp6StateClosed directly, the receive queue and transmit queue will be flushed,\r | |
469 | and no traffic is allowed through this instance.\r | |
470 | \r | |
471 | @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r | |
472 | @param[in] Tcp6ConfigData Pointer to the configure data to configure the instance.\r | |
473 | If Tcp6ConfigData is set to NULL, the instance is reset.\r | |
474 | \r | |
475 | @retval EFI_SUCCESS The operational settings were set, changed, or reset\r | |
476 | successfully.\r | |
477 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r | |
478 | address for this instance, but no source address was available for\r | |
479 | use.\r | |
480 | @retval EFI_INVALID_PARAMETER One or more of the following conditions are TRUE:\r | |
481 | - This is NULL.\r | |
482 | - Tcp6ConfigData->AccessPoint.StationAddress is neither zero nor\r | |
483 | one of the configured IP addresses in the underlying IPv6 driver.\r | |
484 | - Tcp6ConfigData->AccessPoint.RemoteAddress isn't a valid unicast\r | |
485 | IPv6 address.\r | |
486 | - Tcp6ConfigData->AccessPoint.RemoteAddress is zero or\r | |
487 | Tcp6ConfigData->AccessPoint.RemotePort is zero when\r | |
488 | Tcp6ConfigData->AccessPoint.ActiveFlag is TRUE.\r | |
489 | - A same access point has been configured in other TCP\r | |
490 | instance properly.\r | |
491 | @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without\r | |
492 | calling Configure() with NULL to reset it.\r | |
493 | @retval EFI_UNSUPPORTED One or more of the control options are not supported in\r | |
494 | the implementation.\r | |
495 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when\r | |
496 | executing Configure().\r | |
497 | @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r | |
498 | \r | |
499 | **/\r | |
500 | EFI_STATUS\r | |
501 | EFIAPI\r | |
502 | Tcp6Configure (\r | |
503 | IN EFI_TCP6_PROTOCOL *This,\r | |
504 | IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL\r | |
505 | );\r | |
506 | \r | |
507 | /**\r | |
508 | Initiate a nonblocking TCP connection request for an active TCP instance.\r | |
509 | \r | |
510 | The Connect() function will initiate an active open to the remote peer configured\r | |
511 | in current TCP instance if it is configured active. If the connection succeeds or\r | |
512 | fails due to an error, the ConnectionToken->CompletionToken.Event will be signaled,\r | |
513 | and ConnectionToken->CompletionToken.Status will be updated accordingly. This\r | |
514 | function can only be called for the TCP instance in Tcp6StateClosed state. The\r | |
515 | instance will transfer into Tcp6StateSynSent if the function returns EFI_SUCCESS.\r | |
516 | If TCP three-way handshake succeeds, its state will become Tcp6StateEstablished;\r | |
517 | otherwise, the state will return to Tcp6StateClosed.\r | |
518 | \r | |
519 | @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r | |
520 | @param[in] ConnectionToken Pointer to the connection token to return when the TCP\r | |
521 | three-way handshake finishes.\r | |
522 | \r | |
523 | @retval EFI_SUCCESS The connection request successfully initiated and the state of\r | |
524 | this TCP instance has been changed to Tcp6StateSynSent.\r | |
525 | @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r | |
526 | @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r | |
527 | - This instance is not configured as an active instance.\r | |
528 | - This instance is not in Tcp6StateClosed state.\r | |
529 | @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r | |
530 | - This is NULL.\r | |
531 | - ConnectionToken is NULL.\r | |
532 | - ConnectionToken->CompletionToken.Event is NULL.\r | |
533 | @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resources to initiate the active open.\r | |
534 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
535 | \r | |
536 | **/\r | |
537 | EFI_STATUS\r | |
538 | EFIAPI\r | |
539 | Tcp6Connect (\r | |
540 | IN EFI_TCP6_PROTOCOL *This,\r | |
541 | IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken\r | |
542 | );\r | |
543 | \r | |
544 | /**\r | |
545 | Listen on the passive instance to accept an incoming connection request. This is a\r | |
546 | nonblocking operation.\r | |
547 | \r | |
548 | The Accept() function initiates an asynchronous accept request to wait for an incoming\r | |
549 | connection on the passive TCP instance. If a remote peer successfully establishes a\r | |
550 | connection with this instance, a new TCP instance will be created and its handle will\r | |
551 | be returned in ListenToken->NewChildHandle. The newly created instance is configured\r | |
552 | by inheriting the passive instance's configuration, and is ready for use upon return.\r | |
553 | The new instance is in the Tcp6StateEstablished state.\r | |
554 | \r | |
555 | The ListenToken->CompletionToken.Event will be signaled when a new connection is\r | |
556 | accepted, user aborts the listen or connection is reset.\r | |
557 | \r | |
558 | This function only can be called when the current TCP instance is in Tcp6StateListen state.\r | |
559 | \r | |
560 | @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r | |
561 | @param[in] ListenToken Pointer to the listen token to return when the operation finishes.\r | |
562 | \r | |
563 | \r | |
564 | @retval EFI_SUCCESS The listen token was been queued successfully.\r | |
565 | @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r | |
566 | @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r | |
567 | - This instance is not a passive instance.\r | |
568 | - This instance is not in Tcp6StateListen state.\r | |
569 | - The same listen token has already existed in the listen\r | |
570 | token queue of this TCP instance.\r | |
571 | @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r | |
572 | - This is NULL.\r | |
573 | - ListenToken is NULL.\r | |
574 | - ListentToken->CompletionToken.Event is NULL.\r | |
575 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.\r | |
576 | @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error\r | |
577 | categories given above.\r | |
578 | \r | |
579 | **/\r | |
580 | EFI_STATUS\r | |
581 | EFIAPI\r | |
582 | Tcp6Accept (\r | |
583 | IN EFI_TCP6_PROTOCOL *This,\r | |
584 | IN EFI_TCP6_LISTEN_TOKEN *ListenToken\r | |
585 | );\r | |
586 | \r | |
587 | /**\r | |
588 | Queues outgoing data into the transmit queue.\r | |
589 | \r | |
590 | The Transmit() function queues a sending request to this TCP instance along with the\r | |
591 | user data. The status of the token is updated and the event in the token will be\r | |
592 | signaled once the data is sent out or some error occurs.\r | |
593 | \r | |
594 | @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r | |
595 | @param[in] Token Pointer to the completion token to queue to the transmit queue.\r | |
596 | \r | |
597 | @retval EFI_SUCCESS The data has been queued for transmission.\r | |
598 | @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r | |
599 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a\r | |
600 | source address for this instance, but no source address was\r | |
601 | available for use.\r | |
602 | @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r | |
603 | - This is NULL.\r | |
604 | - Token is NULL.\r | |
605 | - Token->CompletionToken.Event is NULL.\r | |
606 | - Token->Packet.TxData is NULL.\r | |
607 | - Token->Packet.FragmentCount is zero.\r | |
608 | - Token->Packet.DataLength is not equal to the sum of fragment lengths.\r | |
609 | @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r | |
610 | - A transmit completion token with the same Token->\r | |
611 | CompletionToken.Event was already in the\r | |
612 | transmission queue.\r | |
613 | - The current instance is in Tcp6StateClosed state.\r | |
614 | - The current instance is a passive one and it is in\r | |
615 | Tcp6StateListen state.\r | |
616 | - User has called Close() to disconnect this connection.\r | |
617 | @retval EFI_NOT_READY The completion token could not be queued because the\r | |
618 | transmit queue is full.\r | |
619 | @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of a resource\r | |
620 | shortage.\r | |
621 | @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.\r | |
622 | \r | |
623 | **/\r | |
624 | EFI_STATUS\r | |
625 | EFIAPI\r | |
626 | Tcp6Transmit (\r | |
627 | IN EFI_TCP6_PROTOCOL *This,\r | |
628 | IN EFI_TCP6_IO_TOKEN *Token\r | |
629 | );\r | |
630 | \r | |
631 | /**\r | |
632 | Places an asynchronous receive request into the receiving queue.\r | |
633 | \r | |
634 | The Receive() function places a completion token into the receive packet queue. This\r | |
635 | function is always asynchronous. The caller must allocate the Token->CompletionToken.Event\r | |
636 | and the FragmentBuffer used to receive data. The caller also must fill the DataLength, which\r | |
637 | represents the whole length of all FragmentBuffer. When the receive operation completes, the\r | |
638 | EFI TCPv6 Protocol driver updates the Token->CompletionToken.Status and Token->Packet.RxData\r | |
639 | fields, and the Token->CompletionToken.Event is signaled. If data is obtained, the data and its length\r | |
640 | will be copied into the FragmentTable. At the same time the full length of received data will\r | |
641 | be recorded in the DataLength fields. Providing a proper notification function and context\r | |
642 | for the event enables the user to receive the notification and receiving status. That\r | |
643 | notification function is guaranteed to not be re-entered.\r | |
644 | \r | |
645 | @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r | |
646 | @param[in] Token Pointer to a token that is associated with the receive data\r | |
647 | descriptor.\r | |
648 | \r | |
649 | @retval EFI_SUCCESS The receive completion token was cached.\r | |
650 | @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r | |
651 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r | |
652 | address for this instance, but no source address was available for use.\r | |
653 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
654 | - This is NULL.\r | |
655 | - Token is NULL.\r | |
656 | - Token->CompletionToken.Event is NULL.\r | |
657 | - Token->Packet.RxData is NULL.\r | |
658 | - Token->Packet.RxData->DataLength is 0.\r | |
659 | - The Token->Packet.RxData->DataLength is not the\r | |
660 | sum of all FragmentBuffer length in FragmentTable.\r | |
661 | @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of\r | |
662 | system resources (usually memory).\r | |
663 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
664 | The EFI TCPv6 Protocol instance has been reset to startup defaults.\r | |
665 | @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r | |
666 | - A receive completion token with the same Token->CompletionToken.Event\r | |
667 | was already in the receive queue.\r | |
668 | - The current instance is in Tcp6StateClosed state.\r | |
669 | - The current instance is a passive one and it is in\r | |
670 | Tcp6StateListen state.\r | |
671 | - The user has called Close() to disconnect this connection.\r | |
672 | @retval EFI_CONNECTION_FIN The communication peer has closed the connection, and there is no\r | |
673 | buffered data in the receive buffer of this instance.\r | |
674 | @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r | |
675 | \r | |
676 | **/\r | |
677 | EFI_STATUS\r | |
678 | EFIAPI\r | |
679 | Tcp6Receive (\r | |
680 | IN EFI_TCP6_PROTOCOL *This,\r | |
681 | IN EFI_TCP6_IO_TOKEN *Token\r | |
682 | );\r | |
683 | \r | |
684 | /**\r | |
685 | Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a\r | |
686 | nonblocking operation.\r | |
687 | \r | |
688 | Initiate an asynchronous close token to the TCP driver. After Close() is called, any buffered\r | |
689 | transmission data will be sent by the TCP driver, and the current instance will have a graceful close\r | |
690 | working flow described as RFC 793 if AbortOnClose is set to FALSE, otherwise, a rest packet\r | |
691 | will be sent by TCP driver to fast disconnect this connection. When the close operation completes\r | |
692 | successfully the TCP instance is in Tcp6StateClosed state, all pending asynchronous\r | |
693 | operations are signaled, and any buffers used for TCP network traffic are flushed.\r | |
694 | \r | |
695 | @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r | |
696 | @param[in] CloseToken Pointer to the close token to return when operation finishes.\r | |
697 | \r | |
698 | @retval EFI_SUCCESS The Close() was called successfully.\r | |
699 | @retval EFI_NOT_STARTED This EFI TCPv6 Protocol instance has not been configured.\r | |
700 | @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r | |
701 | - CloseToken or CloseToken->CompletionToken.Event is already in use.\r | |
702 | - Previous Close() call on this instance has not finished.\r | |
703 | @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r | |
704 | - This is NULL.\r | |
705 | - CloseToken is NULL.\r | |
706 | - CloseToken->CompletionToken.Event is NULL.\r | |
707 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish the operation.\r | |
708 | @retval EFI_DEVICE_ERROR Any unexpected error not belonging to the error categories given above.\r | |
709 | \r | |
710 | **/\r | |
711 | EFI_STATUS\r | |
712 | EFIAPI\r | |
713 | Tcp6Close (\r | |
714 | IN EFI_TCP6_PROTOCOL *This,\r | |
715 | IN EFI_TCP6_CLOSE_TOKEN *CloseToken\r | |
716 | );\r | |
717 | \r | |
718 | /**\r | |
719 | Abort an asynchronous connection, listen, transmission or receive request.\r | |
720 | \r | |
721 | The Cancel() function aborts a pending connection, listen, transmit or\r | |
722 | receive request.\r | |
723 | \r | |
724 | If Token is not NULL and the token is in the connection, listen, transmission\r | |
725 | or receive queue when it is being cancelled, its Token->Status will be set\r | |
726 | to EFI_ABORTED and then Token->Event will be signaled.\r | |
727 | \r | |
728 | If the token is not in one of the queues, which usually means that the\r | |
729 | asynchronous operation has completed, EFI_NOT_FOUND is returned.\r | |
730 | \r | |
731 | If Token is NULL all asynchronous token issued by Connect(), Accept(),\r | |
732 | Transmit() and Receive() will be aborted.\r | |
733 | \r | |
734 | @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r | |
735 | @param[in] Token Pointer to a token that has been issued by\r | |
736 | EFI_TCP6_PROTOCOL.Connect(),\r | |
737 | EFI_TCP6_PROTOCOL.Accept(),\r | |
738 | EFI_TCP6_PROTOCOL.Transmit() or\r | |
739 | EFI_TCP6_PROTOCOL.Receive(). If NULL, all pending\r | |
740 | tokens issued by above four functions will be aborted. Type\r | |
741 | EFI_TCP6_COMPLETION_TOKEN is defined in\r | |
742 | EFI_TCP_PROTOCOL.Connect().\r | |
743 | \r | |
744 | @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event\r | |
745 | is signaled.\r | |
746 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
747 | @retval EFI_NOT_STARTED This instance hasn't been configured.\r | |
748 | @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the transmission or\r | |
749 | receive queue. It has either completed or wasn't issued by\r | |
750 | Transmit() and Receive().\r | |
751 | \r | |
752 | **/\r | |
753 | EFI_STATUS\r | |
754 | EFIAPI\r | |
755 | Tcp6Cancel (\r | |
756 | IN EFI_TCP6_PROTOCOL *This,\r | |
757 | IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL\r | |
758 | );\r | |
759 | \r | |
760 | /**\r | |
761 | Poll to receive incoming data and transmit outgoing segments.\r | |
762 | \r | |
763 | The Poll() function increases the rate that data is moved between the network\r | |
764 | and application and can be called when the TCP instance is created successfully.\r | |
765 | Its use is optional.\r | |
766 | \r | |
767 | @param[in] This Pointer to the EFI_TCP6_PROTOCOL instance.\r | |
768 | \r | |
769 | @retval EFI_SUCCESS Incoming or outgoing data was processed.\r | |
770 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
771 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
772 | @retval EFI_NOT_READY No incoming or outgoing data is processed.\r | |
773 | @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.\r | |
774 | Consider increasing the polling rate.\r | |
775 | \r | |
776 | **/\r | |
777 | EFI_STATUS\r | |
778 | EFIAPI\r | |
779 | Tcp6Poll (\r | |
780 | IN EFI_TCP6_PROTOCOL *This\r | |
781 | );\r | |
782 | \r | |
783 | #endif\r |