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