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