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 - 2008, 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
191 Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.
193 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
194 @param Tcp4ConfigData Pointer to the configure data to configure the instance.
196 @retval EFI_SUCCESS The operational settings are set, changed, or reset
198 @retval EFI_INVALID_PARAMETER Some parameter is invalid.
199 @retval EFI_NO_MAPPING When using a default address, configuration (through
200 DHCP, BOOTP, RARP, etc.) is not finished yet.
201 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
202 calling Configure() with NULL to reset it.
203 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
204 @retval EFI_UNSUPPORTED One or more of the control options are not supported in
206 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
207 executing Configure().
212 (EFIAPI
*EFI_TCP4_CONFIGURE
)(
213 IN EFI_TCP4_PROTOCOL
*This
,
214 IN EFI_TCP4_CONFIG_DATA
*TcpConfigData OPTIONAL
219 Add or delete a route entry to the route table
221 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
222 @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to
223 FALSE to add this route to the routing table.
224 DestinationAddress and SubnetMask are used as the
225 keywords to search route entry.
226 @param SubnetAddress The destination network.
227 @param SubnetMask The subnet mask of the destination network.
228 @param GatewayAddress The gateway address for this route. It must be on the same
229 subnet with the station address unless a direct route is specified.
231 @retval EFI_SUCCESS The operation completed successfully.
232 @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.
233 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
234 RARP, etc.) is not finished yet.
235 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
237 - SubnetAddress is NULL.
238 - SubnetMask is NULL.
239 - GatewayAddress is NULL.
240 - *SubnetAddress is not NULL a valid subnet address.
241 - *SubnetMask is not a valid subnet mask.
242 - *GatewayAddress is not a valid unicast IP address or it
243 is not in the same subnet.
244 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the
246 @retval EFI_NOT_FOUND This route is not in the routing table.
247 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
248 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
253 (EFIAPI
*EFI_TCP4_ROUTES
)(
254 IN EFI_TCP4_PROTOCOL
*This
,
255 IN BOOLEAN DeleteRoute
,
256 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
257 IN EFI_IPv4_ADDRESS
*SubnetMask
,
258 IN EFI_IPv4_ADDRESS
*GatewayAddress
262 Initiate a nonblocking TCP connection request for an active TCP instance.
264 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
265 @param ConnectionToken Pointer to the connection token to return when the TCP three
266 way handshake finishes.
268 @retval EFI_SUCCESS The connection request is successfully initiated and the state
269 - of this TCPv4 instance has been changed to
271 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
272 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
273 - This instance is not configured as an active one.
274 - This instance is not in Tcp4StateClosed state.
275 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
277 - ConnectionToken is NULL.
278 - ConnectionToken->CompletionToken.Event is NULL.
279 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activeopen.
280 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
285 (EFIAPI
*EFI_TCP4_CONNECT
)(
286 IN EFI_TCP4_PROTOCOL
*This
,
287 IN EFI_TCP4_CONNECTION_TOKEN
*ConnectionToken
292 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.
294 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
295 @param ListenToken Pointer to the listen token to return when operation finishes.
297 @retval EFI_SUCCESS The listen token has been queued successfully.
298 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
299 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
300 - This instance is not a passive instance.
301 - This instance is not in Tcp4StateListen state.
302 - The same listen token has already existed in the listen
303 token queue of this TCP instance.
304 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
306 - ListenToken is NULL.
307 - ListentToken->CompletionToken.Event is NULL.
308 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
309 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
314 (EFIAPI
*EFI_TCP4_ACCEPT
)(
315 IN EFI_TCP4_PROTOCOL
*This
,
316 IN EFI_TCP4_LISTEN_TOKEN
*ListenToken
320 Queues outgoing data into the transmit queue.
322 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
323 @param Token Pointer to the completion token to queue to the transmit queue.
325 @retval EFI_SUCCESS The data has been queued for transmission.
326 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
327 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
328 RARP, etc.) is not finished yet.
329 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
332 - Token->CompletionToken.Event is NULL.
333 - Token->Packet.TxData is NULL L.
334 - Token->Packet.FragmentCount is zero.
335 - Token->Packet.DataLength is not equal to the sum of fragment lengths.
336 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
337 - A transmit completion token with the same Token->CompletionToken.Event
338 was already in the transmission queue.
339 - The current instance is in Tcp4StateClosed state.
340 - The current instance is a passive one and it is in
341 Tcp4StateListen state.
342 - User has called Close() to disconnect this connection.
343 @retval EFI_NOT_READY The completion token could not be queued because the
344 transmit queue is full.
345 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource
347 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
352 (EFIAPI
*EFI_TCP4_TRANSMIT
)(
353 IN EFI_TCP4_PROTOCOL
*This
,
354 IN EFI_TCP4_IO_TOKEN
*Token
359 Places an asynchronous receive request into the receiving queue.
361 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
362 @param Token Pointer to a token that is associated with the receive data
365 @retval EFI_SUCCESS The receive completion token was cached.
366 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
367 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,
368 etc.) is not finished yet.
369 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
372 - Token->CompletionToken.Event is NULL.
373 - Token->Packet.RxData is NULL.
374 - Token->Packet.RxData->DataLength is 0.
375 - The Token->Packet.RxData->DataLength is not
376 the sum of all FragmentBuffer length in FragmentTable.
377 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
378 system resources (usually memory).
379 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
380 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
381 - A receive completion token with the same Token-
382 >CompletionToken.Event was already in the receive
384 - The current instance is in Tcp4StateClosed state.
385 - The current instance is a passive one and it is in
386 Tcp4StateListen state.
387 - User has called Close() to disconnect this connection.
388 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is
389 no any buffered data in the receive buffer of this instance.
390 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
395 (EFIAPI
*EFI_TCP4_RECEIVE
)(
396 IN EFI_TCP4_PROTOCOL
*This
,
397 IN EFI_TCP4_IO_TOKEN
*Token
401 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
402 nonblocking operation.
404 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
405 @param CloseToken Pointer to the close token to return when operation finishes.
407 @retval EFI_SUCCESS The Close() is called successfully.
408 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
409 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
410 - Configure() has been called with
411 TcpConfigData set to NULL and this function has
413 - Previous Close() call on this instance has not
415 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
417 - CloseToken is NULL.
418 - CloseToken->CompletionToken.Event is NULL.
419 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
420 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
425 (EFIAPI
*EFI_TCP4_CLOSE
)(
426 IN EFI_TCP4_PROTOCOL
*This
,
427 IN EFI_TCP4_CLOSE_TOKEN
*CloseToken
431 Abort an asynchronous connection, listen, transmission or receive request.
433 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
434 @param Token Pointer to a token that has been issued by
435 EFI_TCP4_PROTOCOL.Connect(),
436 EFI_TCP4_PROTOCOL.Accept(),
437 EFI_TCP4_PROTOCOL.Transmit() or
438 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending
439 tokens issued by above four functions will be aborted. Type
440 EFI_TCP4_COMPLETION_TOKEN is defined in
441 EFI_TCP4_PROTOCOL.Connect().
443 @retval EFI_SUCCESS Incoming or outgoing data was processed.
444 @retval EFI_INVALID_PARAMETER This is NULL.
445 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
446 @retval EFI_NOT_READY No incoming or outgoing data is processed.
447 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
448 Consider increasing the polling rate.
453 (EFIAPI
*EFI_TCP4_CANCEL
)(
454 IN EFI_TCP4_PROTOCOL
*This
,
455 IN EFI_TCP4_COMPLETION_TOKEN
*Token OPTIONAL
460 Poll to receive incoming data and transmit outgoing segments.
462 @param This Pointer to the EFI_TCP4_PROTOCOL instance.
464 @retval EFI_SUCCESS Incoming or outgoing data was processed.
465 @retval EFI_INVALID_PARAMETER This is NULL.
466 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
467 @retval EFI_NOT_READY No incoming or outgoing data is processed.
468 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
469 Consider increasing the polling rate.
474 (EFIAPI
*EFI_TCP4_POLL
)(
475 IN EFI_TCP4_PROTOCOL
*This
479 @par Protocol Description:
480 The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by
481 any network drivers or applications to send or receive data stream.
482 It can either listen on a specified port as a service or actively connected
483 to remote peer as a client. Each instance has its own independent settings,
484 such as the routing table.
486 struct _EFI_TCP4_PROTOCOL
{
487 EFI_TCP4_GET_MODE_DATA GetModeData
;
488 EFI_TCP4_CONFIGURE Configure
;
489 EFI_TCP4_ROUTES Routes
;
490 EFI_TCP4_CONNECT Connect
;
491 EFI_TCP4_ACCEPT Accept
;
492 EFI_TCP4_TRANSMIT Transmit
;
493 EFI_TCP4_RECEIVE Receive
;
494 EFI_TCP4_CLOSE Close
;
495 EFI_TCP4_CANCEL Cancel
;
499 #define EFI_CONNECTION_FIN EFIERR (104)
500 #define EFI_CONNECTION_RESET EFIERR (105)
501 #define EFI_CONNECTION_REFUSED EFIERR (106)
503 extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid
;
504 extern EFI_GUID gEfiTcp4ProtocolGuid
;