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 /// EFI_ABORTED: The active open is aborted.
132 /// EFI_TIMEOUT: The connection establishment timer expires and
133 /// no more specific information is available.
134 /// EFI_NETWORK_UNREACHABLE: The active open fails because
135 /// an ICMP network unreachable error is received.
136 /// EFI_HOST_UNREACHABLE: The active open fails because an
137 /// ICMP host unreachable error is received.
138 /// EFI_PROTOCOL_UNREACHABLE: The active open fails
139 /// because an ICMP protocol unreachable error is received.
140 /// EFI_PORT_UNREACHABLE: The connection establishment
141 /// timer times out and an ICMP port unreachable error is received.
142 /// EFI_ICMP_ERROR: The connection establishment timer timeout and some other ICMP
143 /// error is received.
144 /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
146 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
147 } EFI_TCP4_CONNECTION_TOKEN
;
150 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
151 EFI_HANDLE NewChildHandle
;
152 } EFI_TCP4_LISTEN_TOKEN
;
155 UINT32 FragmentLength
;
156 VOID
*FragmentBuffer
;
157 } EFI_TCP4_FRAGMENT_DATA
;
162 UINT32 FragmentCount
;
163 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
164 } EFI_TCP4_RECEIVE_DATA
;
170 UINT32 FragmentCount
;
171 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
172 } EFI_TCP4_TRANSMIT_DATA
;
176 /// When transmission finishes or meets any unexpected error it will
177 /// be set to one of the following values:
178 /// EFI_SUCCESS: The receiving or transmission operation
179 /// completes successfully.
180 /// EFI_CONNECTION_FIN: The receiving operation fails because the communication peer
181 /// has closed the connection and there is no more data in the
182 /// receive buffer of the instance.
183 /// EFI_CONNECTION_RESET: The receiving or transmission operation fails
184 /// because this connection is reset either by instance
185 /// itself or the communication peer.
186 /// EFI_ABORTED: The receiving or transmission is aborted.
187 /// EFI_TIMEOUT: The transmission timer expires and no more
188 /// specific information is available.
189 /// EFI_NETWORK_UNREACHABLE: The transmission fails
190 /// because an ICMP network unreachable error is received.
191 /// EFI_HOST_UNREACHABLE: The transmission fails because an
192 /// ICMP host unreachable error is received.
193 /// EFI_PROTOCOL_UNREACHABLE: The transmission fails
194 /// because an ICMP protocol unreachable error is received.
195 /// EFI_PORT_UNREACHABLE: The transmission fails and an
196 /// ICMP port unreachable error is received.
197 /// EFI_ICMP_ERROR: The transmission fails and some other
198 /// ICMP error is received.
199 /// EFI_DEVICE_ERROR: An unexpected system or network error occurs.
200 /// EFI_NO_MEDIA: There was a media error.
202 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
205 /// When this token is used for receiving, RxData is a pointer to EFI_TCP4_RECEIVE_DATA.
207 EFI_TCP4_RECEIVE_DATA
*RxData
;
209 /// When this token is used for transmitting, TxData is a pointer to EFI_TCP4_TRANSMIT_DATA.
211 EFI_TCP4_TRANSMIT_DATA
*TxData
;
216 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
217 BOOLEAN AbortOnClose
;
218 } EFI_TCP4_CLOSE_TOKEN
;
221 // Interface definition for TCP4 protocol
225 Get the current operational status.
227 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
228 @param Tcp4State Pointer to the buffer to receive the current TCP state.
229 @param Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration.
230 @param Ip4ModeData Pointer to the buffer to receive the current IPv4 configuration
231 data used by the TCPv4 instance.
232 @param MnpConfigData Pointer to the buffer to receive the current MNP configuration
233 data used indirectly by the TCPv4 instance.
234 @param SnpModeData Pointer to the buffer to receive the current SNP configuration
235 data used indirectly by the TCPv4 instance.
237 @retval EFI_SUCCESS The mode data was read.
238 @retval EFI_INVALID_PARAMETER This is NULL.
239 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
245 (EFIAPI
*EFI_TCP4_GET_MODE_DATA
)(
246 IN CONST EFI_TCP4_PROTOCOL
*This
,
247 OUT EFI_TCP4_CONNECTION_STATE
*Tcp4State OPTIONAL
,
248 OUT EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData OPTIONAL
,
249 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
250 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
251 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
255 Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.
257 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
258 @param Tcp4ConfigData Pointer to the configure data to configure the instance.
260 @retval EFI_SUCCESS The operational settings are set, changed, or reset
262 @retval EFI_INVALID_PARAMETER Some parameter is invalid.
263 @retval EFI_NO_MAPPING When using a default address, configuration (through
264 DHCP, BOOTP, RARP, etc.) is not finished yet.
265 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
266 calling Configure() with NULL to reset it.
267 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
268 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
270 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
271 executing Configure().
276 (EFIAPI
*EFI_TCP4_CONFIGURE
)(
277 IN EFI_TCP4_PROTOCOL
*This
,
278 IN EFI_TCP4_CONFIG_DATA
*TcpConfigData OPTIONAL
283 Add or delete a route entry to the route table
285 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
286 @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to
287 FALSE to add this route to the routing table.
288 DestinationAddress and SubnetMask are used as the
289 keywords to search route entry.
290 @param SubnetAddress The destination network.
291 @param SubnetMask The subnet mask of the destination network.
292 @param GatewayAddress The gateway address for this route. It must be on the same
293 subnet with the station address unless a direct route is specified.
295 @retval EFI_SUCCESS The operation completed successfully.
296 @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.
297 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
298 RARP, etc.) is not finished yet.
299 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
301 - SubnetAddress is NULL.
302 - SubnetMask is NULL.
303 - GatewayAddress is NULL.
304 - *SubnetAddress is not NULL a valid subnet address.
305 - *SubnetMask is not a valid subnet mask.
306 - *GatewayAddress is not a valid unicast IP address or it
307 is not in the same subnet.
308 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the
310 @retval EFI_NOT_FOUND This route is not in the routing table.
311 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
312 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
317 (EFIAPI
*EFI_TCP4_ROUTES
)(
318 IN EFI_TCP4_PROTOCOL
*This
,
319 IN BOOLEAN DeleteRoute
,
320 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
321 IN EFI_IPv4_ADDRESS
*SubnetMask
,
322 IN EFI_IPv4_ADDRESS
*GatewayAddress
326 Initiate a nonblocking TCP connection request for an active TCP instance.
328 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
329 @param ConnectionToken Pointer to the connection token to return when the TCP three
330 way handshake finishes.
332 @retval EFI_SUCCESS The connection request is successfully initiated and the state
333 of this TCPv4 instance has been changed to Tcp4StateSynSent.
334 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
335 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
336 - This instance is not configured as an active one.
337 - This instance is not in Tcp4StateClosed state.
338 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
340 - ConnectionToken is NULL.
341 - ConnectionToken->CompletionToken.Event is NULL.
342 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activ eopen.
343 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
348 (EFIAPI
*EFI_TCP4_CONNECT
)(
349 IN EFI_TCP4_PROTOCOL
*This
,
350 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
355 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.
357 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
358 @param ListenToken Pointer to the listen token to return when operation finishes.
360 @retval EFI_SUCCESS The listen token has been queued successfully.
361 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
362 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
363 - This instance is not a passive instance.
364 - This instance is not in Tcp4StateListen state.
365 - The same listen token has already existed in the listen
366 token queue of this TCP instance.
367 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
369 - ListenToken is NULL.
370 - ListentToken->CompletionToken.Event is NULL.
371 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
372 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
377 (EFIAPI
*EFI_TCP4_ACCEPT
)(
378 IN EFI_TCP4_PROTOCOL
*This
,
379 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
383 Queues outgoing data into the transmit queue.
385 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
386 @param Token Pointer to the completion token to queue to the transmit queue.
388 @retval EFI_SUCCESS The data has been queued for transmission.
389 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
390 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
391 RARP, etc.) is not finished yet.
392 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
395 - Token->CompletionToken.Event is NULL.
396 - Token->Packet.TxData is NULL L.
397 - Token->Packet.FragmentCount is zero.
398 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
399 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
400 - A transmit completion token with the same Token->CompletionToken.Event
401 was already in the transmission queue.
402 - The current instance is in Tcp4StateClosed state.
403 - The current instance is a passive one and it is in
404 Tcp4StateListen state.
405 - User has called Close() to disconnect this connection.
406 @retval EFI_NOT_READY The completion token could not be queued because the
407 transmit queue is full.
408 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource
410 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
415 (EFIAPI
*EFI_TCP4_TRANSMIT
)(
416 IN EFI_TCP4_PROTOCOL
*This
,
417 IN EFI_TCP4_IO_TOKEN
*Token
422 Places an asynchronous receive request into the receiving queue.
424 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
425 @param Token Pointer to a token that is associated with the receive data
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:
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
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.
458 (EFIAPI
*EFI_TCP4_RECEIVE
)(
459 IN EFI_TCP4_PROTOCOL
*This
,
460 IN EFI_TCP4_IO_TOKEN
*Token
464 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
465 nonblocking operation.
467 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
468 @param CloseToken Pointer to the close token to return when operation finishes.
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
476 - Previous Close() call on this instance has not
478 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
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.
488 (EFIAPI
*EFI_TCP4_CLOSE
)(
489 IN EFI_TCP4_PROTOCOL
*This
,
490 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
494 Abort an asynchronous connection, listen, transmission or receive request.
496 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
497 @param Token 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().
506 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
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.
520 (EFIAPI
*EFI_TCP4_CANCEL
)(
521 IN EFI_TCP4_PROTOCOL
*This
,
522 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
527 Poll to receive incoming data and transmit outgoing segments.
529 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
531 @retval EFI_SUCCESS Incoming or outgoing data was processed.
532 @retval EFI_INVALID_PARAMETER This is NULL.
533 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
534 @retval EFI_NOT_READY No incoming or outgoing data is processed.
535 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
536 Consider increasing the polling rate.
541 (EFIAPI
*EFI_TCP4_POLL
)(
542 IN EFI_TCP4_PROTOCOL
*This
546 /// The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by
547 /// any network drivers or applications to send or receive data stream.
548 /// It can either listen on a specified port as a service or actively connected
549 /// to remote peer as a client. Each instance has its own independent settings,
550 /// such as the routing table.
552 struct _EFI_TCP4_PROTOCOL
{
553 EFI_TCP4_GET_MODE_DATA GetModeData
;
554 EFI_TCP4_CONFIGURE Configure
;
555 EFI_TCP4_ROUTES Routes
;
556 EFI_TCP4_CONNECT Connect
;
557 EFI_TCP4_ACCEPT Accept
;
558 EFI_TCP4_TRANSMIT Transmit
;
559 EFI_TCP4_RECEIVE Receive
;
560 EFI_TCP4_CLOSE Close
;
561 EFI_TCP4_CANCEL Cancel
;
565 extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid
;
566 extern EFI_GUID gEfiTcp4ProtocolGuid
;