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.
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
;
96 /// TCP4 connnection state
101 Tcp4StateSynSent
= 2,
102 Tcp4StateSynReceived
= 3,
103 Tcp4StateEstablished
= 4,
104 Tcp4StateFinWait1
= 5,
105 Tcp4StateFinWait2
= 6,
106 Tcp4StateClosing
= 7,
107 Tcp4StateTimeWait
= 8,
108 Tcp4StateCloseWait
= 9,
109 Tcp4StateLastAck
= 10
110 } EFI_TCP4_CONNECTION_STATE
;
115 } EFI_TCP4_COMPLETION_TOKEN
;
118 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
119 } EFI_TCP4_CONNECTION_TOKEN
;
122 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
123 EFI_HANDLE NewChildHandle
;
124 } EFI_TCP4_LISTEN_TOKEN
;
127 UINT32 FragmentLength
;
128 VOID
*FragmentBuffer
;
129 } EFI_TCP4_FRAGMENT_DATA
;
134 UINT32 FragmentCount
;
135 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
136 } EFI_TCP4_RECEIVE_DATA
;
142 UINT32 FragmentCount
;
143 EFI_TCP4_FRAGMENT_DATA FragmentTable
[1];
144 } EFI_TCP4_TRANSMIT_DATA
;
147 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
149 EFI_TCP4_RECEIVE_DATA
*RxData
;
150 EFI_TCP4_TRANSMIT_DATA
*TxData
;
155 EFI_TCP4_COMPLETION_TOKEN CompletionToken
;
156 BOOLEAN AbortOnClose
;
157 } EFI_TCP4_CLOSE_TOKEN
;
160 // Interface definition for TCP4 protocol
164 Get the current operational status.
166 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
167 @param Tcp4State Pointer to the buffer to receive the current TCP state.
168 @param Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration.
169 @param Ip4ModeData Pointer to the buffer to receive the current IPv4 configuration
170 data used by the TCPv4 instance.
171 @param MnpConfigData Pointer to the buffer to receive the current MNP configuration
172 data used indirectly by the TCPv4 instance.
173 @param SnpModeData Pointer to the buffer to receive the current SNP configuration
174 data used indirectly by the TCPv4 instance.
176 @retval EFI_SUCCESS The mode data was read.
177 @retval EFI_INVALID_PARAMETER This is NULL.
178 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
184 (EFIAPI
*EFI_TCP4_GET_MODE_DATA
)(
185 IN CONST EFI_TCP4_PROTOCOL
*This
,
186 OUT EFI_TCP4_CONNECTION_STATE
*Tcp4State OPTIONAL
,
187 OUT EFI_TCP4_CONFIG_DATA
*Tcp4ConfigData OPTIONAL
,
188 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
189 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
190 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
222 Add or delete a route entry to the route table
224 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
225 @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to
226 FALSE to add this route to the routing table.
227 DestinationAddress and SubnetMask are used as the
228 keywords to search route entry.
229 @param SubnetAddress The destination network.
230 @param SubnetMask The subnet mask of the destination network.
231 @param GatewayAddress The gateway address for this route. It must be on the same
232 subnet with the station address unless a direct route is specified.
234 @retval EFI_SUCCESS The operation completed successfully.
235 @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.
236 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
237 RARP, etc.) is not finished yet.
238 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
240 - SubnetAddress is NULL.
241 - SubnetMask is NULL.
242 - GatewayAddress is NULL.
243 - *SubnetAddress is not NULL a valid subnet address.
244 - *SubnetMask is not a valid subnet mask.
245 - *GatewayAddress is not a valid unicast IP address or it
246 is not in the same subnet.
247 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the
249 @retval EFI_NOT_FOUND This route is not in the routing table.
250 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
251 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
256 (EFIAPI
*EFI_TCP4_ROUTES
)(
257 IN EFI_TCP4_PROTOCOL
*This
,
258 IN BOOLEAN DeleteRoute
,
259 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
260 IN EFI_IPv4_ADDRESS
*SubnetMask
,
261 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 Tcp4StateSynSent.
273 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
274 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
275 - This instance is not configured as an active one.
276 - This instance is not in Tcp4StateClosed state.
277 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
279 - ConnectionToken is NULL.
280 - ConnectionToken->CompletionToken.Event is NULL.
281 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activ eopen.
282 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
287 (EFIAPI
*EFI_TCP4_CONNECT
)(
288 IN EFI_TCP4_PROTOCOL
*This
,
289 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
294 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.
296 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
297 @param ListenToken Pointer to the listen token to return when operation finishes.
299 @retval EFI_SUCCESS The listen token has been queued successfully.
300 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
301 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
302 - This instance is not a passive instance.
303 - This instance is not in Tcp4StateListen state.
304 - The same listen token has already existed in the listen
305 token queue of this TCP instance.
306 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
308 - ListenToken is NULL.
309 - ListentToken->CompletionToken.Event is NULL.
310 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
311 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
316 (EFIAPI
*EFI_TCP4_ACCEPT
)(
317 IN EFI_TCP4_PROTOCOL
*This
,
318 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
322 Queues outgoing data into the transmit queue.
324 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
325 @param Token Pointer to the completion token to queue to the transmit queue.
327 @retval EFI_SUCCESS The data has been queued for transmission.
328 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
329 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
330 RARP, etc.) is not finished yet.
331 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
334 - Token->CompletionToken.Event is NULL.
335 - Token->Packet.TxData is NULL L.
336 - Token->Packet.FragmentCount is zero.
337 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
338 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
339 - A transmit completion token with the same Token->CompletionToken.Event
340 was already in the transmission queue.
341 - The current instance is in Tcp4StateClosed state.
342 - The current instance is a passive one and it is in
343 Tcp4StateListen state.
344 - User has called Close() to disconnect this connection.
345 @retval EFI_NOT_READY The completion token could not be queued because the
346 transmit queue is full.
347 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource
349 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
354 (EFIAPI
*EFI_TCP4_TRANSMIT
)(
355 IN EFI_TCP4_PROTOCOL
*This
,
356 IN EFI_TCP4_IO_TOKEN
*Token
361 Places an asynchronous receive request into the receiving queue.
363 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
364 @param Token Pointer to a token that is associated with the receive data
367 @retval EFI_SUCCESS The receive completion token was cached.
368 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
369 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,
370 etc.) is not finished yet.
371 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
374 - Token->CompletionToken.Event is NULL.
375 - Token->Packet.RxData is NULL.
376 - Token->Packet.RxData->DataLength is 0.
377 - The Token->Packet.RxData->DataLength is not
378 the sum of all FragmentBuffer length in FragmentTable.
379 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
380 system resources (usually memory).
381 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
382 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
383 - A receive completion token with the same Token-
384 >CompletionToken.Event was already in the receive
386 - The current instance is in Tcp4StateClosed state.
387 - The current instance is a passive one and it is in
388 Tcp4StateListen state.
389 - User has called Close() to disconnect this connection.
390 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is
391 no any buffered data in the receive buffer of this instance.
392 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
397 (EFIAPI
*EFI_TCP4_RECEIVE
)(
398 IN EFI_TCP4_PROTOCOL
*This
,
399 IN EFI_TCP4_IO_TOKEN
*Token
403 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
404 nonblocking operation.
406 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
407 @param CloseToken Pointer to the close token to return when operation finishes.
409 @retval EFI_SUCCESS The Close() is called successfully.
410 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
411 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
412 - Configure() has been called with
413 TcpConfigData set to NULL and this function has
415 - Previous Close() call on this instance has not
417 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
419 - CloseToken is NULL.
420 - CloseToken->CompletionToken.Event is NULL.
421 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
422 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
427 (EFIAPI
*EFI_TCP4_CLOSE
)(
428 IN EFI_TCP4_PROTOCOL
*This
,
429 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
433 Abort an asynchronous connection, listen, transmission or receive request.
435 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
436 @param Token Pointer to a token that has been issued by
437 EFI_TCP4_PROTOCOL.Connect(),
438 EFI_TCP4_PROTOCOL.Accept(),
439 EFI_TCP4_PROTOCOL.Transmit() or
440 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending
441 tokens issued by above four functions will be aborted. Type
442 EFI_TCP4_COMPLETION_TOKEN is defined in
443 EFI_TCP4_PROTOCOL.Connect().
445 @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
447 @retval EFI_INVALID_PARAMETER This is NULL.
448 @retval EFI_NOT_STARTED This instance hasn't been configured.
449 @retval EFI_NO_MAPPING When using the default address, configuration
450 (DHCP, BOOTP,RARP, etc.) hasn't finished yet.
451 @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the
452 transmission or receive queue. It has either
453 completed or wasn't issued by Transmit() and Receive().
458 (EFIAPI
*EFI_TCP4_CANCEL
)(
459 IN EFI_TCP4_PROTOCOL
*This
,
460 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
465 Poll to receive incoming data and transmit outgoing segments.
467 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
469 @retval EFI_SUCCESS Incoming or outgoing data was processed.
470 @retval EFI_INVALID_PARAMETER This is NULL.
471 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
472 @retval EFI_NOT_READY No incoming or outgoing data is processed.
473 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
474 Consider increasing the polling rate.
479 (EFIAPI
*EFI_TCP4_POLL
)(
480 IN EFI_TCP4_PROTOCOL
*This
484 /// The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by
485 /// any network drivers or applications to send or receive data stream.
486 /// It can either listen on a specified port as a service or actively connected
487 /// to remote peer as a client. Each instance has its own independent settings,
488 /// such as the routing table.
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 extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid
;
504 extern EFI_GUID gEfiTcp4ProtocolGuid
;