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.
7 Copyright (c) 2006 - 2009, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
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.
16 @par Revision Reference:
17 This Protocol is introduced in UEFI Specification 2.0
21 #ifndef __EFI_TCP4_PROTOCOL_H__
22 #define __EFI_TCP4_PROTOCOL_H__
24 #include <Protocol/Ip4.h>
26 #define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \
28 0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \
31 #define EFI_TCP4_PROTOCOL_GUID \
33 0x65530BC7, 0xA359, 0x410f, {0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } \
36 typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL
;
39 EFI_HANDLE InstanceHandle
;
40 EFI_IPv4_ADDRESS LocalAddress
;
42 EFI_IPv4_ADDRESS RemoteAddress
;
44 } EFI_TCP4_SERVICE_POINT
;
47 EFI_HANDLE DriverHandle
;
49 EFI_TCP4_SERVICE_POINT Services
[1];
50 } EFI_TCP4_VARIABLE_DATA
;
53 BOOLEAN UseDefaultAddress
;
54 EFI_IPv4_ADDRESS StationAddress
;
55 EFI_IPv4_ADDRESS SubnetMask
;
57 EFI_IPv4_ADDRESS RemoteAddress
;
60 } EFI_TCP4_ACCESS_POINT
;
63 UINT32 ReceiveBufferSize
;
64 UINT32 SendBufferSize
;
66 UINT32 ConnectionTimeout
;
69 UINT32 TimeWaitTimeout
;
70 UINT32 KeepAliveProbes
;
72 UINT32 KeepAliveInterval
;
74 BOOLEAN EnableTimeStamp
;
75 BOOLEAN EnableWindowScaling
;
76 BOOLEAN EnableSelectiveAck
;
77 BOOLEAN EnablePathMtuDiscovery
;
90 EFI_TCP4_ACCESS_POINT AccessPoint
;
93 // TCP Control Options
95 EFI_TCP4_OPTION
*ControlOption
;
96 } EFI_TCP4_CONFIG_DATA
;
99 /// TCP4 connnection state
104 Tcp4StateSynSent
= 2,
105 Tcp4StateSynReceived
= 3,
106 Tcp4StateEstablished
= 4,
107 Tcp4StateFinWait1
= 5,
108 Tcp4StateFinWait2
= 6,
109 Tcp4StateClosing
= 7,
110 Tcp4StateTimeWait
= 8,
111 Tcp4StateCloseWait
= 9,
112 Tcp4StateLastAck
= 10
113 } EFI_TCP4_CONNECTION_STATE
;
118 } EFI_TCP4_COMPLETION_TOKEN
;
122 /// The Status in the CompletionToken will be set to one of
123 /// the following values if the active open succeeds or an unexpected
125 /// EFI_SUCCESS: The active open succeeds and the instance's
126 /// state is Tcp4StateEstablished.
127 /// EFI_CONNECTION_RESET: The connect fails because the connection is reset
128 /// either by instance itself or the communication peer.
129 /// EFI_CONNECTION_REFUSED: The connect fails because this connection is initiated with
130 /// an active open and the connection is refused.
131 /// Note: It is not defined in UEFI 2.3 Specification.
132 /// EFI_ABORTED: The active open is aborted.
133 /// EFI_TIMEOUT: The connection establishment timer expires and
134 /// no more specific information is available.
135 /// EFI_NETWORK_UNREACHABLE: The active open fails because
136 /// an ICMP network unreachable error is received.
137 /// EFI_HOST_UNREACHABLE: The active open fails because an
138 /// ICMP host unreachable error is received.
139 /// EFI_PROTOCOL_UNREACHABLE: The active open fails
140 /// because an ICMP protocol unreachable error is received.
141 /// EFI_PORT_UNREACHABLE: The connection establishment
142 /// timer times out and an ICMP port unreachable error is received.
143 /// EFI_ICMP_ERROR: The connection establishment timer timeout and some other ICMP
144 /// error is received.
145 /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
147 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
148 } EFI_TCP4_CONNECTION_TOKEN
;
151 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
152 EFI_HANDLE NewChildHandle
;
153 } EFI_TCP4_LISTEN_TOKEN
;
156 UINT32 FragmentLength
;
157 VOID
*FragmentBuffer
;
158 } EFI_TCP4_FRAGMENT_DATA
;
163 UINT32 FragmentCount
;
164 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
165 } EFI_TCP4_RECEIVE_DATA
;
171 UINT32 FragmentCount
;
172 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
173 } EFI_TCP4_TRANSMIT_DATA
;
177 /// When transmission finishes or meets any unexpected error it will
178 /// be set to one of the following values:
179 /// EFI_SUCCESS: The receiving or transmission operation
180 /// completes successfully.
181 /// EFI_CONNECTION_FIN: The receiving operation fails because the communication peer
182 /// has closed the connection and there is no more data in the
183 /// receive buffer of the instance.
184 /// Note: It is not defined in UEFI 2.3 Specification.
185 /// EFI_CONNECTION_RESET: The receiving or transmission operation fails
186 /// because this connection is reset either by instance
187 /// itself or the communication peer.
188 /// EFI_ABORTED: The receiving or transmission is aborted.
189 /// EFI_TIMEOUT: The transmission timer expires and no more
190 /// specific information is available.
191 /// EFI_NETWORK_UNREACHABLE: The transmission fails
192 /// because an ICMP network unreachable error is received.
193 /// EFI_HOST_UNREACHABLE: The transmission fails because an
194 /// ICMP host unreachable error is received.
195 /// EFI_PROTOCOL_UNREACHABLE: The transmission fails
196 /// because an ICMP protocol unreachable error is received.
197 /// EFI_PORT_UNREACHABLE: The transmission fails and an
198 /// ICMP port unreachable error is received.
199 /// EFI_ICMP_ERROR: The transmission fails and some other
200 /// ICMP error is received.
201 /// EFI_DEVICE_ERROR: An unexpected system or network error occurs.
202 /// EFI_NO_MEDIA: There was a media error.
204 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
207 /// When this token is used for receiving, RxData is a pointer to EFI_TCP4_RECEIVE_DATA.
209 EFI_TCP4_RECEIVE_DATA
*RxData
;
211 /// When this token is used for transmitting, TxData is a pointer to EFI_TCP4_TRANSMIT_DATA.
213 EFI_TCP4_TRANSMIT_DATA
*TxData
;
218 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
219 BOOLEAN AbortOnClose
;
220 } EFI_TCP4_CLOSE_TOKEN
;
223 // Interface definition for TCP4 protocol
227 Get the current operational status.
229 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
230 @param Tcp4State Pointer to the buffer to receive the current TCP state.
231 @param Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration.
232 @param Ip4ModeData Pointer to the buffer to receive the current IPv4 configuration
233 data used by the TCPv4 instance.
234 @param MnpConfigData Pointer to the buffer to receive the current MNP configuration
235 data used indirectly by the TCPv4 instance.
236 @param SnpModeData Pointer to the buffer to receive the current SNP configuration
237 data used indirectly by the TCPv4 instance.
239 @retval EFI_SUCCESS The mode data was read.
240 @retval EFI_INVALID_PARAMETER This is NULL.
241 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
247 (EFIAPI
*EFI_TCP4_GET_MODE_DATA
)(
248 IN CONST EFI_TCP4_PROTOCOL
*This
,
249 OUT EFI_TCP4_CONNECTION_STATE
*Tcp4State OPTIONAL
,
250 OUT EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData OPTIONAL
,
251 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
252 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
253 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
257 Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.
259 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
260 @param Tcp4ConfigData Pointer to the configure data to configure the instance.
262 @retval EFI_SUCCESS The operational settings are set, changed, or reset
264 @retval EFI_INVALID_PARAMETER Some parameter is invalid.
265 @retval EFI_NO_MAPPING When using a default address, configuration (through
266 DHCP, BOOTP, RARP, etc.) is not finished yet.
267 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
268 calling Configure() with NULL to reset it.
269 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
270 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
272 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
273 executing Configure().
278 (EFIAPI
*EFI_TCP4_CONFIGURE
)(
279 IN EFI_TCP4_PROTOCOL
*This
,
280 IN EFI_TCP4_CONFIG_DATA
*TcpConfigData OPTIONAL
285 Add or delete a route entry to the route table
287 @param This 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.
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:
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
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.
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
328 Initiate a nonblocking TCP connection request for an active TCP instance.
330 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
331 @param ConnectionToken Pointer to the connection token to return when the TCP three
332 way handshake finishes.
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:
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.
350 (EFIAPI
*EFI_TCP4_CONNECT
)(
351 IN EFI_TCP4_PROTOCOL
*This
,
352 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
357 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.
359 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
360 @param ListenToken Pointer to the listen token to return when operation finishes.
362 @retval EFI_SUCCESS The listen token has been queued successfully.
363 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
364 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
365 - This instance is not a passive instance.
366 - This instance is not in Tcp4StateListen state.
367 - The same listen token has already existed in the listen
368 token queue of this TCP instance.
369 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
371 - ListenToken is NULL.
372 - ListentToken->CompletionToken.Event is NULL.
373 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
374 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
379 (EFIAPI
*EFI_TCP4_ACCEPT
)(
380 IN EFI_TCP4_PROTOCOL
*This
,
381 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
385 Queues outgoing data into the transmit queue.
387 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
388 @param Token Pointer to the completion token to queue to the transmit queue.
390 @retval EFI_SUCCESS The data has been queued for transmission.
391 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
392 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
393 RARP, etc.) is not finished yet.
394 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
397 - Token->CompletionToken.Event is NULL.
398 - Token->Packet.TxData is NULL L.
399 - Token->Packet.FragmentCount is zero.
400 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
401 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
402 - A transmit completion token with the same Token->CompletionToken.Event
403 was already in the transmission queue.
404 - The current instance is in Tcp4StateClosed state.
405 - The current instance is a passive one and it is in
406 Tcp4StateListen state.
407 - User has called Close() to disconnect this connection.
408 @retval EFI_NOT_READY The completion token could not be queued because the
409 transmit queue is full.
410 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource
412 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
417 (EFIAPI
*EFI_TCP4_TRANSMIT
)(
418 IN EFI_TCP4_PROTOCOL
*This
,
419 IN EFI_TCP4_IO_TOKEN
*Token
424 Places an asynchronous receive request into the receiving queue.
426 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
427 @param Token Pointer to a token that is associated with the receive data
430 @retval EFI_SUCCESS The receive completion token was cached.
431 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
432 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,
433 etc.) is not finished yet.
434 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
437 - Token->CompletionToken.Event is NULL.
438 - Token->Packet.RxData is NULL.
439 - Token->Packet.RxData->DataLength is 0.
440 - The Token->Packet.RxData->DataLength is not
441 the sum of all FragmentBuffer length in FragmentTable.
442 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
443 system resources (usually memory).
444 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
445 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
446 - A receive completion token with the same Token-
447 >CompletionToken.Event was already in the receive
449 - The current instance is in Tcp4StateClosed state.
450 - The current instance is a passive one and it is in
451 Tcp4StateListen state.
452 - User has called Close() to disconnect this connection.
453 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is
454 no any buffered data in the receive buffer of this instance.
455 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
460 (EFIAPI
*EFI_TCP4_RECEIVE
)(
461 IN EFI_TCP4_PROTOCOL
*This
,
462 IN EFI_TCP4_IO_TOKEN
*Token
466 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
467 nonblocking operation.
469 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
470 @param CloseToken Pointer to the close token to return when operation finishes.
472 @retval EFI_SUCCESS The Close() is called successfully.
473 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
474 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
475 - Configure() has been called with
476 TcpConfigData set to NULL and this function has
478 - Previous Close() call on this instance has not
480 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
482 - CloseToken is NULL.
483 - CloseToken->CompletionToken.Event is NULL.
484 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
485 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
490 (EFIAPI
*EFI_TCP4_CLOSE
)(
491 IN EFI_TCP4_PROTOCOL
*This
,
492 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
496 Abort an asynchronous connection, listen, transmission or receive request.
498 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
499 @param Token Pointer to a token that has been issued by
500 EFI_TCP4_PROTOCOL.Connect(),
501 EFI_TCP4_PROTOCOL.Accept(),
502 EFI_TCP4_PROTOCOL.Transmit() or
503 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending
504 tokens issued by above four functions will be aborted. Type
505 EFI_TCP4_COMPLETION_TOKEN is defined in
506 EFI_TCP4_PROTOCOL.Connect().
508 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
510 @retval EFI_INVALID_PARAMETER This is NULL.
511 @retval EFI_NOT_STARTED This instance hasn't been configured.
512 @retval EFI_NO_MAPPING When using the default address, configuration
513 (DHCP, BOOTP,RARP, etc.) hasn't finished yet.
514 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the
515 transmission or receive queue. It has either
516 completed or wasn't issued by Transmit() and Receive().
517 @retval EFI_UNSUPPORTED The implementation does not support this function.
518 Note: It is not defined in UEFI 2.3 Specification.
523 (EFIAPI
*EFI_TCP4_CANCEL
)(
524 IN EFI_TCP4_PROTOCOL
*This
,
525 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
530 Poll to receive incoming data and transmit outgoing segments.
532 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
534 @retval EFI_SUCCESS Incoming or outgoing data was processed.
535 @retval EFI_INVALID_PARAMETER This is NULL.
536 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
537 @retval EFI_NOT_READY No incoming or outgoing data is processed.
538 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
539 Consider increasing the polling rate.
544 (EFIAPI
*EFI_TCP4_POLL
)(
545 IN EFI_TCP4_PROTOCOL
*This
549 /// The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by
550 /// any network drivers or applications to send or receive data stream.
551 /// It can either listen on a specified port as a service or actively connected
552 /// to remote peer as a client. Each instance has its own independent settings,
553 /// such as the routing table.
555 struct _EFI_TCP4_PROTOCOL
{
556 EFI_TCP4_GET_MODE_DATA GetModeData
;
557 EFI_TCP4_CONFIGURE Configure
;
558 EFI_TCP4_ROUTES Routes
;
559 EFI_TCP4_CONNECT Connect
;
560 EFI_TCP4_ACCEPT Accept
;
561 EFI_TCP4_TRANSMIT Transmit
;
562 EFI_TCP4_RECEIVE Receive
;
563 EFI_TCP4_CLOSE Close
;
564 EFI_TCP4_CANCEL Cancel
;
568 extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid
;
569 extern EFI_GUID gEfiTcp4ProtocolGuid
;