~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/include/ipxe/efi/Protocol/Tcp4.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

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