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 - 2011, 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.
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.
145 /// EFI_NO_MEDIA: There was a media error.
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 /// EFI_CONNECTION_RESET: The receiving or transmission operation fails
185 /// because this connection is reset either by instance
186 /// itself or the communication peer.
187 /// EFI_ABORTED: The receiving or transmission is aborted.
188 /// EFI_TIMEOUT: The transmission timer expires and no more
189 /// specific information is available.
190 /// EFI_NETWORK_UNREACHABLE: The transmission fails
191 /// because an ICMP network unreachable error is received.
192 /// EFI_HOST_UNREACHABLE: The transmission fails because an
193 /// ICMP host unreachable error is received.
194 /// EFI_PROTOCOL_UNREACHABLE: The transmission fails
195 /// because an ICMP protocol unreachable error is received.
196 /// EFI_PORT_UNREACHABLE: The transmission fails and an
197 /// ICMP port unreachable error is received.
198 /// EFI_ICMP_ERROR: The transmission fails and some other
199 /// ICMP error is received.
200 /// EFI_DEVICE_ERROR: An unexpected system or network error occurs.
201 /// EFI_NO_MEDIA: There was a media error.
203 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
206 /// When this token is used for receiving, RxData is a pointer to EFI_TCP4_RECEIVE_DATA.
208 EFI_TCP4_RECEIVE_DATA
*RxData
;
210 /// When this token is used for transmitting, TxData is a pointer to EFI_TCP4_TRANSMIT_DATA.
212 EFI_TCP4_TRANSMIT_DATA
*TxData
;
217 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
218 BOOLEAN AbortOnClose
;
219 } EFI_TCP4_CLOSE_TOKEN
;
222 // Interface definition for TCP4 protocol
226 Get the current operational status.
228 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
229 @param Tcp4State The pointer to the buffer to receive the current TCP state.
230 @param Tcp4ConfigData The pointer to the buffer to receive the current TCP configuration.
231 @param Ip4ModeData The pointer to the buffer to receive the current IPv4 configuration
232 data used by the TCPv4 instance.
233 @param MnpConfigData The pointer to the buffer to receive the current MNP configuration
234 data used indirectly by the TCPv4 instance.
235 @param SnpModeData The pointer to the buffer to receive the current SNP configuration
236 data used indirectly by the TCPv4 instance.
238 @retval EFI_SUCCESS The mode data was read.
239 @retval EFI_INVALID_PARAMETER This is NULL.
240 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
246 (EFIAPI
*EFI_TCP4_GET_MODE_DATA
)(
247 IN EFI_TCP4_PROTOCOL
*This
,
248 OUT EFI_TCP4_CONNECTION_STATE
*Tcp4State OPTIONAL
,
249 OUT EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData OPTIONAL
,
250 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
251 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
252 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
256 Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.
258 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
259 @param Tcp4ConfigData The pointer to the configure data to configure the instance.
261 @retval EFI_SUCCESS The operational settings are set, changed, or reset
263 @retval EFI_INVALID_PARAMETER Some parameter is invalid.
264 @retval EFI_NO_MAPPING When using a default address, configuration (through
265 DHCP, BOOTP, RARP, etc.) is not finished yet.
266 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
267 calling Configure() with NULL to reset it.
268 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
269 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
271 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
272 executing Configure().
277 (EFIAPI
*EFI_TCP4_CONFIGURE
)(
278 IN EFI_TCP4_PROTOCOL
*This
,
279 IN EFI_TCP4_CONFIG_DATA
*TcpConfigData OPTIONAL
284 Add or delete a route entry to the route table
286 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
287 @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to
288 FALSE to add this route to the routing table.
289 DestinationAddress and SubnetMask are used as the
290 keywords to search route entry.
291 @param SubnetAddress The destination network.
292 @param SubnetMask The subnet mask of the destination network.
293 @param GatewayAddress The gateway address for this route. It must be on the same
294 subnet with the station address unless a direct route is specified.
296 @retval EFI_SUCCESS The operation completed successfully.
297 @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.
298 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
299 RARP, etc.) is not finished yet.
300 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
302 - SubnetAddress is NULL.
303 - SubnetMask is NULL.
304 - GatewayAddress is NULL.
305 - *SubnetAddress is not NULL a valid subnet address.
306 - *SubnetMask is not a valid subnet mask.
307 - *GatewayAddress is not a valid unicast IP address or it
308 is not in the same subnet.
309 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the
311 @retval EFI_NOT_FOUND This route is not in the routing table.
312 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
313 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
318 (EFIAPI
*EFI_TCP4_ROUTES
)(
319 IN EFI_TCP4_PROTOCOL
*This
,
320 IN BOOLEAN DeleteRoute
,
321 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
322 IN EFI_IPv4_ADDRESS
*SubnetMask
,
323 IN EFI_IPv4_ADDRESS
*GatewayAddress
327 Initiate a nonblocking TCP connection request for an active TCP instance.
329 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
330 @param ConnectionToken The pointer to the connection token to return when the TCP three
331 way handshake finishes.
333 @retval EFI_SUCCESS The connection request is successfully initiated and the state
334 of this TCPv4 instance has been changed to Tcp4StateSynSent.
335 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
336 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
337 - This instance is not configured as an active one.
338 - This instance is not in Tcp4StateClosed state.
339 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
341 - ConnectionToken is NULL.
342 - ConnectionToken->CompletionToken.Event is NULL.
343 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activ eopen.
344 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
349 (EFIAPI
*EFI_TCP4_CONNECT
)(
350 IN EFI_TCP4_PROTOCOL
*This
,
351 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
356 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.
358 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
359 @param ListenToken The pointer to the listen token to return when operation finishes.
361 @retval EFI_SUCCESS The listen token has been queued successfully.
362 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
363 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
364 - This instance is not a passive instance.
365 - This instance is not in Tcp4StateListen state.
366 - The same listen token has already existed in the listen
367 token queue of this TCP instance.
368 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
370 - ListenToken is NULL.
371 - ListentToken->CompletionToken.Event is NULL.
372 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
373 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
378 (EFIAPI
*EFI_TCP4_ACCEPT
)(
379 IN EFI_TCP4_PROTOCOL
*This
,
380 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
384 Queues outgoing data into the transmit queue.
386 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
387 @param Token The pointer to the completion token to queue to the transmit queue.
389 @retval EFI_SUCCESS The data has been queued for transmission.
390 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
391 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
392 RARP, etc.) is not finished yet.
393 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
396 - Token->CompletionToken.Event is NULL.
397 - Token->Packet.TxData is NULL L.
398 - Token->Packet.FragmentCount is zero.
399 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
400 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
401 - A transmit completion token with the same Token->CompletionToken.Event
402 was already in the transmission queue.
403 - The current instance is in Tcp4StateClosed state.
404 - The current instance is a passive one and it is in
405 Tcp4StateListen state.
406 - User has called Close() to disconnect this connection.
407 @retval EFI_NOT_READY The completion token could not be queued because the
408 transmit queue is full.
409 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource
411 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
416 (EFIAPI
*EFI_TCP4_TRANSMIT
)(
417 IN EFI_TCP4_PROTOCOL
*This
,
418 IN EFI_TCP4_IO_TOKEN
*Token
423 Places an asynchronous receive request into the receiving queue.
425 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
426 @param Token The pointer to a token that is associated with the receive data
429 @retval EFI_SUCCESS The receive completion token was cached.
430 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
431 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,
432 etc.) is not finished yet.
433 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
436 - Token->CompletionToken.Event is NULL.
437 - Token->Packet.RxData is NULL.
438 - Token->Packet.RxData->DataLength is 0.
439 - The Token->Packet.RxData->DataLength is not
440 the sum of all FragmentBuffer length in FragmentTable.
441 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
442 system resources (usually memory).
443 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
444 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
445 - A receive completion token with the same Token-
446 >CompletionToken.Event was already in the receive
448 - The current instance is in Tcp4StateClosed state.
449 - The current instance is a passive one and it is in
450 Tcp4StateListen state.
451 - User has called Close() to disconnect this connection.
452 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is
453 no any buffered data in the receive buffer of this instance.
454 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
459 (EFIAPI
*EFI_TCP4_RECEIVE
)(
460 IN EFI_TCP4_PROTOCOL
*This
,
461 IN EFI_TCP4_IO_TOKEN
*Token
465 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
466 nonblocking operation.
468 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
469 @param CloseToken The pointer to the close token to return when operation finishes.
471 @retval EFI_SUCCESS The Close() is called successfully.
472 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
473 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
474 - Configure() has been called with
475 TcpConfigData set to NULL and this function has
477 - Previous Close() call on this instance has not
479 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
481 - CloseToken is NULL.
482 - CloseToken->CompletionToken.Event is NULL.
483 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
484 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
489 (EFIAPI
*EFI_TCP4_CLOSE
)(
490 IN EFI_TCP4_PROTOCOL
*This
,
491 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
495 Abort an asynchronous connection, listen, transmission or receive request.
497 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
498 @param Token The pointer to a token that has been issued by
499 EFI_TCP4_PROTOCOL.Connect(),
500 EFI_TCP4_PROTOCOL.Accept(),
501 EFI_TCP4_PROTOCOL.Transmit() or
502 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending
503 tokens issued by above four functions will be aborted. Type
504 EFI_TCP4_COMPLETION_TOKEN is defined in
505 EFI_TCP4_PROTOCOL.Connect().
507 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
509 @retval EFI_INVALID_PARAMETER This is NULL.
510 @retval EFI_NOT_STARTED This instance hasn't been configured.
511 @retval EFI_NO_MAPPING When using the default address, configuration
512 (DHCP, BOOTP,RARP, etc.) hasn't finished yet.
513 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the
514 transmission or receive queue. It has either
515 completed or wasn't issued by Transmit() and Receive().
516 @retval EFI_UNSUPPORTED The implementation does not support this function.
521 (EFIAPI
*EFI_TCP4_CANCEL
)(
522 IN EFI_TCP4_PROTOCOL
*This
,
523 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
528 Poll to receive incoming data and transmit outgoing segments.
530 @param This The pointer to the EFI_TCP4_PROTOCOL instance.
532 @retval EFI_SUCCESS Incoming or outgoing data was processed.
533 @retval EFI_INVALID_PARAMETER This is NULL.
534 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
535 @retval EFI_NOT_READY No incoming or outgoing data is processed.
536 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
537 Consider increasing the polling rate.
542 (EFIAPI
*EFI_TCP4_POLL
)(
543 IN EFI_TCP4_PROTOCOL
*This
547 /// The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by
548 /// any network drivers or applications to send or receive data stream.
549 /// It can either listen on a specified port as a service or actively connected
550 /// to remote peer as a client. Each instance has its own independent settings,
551 /// such as the routing table.
553 struct _EFI_TCP4_PROTOCOL
{
554 EFI_TCP4_GET_MODE_DATA GetModeData
;
555 EFI_TCP4_CONFIGURE Configure
;
556 EFI_TCP4_ROUTES Routes
;
557 EFI_TCP4_CONNECT Connect
;
558 EFI_TCP4_ACCEPT Accept
;
559 EFI_TCP4_TRANSMIT Transmit
;
560 EFI_TCP4_RECEIVE Receive
;
561 EFI_TCP4_CLOSE Close
;
562 EFI_TCP4_CANCEL Cancel
;
566 extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid
;
567 extern EFI_GUID gEfiTcp4ProtocolGuid
;