2 EFI TCPv4 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, 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.
18 #ifndef __EFI_TCP4_PROTOCOL_H__
19 #define __EFI_TCP4_PROTOCOL_H__
21 #include <Protocol/Ip4.h>
23 #define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \
25 0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \
28 #define EFI_TCP4_PROTOCOL_GUID \
30 0x65530BC7, 0xA359, 0x410f, {0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } \
33 typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL
;
36 EFI_HANDLE InstanceHandle
;
37 EFI_IPv4_ADDRESS LocalAddress
;
39 EFI_IPv4_ADDRESS RemoteAddress
;
41 } EFI_TCP4_SERVICE_POINT
;
44 EFI_HANDLE DriverHandle
;
46 EFI_TCP4_SERVICE_POINT Services
[1];
47 } EFI_TCP4_VARIABLE_DATA
;
50 BOOLEAN UseDefaultAddress
;
51 EFI_IPv4_ADDRESS StationAddress
;
52 EFI_IPv4_ADDRESS SubnetMask
;
54 EFI_IPv4_ADDRESS RemoteAddress
;
57 } EFI_TCP4_ACCESS_POINT
;
60 UINT32 ReceiveBufferSize
;
61 UINT32 SendBufferSize
;
63 UINT32 ConnectionTimeout
;
66 UINT32 TimeWaitTimeout
;
67 UINT32 KeepAliveProbes
;
69 UINT32 KeepAliveInterval
;
71 BOOLEAN EnableTimeStamp
;
72 BOOLEAN EnableWindowScaling
;
73 BOOLEAN EnableSelectiveAck
;
74 BOOLEAN EnablePathMtuDiscovery
;
87 EFI_TCP4_ACCESS_POINT AccessPoint
;
90 // TCP Control Options
92 EFI_TCP4_OPTION
*ControlOption
;
93 } EFI_TCP4_CONFIG_DATA
;
99 Tcp4StateSynReceived
= 3,
100 Tcp4StateEstablished
= 4,
101 Tcp4StateFinWait1
= 5,
102 Tcp4StateFinWait2
= 6,
103 Tcp4StateClosing
= 7,
104 Tcp4StateTimeWait
= 8,
105 Tcp4StateCloseWait
= 9,
106 Tcp4StateLastAck
= 10
107 } EFI_TCP4_CONNECTION_STATE
;
112 } EFI_TCP4_COMPLETION_TOKEN
;
115 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
116 } EFI_TCP4_CONNECTION_TOKEN
;
119 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
120 EFI_HANDLE NewChildHandle
;
121 } EFI_TCP4_LISTEN_TOKEN
;
124 UINT32 FragmentLength
;
125 VOID
*FragmentBuffer
;
126 } EFI_TCP4_FRAGMENT_DATA
;
131 UINT32 FragmentCount
;
132 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
133 } EFI_TCP4_RECEIVE_DATA
;
139 UINT32 FragmentCount
;
140 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
141 } EFI_TCP4_TRANSMIT_DATA
;
144 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
146 EFI_TCP4_RECEIVE_DATA
*RxData
;
147 EFI_TCP4_TRANSMIT_DATA
*TxData
;
152 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
153 BOOLEAN AbortOnClose
;
154 } EFI_TCP4_CLOSE_TOKEN
;
157 // Interface definition for TCP4 protocol
161 Get the current operational status.
163 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
164 @param Tcp4State Pointer to the buffer to receive the current TCP state.
165 @param Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration.
166 @param Ip4ModeData Pointer to the buffer to receive the current IPv4 configuration
167 data used by the TCPv4 instance.
168 @param MnpConfigData Pointer to the buffer to receive the current MNP configuration
169 data used indirectly by the TCPv4 instance.
170 @param SnpModeData Pointer to the buffer to receive the current SNP configuration
171 data used indirectly by the TCPv4 instance.
173 @retval EFI_SUCCESS The mode data was read.
174 @retval EFI_INVALID_PARAMETER This is NULL.
175 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
181 (EFIAPI
*EFI_TCP4_GET_MODE_DATA
)(
182 IN CONST EFI_TCP4_PROTOCOL
*This
,
183 OUT EFI_TCP4_CONNECTION_STATE
*Tcp4State OPTIONAL
,
184 OUT EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData OPTIONAL
,
185 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
186 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
187 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
192 Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.
194 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
195 @param Tcp4ConfigData Pointer to the configure data to configure the instance.
197 @retval EFI_SUCCESS The operational settings are set, changed, or reset
199 @retval EFI_INVALID_PARAMETER Some parameter is invalid.
200 @retval EFI_NO_MAPPING When using a default address, configuration (through
201 DHCP, BOOTP, RARP, etc.) is not finished yet.
202 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
203 calling Configure() with NULL to reset it.
204 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
205 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
207 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
208 executing Configure().
213 (EFIAPI
*EFI_TCP4_CONFIGURE
)(
214 IN EFI_TCP4_PROTOCOL
*This
,
215 IN EFI_TCP4_CONFIG_DATA
*TcpConfigData OPTIONAL
221 Add or delete a route entry to the route table
223 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
224 @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to
225 FALSE to add this route to the routing table.
226 DestinationAddress and SubnetMask are used as the
227 keywords to search route entry.
228 @param SubnetAddress The destination network.
229 @param SubnetMask The subnet mask of the destination network.
230 @param GatewayAddress The gateway address for this route. It must be on the same
231 subnet with the station address unless a direct route is specified.
233 @retval EFI_SUCCESS The operation completed successfully.
234 @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.
235 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
236 RARP, etc.) is not finished yet.
237 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
239 - SubnetAddress is NULL.
240 - SubnetMask is NULL.
241 - GatewayAddress is NULL.
242 - *SubnetAddress is not NULL a valid subnet address.
243 - *SubnetMask is not a valid subnet mask.
244 - *GatewayAddress is not a valid unicast IP address or it
245 is not in the same subnet.
246 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the
248 @retval EFI_NOT_FOUND This route is not in the routing table.
249 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
250 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
255 (EFIAPI
*EFI_TCP4_ROUTES
)(
256 IN EFI_TCP4_PROTOCOL
*This
,
257 IN BOOLEAN DeleteRoute
,
258 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
259 IN EFI_IPv4_ADDRESS
*SubnetMask
,
260 IN EFI_IPv4_ADDRESS
*GatewayAddress
265 Initiate a nonblocking TCP connection request for an active TCP instance.
267 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
268 @param ConnectionToken Pointer to the connection token to return when the TCP three
269 way handshake finishes.
271 @retval EFI_SUCCESS The connection request is successfully initiated and the state
272 - of this TCPv4 instance has been changed to
274 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
275 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
276 - This instance is not configured as an active one.
277 - This instance is not in Tcp4StateClosed state.
278 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
280 - ConnectionToken is NULL.
281 - ConnectionToken->CompletionToken.Event is NULL.
282 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activeopen.
283 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
288 (EFIAPI
*EFI_TCP4_CONNECT
)(
289 IN EFI_TCP4_PROTOCOL
*This
,
290 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
296 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.
298 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
299 @param ListenToken Pointer to the listen token to return when operation finishes.
301 @retval EFI_SUCCESS The listen token has been queued successfully.
302 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
303 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
304 - This instance is not a passive instance.
305 - This instance is not in Tcp4StateListen state.
306 - The same listen token has already existed in the listen
307 token queue of this TCP instance.
308 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
310 - ListenToken is NULL.
311 - ListentToken->CompletionToken.Event is NULL.
312 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
313 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
318 (EFIAPI
*EFI_TCP4_ACCEPT
)(
319 IN EFI_TCP4_PROTOCOL
*This
,
320 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
325 Queues outgoing data into the transmit queue.
327 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
328 @param Token Pointer to the completion token to queue to the transmit queue.
330 @retval EFI_SUCCESS The data has been queued for transmission.
331 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
332 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
333 RARP, etc.) is not finished yet.
334 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
337 - Token->CompletionToken.Event is NULL.
338 - Token->Packet.TxData is NULL L.
339 - Token->Packet.FragmentCount is zero.
340 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
341 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
342 - A transmit completion token with the same Token->CompletionToken.Event
343 was already in the transmission queue.
344 - The current instance is in Tcp4StateClosed state.
345 - The current instance is a passive one and it is in
346 Tcp4StateListen state.
347 - User has called Close() to disconnect this connection.
348 @retval EFI_NOT_READY The completion token could not be queued because the
349 transmit queue is full.
350 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource
352 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
357 (EFIAPI
*EFI_TCP4_TRANSMIT
)(
358 IN EFI_TCP4_PROTOCOL
*This
,
359 IN EFI_TCP4_IO_TOKEN
*Token
365 Places an asynchronous receive request into the receiving queue.
367 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
368 @param Token Pointer to a token that is associated with the receive data
371 @retval EFI_SUCCESS The receive completion token was cached.
372 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
373 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,
374 etc.) is not finished yet.
375 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
378 - Token->CompletionToken.Event is NULL.
379 - Token->Packet.RxData is NULL.
380 - Token->Packet.RxData->DataLength is 0.
381 - The Token->Packet.RxData->DataLength is not
382 the sum of all FragmentBuffer length in FragmentTable.
383 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
384 system resources (usually memory).
385 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
386 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
387 - A receive completion token with the same Token-
388 >CompletionToken.Event was already in the receive
390 - The current instance is in Tcp4StateClosed state.
391 - The current instance is a passive one and it is in
392 Tcp4StateListen state.
393 - User has called Close() to disconnect this connection.
394 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is
395 no any buffered data in the receive buffer of this instance.
396 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
401 (EFIAPI
*EFI_TCP4_RECEIVE
)(
402 IN EFI_TCP4_PROTOCOL
*This
,
403 IN EFI_TCP4_IO_TOKEN
*Token
408 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
409 nonblocking operation.
411 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
412 @param CloseToken Pointer to the close token to return when operation finishes.
414 @retval EFI_SUCCESS The Close() is called successfully.
415 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
416 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
417 - Configure() has been called with
418 TcpConfigData set to NULL and this function has
420 - Previous Close() call on this instance has not
422 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
424 - CloseToken is NULL.
425 - CloseToken->CompletionToken.Event is NULL.
426 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
427 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
432 (EFIAPI
*EFI_TCP4_CLOSE
)(
433 IN EFI_TCP4_PROTOCOL
*This
,
434 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
439 Abort an asynchronous connection, listen, transmission or receive request.
441 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
442 @param Token Pointer to a token that has been issued by
443 EFI_TCP4_PROTOCOL.Connect(),
444 EFI_TCP4_PROTOCOL.Accept(),
445 EFI_TCP4_PROTOCOL.Transmit() or
446 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending
447 tokens issued by above four functions will be aborted. Type
448 EFI_TCP4_COMPLETION_TOKEN is defined in
449 EFI_TCP4_PROTOCOL.Connect().
451 @retval EFI_SUCCESS Incoming or outgoing data was processed.
452 @retval EFI_INVALID_PARAMETER This is NULL.
453 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
454 @retval EFI_NOT_READY No incoming or outgoing data is processed.
455 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
456 Consider increasing the polling rate.
461 (EFIAPI
*EFI_TCP4_CANCEL
)(
462 IN EFI_TCP4_PROTOCOL
*This
,
463 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
469 Poll to receive incoming data and transmit outgoing segments.
471 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
473 @retval EFI_SUCCESS Incoming or outgoing data was processed.
474 @retval EFI_INVALID_PARAMETER This is NULL.
475 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
476 @retval EFI_NOT_READY No incoming or outgoing data is processed.
477 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
478 Consider increasing the polling rate.
483 (EFIAPI
*EFI_TCP4_POLL
)(
484 IN EFI_TCP4_PROTOCOL
*This
489 @par Protocol Description:
490 The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by
491 any network drivers or applications to send or receive data stream.
492 It can either listen on a specified port as a service or actively connected
493 to remote peer as a client. Each instance has its own independent settings,
494 such as the routing table.
497 Get the current operational status.
500 Initialize, change, or brutally reset operational settings of the EFI TCPv4 Protocol.
503 Add or delete routing entries for this TCP4 instance.
506 Initiate the TCP three-way handshake to connect to the remote peer
507 configured in this TCP instance. The function is a nonblocking operation.
510 Listen for incoming TCP connection request. This function is a nonblocking operation.
513 Queue outgoing data to the transmit queue. This function is a nonblocking operation.
516 Queue a receiving request token to the receive queue. This function is
517 a nonblocking operation.
520 Gracefully disconnecting a TCP connection follow RFC 793 or reset a TCP
521 connection. This function is a nonblocking operation.
524 Abort a pending connect, listen, transmit or receive request.
527 Poll to receive incoming data and transmit outgoing TCP segments.
530 struct _EFI_TCP4_PROTOCOL
{
531 EFI_TCP4_GET_MODE_DATA GetModeData
;
532 EFI_TCP4_CONFIGURE Configure
;
533 EFI_TCP4_ROUTES Routes
;
534 EFI_TCP4_CONNECT Connect
;
535 EFI_TCP4_ACCEPT Accept
;
536 EFI_TCP4_TRANSMIT Transmit
;
537 EFI_TCP4_RECEIVE Receive
;
538 EFI_TCP4_CLOSE Close
;
539 EFI_TCP4_CANCEL Cancel
;
543 #define EFI_CONNECTION_FIN EFIERR (104)
544 #define EFI_CONNECTION_RESET EFIERR (105)
545 #define EFI_CONNECTION_REFUSED EFIERR (106)
547 extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid
;
548 extern EFI_GUID gEfiTcp4ProtocolGuid
;