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.
20 #ifndef __EFI_TCP4_PROTOCOL_H__
21 #define __EFI_TCP4_PROTOCOL_H__
23 #include <Protocol/Ip4.h>
25 #define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \
27 0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \
30 #define EFI_TCP4_PROTOCOL_GUID \
32 0x65530BC7, 0xA359, 0x410f, {0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } \
35 typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL
;
38 EFI_HANDLE InstanceHandle
;
39 EFI_IPv4_ADDRESS LocalAddress
;
41 EFI_IPv4_ADDRESS RemoteAddress
;
43 } EFI_TCP4_SERVICE_POINT
;
46 EFI_HANDLE DriverHandle
;
48 EFI_TCP4_SERVICE_POINT Services
[1];
49 } EFI_TCP4_VARIABLE_DATA
;
52 BOOLEAN UseDefaultAddress
;
53 EFI_IPv4_ADDRESS StationAddress
;
54 EFI_IPv4_ADDRESS SubnetMask
;
56 EFI_IPv4_ADDRESS RemoteAddress
;
59 } EFI_TCP4_ACCESS_POINT
;
62 UINTN ReceiveBufferSize
;
65 UINTN ConnectionTimeout
;
68 UINTN TimeWaitTimeout
;
69 UINTN KeepAliveProbes
;
71 UINTN KeepAliveInterval
;
73 BOOLEAN EnableTimeStamp
;
74 BOOLEAN EnableWindowScaling
;
75 BOOLEAN EnableSelectiveAck
;
76 BOOLEAN EnablePathMtuDiscovery
;
89 EFI_TCP4_ACCESS_POINT AccessPoint
;
92 // TCP Control Options
94 EFI_TCP4_OPTION
*ControlOption
;
95 } EFI_TCP4_CONFIG_DATA
;
100 Tcp4StateSynSent
= 2,
101 Tcp4StateSynReceived
= 3,
102 Tcp4StateEstablished
= 4,
103 Tcp4StateFinWait1
= 5,
104 Tcp4StateFinWait2
= 6,
105 Tcp4StateClosing
= 7,
106 Tcp4StateTimeWait
= 8,
107 Tcp4StateCloseWait
= 9,
108 Tcp4StateLastAck
= 10
109 } EFI_TCP4_CONNECTION_STATE
;
114 } EFI_TCP4_COMPLETION_TOKEN
;
117 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
118 } EFI_TCP4_CONNECTION_TOKEN
;
121 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
122 EFI_HANDLE NewChildHandle
;
123 } EFI_TCP4_LISTEN_TOKEN
;
126 UINTN FragmentLength
;
127 VOID
*FragmentBuffer
;
128 } EFI_TCP4_FRAGMENT_DATA
;
132 IN OUT UINTN DataLength
;
134 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
135 } EFI_TCP4_RECEIVE_DATA
;
142 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
143 } EFI_TCP4_TRANSMIT_DATA
;
146 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
148 EFI_TCP4_RECEIVE_DATA
*RxData
;
149 EFI_TCP4_TRANSMIT_DATA
*TxData
;
154 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
155 BOOLEAN AbortOnClose
;
156 } EFI_TCP4_CLOSE_TOKEN
;
159 // Interface definition for TCP4 protocol
163 Get the current operational status.
165 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
166 @param Tcp4State Pointer to the buffer to receive the current TCP state.
167 @param Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration.
168 @param Ip4ModeData Pointer to the buffer to receive the current IPv4 configuration
169 data used by the TCPv4 instance.
170 @param MnpConfigData Pointer to the buffer to receive the current MNP configuration
171 data used indirectly by the TCPv4 instance.
172 @param SnpModeData Pointer to the buffer to receive the current SNP configuration
173 data used indirectly by the TCPv4 instance.
175 @retval EFI_SUCCESS The mode data was read.
176 @retval EFI_INVALID_PARAMETER This is NULL.
177 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
183 (EFIAPI
*EFI_TCP4_GET_MODE_DATA
) (
184 IN CONST EFI_TCP4_PROTOCOL
*This
,
185 OUT EFI_TCP4_CONNECTION_STATE
*Tcp4State OPTIONAL
,
186 OUT EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData OPTIONAL
,
187 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
188 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
189 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
194 Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.
196 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
197 @param Tcp4ConfigData Pointer to the configure data to configure the instance.
199 @retval EFI_SUCCESS The operational settings are set, changed, or reset
201 @retval EFI_INVALID_PARAMETER Some parameter is invalid.
202 @retval EFI_NO_MAPPING When using a default address, configuration (through
203 DHCP, BOOTP, RARP, etc.) is not finished yet.
204 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
205 calling Configure() with NULL to reset it.
206 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
207 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
209 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
210 executing Configure().
215 (EFIAPI
*EFI_TCP4_CONFIGURE
) (
216 IN EFI_TCP4_PROTOCOL
*This
,
217 IN EFI_TCP4_CONFIG_DATA
*TcpConfigData OPTIONAL
223 Add or delete a route entry to the route table
225 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
226 @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to
227 FALSE to add this route to the routing table.
228 DestinationAddress and SubnetMask are used as the
229 keywords to search route entry.
230 @param SubnetAddress The destination network.
231 @param SubnetMask The subnet mask of the destination network.
232 @param GatewayAddress The gateway address for this route. It must be on the same
233 subnet with the station address unless a direct route is specified.
235 @retval EFI_SUCCESS The operation completed successfully.
236 @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.
237 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
238 RARP, etc.) is not finished yet.
239 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
241 - SubnetAddress is NULL.
242 - SubnetMask is NULL.
243 - GatewayAddress is NULL.
244 - *SubnetAddress is not NULL a valid subnet address.
245 - *SubnetMask is not a valid subnet mask.
246 - *GatewayAddress is not a valid unicast IP address or it
247 is not in the same subnet.
248 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the
250 @retval EFI_NOT_FOUND This route is not in the routing table.
251 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
252 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
257 (EFIAPI
*EFI_TCP4_ROUTES
) (
258 IN EFI_TCP4_PROTOCOL
*This
,
259 IN BOOLEAN DeleteRoute
,
260 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
261 IN EFI_IPv4_ADDRESS
*SubnetMask
,
262 IN EFI_IPv4_ADDRESS
*GatewayAddress
267 Initiate a nonblocking TCP connection request for an active TCP instance.
269 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
270 @param ConnectionToken Pointer to the connection token to return when the TCP three
271 way handshake finishes.
273 @retval EFI_SUCCESS The connection request is successfully initiated and the state
274 - of this TCPv4 instance has been changed to
276 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
277 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
278 - This instance is not configured as an active one.
279 - This instance is not in Tcp4StateClosed state.
280 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
282 - ConnectionToken is NULL.
283 - ConnectionToken->CompletionToken.Event is NULL.
284 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activeopen.
285 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
290 (EFIAPI
*EFI_TCP4_CONNECT
) (
291 IN EFI_TCP4_PROTOCOL
*This
,
292 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
298 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.
300 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
301 @param ListenToken Pointer to the listen token to return when operation finishes.
303 @retval EFI_SUCCESS The listen token has been queued successfully.
304 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
305 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
306 - This instance is not a passive instance.
307 - This instance is not in Tcp4StateListen state.
308 - The same listen token has already existed in the listen
309 token queue of this TCP instance.
310 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
312 - ListenToken is NULL.
313 - ListentToken->CompletionToken.Event is NULL.
314 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
315 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
320 (EFIAPI
*EFI_TCP4_ACCEPT
) (
321 IN EFI_TCP4_PROTOCOL
*This
,
322 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
327 Queues outgoing data into the transmit queue.
329 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
330 @param Token Pointer to the completion token to queue to the transmit queue.
332 @retval EFI_SUCCESS The data has been queued for transmission.
333 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
334 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
335 RARP, etc.) is not finished yet.
336 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
339 - Token->CompletionToken.Event is NULL.
340 - Token->Packet.TxData is NULL L.
341 - Token->Packet.FragmentCount is zero.
342 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
343 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
344 - A transmit completion token with the same Token->CompletionToken.Event
345 was already in the transmission queue.
346 - The current instance is in Tcp4StateClosed state.
347 - The current instance is a passive one and it is in
348 Tcp4StateListen state.
349 - User has called Close() to disconnect this connection.
350 @retval EFI_NOT_READY The completion token could not be queued because the
351 transmit queue is full.
352 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource
354 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
359 (EFIAPI
*EFI_TCP4_TRANSMIT
) (
360 IN EFI_TCP4_PROTOCOL
*This
,
361 IN EFI_TCP4_IO_TOKEN
*Token
367 Places an asynchronous receive request into the receiving queue.
369 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
370 @param Token Pointer to a token that is associated with the receive data
373 @retval EFI_SUCCESS The receive completion token was cached.
374 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
375 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,
376 etc.) is not finished yet.
377 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
380 - Token->CompletionToken.Event is NULL.
381 - Token->Packet.RxData is NULL.
382 - Token->Packet.RxData->DataLength is 0.
383 - The Token->Packet.RxData->DataLength is not
384 the sum of all FragmentBuffer length in FragmentTable.
385 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
386 system resources (usually memory).
387 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
388 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
389 - A receive completion token with the same Token-
390 >CompletionToken.Event was already in the receive
392 - The current instance is in Tcp4StateClosed state.
393 - The current instance is a passive one and it is in
394 Tcp4StateListen state.
395 - User has called Close() to disconnect this connection.
396 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is
397 no any buffered data in the receive buffer of this instance.
398 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
403 (EFIAPI
*EFI_TCP4_RECEIVE
) (
404 IN EFI_TCP4_PROTOCOL
*This
,
405 IN EFI_TCP4_IO_TOKEN
*Token
410 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
411 nonblocking operation.
413 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
414 @param CloseToken Pointer to the close token to return when operation finishes.
416 @retval EFI_SUCCESS The Close() is called successfully.
417 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
418 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
419 - Configure() has been called with
420 TcpConfigData set to NULL and this function has
422 - Previous Close() call on this instance has not
424 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
426 - CloseToken is NULL.
427 - CloseToken->CompletionToken.Event is NULL.
428 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
429 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
434 (EFIAPI
*EFI_TCP4_CLOSE
) (
435 IN EFI_TCP4_PROTOCOL
*This
,
436 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
441 Abort an asynchronous connection, listen, transmission or receive request.
443 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
444 @param Token Pointer to a token that has been issued by
445 EFI_TCP4_PROTOCOL.Connect(),
446 EFI_TCP4_PROTOCOL.Accept(),
447 EFI_TCP4_PROTOCOL.Transmit() or
448 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending
449 tokens issued by above four functions will be aborted. Type
450 EFI_TCP4_COMPLETION_TOKEN is defined in
451 EFI_TCP4_PROTOCOL.Connect().
453 @retval EFI_SUCCESS Incoming or outgoing data was processed.
454 @retval EFI_INVALID_PARAMETER This is NULL.
455 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
456 @retval EFI_NOT_READY No incoming or outgoing data is processed.
457 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
458 Consider increasing the polling rate.
463 (EFIAPI
*EFI_TCP4_CANCEL
) (
464 IN EFI_TCP4_PROTOCOL
*This
,
465 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
471 Poll to receive incoming data and transmit outgoing segments.
473 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
475 @retval EFI_SUCCESS Incoming or outgoing data was processed.
476 @retval EFI_INVALID_PARAMETER This is NULL.
477 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
478 @retval EFI_NOT_READY No incoming or outgoing data is processed.
479 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
480 Consider increasing the polling rate.
485 (EFIAPI
*EFI_TCP4_POLL
) (
486 IN EFI_TCP4_PROTOCOL
*This
490 struct _EFI_TCP4_PROTOCOL
{
491 EFI_TCP4_GET_MODE_DATA GetModeData
;
492 EFI_TCP4_CONFIGURE Configure
;
493 EFI_TCP4_ROUTES Routes
;
494 EFI_TCP4_CONNECT Connect
;
495 EFI_TCP4_ACCEPT Accept
;
496 EFI_TCP4_TRANSMIT Transmit
;
497 EFI_TCP4_RECEIVE Receive
;
498 EFI_TCP4_CLOSE Close
;
499 EFI_TCP4_CANCEL Cancel
;
503 #define EFI_CONNECTION_FIN EFIERR (104)
504 #define EFI_CONNECTION_RESET EFIERR (105)
505 #define EFI_CONNECTION_REFUSED EFIERR (106)
507 extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid
;
508 extern EFI_GUID gEfiTcp4ProtocolGuid
;