1 /** @file
2   EFI TCPv4(Transmission Control Protocol version 4) Protocol Definition
3   The EFI TCPv4 Service Binding Protocol is used to locate EFI TCPv4 Protocol drivers to create
4   and destroy child of the driver to communicate with other host using TCP protocol.
5   The EFI TCPv4 Protocol provides services to send and receive data stream.
6 
7 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
12 
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 
16   @par Revision Reference:
17   This Protocol is introduced in UEFI Specification 2.0.
18 
19 **/
20 
21 #ifndef __EFI_TCP4_PROTOCOL_H__
22 #define __EFI_TCP4_PROTOCOL_H__
23 
24 #include <Protocol/Ip4.h>
25 
26 #define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \
27   { \
28     0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \
29   }
30 
31 #define EFI_TCP4_PROTOCOL_GUID \
32   { \
33     0x65530BC7, 0xA359, 0x410f, {0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } \
34   }
35 
36 typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL;
37 
38 ///
39 /// EFI_TCP4_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
40 /// The definition in here is only present to provide backwards compatability.
41 ///
42 typedef struct {
43   EFI_HANDLE              InstanceHandle;
44   EFI_IPv4_ADDRESS        LocalAddress;
45   UINT16                  LocalPort;
46   EFI_IPv4_ADDRESS        RemoteAddress;
47   UINT16                  RemotePort;
48 } EFI_TCP4_SERVICE_POINT;
49 
50 ///
51 /// EFI_TCP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
52 /// The definition in here is only present to provide backwards compatability.
53 ///
54 typedef struct {
55   EFI_HANDLE              DriverHandle;
56   UINT32                  ServiceCount;
57   EFI_TCP4_SERVICE_POINT  Services[1];
58 } EFI_TCP4_VARIABLE_DATA;
59 
60 typedef struct {
61   BOOLEAN                 UseDefaultAddress;
62   EFI_IPv4_ADDRESS        StationAddress;
63   EFI_IPv4_ADDRESS        SubnetMask;
64   UINT16                  StationPort;
65   EFI_IPv4_ADDRESS        RemoteAddress;
66   UINT16                  RemotePort;
67   BOOLEAN                 ActiveFlag;
68 } EFI_TCP4_ACCESS_POINT;
69 
70 typedef struct {
71   UINT32                  ReceiveBufferSize;
72   UINT32                  SendBufferSize;
73   UINT32                  MaxSynBackLog;
74   UINT32                  ConnectionTimeout;
75   UINT32                  DataRetries;
76   UINT32                  FinTimeout;
77   UINT32                  TimeWaitTimeout;
78   UINT32                  KeepAliveProbes;
79   UINT32                  KeepAliveTime;
80   UINT32                  KeepAliveInterval;
81   BOOLEAN                 EnableNagle;
82   BOOLEAN                 EnableTimeStamp;
83   BOOLEAN                 EnableWindowScaling;
84   BOOLEAN                 EnableSelectiveAck;
85   BOOLEAN                 EnablePathMtuDiscovery;
86 } EFI_TCP4_OPTION;
87 
88 typedef struct {
89   //
90   // I/O parameters
91   //
92   UINT8                   TypeOfService;
93   UINT8                   TimeToLive;
94 
95   //
96   // Access Point
97   //
98   EFI_TCP4_ACCESS_POINT   AccessPoint;
99 
100   //
101   // TCP Control Options
102   //
103   EFI_TCP4_OPTION         *ControlOption;
104 } EFI_TCP4_CONFIG_DATA;
105 
106 ///
107 /// TCP4 connnection state
108 ///
109 typedef enum {
110   Tcp4StateClosed         = 0,
111   Tcp4StateListen         = 1,
112   Tcp4StateSynSent        = 2,
113   Tcp4StateSynReceived    = 3,
114   Tcp4StateEstablished    = 4,
115   Tcp4StateFinWait1       = 5,
116   Tcp4StateFinWait2       = 6,
117   Tcp4StateClosing        = 7,
118   Tcp4StateTimeWait       = 8,
119   Tcp4StateCloseWait      = 9,
120   Tcp4StateLastAck        = 10
121 } EFI_TCP4_CONNECTION_STATE;
122 
123 typedef struct {
124   EFI_EVENT   Event;
125   EFI_STATUS  Status;
126 } EFI_TCP4_COMPLETION_TOKEN;
127 
128 typedef struct {
129   ///
130   /// The Status in the CompletionToken will be set to one of
131   /// the following values if the active open succeeds or an unexpected
132   /// error happens:
133   /// EFI_SUCCESS:              The active open succeeds and the instance's
134   ///                           state is Tcp4StateEstablished.
135   /// EFI_CONNECTION_RESET:     The connect fails because the connection is reset
136   ///                           either by instance itself or the communication peer.
137   /// EFI_CONNECTION_REFUSED:   The connect fails because this connection is initiated with
138   ///                           an active open and the connection is refused.
139   /// EFI_ABORTED:              The active open is aborted.
140   /// EFI_TIMEOUT:              The connection establishment timer expires and
141   ///                           no more specific information is available.
142   /// EFI_NETWORK_UNREACHABLE:  The active open fails because
143   ///                           an ICMP network unreachable error is received.
144   /// EFI_HOST_UNREACHABLE:     The active open fails because an
145   ///                           ICMP host unreachable error is received.
146   /// EFI_PROTOCOL_UNREACHABLE: The active open fails
147   ///                           because an ICMP protocol unreachable error is received.
148   /// EFI_PORT_UNREACHABLE:     The connection establishment
149   ///                           timer times out and an ICMP port unreachable error is received.
150   /// EFI_ICMP_ERROR:           The connection establishment timer timeout and some other ICMP
151   ///                           error is received.
152   /// EFI_DEVICE_ERROR:         An unexpected system or network error occurred.
153   /// EFI_NO_MEDIA:             There was a media error.
154   ///
155   EFI_TCP4_COMPLETION_TOKEN CompletionToken;
156 } EFI_TCP4_CONNECTION_TOKEN;
157 
158 typedef struct {
159   EFI_TCP4_COMPLETION_TOKEN CompletionToken;
160   EFI_HANDLE                NewChildHandle;
161 } EFI_TCP4_LISTEN_TOKEN;
162 
163 typedef struct {
164   UINT32 FragmentLength;
165   VOID   *FragmentBuffer;
166 } EFI_TCP4_FRAGMENT_DATA;
167 
168 typedef struct {
169   BOOLEAN                   UrgentFlag;
170   UINT32                    DataLength;
171   UINT32                    FragmentCount;
172   EFI_TCP4_FRAGMENT_DATA    FragmentTable[1];
173 } EFI_TCP4_RECEIVE_DATA;
174 
175 typedef struct {
176   BOOLEAN                   Push;
177   BOOLEAN                   Urgent;
178   UINT32                    DataLength;
179   UINT32                    FragmentCount;
180   EFI_TCP4_FRAGMENT_DATA    FragmentTable[1];
181 } EFI_TCP4_TRANSMIT_DATA;
182 
183 typedef struct {
184   ///
185   /// When transmission finishes or meets any unexpected error it will
186   /// be set to one of the following values:
187   /// EFI_SUCCESS:              The receiving or transmission operation
188   ///                           completes successfully.
189   /// EFI_CONNECTION_FIN:       The receiving operation fails because the communication peer
190   ///                           has closed the connection and there is no more data in the
191   ///                           receive buffer of the instance.
192   /// EFI_CONNECTION_RESET:     The receiving or transmission operation fails
193   ///                           because this connection is reset either by instance
194   ///                           itself or the communication peer.
195   /// EFI_ABORTED:              The receiving or transmission is aborted.
196   /// EFI_TIMEOUT:              The transmission timer expires and no more
197   ///                           specific information is available.
198   /// EFI_NETWORK_UNREACHABLE:  The transmission fails
199   ///                           because an ICMP network unreachable error is received.
200   /// EFI_HOST_UNREACHABLE:     The transmission fails because an
201   ///                           ICMP host unreachable error is received.
202   /// EFI_PROTOCOL_UNREACHABLE: The transmission fails
203   ///                           because an ICMP protocol unreachable error is received.
204   /// EFI_PORT_UNREACHABLE:     The transmission fails and an
205   ///                           ICMP port unreachable error is received.
206   /// EFI_ICMP_ERROR:           The transmission fails and some other
207   ///                           ICMP error is received.
208   /// EFI_DEVICE_ERROR:         An unexpected system or network error occurs.
209   /// EFI_NO_MEDIA:             There was a media error.
210   ///
211   EFI_TCP4_COMPLETION_TOKEN CompletionToken;
212   union {
213     ///
214     /// When this token is used for receiving, RxData is a pointer to EFI_TCP4_RECEIVE_DATA.
215     ///
216     EFI_TCP4_RECEIVE_DATA   *RxData;
217     ///
218     /// When this token is used for transmitting, TxData is a pointer to EFI_TCP4_TRANSMIT_DATA.
219     ///
220     EFI_TCP4_TRANSMIT_DATA  *TxData;
221   } Packet;
222 } EFI_TCP4_IO_TOKEN;
223 
224 typedef struct {
225   EFI_TCP4_COMPLETION_TOKEN CompletionToken;
226   BOOLEAN                   AbortOnClose;
227 } EFI_TCP4_CLOSE_TOKEN;
228 
229 //
230 // Interface definition for TCP4 protocol
231 //
232 
233 /**
234   Get the current operational status.
235 
236   @param  This           The pointer to the EFI_TCP4_PROTOCOL instance.
237   @param  Tcp4State      The pointer to the buffer to receive the current TCP state.
238   @param  Tcp4ConfigData The pointer to the buffer to receive the current TCP configuration.
239   @param  Ip4ModeData    The pointer to the buffer to receive the current IPv4 configuration
240                          data used by the TCPv4 instance.
241   @param  MnpConfigData  The pointer to the buffer to receive the current MNP configuration
242                          data used indirectly by the TCPv4 instance.
243   @param  SnpModeData    The pointer to the buffer to receive the current SNP configuration
244                          data used indirectly by the TCPv4 instance.
245 
246   @retval EFI_SUCCESS           The mode data was read.
247   @retval EFI_INVALID_PARAMETER This is NULL.
248   @retval EFI_NOT_STARTED       No configuration data is available because this instance hasn't
249                                  been started.
250 
251 **/
252 typedef
253 EFI_STATUS
254 (EFIAPI *EFI_TCP4_GET_MODE_DATA)(
255   IN   EFI_TCP4_PROTOCOL                  *This,
256   OUT  EFI_TCP4_CONNECTION_STATE          *Tcp4State      OPTIONAL,
257   OUT  EFI_TCP4_CONFIG_DATA               *Tcp4ConfigData OPTIONAL,
258   OUT  EFI_IP4_MODE_DATA                  *Ip4ModeData    OPTIONAL,
259   OUT  EFI_MANAGED_NETWORK_CONFIG_DATA    *MnpConfigData  OPTIONAL,
260   OUT  EFI_SIMPLE_NETWORK_MODE            *SnpModeData    OPTIONAL
261   );
262 
263 /**
264   Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.
265 
266   @param  This           The pointer to the EFI_TCP4_PROTOCOL instance.
267   @param  Tcp4ConfigData The pointer to the configure data to configure the instance.
268 
269   @retval EFI_SUCCESS           The operational settings are set, changed, or reset
270                                 successfully.
271   @retval EFI_INVALID_PARAMETER Some parameter is invalid.
272   @retval EFI_NO_MAPPING        When using a default address, configuration (through
273                                 DHCP, BOOTP, RARP, etc.) is not finished yet.
274   @retval EFI_ACCESS_DENIED     Configuring TCP instance when it is configured without
275                                 calling Configure() with NULL to reset it.
276   @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.
277   @retval EFI_UNSUPPORTED       One or more of the control options are not supported in
278                                 the implementation.
279   @retval EFI_OUT_OF_RESOURCES  Could not allocate enough system resources when
280                                 executing Configure().
281 
282 **/
283 typedef
284 EFI_STATUS
285 (EFIAPI *EFI_TCP4_CONFIGURE)(
286   IN EFI_TCP4_PROTOCOL                   *This,
287   IN EFI_TCP4_CONFIG_DATA                *TcpConfigData OPTIONAL
288   );
289 
290 
291 /**
292   Add or delete a route entry to the route table
293 
294   @param  This           The pointer to the EFI_TCP4_PROTOCOL instance.
295   @param  DeleteRoute    Set it to TRUE to delete this route from the routing table. Set it to
296                          FALSE to add this route to the routing table.
297                          DestinationAddress and SubnetMask are used as the
298                          keywords to search route entry.
299   @param  SubnetAddress  The destination network.
300   @param  SubnetMask     The subnet mask of the destination network.
301   @param  GatewayAddress The gateway address for this route. It must be on the same
302                          subnet with the station address unless a direct route is specified.
303 
304   @retval EFI_SUCCESS           The operation completed successfully.
305   @retval EFI_NOT_STARTED       The EFI TCPv4 Protocol instance has not been configured.
306   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,
307                                 RARP, etc.) is not finished yet.
308   @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
309                                 - This is NULL.
310                                 - SubnetAddress is NULL.
311                                 - SubnetMask is NULL.
312                                 - GatewayAddress is NULL.
313                                 - *SubnetAddress is not NULL a valid subnet address.
314                                 - *SubnetMask is not a valid subnet mask.
315                                 - *GatewayAddress is not a valid unicast IP address or it
316                                 is not in the same subnet.
317   @retval EFI_OUT_OF_RESOURCES  Could not allocate enough resources to add the entry to the
318                                 routing table.
319   @retval EFI_NOT_FOUND         This route is not in the routing table.
320   @retval EFI_ACCESS_DENIED     The route is already defined in the routing table.
321   @retval EFI_UNSUPPORTED       The TCP driver does not support this operation.
322 
323 **/
324 typedef
325 EFI_STATUS
326 (EFIAPI *EFI_TCP4_ROUTES)(
327   IN EFI_TCP4_PROTOCOL                   *This,
328   IN BOOLEAN                             DeleteRoute,
329   IN EFI_IPv4_ADDRESS                    *SubnetAddress,
330   IN EFI_IPv4_ADDRESS                    *SubnetMask,
331   IN EFI_IPv4_ADDRESS                    *GatewayAddress
332   );
333 
334 /**
335   Initiate a nonblocking TCP connection request for an active TCP instance.
336 
337   @param  This                  The pointer to the EFI_TCP4_PROTOCOL instance.
338   @param  ConnectionToken       The pointer to the connection token to return when the TCP three
339                                 way handshake finishes.
340 
341   @retval EFI_SUCCESS           The connection request is successfully initiated and the state
342                                 of this TCPv4 instance has been changed to Tcp4StateSynSent.
343   @retval EFI_NOT_STARTED       This EFI TCPv4 Protocol instance has not been configured.
344   @retval EFI_ACCESS_DENIED     One or more of the following conditions are TRUE:
345                                 - This instance is not configured as an active one.
346                                 - This instance is not in Tcp4StateClosed state.
347   @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
348                                 - This is NULL.
349                                 - ConnectionToken is NULL.
350                                 - ConnectionToken->CompletionToken.Event is NULL.
351   @retval EFI_OUT_OF_RESOURCES  The driver can't allocate enough resource to initiate the activ eopen.
352   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
353 
354 **/
355 typedef
356 EFI_STATUS
357 (EFIAPI *EFI_TCP4_CONNECT)(
358   IN EFI_TCP4_PROTOCOL                   *This,
359   IN EFI_TCP4_CONNECTION_TOKEN           *ConnectionToken
360   );
361 
362 
363 /**
364   Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.
365 
366   @param  This        The pointer to the EFI_TCP4_PROTOCOL instance.
367   @param  ListenToken The pointer to the listen token to return when operation finishes.
368 
369   @retval EFI_SUCCESS           The listen token has been queued successfully.
370   @retval EFI_NOT_STARTED       This EFI TCPv4 Protocol instance has not been configured.
371   @retval EFI_ACCESS_DENIED     One or more of the following are TRUE:
372                                 - This instance is not a passive instance.
373                                 - This instance is not in Tcp4StateListen state.
374                                 - The same listen token has already existed in the listen
375                                 token queue of this TCP instance.
376   @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
377                                 - This is NULL.
378                                 - ListenToken is NULL.
379                                 - ListentToken->CompletionToken.Event is NULL.
380   @retval EFI_OUT_OF_RESOURCES  Could not allocate enough resource to finish the operation.
381   @retval EFI_DEVICE_ERROR      Any unexpected and not belonged to above category error.
382 
383 **/
384 typedef
385 EFI_STATUS
386 (EFIAPI *EFI_TCP4_ACCEPT)(
387   IN EFI_TCP4_PROTOCOL                   *This,
388   IN EFI_TCP4_LISTEN_TOKEN               *ListenToken
389   );
390 
391 /**
392   Queues outgoing data into the transmit queue.
393 
394   @param  This  The pointer to the EFI_TCP4_PROTOCOL instance.
395   @param  Token The pointer to the completion token to queue to the transmit queue.
396 
397   @retval EFI_SUCCESS             The data has been queued for transmission.
398   @retval EFI_NOT_STARTED         This EFI TCPv4 Protocol instance has not been configured.
399   @retval EFI_NO_MAPPING          When using a default address, configuration (DHCP, BOOTP,
400                                   RARP, etc.) is not finished yet.
401   @retval EFI_INVALID_PARAMETER   One or more of the following are TRUE:
402                                   - This is NULL.
403                                   - Token is NULL.
404                                   - Token->CompletionToken.Event is NULL.
405                                   - Token->Packet.TxData is NULL L.
406                                   - Token->Packet.FragmentCount is zero.
407                                   - Token->Packet.DataLength is not equal to the sum of fragment lengths.
408   @retval EFI_ACCESS_DENIED       One or more of the following conditions is TRUE:
409                                   - A transmit completion token with the same Token->CompletionToken.Event
410                                   was already in the transmission queue.
411                                   - The current instance is in Tcp4StateClosed state.
412                                   - The current instance is a passive one and it is in
413                                   Tcp4StateListen state.
414                                   - User has called Close() to disconnect this connection.
415   @retval EFI_NOT_READY           The completion token could not be queued because the
416                                   transmit queue is full.
417   @retval EFI_OUT_OF_RESOURCES    Could not queue the transmit data because of resource
418                                   shortage.
419   @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
420 
421 **/
422 typedef
423 EFI_STATUS
424 (EFIAPI *EFI_TCP4_TRANSMIT)(
425   IN EFI_TCP4_PROTOCOL                   *This,
426   IN EFI_TCP4_IO_TOKEN                   *Token
427   );
428 
429 
430 /**
431   Places an asynchronous receive request into the receiving queue.
432 
433   @param  This  The pointer to the EFI_TCP4_PROTOCOL instance.
434   @param  Token The pointer to a token that is associated with the receive data
435                 descriptor.
436 
437   @retval EFI_SUCCESS           The receive completion token was cached.
438   @retval EFI_NOT_STARTED       This EFI TCPv4 Protocol instance has not been configured.
439   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP, RARP,
440                                 etc.) is not finished yet.
441   @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
442                                 - This is NULL.
443                                 - Token is NULL.
444                                 - Token->CompletionToken.Event is NULL.
445                                 - Token->Packet.RxData is NULL.
446                                 - Token->Packet.RxData->DataLength is 0.
447                                 - The Token->Packet.RxData->DataLength is not
448                                 the sum of all FragmentBuffer length in FragmentTable.
449   @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
450                                system resources (usually memory).
451   @retval EFI_DEVICE_ERROR     An unexpected system or network error occurred.
452   @retval EFI_ACCESS_DENIED    One or more of the following conditions is TRUE:
453                                - A receive completion token with the same Token-
454                                >CompletionToken.Event was already in the receive
455                                queue.
456                                - The current instance is in Tcp4StateClosed state.
457                                - The current instance is a passive one and it is in
458                                Tcp4StateListen state.
459                                - User has called Close() to disconnect this connection.
460   @retval EFI_CONNECTION_FIN   The communication peer has closed the connection and there is
461                                no any buffered data in the receive buffer of this instance.
462   @retval EFI_NOT_READY        The receive request could not be queued because the receive queue is full.
463 
464 **/
465 typedef
466 EFI_STATUS
467 (EFIAPI *EFI_TCP4_RECEIVE)(
468   IN EFI_TCP4_PROTOCOL                   *This,
469   IN EFI_TCP4_IO_TOKEN                   *Token
470   );
471 
472 /**
473   Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
474   nonblocking operation.
475 
476   @param  This       The pointer to the EFI_TCP4_PROTOCOL instance.
477   @param  CloseToken The pointer to the close token to return when operation finishes.
478 
479   @retval EFI_SUCCESS           The Close() is called successfully.
480   @retval EFI_NOT_STARTED       This EFI TCPv4 Protocol instance has not been configured.
481   @retval EFI_ACCESS_DENIED     One or more of the following are TRUE:
482                                 - Configure() has been called with
483                                 TcpConfigData set to NULL and this function has
484                                 not returned.
485                                 - Previous Close() call on this instance has not
486                                 finished.
487   @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
488                                 - This is NULL.
489                                 - CloseToken is NULL.
490                                 - CloseToken->CompletionToken.Event is NULL.
491   @retval EFI_OUT_OF_RESOURCES  Could not allocate enough resource to finish the operation.
492   @retval EFI_DEVICE_ERROR      Any unexpected and not belonged to above category error.
493 
494 **/
495 typedef
496 EFI_STATUS
497 (EFIAPI *EFI_TCP4_CLOSE)(
498   IN EFI_TCP4_PROTOCOL                   *This,
499   IN EFI_TCP4_CLOSE_TOKEN                *CloseToken
500   );
501 
502 /**
503   Abort an asynchronous connection, listen, transmission or receive request.
504 
505   @param  This  The pointer to the EFI_TCP4_PROTOCOL instance.
506   @param  Token The pointer to a token that has been issued by
507                 EFI_TCP4_PROTOCOL.Connect(),
508                 EFI_TCP4_PROTOCOL.Accept(),
509                 EFI_TCP4_PROTOCOL.Transmit() or
510                 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending
511                 tokens issued by above four functions will be aborted. Type
512                 EFI_TCP4_COMPLETION_TOKEN is defined in
513                 EFI_TCP4_PROTOCOL.Connect().
514 
515   @retval  EFI_SUCCESS             The asynchronous I/O request is aborted and Token->Event
516                                    is signaled.
517   @retval  EFI_INVALID_PARAMETER   This is NULL.
518   @retval  EFI_NOT_STARTED         This instance hasn't been configured.
519   @retval  EFI_NO_MAPPING          When using the default address, configuration
520                                    (DHCP, BOOTP,RARP, etc.) hasn't finished yet.
521   @retval  EFI_NOT_FOUND           The asynchronous I/O request isn't found in the
522                                    transmission or receive queue. It has either
523                                    completed or wasn't issued by Transmit() and Receive().
524   @retval  EFI_UNSUPPORTED         The implementation does not support this function.
525 
526 **/
527 typedef
528 EFI_STATUS
529 (EFIAPI *EFI_TCP4_CANCEL)(
530   IN EFI_TCP4_PROTOCOL                   *This,
531   IN EFI_TCP4_COMPLETION_TOKEN           *Token OPTIONAL
532   );
533 
534 
535 /**
536   Poll to receive incoming data and transmit outgoing segments.
537 
538   @param  This The pointer to the EFI_TCP4_PROTOCOL instance.
539 
540   @retval  EFI_SUCCESS           Incoming or outgoing data was processed.
541   @retval  EFI_INVALID_PARAMETER This is NULL.
542   @retval  EFI_DEVICE_ERROR      An unexpected system or network error occurred.
543   @retval  EFI_NOT_READY         No incoming or outgoing data is processed.
544   @retval  EFI_TIMEOUT           Data was dropped out of the transmission or receive queue.
545                                  Consider increasing the polling rate.
546 
547 **/
548 typedef
549 EFI_STATUS
550 (EFIAPI *EFI_TCP4_POLL)(
551   IN EFI_TCP4_PROTOCOL                   *This
552   );
553 
554 ///
555 /// The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by
556 /// any network drivers or applications to send or receive data stream.
557 /// It can either listen on a specified port as a service or actively connected
558 /// to remote peer as a client. Each instance has its own independent settings,
559 /// such as the routing table.
560 ///
561 struct _EFI_TCP4_PROTOCOL {
562   EFI_TCP4_GET_MODE_DATA                 GetModeData;
563   EFI_TCP4_CONFIGURE                     Configure;
564   EFI_TCP4_ROUTES                        Routes;
565   EFI_TCP4_CONNECT                       Connect;
566   EFI_TCP4_ACCEPT                        Accept;
567   EFI_TCP4_TRANSMIT                      Transmit;
568   EFI_TCP4_RECEIVE                       Receive;
569   EFI_TCP4_CLOSE                         Close;
570   EFI_TCP4_CANCEL                        Cancel;
571   EFI_TCP4_POLL                          Poll;
572 };
573 
574 extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid;
575 extern EFI_GUID gEfiTcp4ProtocolGuid;
576 
577 #endif
578