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