]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Tcp4.h
Add Information Opcode in S3 modules.
[mirror_edk2.git] / MdePkg / Include / Protocol / Tcp4.h
CommitLineData
878ddf1f 1/** @file\r
2 EFI TCPv4 Protocol Definition\r
3 The EFI TCPv4 Service Binding Protocol is used to locate EFI TCPv4 Protocol drivers to create\r
4 and destroy child of the driver to communicate with other host using TCP protocol. \r
5 The EFI TCPv4 Protocol provides services to send and receive data stream. \r
6\r
7 Copyright (c) 2006, Intel Corporation \r
8 All rights reserved. This program and the accompanying materials \r
9 are licensed and made available under the terms and conditions of the BSD License \r
10 which accompanies this distribution. The full text of the license may be found at \r
11 http://opensource.org/licenses/bsd-license.php \r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
15\r
16 Module Name: Tcp4.h\r
17\r
18**/\r
19\r
20#ifndef __EFI_TCP4_PROTOCOL_H__\r
21#define __EFI_TCP4_PROTOCOL_H__\r
22\r
23#define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \\r
24 { \\r
25 0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \\r
26 }\r
27\r
28#define EFI_TCP4_PROTOCOL_GUID \\r
29 { \\r
30 0x65530BC7, 0xA359, 0x410f, {0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } \\r
31 }\r
32\r
33typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL;\r
34\r
35typedef struct {\r
36 EFI_IPv4_ADDRESS LocalAddress;\r
37 UINT16 LocalPort;\r
38 EFI_IPv4_ADDRESS RemoteAddress;\r
39 UINT16 RemotePort;\r
40} EFI_TCP4_SERVICE_POINT;\r
41\r
42typedef struct {\r
43 EFI_HANDLE DriverHandle;\r
44 UINTN ServiceCount;\r
45 EFI_TCP4_SERVICE_POINT Services[1];\r
46} EFI_TCP4_VARIABLE_DATA;\r
47\r
48typedef struct {\r
49 BOOLEAN UseDefaultAddress;\r
50 EFI_IPv4_ADDRESS StationAddress;\r
51 EFI_IPv4_ADDRESS SubnetMask;\r
52 UINT16 StationPort;\r
53 EFI_IPv4_ADDRESS RemoteAddress;\r
54 UINT16 RemotePort;\r
55 BOOLEAN ActiveFlag;\r
56} EFI_TCP4_ACCESS_POINT;\r
57\r
58typedef struct {\r
59 UINTN ReceiveBufferSize;\r
60 UINTN SendBufferSize;\r
61 UINTN MaxSynBackLog;\r
62 UINTN ConnectionTimeout;\r
63 UINTN DataRetries;\r
64 UINTN FinTimeout;\r
65 UINTN TimeWaitTimeout;\r
66 UINTN KeepAliveProbes;\r
67 UINTN KeepAliveTime;\r
68 UINTN KeepAliveInterval;\r
69 BOOLEAN EnableNagle;\r
70 BOOLEAN EnableTimeStamp;\r
71 BOOLEAN EnableWindowScaling;\r
72 BOOLEAN EnableSelectiveAck;\r
73 BOOLEAN EnablePathMtuDiscovery;\r
74} EFI_TCP4_OPTION;\r
75\r
76typedef struct {\r
77 //\r
78 // I/O parameters\r
79 //\r
80 UINT8 TypeOfService;\r
81 UINT8 TimeToLive;\r
82\r
83 //\r
84 // Access Point\r
85 //\r
86 EFI_TCP4_ACCESS_POINT AccessPoint;\r
87 \r
88 // \r
89 // TCP Control Options \r
90 // \r
91 EFI_TCP4_OPTION *ControlOption;\r
92} EFI_TCP4_CONFIG_DATA;\r
93\r
94typedef enum {\r
95 Tcp4StateClosed = 0,\r
96 Tcp4StateListen = 1,\r
97 Tcp4StateSynSent = 2,\r
98 Tcp4StateSynReceived = 3,\r
99 Tcp4StateEstablished = 4,\r
100 Tcp4StateFinWait1 = 5,\r
101 Tcp4StateFinWait2 = 6,\r
102 Tcp4StateClosing = 7,\r
103 Tcp4StateTimeWait = 8,\r
104 Tcp4StateCloseWait = 9,\r
105 Tcp4StateLastAck = 10\r
106} EFI_TCP4_CONNECTION_STATE;\r
107\r
108typedef struct {\r
109 EFI_EVENT Event;\r
110 EFI_STATUS Status;\r
111} EFI_TCP4_COMPLETION_TOKEN;\r
112\r
113typedef struct {\r
114 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
115} EFI_TCP4_CONNECTION_TOKEN;\r
116\r
117typedef struct {\r
118 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
119 EFI_HANDLE NewChildHandle;\r
120} EFI_TCP4_LISTEN_TOKEN;\r
121\r
122typedef struct {\r
123 UINTN FragmentLength;\r
124 VOID *FragmentBuffer;\r
125} EFI_TCP4_FRAGMENT_DATA;\r
126\r
127typedef struct {\r
128 BOOLEAN UrgentFlag;\r
129 IN OUT UINTN DataLength;\r
130 UINTN FragmentCount;\r
131 EFI_TCP4_FRAGMENT_DATA FragmentTable[1];\r
132} EFI_TCP4_RECEIVE_DATA; \r
133\r
134typedef struct { \r
135 BOOLEAN Push;\r
136 BOOLEAN Urgent;\r
137 UINTN DataLength;\r
138 UINTN FragmentCount;\r
139 EFI_TCP4_FRAGMENT_DATA FragmentTable[1];\r
140} EFI_TCP4_TRANSMIT_DATA;\r
141\r
142typedef struct {\r
143 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
144 union {\r
145 EFI_TCP4_RECEIVE_DATA *RxData;\r
146 EFI_TCP4_TRANSMIT_DATA *TxData;\r
147 } Packet;\r
148} EFI_TCP4_IO_TOKEN;\r
149\r
150typedef struct {\r
151 EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
152 BOOLEAN AbortOnClose;\r
153} EFI_TCP4_CLOSE_TOKEN;\r
154\r
155//\r
156// Interface definition for TCP4 protocol\r
157//\r
158\r
159/**\r
160 Get the current operational status.\r
161\r
162 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
163 @param Tcp4State Pointer to the buffer to receive the current TCP state.\r
164 @param Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration.\r
165 @param Ip4ModeData Pointer to the buffer to receive the current IPv4 configuration\r
166 data used by the TCPv4 instance.\r
167 @param MnpConfigData Pointer to the buffer to receive the current MNP configuration\r
168 data used indirectly by the TCPv4 instance.\r
169 @param SnpModeData Pointer to the buffer to receive the current SNP configuration\r
170 data used indirectly by the TCPv4 instance.\r
171\r
172 @retval EFI_SUCCESS The mode data was read.\r
173 @retval EFI_INVALID_PARAMETER This is NULL.\r
511710d6 174 @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't\r
878ddf1f 175 been started.\r
176\r
177**/\r
178typedef\r
179EFI_STATUS\r
180(EFIAPI *EFI_TCP4_GET_MODE_DATA) (\r
181 IN EFI_TCP4_PROTOCOL *This,\r
182 OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,\r
183 OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,\r
184 OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,\r
185 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
186 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
187 )\r
188;\r
189 \r
190/**\r
191 Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.\r
192\r
193 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
194 @param Tcp4ConfigData Pointer to the configure data to configure the instance.\r
195\r
196 @retval EFI_SUCCESS The operational settings are set, changed, or reset\r
197 successfully.\r
198 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
199 @retval EFI_NO_MAPPING When using a default address, configuration (through\r
200 DHCP, BOOTP, RARP, etc.) is not finished yet.\r
201 @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without\r
202 calling Configure() with NULL to reset it.\r
203 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
204 @retval EFI_UNSUPPORTED One or more of the control options are not supported in\r
205 the implementation.\r
206 @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when\r
207 executing Configure().\r
208\r
209**/\r
210typedef\r
211EFI_STATUS\r
212(EFIAPI *EFI_TCP4_CONFIGURE) (\r
213 IN EFI_TCP4_PROTOCOL *This,\r
214 IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL\r
215 )\r
216;\r
217 \r
218\r
219/**\r
220 Add or delete a route entry to the route table\r
221\r
222 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
223 @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to\r
224 FALSE to add this route to the routing table.\r
225 DestinationAddress and SubnetMask are used as the\r
226 keywords to search route entry.\r
227 @param SubnetAddress The destination network.\r
228 @param SubnetMask The subnet mask of the destination network.\r
229 @param GatewayAddress The gateway address for this route. It must be on the same\r
230 subnet with the station address unless a direct route is specified.\r
231\r
232 @retval EFI_SUCCESS The operation completed successfully.\r
233 @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.\r
234 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
235 RARP, etc.) is not finished yet.\r
236 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
237 - This is NULL.\r
238 - SubnetAddress is NULL.\r
239 - SubnetMask is NULL.\r
240 - GatewayAddress is NULL.\r
241 - *SubnetAddress is not NULL a valid subnet address.\r
242 - *SubnetMask is not a valid subnet mask.\r
243 - *GatewayAddress is not a valid unicast IP address or it\r
244 is not in the same subnet.\r
245 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the\r
246 routing table.\r
247 @retval EFI_NOT_FOUND This route is not in the routing table.\r
248 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.\r
249 @retval EFI_UNSUPPORTED The TCP driver does not support this operation.\r
250\r
251**/\r
252typedef\r
253EFI_STATUS\r
254(EFIAPI *EFI_TCP4_ROUTES) (\r
255 IN EFI_TCP4_PROTOCOL *This,\r
256 IN BOOLEAN DeleteRoute,\r
257 IN EFI_IPv4_ADDRESS *SubnetAddress,\r
258 IN EFI_IPv4_ADDRESS *SubnetMask,\r
259 IN EFI_IPv4_ADDRESS *GatewayAddress\r
260 )\r
261; \r
262\r
263/**\r
264 Initiate a nonblocking TCP connection request for an active TCP instance.\r
265\r
266 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
267 @param ConnectionToken Pointer to the connection token to return when the TCP three\r
268 way handshake finishes.\r
269 \r
270 @retval EFI_SUCCESS The connection request is successfully initiated and the state\r
271 - of this TCPv4 instance has been changed to\r
272 - Tcp4StateSynSent.\r
273 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
274 @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:\r
275 - This instance is not configured as an active one.\r
276 - This instance is not in Tcp4StateClosed state.\r
277 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
278 - This is NULL.\r
279 - ConnectionToken is NULL.\r
280 - ConnectionToken->CompletionToken.Event is NULL.\r
511710d6 281 @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activeopen.\r
878ddf1f 282 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
283\r
284**/\r
285typedef\r
286EFI_STATUS\r
287(EFIAPI *EFI_TCP4_CONNECT) (\r
288 IN EFI_TCP4_PROTOCOL *This,\r
289 IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken\r
290 )\r
291; \r
292 \r
293\r
294/**\r
295 Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.\r
296\r
297 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
298 @param ListenToken Pointer to the listen token to return when operation finishes.\r
299\r
300 @retval EFI_SUCCESS The listen token has been queued successfully.\r
301 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
302 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
303 - This instance is not a passive instance.\r
304 - This instance is not in Tcp4StateListen state.\r
305 - The same listen token has already existed in the listen\r
306 token queue of this TCP instance.\r
307 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
308 - This is NULL.\r
309 - ListenToken is NULL.\r
310 - ListentToken->CompletionToken.Event is NULL.\r
311 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.\r
312 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.\r
313\r
314**/\r
315typedef\r
316EFI_STATUS\r
317(EFIAPI *EFI_TCP4_ACCEPT) (\r
318 IN EFI_TCP4_PROTOCOL *This,\r
319 IN EFI_TCP4_LISTEN_TOKEN *ListenToken\r
320 )\r
321; \r
322\r
323/**\r
324 Queues outgoing data into the transmit queue.\r
325\r
326 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
327 @param Token Pointer to the completion token to queue to the transmit queue.\r
328\r
329 @retval EFI_SUCCESS The data has been queued for transmission.\r
330 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
331 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
332 RARP, etc.) is not finished yet.\r
333 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
334 - This is NULL.\r
335 - Token is NULL.\r
336 - Token->CompletionToken.Event is NULL.\r
337 - Token->Packet.TxData is NULL L.\r
338 - Token->Packet.FragmentCount is zero.\r
339 - Token->Packet.DataLength is not equal to the sum of fragment lengths.\r
340 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
341 - A transmit completion token with the same Token->CompletionToken.Event\r
342 was already in the transmission queue.\r
343 - The current instance is in Tcp4StateClosed state.\r
344 - The current instance is a passive one and it is in\r
345 Tcp4StateListen state.\r
346 - User has called Close() to disconnect this connection.\r
347 @retval EFI_NOT_READY The completion token could not be queued because the\r
348 transmit queue is full.\r
349 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource\r
350 shortage.\r
351 @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.\r
352\r
353**/\r
354typedef\r
355EFI_STATUS\r
356(EFIAPI *EFI_TCP4_TRANSMIT) (\r
357 IN EFI_TCP4_PROTOCOL *This,\r
358 IN EFI_TCP4_IO_TOKEN *Token\r
359 )\r
360; \r
361\r
362\r
363/**\r
364 Places an asynchronous receive request into the receiving queue.\r
365\r
366 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
367 @param Token Pointer to a token that is associated with the receive data\r
368 descriptor.\r
369\r
370 @retval EFI_SUCCESS The receive completion token was cached.\r
371 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
372 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,\r
373 etc.) is not finished yet.\r
374 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
375 - This is NULL.\r
376 - Token is NULL.\r
377 - Token->CompletionToken.Event is NULL.\r
378 - Token->Packet.RxData is NULL.\r
379 - Token->Packet.RxData->DataLength is 0.\r
380 - The Token->Packet.RxData->DataLength is not\r
381 the sum of all FragmentBuffer length in FragmentTable.\r
382 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of\r
383 system resources (usually memory).\r
384 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
385 @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
386 - A receive completion token with the same Token-\r
387 >CompletionToken.Event was already in the receive\r
388 queue.\r
389 - The current instance is in Tcp4StateClosed state.\r
390 - The current instance is a passive one and it is in\r
391 Tcp4StateListen state.\r
392 - User has called Close() to disconnect this connection.\r
393 @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is\r
394 no any buffered data in the receive buffer of this instance.\r
395 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r
396\r
397**/\r
398typedef\r
399EFI_STATUS\r
400(EFIAPI *EFI_TCP4_RECEIVE) (\r
401 IN EFI_TCP4_PROTOCOL *This,\r
402 IN EFI_TCP4_IO_TOKEN *Token\r
403 )\r
404; \r
405 \r
406/**\r
407 Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a\r
408 nonblocking operation. \r
409\r
410 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
411 @param CloseToken Pointer to the close token to return when operation finishes.\r
412\r
413 @retval EFI_SUCCESS The Close() is called successfully.\r
414 @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.\r
415 @retval EFI_ACCESS_DENIED One or more of the following are TRUE:\r
416 - Configure() has been called with\r
417 TcpConfigData set to NULL and this function has\r
418 not returned.\r
419 - Previous Close() call on this instance has not\r
420 finished.\r
421 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
422 - This is NULL.\r
423 - CloseToken is NULL.\r
424 - CloseToken->CompletionToken.Event is NULL.\r
425 @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.\r
426 @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.\r
427\r
428**/\r
429typedef\r
430EFI_STATUS\r
431(EFIAPI *EFI_TCP4_CLOSE) (\r
432 IN EFI_TCP4_PROTOCOL *This,\r
433 IN EFI_TCP4_CLOSE_TOKEN *CloseToken\r
434 )\r
435; \r
436\r
437/**\r
438 Abort an asynchronous connection, listen, transmission or receive request.\r
439\r
440 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
441 @param Token Pointer to a token that has been issued by\r
442 EFI_TCP4_PROTOCOL.Connect(),\r
443 EFI_TCP4_PROTOCOL.Accept(),\r
444 EFI_TCP4_PROTOCOL.Transmit() or\r
445 EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending\r
446 tokens issued by above four functions will be aborted. Type\r
447 EFI_TCP4_COMPLETION_TOKEN is defined in\r
448 EFI_TCP4_PROTOCOL.Connect().\r
449\r
450 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
451 @retval EFI_INVALID_PARAMETER This is NULL.\r
452 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
453 @retval EFI_NOT_READY No incoming or outgoing data is processed.\r
454 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.\r
455 Consider increasing the polling rate.\r
456\r
457**/\r
458typedef\r
459EFI_STATUS\r
460(EFIAPI *EFI_TCP4_CANCEL) (\r
461 IN EFI_TCP4_PROTOCOL *This,\r
462 IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r
463 )\r
464; \r
465\r
466\r
467/**\r
468 Poll to receive incoming data and transmit outgoing segments.\r
469\r
470 @param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
471\r
472 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
473 @retval EFI_INVALID_PARAMETER This is NULL.\r
474 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
475 @retval EFI_NOT_READY No incoming or outgoing data is processed.\r
476 @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.\r
477 Consider increasing the polling rate.\r
478\r
479**/\r
480typedef\r
481EFI_STATUS\r
482(EFIAPI *EFI_TCP4_POLL) (\r
483 IN EFI_TCP4_PROTOCOL *This\r
484 )\r
485; \r
486\r
487struct _EFI_TCP4_PROTOCOL {\r
488 EFI_TCP4_GET_MODE_DATA GetModeData;\r
489 EFI_TCP4_CONFIGURE Configure;\r
490 EFI_TCP4_ROUTES Routes;\r
491 EFI_TCP4_CONNECT Connect;\r
492 EFI_TCP4_ACCEPT Accept;\r
493 EFI_TCP4_TRANSMIT Transmit;\r
494 EFI_TCP4_RECEIVE Receive;\r
495 EFI_TCP4_CLOSE Close;\r
496 EFI_TCP4_CANCEL Cancel;\r
497 EFI_TCP4_POLL Poll;\r
498};\r
499\r
500#define EFI_CONNECTION_FIN EFIERR (104)\r
501#define EFI_CONNECTION_RESET EFIERR (105)\r
502#define EFI_CONNECTION_REFUSED EFIERR (106)\r
503\r
504extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid;\r
505extern EFI_GUID gEfiTcp4ProtocolGuid;\r
506\r
507#endif\r