]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/EfiSocketLib/Socket.h
ShellPkg: Fix ICC11 build failure.
[mirror_edk2.git] / StdLib / EfiSocketLib / Socket.h
CommitLineData
d7ce7006 1/** @file\r
2 Definitions for the Socket layer driver.\r
3\r
4 Copyright (c) 2011, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14#ifndef _SOCKET_H_\r
15#define _SOCKET_H_\r
16\r
17#include <Efi/EfiSocketLib.h>\r
18\r
19//------------------------------------------------------------------------------\r
20// Constants\r
21//------------------------------------------------------------------------------\r
22\r
23#define DEBUG_SOCKET 0x20000000 ///< Display Socket related messages\r
24#define DEBUG_BIND 0x10000000 ///< Display bind related messages\r
25#define DEBUG_LISTEN 0x08000000 ///< Display listen related messages\r
26#define DEBUG_CONNECTION 0x04000000 ///< Display connection list related messages\r
27#define DEBUG_POLL 0x02000000 ///< Display poll messages\r
28#define DEBUG_ACCEPT 0x01000000 ///< Display accept related messages\r
29#define DEBUG_RX 0x00800000 ///< Display receive messages\r
30#define DEBUG_TX 0x00400000 ///< Display transmit messages\r
31#define DEBUG_CLOSE 0x00200000 ///< Display close messages\r
32#define DEBUG_CONNECT 0x00100000 ///< Display connect messages\r
a88c3163 33#define DEBUG_OPTION 0x00080000 ///< Display option messages\r
d7ce7006 34\r
35#define MAX_PENDING_CONNECTIONS 1 ///< Maximum connection FIFO depth\r
36#define MAX_RX_DATA 65536 ///< Maximum receive data size\r
a88c3163 37#define MAX_TX_DATA ( MAX_RX_DATA * 2 ) ///< Maximum buffered transmit data in bytes\r
d7ce7006 38#define RX_PACKET_DATA 16384 ///< Maximum number of bytes in a RX packet\r
a88c3163 39#define MAX_UDP_RETRANSMIT 16 ///< UDP retransmit attempts to handle address not mapped\r
d7ce7006 40\r
a88c3163 41#define ESL_STRUCTURE_ALIGNMENT_BYTES 15 ///< Number of bytes for structure alignment\r
42#define ESL_STRUCTURE_ALIGNMENT_MASK ( ~ESL_STRUCTURE_ALIGNMENT_BYTES ) ///< Mask to align structures\r
d7ce7006 43\r
a88c3163 44#define LAYER_SIGNATURE SIGNATURE_32 ('S','k','t','L') ///< ESL_LAYER memory signature\r
45#define SERVICE_SIGNATURE SIGNATURE_32 ('S','k','t','S') ///< ESL_SERVICE memory signature\r
46#define SOCKET_SIGNATURE SIGNATURE_32 ('S','c','k','t') ///< ESL_SOCKET memory signature\r
47#define PORT_SIGNATURE SIGNATURE_32 ('P','o','r','t') ///< ESL_PORT memory signature\r
d7ce7006 48\r
a88c3163 49\r
50/**\r
51 Socket states\r
52**/\r
d7ce7006 53typedef enum\r
54{\r
55 SOCKET_STATE_NOT_CONFIGURED = 0, ///< socket call was successful\r
56 SOCKET_STATE_BOUND, ///< bind call was successful\r
57 SOCKET_STATE_LISTENING, ///< listen call was successful\r
58 SOCKET_STATE_NO_PORTS, ///< No ports available\r
59 SOCKET_STATE_IN_FIFO, ///< Socket on FIFO\r
60 SOCKET_STATE_CONNECTING, ///< Connecting to a remote system\r
61 SOCKET_STATE_CONNECTED, ///< Accept or connect call was successful\r
62\r
63 //\r
64 // Close state must be the last in the list\r
65 //\r
66 SOCKET_STATE_CLOSED ///< Close call was successful\r
67} SOCKET_STATE;\r
68\r
a88c3163 69\r
70/**\r
71 Port states\r
72**/\r
d7ce7006 73typedef enum\r
74{\r
75 PORT_STATE_ALLOCATED = 0, ///< Port allocated\r
76 PORT_STATE_OPEN, ///< Port opened\r
77 PORT_STATE_RX_ERROR, ///< Receive error detected\r
78\r
79 //\r
a88c3163 80 // Close state must be last in the list!\r
81 //\r
82 // Using < <= > >= in tests code to detect port close state\r
83 // machine has started\r
d7ce7006 84 //\r
85 PORT_STATE_CLOSE_STARTED, ///< Close started on port\r
86 PORT_STATE_CLOSE_TX_DONE, ///< Transmits shutdown\r
a88c3163 87 PORT_STATE_CLOSE_DONE, ///< Port close operation complete\r
88 PORT_STATE_CLOSE_RX_DONE ///< Receives shutdown\r
d7ce7006 89} PORT_STATE;\r
90\r
91//------------------------------------------------------------------------------\r
92// Data Types\r
93//------------------------------------------------------------------------------\r
94\r
a88c3163 95typedef struct _ESL_IO_MGMT ESL_IO_MGMT;///< Forward declaration\r
96typedef struct _ESL_PACKET ESL_PACKET; ///< Forward declaration\r
97typedef struct _ESL_PORT ESL_PORT; ///< Forward declaration\r
98typedef struct _ESL_SOCKET ESL_SOCKET; ///< Forward declaration\r
99\r
100/**\r
101 Receive context for SOCK_RAW sockets using IPv4.\r
102**/\r
103typedef struct\r
104{\r
105 EFI_IP4_RECEIVE_DATA * pRxData; ///< Receive operation description\r
106} ESL_IP4_RX_DATA;\r
107\r
108\r
109/**\r
110 Transmit context for SOCK_RAW sockets using IPv4.\r
111**/\r
112typedef struct\r
113{\r
114 EFI_IP4_OVERRIDE_DATA Override; ///< Override data\r
115 EFI_IP4_TRANSMIT_DATA TxData; ///< Transmit operation description\r
116 UINT8 Buffer[ 1 ]; ///< Data buffer\r
117} ESL_IP4_TX_DATA;\r
d7ce7006 118\r
a88c3163 119\r
120/**\r
121 Receive context for SOCK_STREAM and SOCK_SEQPACKET sockets using TCPv4.\r
122**/\r
d7ce7006 123typedef struct\r
124{\r
125 EFI_TCP4_RECEIVE_DATA RxData; ///< Receive operation description\r
a88c3163 126 UINT8 Buffer[ RX_PACKET_DATA ]; ///< Data buffer\r
127} ESL_TCP4_RX_DATA;\r
128\r
d7ce7006 129\r
a88c3163 130/**\r
131 Transmit context for SOCK_STREAM and SOCK_SEQPACKET sockets using TCPv4.\r
132**/\r
d7ce7006 133typedef struct\r
134{\r
135 EFI_TCP4_TRANSMIT_DATA TxData; ///< Transmit operation description\r
a88c3163 136 UINT8 Buffer[ 1 ]; ///< Data buffer\r
137} ESL_TCP4_TX_DATA;\r
d7ce7006 138\r
a88c3163 139\r
3bdf9aae 140/**\r
141 Receive context for SOCK_STREAM and SOCK_SEQPACKET sockets using TCPv6.\r
142**/\r
143typedef struct\r
144{\r
145 EFI_TCP6_RECEIVE_DATA RxData; ///< Receive operation description\r
146 UINT8 Buffer[ RX_PACKET_DATA ]; ///< Data buffer\r
147} ESL_TCP6_RX_DATA;\r
148\r
149\r
150/**\r
151 Transmit context for SOCK_STREAM and SOCK_SEQPACKET sockets using TCPv6.\r
152**/\r
153typedef struct\r
154{\r
155 EFI_TCP6_TRANSMIT_DATA TxData; ///< Transmit operation description\r
156 UINT8 Buffer[ 1 ]; ///< Data buffer\r
157} ESL_TCP6_TX_DATA;\r
158\r
159\r
a88c3163 160/**\r
161 Receive context for SOCK_DGRAM sockets using UDPv4.\r
162**/\r
d7ce7006 163typedef struct\r
164{\r
a88c3163 165 EFI_UDP4_SESSION_DATA Session; ///< Remote network address\r
166 EFI_UDP4_RECEIVE_DATA * pRxData; ///< Receive operation description\r
167} ESL_UDP4_RX_DATA;\r
d7ce7006 168\r
a88c3163 169\r
170/**\r
171 Transmit context for SOCK_DGRAM sockets using UDPv4.\r
172**/\r
d7ce7006 173typedef struct\r
174{\r
175 EFI_UDP4_SESSION_DATA Session; ///< Remote network address\r
176 EFI_UDP4_TRANSMIT_DATA TxData; ///< Transmit operation description\r
a88c3163 177 UINTN RetransmitCount; ///< Retransmit to handle ARP negotiation\r
178 UINT8 Buffer[ 1 ]; ///< Data buffer\r
179} ESL_UDP4_TX_DATA;\r
180\r
d7ce7006 181\r
3bdf9aae 182/**\r
183 Receive context for SOCK_DGRAM sockets using UDPv6.\r
184**/\r
185typedef struct\r
186{\r
187 EFI_UDP6_SESSION_DATA Session; ///< Remote network address\r
188 EFI_UDP6_RECEIVE_DATA * pRxData; ///< Receive operation description\r
189} ESL_UDP6_RX_DATA;\r
190\r
191\r
192/**\r
193 Transmit context for SOCK_DGRAM sockets using UDPv6.\r
194**/\r
195typedef struct\r
196{\r
197 EFI_UDP6_SESSION_DATA Session; ///< Remote network address\r
198 EFI_UDP6_TRANSMIT_DATA TxData; ///< Transmit operation description\r
199 UINTN RetransmitCount; ///< Retransmit to handle ARP negotiation\r
200 UINT8 Buffer[ 1 ]; ///< Data buffer\r
201} ESL_UDP6_TX_DATA;\r
202\r
203\r
a88c3163 204/**\r
205 Network specific context for transmit and receive packets.\r
206**/\r
207typedef struct _ESL_PACKET {\r
208 ESL_PACKET * pNext; ///< Next packet in the receive list\r
d7ce7006 209 size_t PacketSize; ///< Size of this data structure\r
a88c3163 210 size_t ValidBytes; ///< Length of valid data in bytes\r
211 UINT8 * pBuffer; ///< Current data pointer\r
d7ce7006 212 union {\r
a88c3163 213 ESL_IP4_RX_DATA Ip4Rx; ///< Receive operation description\r
214 ESL_IP4_TX_DATA Ip4Tx; ///< Transmit operation description\r
215 ESL_TCP4_RX_DATA Tcp4Rx; ///< Receive operation description\r
216 ESL_TCP4_TX_DATA Tcp4Tx; ///< Transmit operation description\r
3bdf9aae 217 ESL_TCP6_RX_DATA Tcp6Rx; ///< Receive operation description\r
218 ESL_TCP6_TX_DATA Tcp6Tx; ///< Transmit operation description\r
a88c3163 219 ESL_UDP4_RX_DATA Udp4Rx; ///< Receive operation description\r
220 ESL_UDP4_TX_DATA Udp4Tx; ///< Transmit operation description\r
3bdf9aae 221 ESL_UDP6_RX_DATA Udp6Rx; ///< Receive operation description\r
222 ESL_UDP6_TX_DATA Udp6Tx; ///< Transmit operation description\r
a88c3163 223 } Op; ///< Network specific context\r
224} GCC_ESL_PACKET;\r
d7ce7006 225\r
226/**\r
227 Service control structure\r
228\r
229 The driver uses this structure to manage the network devices.\r
230**/\r
a88c3163 231typedef struct _ESL_SERVICE {\r
d7ce7006 232 UINTN Signature; ///< Structure identification\r
233\r
234 //\r
235 // Links\r
236 //\r
a88c3163 237 ESL_SERVICE * pNext; ///< Next service in the service list\r
d7ce7006 238\r
239 //\r
240 // Service data\r
241 //\r
a88c3163 242 CONST ESL_SOCKET_BINDING * pSocketBinding; ///< Name and shutdown routine\r
243 EFI_HANDLE Controller; ///< Controller for the service\r
244 EFI_SERVICE_BINDING_PROTOCOL * pServiceBinding; ///< Network layer service binding interface\r
d7ce7006 245\r
246 //\r
247 // Network data\r
248 //\r
a88c3163 249 ESL_PORT * pPortList; ///< List of ports using this service\r
250}GCC_ESL_SERVICE;\r
d7ce7006 251\r
252/**\r
a88c3163 253 IO management structure\r
d7ce7006 254\r
a88c3163 255 This structure manages a single operation with the network.\r
256**/\r
257typedef struct _ESL_IO_MGMT {\r
258 ESL_IO_MGMT * pNext; ///< Next TX management structure\r
259 ESL_PORT * pPort; ///< Port structure address\r
260 ESL_PACKET * pPacket; ///< Packet structure address\r
261 union {\r
262 EFI_IP4_COMPLETION_TOKEN Ip4Rx; ///< IP4 receive token\r
263 EFI_IP4_COMPLETION_TOKEN Ip4Tx; ///< IP4 transmit token\r
264 EFI_TCP4_IO_TOKEN Tcp4Rx; ///< TCP4 receive token\r
265 EFI_TCP4_IO_TOKEN Tcp4Tx; ///< TCP4 transmit token\r
3bdf9aae 266 EFI_TCP6_IO_TOKEN Tcp6Rx; ///< TCP6 receive token\r
267 EFI_TCP6_IO_TOKEN Tcp6Tx; ///< TCP6 transmit token\r
a88c3163 268 EFI_UDP4_COMPLETION_TOKEN Udp4Rx; ///< UDP4 receive token\r
269 EFI_UDP4_COMPLETION_TOKEN Udp4Tx; ///< UDP4 transmit token\r
3bdf9aae 270 EFI_UDP6_COMPLETION_TOKEN Udp6Rx; ///< UDP6 receive token\r
271 EFI_UDP6_COMPLETION_TOKEN Udp6Tx; ///< UDP6 transmit token\r
a88c3163 272 } Token; ///< Completion token for the network operation\r
58081f2c 273} GCC_IO_MGMT;\r
a88c3163 274\r
275/**\r
276 IP4 context structure\r
d7ce7006 277\r
a88c3163 278 The driver uses this structure to manage the IP4 connections.\r
d7ce7006 279**/\r
a88c3163 280typedef struct {\r
281 //\r
282 // IP4 context\r
283 //\r
284 EFI_IP4_MODE_DATA ModeData; ///< IP4 mode data, includes configuration data\r
285 EFI_IPv4_ADDRESS DestinationAddress; ///< Default destination address\r
286} ESL_IP4_CONTEXT;\r
287\r
d7ce7006 288\r
289/**\r
290 TCP4 context structure\r
291\r
292 The driver uses this structure to manage the TCP4 connections.\r
293**/\r
294typedef struct {\r
295 //\r
296 // TCP4 context\r
297 //\r
a88c3163 298 EFI_TCP4_CONFIG_DATA ConfigData; ///< TCP4 configuration data\r
299 EFI_TCP4_OPTION Option; ///< TCP4 port options\r
d7ce7006 300\r
301 //\r
302 // Tokens\r
303 //\r
a88c3163 304 EFI_TCP4_LISTEN_TOKEN ListenToken; ///< Listen control\r
d7ce7006 305 EFI_TCP4_CONNECTION_TOKEN ConnectToken; ///< Connection control\r
a88c3163 306 EFI_TCP4_CLOSE_TOKEN CloseToken; ///< Close control\r
307} ESL_TCP4_CONTEXT;\r
d7ce7006 308\r
3bdf9aae 309/**\r
310 TCP6 context structure\r
311\r
312 The driver uses this structure to manage the TCP6 connections.\r
313**/\r
314typedef struct {\r
315 //\r
316 // TCP6 context\r
317 //\r
318 EFI_TCP6_CONFIG_DATA ConfigData; ///< TCP6 configuration data\r
319 EFI_TCP6_OPTION Option; ///< TCP6 port options\r
320\r
321 //\r
322 // Tokens\r
323 //\r
324 EFI_TCP6_LISTEN_TOKEN ListenToken; ///< Listen control\r
325 EFI_TCP6_CONNECTION_TOKEN ConnectToken; ///< Connection control\r
326 EFI_TCP6_CLOSE_TOKEN CloseToken; ///< Close control\r
327} ESL_TCP6_CONTEXT;\r
328\r
d7ce7006 329/**\r
330 UDP4 context structure\r
331\r
332 The driver uses this structure to manage the UDP4 connections.\r
333**/\r
334typedef struct {\r
335 //\r
336 // UDP4 context\r
337 //\r
d7ce7006 338 EFI_UDP4_CONFIG_DATA ConfigData; ///< UDP4 configuration data\r
a88c3163 339} ESL_UDP4_CONTEXT;\r
d7ce7006 340\r
3bdf9aae 341/**\r
342 UDP6 context structure\r
343\r
344 The driver uses this structure to manage the UDP6 connections.\r
345**/\r
346typedef struct {\r
347 //\r
348 // UDP6 context\r
349 //\r
350 EFI_UDP6_CONFIG_DATA ConfigData; ///< UDP6 configuration data\r
351} ESL_UDP6_CONTEXT;\r
352\r
d7ce7006 353\r
a88c3163 354/**\r
355 Configure the network layer.\r
356\r
357 @param [in] pProtocol Protocol structure address\r
358 @param [in] pConfigData Address of the confiuration data\r
359\r
360 @return Returns EFI_SUCCESS if the operation is successfully\r
361 started.\r
362**/\r
363typedef\r
364EFI_STATUS\r
365(* PFN_NET_CONFIGURE) (\r
366 IN VOID * pProtocol,\r
367 IN VOID * pConfigData\r
368 );\r
369\r
370/**\r
371 Hand an I/O operation to the network layer.\r
372\r
373 @param [in] pProtocol Protocol structure address\r
374 @param [in] pToken Completion token address\r
d7ce7006 375\r
a88c3163 376 @return Returns EFI_SUCCESS if the operation is successfully\r
377 started.\r
378**/\r
379typedef\r
380EFI_STATUS\r
381(* PFN_NET_IO_START) (\r
382 IN VOID * pProtocol,\r
383 IN VOID * pToken\r
384 );\r
d7ce7006 385\r
3bdf9aae 386/**\r
387 Poll the LAN adapter for receive packets.\r
388\r
389 @param [in] pProtocol Protocol structure address\r
390 @param [in] pToken Completion token address\r
391\r
392 @return Returns EFI_SUCCESS if the operation is successfully\r
393 started.\r
394**/\r
395typedef\r
396EFI_STATUS\r
397(* PFN_NET_POLL) (\r
398 IN VOID * pProtocol\r
399 );\r
400\r
d7ce7006 401/**\r
402 Port control structure\r
403\r
404 The driver uses this structure to manager the socket's connection\r
405 with the network driver.\r
406**/\r
a88c3163 407typedef struct _ESL_PORT {\r
d7ce7006 408 UINTN Signature; ///< Structure identification\r
409\r
410 //\r
411 // List links\r
412 //\r
a88c3163 413 ESL_PORT * pLinkService; ///< Link in service port list\r
414 ESL_PORT * pLinkSocket; ///< Link in socket port list\r
d7ce7006 415\r
416 //\r
417 // Structures\r
418 //\r
a88c3163 419 ESL_SERVICE * pService; ///< Service for this port\r
420 ESL_SOCKET * pSocket; ///< Socket for this port\r
d7ce7006 421\r
422 //\r
a88c3163 423 // Eliminate the pService references during port close\r
d7ce7006 424 //\r
a88c3163 425 EFI_SERVICE_BINDING_PROTOCOL * pServiceBinding; ///< Service binding for network layer\r
426 CONST ESL_SOCKET_BINDING * pSocketBinding; ///< Socket binding for network layer\r
d7ce7006 427\r
428 //\r
a88c3163 429 // Port management\r
d7ce7006 430 //\r
a88c3163 431 EFI_HANDLE Handle; ///< Network port handle\r
432 PORT_STATE State; ///< State of the port\r
433 UINTN DebugFlags; ///< Debug flags used to close the port\r
434 BOOLEAN bCloseNow; ///< TRUE = Close the port immediately\r
435 BOOLEAN bConfigured; ///< TRUE = Configure call made to network layer\r
436 PFN_NET_CONFIGURE pfnConfigure; ///< Configure the network layer\r
d7ce7006 437\r
438 //\r
439 // Transmit data management\r
440 //\r
a88c3163 441 BOOLEAN bTxFlowControl; ///< TX flow control applied\r
442 PFN_NET_IO_START pfnTxStart; ///< Start a transmit on the network\r
443 ESL_IO_MGMT * pTxActive; ///< Normal data queue\r
444 ESL_IO_MGMT * pTxFree; ///< Normal free queue\r
d7ce7006 445\r
a88c3163 446 ESL_IO_MGMT * pTxOobActive; ///< Urgent data queue\r
447 ESL_IO_MGMT * pTxOobFree; ///< Urgent free queue\r
d7ce7006 448\r
449 //\r
a88c3163 450 // Receive data management\r
d7ce7006 451 //\r
a88c3163 452 PFN_NET_IO_START pfnRxCancel; ///< Cancel a receive on the network\r
3bdf9aae 453 PFN_NET_POLL pfnRxPoll; ///< Poll the LAN adapter for receive packets\r
a88c3163 454 PFN_NET_IO_START pfnRxStart; ///< Start a receive on the network\r
455 ESL_IO_MGMT * pRxActive; ///< Active receive operation queue\r
456 ESL_IO_MGMT * pRxFree; ///< Free structure queue\r
d7ce7006 457\r
458 //\r
a88c3163 459 // Protocol specific management data\r
d7ce7006 460 //\r
a88c3163 461 union {\r
462 VOID * v; ///< VOID pointer\r
463 EFI_IP4_PROTOCOL * IPv4; ///< IP4 protocol pointer\r
464 EFI_TCP4_PROTOCOL * TCPv4; ///< TCP4 protocol pointer\r
3bdf9aae 465 EFI_TCP6_PROTOCOL * TCPv6; ///< TCP6 protocol pointer\r
a88c3163 466 EFI_UDP4_PROTOCOL * UDPv4; ///< UDP4 protocol pointer\r
3bdf9aae 467 EFI_UDP6_PROTOCOL * UDPv6; ///< UDP6 protocol pointer\r
a88c3163 468 } pProtocol; ///< Protocol structure address\r
469 union {\r
470 ESL_IP4_CONTEXT Ip4; ///< IPv4 management data\r
471 ESL_TCP4_CONTEXT Tcp4; ///< TCPv4 management data\r
3bdf9aae 472 ESL_TCP6_CONTEXT Tcp6; ///< TCPv6 management data\r
a88c3163 473 ESL_UDP4_CONTEXT Udp4; ///< UDPv4 management data\r
3bdf9aae 474 ESL_UDP6_CONTEXT Udp6; ///< UDPv6 management data\r
a88c3163 475 } Context; ///< Network specific context\r
476}GCC_ESL_PORT;\r
d7ce7006 477\r
478/**\r
479 Accept a network connection.\r
480\r
d7ce7006 481 @param [in] pSocket Address of the socket structure.\r
482\r
483 @param [in] pSockAddr Address of a buffer to receive the remote\r
484 network address.\r
485\r
486 @param [in, out] pSockAddrLength Length in bytes of the address buffer.\r
487 On output specifies the length of the\r
488 remote network address.\r
489\r
490 @retval EFI_SUCCESS Remote address is available\r
491 @retval Others Remote address not available\r
492\r
493 **/\r
a88c3163 494typedef\r
d7ce7006 495EFI_STATUS\r
a88c3163 496(* PFN_API_ACCEPT) (\r
497 IN ESL_SOCKET * pSocket,\r
d7ce7006 498 IN struct sockaddr * pSockAddr,\r
499 IN OUT socklen_t * pSockAddrLength\r
500 );\r
501\r
502/**\r
a88c3163 503 Poll for completion of the connection attempt.\r
d7ce7006 504\r
a88c3163 505 @param [in] pSocket Address of an ::ESL_SOCKET structure.\r
d7ce7006 506\r
a88c3163 507 @retval EFI_SUCCESS The connection was successfully established.\r
508 @retval EFI_NOT_READY The connection is in progress, call this routine again.\r
509 @retval Others The connection attempt failed.\r
d7ce7006 510\r
511 **/\r
a88c3163 512typedef\r
d7ce7006 513EFI_STATUS\r
a88c3163 514(* PFN_API_CONNECT_POLL) (\r
515 IN ESL_SOCKET * pSocket\r
d7ce7006 516 );\r
517\r
518/**\r
a88c3163 519 Attempt to connect to a remote TCP port\r
520\r
521 This routine starts the connection processing for a SOCK_STREAM\r
522 or SOCK_SEQPAKCET socket using the TCP network layer.\r
d7ce7006 523\r
a88c3163 524 This routine is called by ::EslSocketConnect to initiate the TCP\r
525 network specific connect operations.\r
d7ce7006 526\r
a88c3163 527 @param [in] pSocket Address of an ::ESL_SOCKET structure.\r
d7ce7006 528\r
529 @retval EFI_SUCCESS The connection was successfully established.\r
530 @retval EFI_NOT_READY The connection is in progress, call this routine again.\r
531 @retval Others The connection attempt failed.\r
532\r
533 **/\r
a88c3163 534typedef\r
d7ce7006 535EFI_STATUS\r
a88c3163 536(* PFN_API_CONNECT_START) (\r
537 IN ESL_SOCKET * pSocket\r
d7ce7006 538 );\r
539\r
540/**\r
a88c3163 541 Get the local socket address\r
d7ce7006 542\r
a88c3163 543 @param [in] pPort Address of an ::ESL_PORT structure.\r
d7ce7006 544\r
a88c3163 545 @param [out] pAddress Network address to receive the local system address\r
d7ce7006 546\r
547**/\r
a88c3163 548typedef\r
549VOID\r
550(* PFN_API_LOCAL_ADDR_GET) (\r
551 IN ESL_PORT * pPort,\r
552 OUT struct sockaddr * pAddress\r
d7ce7006 553 );\r
554\r
555/**\r
a88c3163 556 Set the local port address.\r
d7ce7006 557\r
a88c3163 558 This routine sets the local port address.\r
d7ce7006 559\r
a88c3163 560 This support routine is called by ::EslSocketPortAllocate.\r
d7ce7006 561\r
a88c3163 562 @param [in] ppPort Address of an ESL_PORT structure\r
563 @param [in] pSockAddr Address of a sockaddr structure that contains the\r
564 connection point on the local machine. An IPv4 address\r
565 of INADDR_ANY specifies that the connection is made to\r
566 all of the network stacks on the platform. Specifying a\r
567 specific IPv4 address restricts the connection to the\r
568 network stack supporting that address. Specifying zero\r
569 for the port causes the network layer to assign a port\r
570 number from the dynamic range. Specifying a specific\r
571 port number causes the network layer to use that port.\r
572 @param [in] bBindTest TRUE = run bind testing\r
d7ce7006 573\r
a88c3163 574 @retval EFI_SUCCESS The operation was successful\r
d7ce7006 575\r
a88c3163 576 **/\r
577typedef\r
d7ce7006 578EFI_STATUS\r
a88c3163 579(* PFN_API_LOCAL_ADDR_SET) (\r
580 IN ESL_PORT * pPort,\r
581 IN CONST struct sockaddr * pSockAddr,\r
582 IN BOOLEAN bBindTest\r
d7ce7006 583 );\r
584\r
58081f2c 585/**\r
586 Process the completion event\r
587\r
588 This routine handles the I/O completion event.\r
589\r
590 This routine is called by the low level network driver when\r
591 the operation is completed.\r
592\r
593 @param [in] Event The receive completion event\r
594\r
595 @param [in] pIo The address of an ::ESL_IO_MGMT structure\r
596\r
597**/\r
598typedef\r
599VOID\r
600(* PFN_API_IO_COMPLETE) (\r
601 IN EFI_EVENT Event,\r
602 IN ESL_IO_MGMT * pIo\r
603 );\r
604\r
d7ce7006 605/**\r
a88c3163 606 Determine if the socket is configured.\r
d7ce7006 607\r
d7ce7006 608\r
a88c3163 609 @param [in] pSocket Address of a ESL_SOCKET structure\r
610 \r
611 @retval EFI_SUCCESS - The port is connected\r
612 @retval EFI_NOT_STARTED - The port is not connected\r
d7ce7006 613\r
a88c3163 614 **/\r
615 typedef\r
616 EFI_STATUS\r
617 (* PFN_API_IS_CONFIGURED) (\r
618 IN ESL_SOCKET * pSocket\r
d7ce7006 619 );\r
620\r
621/**\r
622 Establish the known port to listen for network connections.\r
623\r
d7ce7006 624 @param [in] pSocket Address of the socket structure.\r
a88c3163 625\r
d7ce7006 626 @retval EFI_SUCCESS - Socket successfully created\r
627 @retval Other - Failed to enable the socket for listen\r
628\r
629**/\r
a88c3163 630typedef\r
d7ce7006 631EFI_STATUS\r
a88c3163 632(* PFN_API_LISTEN) (\r
633 IN ESL_SOCKET * pSocket\r
d7ce7006 634 );\r
635\r
636/**\r
a88c3163 637 Get the option value\r
d7ce7006 638\r
a88c3163 639 Retrieve the protocol options one at a time by name.\r
d7ce7006 640\r
a88c3163 641 @param [in] pSocket Address of a ESL_SOCKET structure\r
642 @param [in] OptionName Name of the option\r
643 @param [out] ppOptionData Buffer to receive address of option value\r
644 @param [out] pOptionLength Buffer to receive the option length\r
d7ce7006 645\r
a88c3163 646 @retval EFI_SUCCESS - Socket data successfully received\r
d7ce7006 647\r
648 **/\r
a88c3163 649typedef\r
d7ce7006 650EFI_STATUS\r
a88c3163 651(* PFN_API_OPTION_GET) (\r
652 IN ESL_SOCKET * pSocket,\r
653 IN int OptionName,\r
654 OUT CONST void ** __restrict ppOptionData,\r
655 OUT socklen_t * __restrict pOptionLength\r
d7ce7006 656 );\r
657\r
658/**\r
a88c3163 659 Set the option value\r
d7ce7006 660\r
a88c3163 661 Adjust the protocol options one at a time by name.\r
d7ce7006 662\r
a88c3163 663 @param [in] pSocket Address of a ESL_SOCKET structure\r
664 @param [in] OptionName Name of the option\r
665 @param [in] pOptionValue Buffer containing the option value\r
666 @param [in] OptionLength Length of the buffer in bytes\r
d7ce7006 667\r
a88c3163 668 @retval EFI_SUCCESS - Option successfully set\r
669\r
670 **/\r
671typedef\r
d7ce7006 672EFI_STATUS\r
a88c3163 673(* PFN_API_OPTION_SET) (\r
674 IN ESL_SOCKET * pSocket,\r
675 IN int OptionName,\r
676 IN CONST void * pOptionValue,\r
677 IN socklen_t OptionLength\r
d7ce7006 678 );\r
679\r
680/**\r
a88c3163 681 Free a receive packet\r
d7ce7006 682\r
a88c3163 683 This routine performs the network specific operations necessary\r
684 to free a receive packet.\r
d7ce7006 685\r
a88c3163 686 This routine is called by ::EslSocketPortCloseTxDone to free a\r
687 receive packet.\r
688\r
689 @param [in] pPacket Address of an ::ESL_PACKET structure.\r
690 @param [in, out] pRxBytes Address of the count of RX bytes\r
d7ce7006 691\r
692**/\r
a88c3163 693typedef\r
d7ce7006 694VOID\r
a88c3163 695(* PFN_API_PACKET_FREE) (\r
696 IN ESL_PACKET * pPacket,\r
697 IN OUT size_t * pRxBytes\r
d7ce7006 698 );\r
699\r
700/**\r
a88c3163 701 Initialize the network specific portions of an ::ESL_PORT structure.\r
d7ce7006 702\r
a88c3163 703 This routine initializes the network specific portions of an\r
704 ::ESL_PORT structure for use by the socket.\r
d7ce7006 705\r
a88c3163 706 This support routine is called by ::EslSocketPortAllocate\r
707 to connect the socket with the underlying network adapter\r
708 running the IPv4 protocol.\r
d7ce7006 709\r
a88c3163 710 @param [in] ppPort Address of an ESL_PORT structure\r
711 @param [in] DebugFlags Flags for debug messages\r
d7ce7006 712\r
a88c3163 713 @retval EFI_SUCCESS - Socket successfully created\r
714\r
715 **/\r
716typedef\r
d7ce7006 717EFI_STATUS\r
a88c3163 718(* PFN_API_PORT_ALLOC) (\r
719 IN ESL_PORT * pPort,\r
720 IN UINTN DebugFlags\r
d7ce7006 721 );\r
722\r
723/**\r
a88c3163 724 Close a network specific port.\r
d7ce7006 725\r
a88c3163 726 This routine releases the resources allocated by the\r
727 network specific PortAllocate routine.\r
728\r
729 This routine is called by ::EslSocketPortCloseRxDone as\r
730 the last step of closing processing.\r
731 See the \ref PortCloseStateMachine section.\r
732 \r
733 @param [in] pPort Address of an ::ESL_PORT structure.\r
734\r
735 @retval EFI_SUCCESS The port is closed\r
736 @retval other Port close error\r
d7ce7006 737\r
738**/\r
a88c3163 739typedef\r
d7ce7006 740EFI_STATUS\r
a88c3163 741(* PFN_API_PORT_CLOSE) (\r
742 IN ESL_PORT * pPort\r
d7ce7006 743 );\r
744\r
745/**\r
a88c3163 746 Perform the network specific close operation on the port.\r
d7ce7006 747\r
a88c3163 748 This routine performs the network specific operation to\r
749 shutdown receive operations on the port.\r
d7ce7006 750\r
a88c3163 751 This routine is called by the ::EslSocketPortCloseTxDone\r
752 routine after the port completes all of the transmission.\r
d7ce7006 753\r
a88c3163 754 @param [in] pPort Address of an ::ESL_PORT structure.\r
755\r
756 @retval EFI_SUCCESS The port is closed, not normally returned\r
d7ce7006 757 @retval EFI_NOT_READY The port is still closing\r
758 @retval EFI_ALREADY_STARTED Error, the port is in the wrong state,\r
759 most likely the routine was called already.\r
760\r
761**/\r
a88c3163 762typedef\r
d7ce7006 763EFI_STATUS\r
a88c3163 764(* PFN_API_PORT_CLOSE_OP) (\r
765 IN ESL_PORT * pPort\r
d7ce7006 766 );\r
767\r
768/**\r
769 Receive data from a network connection.\r
770\r
a88c3163 771 This routine attempts to return buffered data to the caller. The\r
772 data is removed from the urgent queue if the message flag MSG_OOB\r
773 is specified, otherwise data is removed from the normal queue.\r
774 See the \ref ReceiveEngine section.\r
d7ce7006 775\r
a88c3163 776 This routine is called by ::EslSocketReceive to handle the network\r
777 specific receive operation.\r
778\r
779 @param [in] pPort Address of an ::ESL_PORT structure.\r
780\r
781 @param [in] pPacket Address of an ::ESL_PACKET structure.\r
d7ce7006 782 \r
a88c3163 783 @param [in] pbConsumePacket Address of a BOOLEAN indicating if the packet is to be consumed\r
d7ce7006 784 \r
785 @param [in] BufferLength Length of the the buffer\r
786 \r
787 @param [in] pBuffer Address of a buffer to receive the data.\r
788 \r
789 @param [in] pDataLength Number of received data bytes in the buffer.\r
790\r
791 @param [out] pAddress Network address to receive the remote system address\r
792\r
a88c3163 793 @param [out] pSkipBytes Address to receive the number of bytes skipped\r
d7ce7006 794\r
a88c3163 795 @return Returns the address of the next free byte in the buffer.\r
d7ce7006 796\r
797 **/\r
a88c3163 798typedef\r
799UINT8 *\r
800(* PFN_API_RECEIVE) (\r
801 IN ESL_PORT * pPort,\r
802 IN ESL_PACKET * pPacket,\r
803 IN BOOLEAN * pbConsumePacket,\r
d7ce7006 804 IN size_t BufferLength,\r
805 IN UINT8 * pBuffer,\r
806 OUT size_t * pDataLength,\r
807 OUT struct sockaddr * pAddress,\r
a88c3163 808 OUT size_t * pSkipBytes\r
d7ce7006 809 );\r
810\r
811/**\r
a88c3163 812 Get the remote socket address\r
d7ce7006 813\r
a88c3163 814 @param [in] pPort Address of an ::ESL_PORT structure.\r
d7ce7006 815\r
a88c3163 816 @param [out] pAddress Network address to receive the remote system address\r
817\r
818**/\r
819typedef\r
820VOID\r
821(* PFN_API_REMOTE_ADDR_GET) (\r
822 IN ESL_PORT * pPort,\r
823 OUT struct sockaddr * pAddress\r
d7ce7006 824 );\r
825\r
826/**\r
a88c3163 827 Set the remote address\r
d7ce7006 828\r
a88c3163 829 This routine sets the remote address in the port.\r
d7ce7006 830\r
a88c3163 831 This routine is called by ::EslSocketConnect to specify the\r
832 remote network address.\r
d7ce7006 833\r
a88c3163 834 @param [in] pPort Address of an ::ESL_PORT structure.\r
d7ce7006 835\r
a88c3163 836 @param [in] pSockAddr Network address of the remote system.\r
d7ce7006 837\r
a88c3163 838 @param [in] SockAddrLength Length in bytes of the network address.\r
d7ce7006 839\r
a88c3163 840 @retval EFI_SUCCESS The operation was successful\r
d7ce7006 841\r
842 **/\r
a88c3163 843typedef\r
844EFI_STATUS\r
845(* PFN_API_REMOTE_ADDR_SET) (\r
846 IN ESL_PORT * pPort,\r
847 IN CONST struct sockaddr * pSockAddr,\r
848 IN socklen_t SockAddrLength\r
d7ce7006 849 );\r
850\r
d7ce7006 851/**\r
a88c3163 852 Start a receive operation\r
d7ce7006 853\r
a88c3163 854 This routine prepares a packet for the receive operation.\r
855 See the \ref ReceiveEngine section.\r
d7ce7006 856\r
a88c3163 857 This support routine is called by EslSocketRxStart.\r
858\r
859 @param [in] pPort Address of an ::ESL_PORT structure.\r
860 @param [in] pIo Address of an ::ESL_IO_MGMT structure.\r
d7ce7006 861\r
862 **/\r
a88c3163 863typedef\r
864VOID\r
865(* PFN_API_RX_START) (\r
866 IN ESL_PORT * pPort,\r
867 IN ESL_IO_MGMT * pIo\r
d7ce7006 868 );\r
869\r
870/**\r
871 Buffer data for transmission over a network connection.\r
872\r
a88c3163 873 @param [in] pSocket Address of a ESL_SOCKET structure\r
d7ce7006 874\r
d7ce7006 875 @param [in] Flags Message control flags\r
a88c3163 876\r
d7ce7006 877 @param [in] BufferLength Length of the the buffer\r
a88c3163 878\r
d7ce7006 879 @param [in] pBuffer Address of a buffer to receive the data.\r
a88c3163 880\r
d7ce7006 881 @param [in] pDataLength Number of received data bytes in the buffer.\r
882\r
a88c3163 883 @param [in] pAddress Network address of the remote system address\r
884\r
885 @param [in] AddressLength Length of the remote network address structure\r
886\r
d7ce7006 887 @retval EFI_SUCCESS - Socket data successfully buffered\r
888\r
a88c3163 889**/\r
890typedef\r
d7ce7006 891EFI_STATUS\r
a88c3163 892(* PFN_API_TRANSMIT) (\r
893 IN ESL_SOCKET * pSocket,\r
d7ce7006 894 IN int Flags,\r
895 IN size_t BufferLength,\r
896 IN CONST UINT8 * pBuffer,\r
a88c3163 897 OUT size_t * pDataLength,\r
898 IN const struct sockaddr * pAddress,\r
899 IN socklen_t AddressLength\r
d7ce7006 900 );\r
901\r
902/**\r
a88c3163 903 Process the transmit completion\r
d7ce7006 904\r
a88c3163 905 This routine calls ::EslSocketTxComplete to handle the\r
906 transmit completion.\r
d7ce7006 907\r
a88c3163 908 This routine is called by the network layers upon the completion\r
909 of a transmit operation.\r
910\r
911 @param [in] Event The urgent transmit completion event\r
912\r
913 @param [in] pIo The ESL_IO_MGMT structure address\r
d7ce7006 914\r
915**/\r
a88c3163 916typedef\r
d7ce7006 917VOID\r
a88c3163 918(* PFN_API_TX_COMPLETE) (\r
d7ce7006 919 IN EFI_EVENT Event,\r
a88c3163 920 IN ESL_IO_MGMT * pIo\r
d7ce7006 921 );\r
922\r
923/**\r
a88c3163 924 Socket type control structure\r
925\r
926 This driver uses this structure to define the API for the socket type.\r
927**/\r
928typedef struct {\r
929 CONST CHAR8 * pName; ///< Protocol name\r
930 int DefaultProtocol; ///< Default protocol\r
931 UINTN ConfigDataOffset; ///< Offset in ::ESL_PORT to the configuration data\r
932 UINTN ServiceListOffset; ///< Offset in ::ESL_LAYER for the list of services\r
933 socklen_t MinimumAddressLength; ///< Minimum address length in bytes\r
934 socklen_t AddressLength; ///< Address length in bytes\r
935 sa_family_t AddressFamily; ///< Address family\r
936 UINTN RxPacketBytes; ///< Length of the RX packet allocation\r
937 UINTN RxZeroBytes; ///< Number of bytes to zero in RX packet\r
938 UINTN RxBufferOffset; ///< Offset of buffer address in ESL_IO_MGMT structure\r
939 BOOLEAN bOobSupported; ///< TRUE if out-of-band messages are supported\r
940 int BindTestErrno; ///< errno value if EslSocketBindTest fails\r
941 PFN_API_ACCEPT pfnAccept; ///< Accept a network connection\r
942 PFN_API_CONNECT_POLL pfnConnectPoll; ///< Poll for connection complete\r
943 PFN_API_CONNECT_START pfnConnectStart; ///< Start the connection to a remote system\r
944 PFN_API_IS_CONFIGURED pfnIsConfigured; ///< Determine if the socket is configured\r
945 PFN_API_LOCAL_ADDR_GET pfnLocalAddrGet; ///< Get the local address\r
946 PFN_API_LOCAL_ADDR_SET pfnLocalAddrSet; ///< Set the local address\r
947 PFN_API_LISTEN pfnListen; ///< Listen for connections on known server port\r
948 PFN_API_OPTION_GET pfnOptionGet; ///< Get the option value\r
949 PFN_API_OPTION_SET pfnOptionSet; ///< Set the option value\r
950 PFN_API_PACKET_FREE pfnPacketFree; ///< Free the receive packet\r
951 PFN_API_PORT_ALLOC pfnPortAllocate; ///< Allocate the network specific resources for the port\r
952 PFN_API_PORT_CLOSE pfnPortClose; ///< Close the network specific resources for the port\r
953 PFN_API_PORT_CLOSE_OP pfnPortCloseOp; ///< Perform the close operation on the port\r
954 BOOLEAN bPortCloseComplete; ///< TRUE = Close is complete after close operation\r
955 PFN_API_RECEIVE pfnReceive; ///< Attempt to receive some data\r
956 PFN_API_REMOTE_ADDR_GET pfnRemoteAddrGet; ///< Get remote address\r
957 PFN_API_REMOTE_ADDR_SET pfnRemoteAddrSet; ///< Set the remote system address\r
58081f2c 958 PFN_API_IO_COMPLETE pfnRxComplete; ///< RX completion\r
a88c3163 959 PFN_API_RX_START pfnRxStart; ///< Start a network specific receive operation\r
960 PFN_API_TRANSMIT pfnTransmit; ///< Attempt to buffer a packet for transmit\r
961 PFN_API_TX_COMPLETE pfnTxComplete; ///< TX completion for normal data\r
962 PFN_API_TX_COMPLETE pfnTxOobComplete; ///< TX completion for urgent data\r
963} ESL_PROTOCOL_API;\r
d7ce7006 964\r
d7ce7006 965\r
a88c3163 966/**\r
967 Socket control structure\r
d7ce7006 968\r
a88c3163 969 The driver uses this structure to manage the socket.\r
d7ce7006 970**/\r
a88c3163 971typedef struct _ESL_SOCKET {\r
972 UINTN Signature; ///< Structure identification\r
d7ce7006 973\r
a88c3163 974 //\r
975 // Protocol binding\r
976 //\r
977 EFI_SOCKET_PROTOCOL SocketProtocol; ///< Socket protocol declaration\r
978 CONST ESL_PROTOCOL_API * pApi; ///< API for the protocol\r
979\r
980 //\r
981 // Socket management\r
982 //\r
983 ESL_SOCKET * pNext; ///< Next socket in the list of sockets\r
984 int errno; ///< Error information for this socket\r
985 EFI_STATUS Status; ///< Asyncronous error information for this socket\r
986 SOCKET_STATE State; ///< Socket state\r
987 UINT32 DebugFlags; ///< Debug flags\r
d7ce7006 988\r
a88c3163 989 //\r
990 // Socket options\r
991 //\r
992 BOOLEAN bListenCalled; ///< TRUE if listen was successfully called\r
993 BOOLEAN bOobInLine; ///< TRUE if out-of-band messages are to be received inline with normal data\r
994 BOOLEAN bIncludeHeader; ///< TRUE if including the IP header\r
d7ce7006 995\r
a88c3163 996 //\r
997 // Socket data\r
998 //\r
999 int Domain; ///< Specifies family of protocols\r
1000 int Type; ///< Specifies how to make network connection\r
1001 int Protocol; ///< Specifies lower layer protocol to use\r
1002 BOOLEAN bConfigured; ///< Set after the socket is configured\r
d7ce7006 1003\r
a88c3163 1004 BOOLEAN bRxDisable; ///< Receive disabled via shutdown\r
1005 size_t RxBytes; ///< Total Rx bytes\r
1006 size_t RxOobBytes; ///< Urgent Rx bytes\r
1007 EFI_STATUS RxError; ///< Error during receive\r
d7ce7006 1008\r
a88c3163 1009 BOOLEAN bTxDisable; ///< Transmit disabled via shutdown\r
1010 size_t TxBytes; ///< Normal Tx bytes\r
1011 size_t TxOobBytes; ///< Urgent Tx bytes\r
1012 EFI_STATUS TxError; ///< Error during transmit\r
1013\r
1014 //\r
1015 // Pending connection data\r
1016 //\r
1017 BOOLEAN bConnected; ///< Set when connected, cleared by poll\r
1018 EFI_STATUS ConnectStatus; ///< Connection status\r
1019 UINTN MaxFifoDepth; ///< Maximum FIFO depth\r
1020 UINTN FifoDepth; ///< Number of sockets in the FIFO\r
1021 ESL_SOCKET * pFifoHead; ///< Head of the FIFO\r
1022 ESL_SOCKET * pFifoTail; ///< Tail of the FIFO\r
1023 ESL_SOCKET * pNextConnection; ///< Link in the FIFO\r
1024\r
1025 //\r
1026 // Network use\r
1027 //\r
1028 ESL_PORT * pPortList; ///< List of ports managed by this socket\r
1029 EFI_EVENT WaitAccept; ///< Wait for accept completion\r
1030\r
1031 //\r
1032 // Receive data management\r
1033 //\r
1034 UINT32 MaxRxBuf; ///< Maximum size of the receive buffer\r
1035 struct timeval RxTimeout; ///< Receive timeout\r
1036 ESL_PACKET * pRxFree; ///< Free packet list\r
1037 ESL_PACKET * pRxOobPacketListHead;///< Urgent data list head\r
1038 ESL_PACKET * pRxOobPacketListTail;///< Urgent data list tail\r
1039 ESL_PACKET * pRxPacketListHead; ///< Normal data list head\r
1040 ESL_PACKET * pRxPacketListTail; ///< Normal data list tail\r
1041\r
1042 //\r
1043 // Transmit data management\r
1044 //\r
1045 UINTN TxPacketOffset; ///< Offset for data pointer in ::ESL_PACKET\r
1046 UINTN TxTokenEventOffset; ///< Offset to the Event in the TX token\r
1047 UINTN TxTokenOffset; ///< Offset for data pointer in TX token\r
1048 UINT32 MaxTxBuf; ///< Maximum size of the transmit buffer\r
1049 ESL_PACKET * pTxOobPacketListHead;///< Urgent data list head\r
1050 ESL_PACKET * pTxOobPacketListTail;///< Urgent data list tail\r
1051 ESL_PACKET * pTxPacketListHead; ///< Normal data list head\r
1052 ESL_PACKET * pTxPacketListTail; ///< Normal data list tail\r
1053}GCC_ESL_SOCKET;\r
1054\r
1055#define SOCKET_FROM_PROTOCOL(a) CR (a, ESL_SOCKET, SocketProtocol, SOCKET_SIGNATURE) ///< Locate ESL_SOCKET from protocol\r
d7ce7006 1056\r
1057/**\r
a88c3163 1058 Socket layer control structure\r
d7ce7006 1059\r
a88c3163 1060 The driver uses this structure to manage the driver.\r
1061**/\r
1062typedef struct {\r
1063 UINTN Signature; ///< Structure identification\r
d7ce7006 1064\r
a88c3163 1065 //\r
1066 // Service binding interface\r
1067 //\r
1068 CONST EFI_SERVICE_BINDING_PROTOCOL * pServiceBinding; ///< Driver's binding\r
d7ce7006 1069\r
a88c3163 1070 //\r
1071 // Image data\r
1072 //\r
1073 EFI_HANDLE ImageHandle; ///< Image handle\r
d7ce7006 1074\r
a88c3163 1075 //\r
1076 // Network services\r
1077 //\r
1078 ESL_SERVICE * pIp4List; ///< List of Ip4 services\r
1079 ESL_SERVICE * pTcp4List; ///< List of Tcp4 services\r
3bdf9aae 1080 ESL_SERVICE * pTcp6List; ///< List of Tcp6 services\r
a88c3163 1081 ESL_SERVICE * pUdp4List; ///< List of Udp4 services\r
3bdf9aae 1082 ESL_SERVICE * pUdp6List; ///< List of Udp6 services\r
d7ce7006 1083\r
a88c3163 1084 //\r
1085 // Socket management\r
1086 //\r
1087 ESL_SOCKET * pSocketList; ///< List of sockets\r
1088} ESL_LAYER;\r
d7ce7006 1089\r
a88c3163 1090#define LAYER_FROM_SERVICE(a) CR (a, ESL_LAYER, ServiceBinding, LAYER_SIGNATURE) ///< Locate ESL_LAYER from service binding\r
d7ce7006 1091\r
a88c3163 1092//------------------------------------------------------------------------------\r
1093// Data\r
1094//------------------------------------------------------------------------------\r
1095\r
1096extern ESL_LAYER mEslLayer;\r
1097\r
1098extern CONST ESL_PROTOCOL_API cEslIp4Api;\r
3bdf9aae 1099extern CONST ESL_PROTOCOL_API cEslIp6Api;\r
a88c3163 1100extern CONST ESL_PROTOCOL_API cEslTcp4Api;\r
3bdf9aae 1101extern CONST ESL_PROTOCOL_API cEslTcp6Api;\r
a88c3163 1102extern CONST ESL_PROTOCOL_API cEslUdp4Api;\r
3bdf9aae 1103extern CONST ESL_PROTOCOL_API cEslUdp6Api;\r
d7ce7006 1104\r
a88c3163 1105extern CONST EFI_SERVICE_BINDING_PROTOCOL mEfiServiceBinding;\r
d7ce7006 1106\r
a88c3163 1107//------------------------------------------------------------------------------\r
1108// Socket Support Routines\r
1109//------------------------------------------------------------------------------\r
1110\r
1111/**\r
1112 Allocate and initialize a ESL_SOCKET structure.\r
1113 \r
1114 This support function allocates an ::ESL_SOCKET structure\r
1115 and installs a protocol on ChildHandle. If pChildHandle is a\r
1116 pointer to NULL, then a new handle is created and returned in\r
1117 pChildHandle. If pChildHandle is not a pointer to NULL, then\r
1118 the protocol installs on the existing pChildHandle.\r
d7ce7006 1119\r
a88c3163 1120 @param [in, out] pChildHandle Pointer to the handle of the child to create.\r
1121 If it is NULL, then a new handle is created.\r
1122 If it is a pointer to an existing UEFI handle, \r
1123 then the protocol is added to the existing UEFI\r
1124 handle.\r
1125 @param [in] DebugFlags Flags for debug messages\r
1126 @param [in, out] ppSocket The buffer to receive an ::ESL_SOCKET structure address.\r
d7ce7006 1127\r
a88c3163 1128 @retval EFI_SUCCESS The protocol was added to ChildHandle.\r
1129 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
1130 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r
1131 the child\r
1132 @retval other The child handle was not created\r
1133 \r
d7ce7006 1134**/\r
1135EFI_STATUS\r
1136EFIAPI\r
a88c3163 1137EslSocketAllocate (\r
1138 IN OUT EFI_HANDLE * pChildHandle,\r
1139 IN UINTN DebugFlags,\r
1140 IN OUT ESL_SOCKET ** ppSocket\r
d7ce7006 1141 );\r
1142\r
1143/**\r
a88c3163 1144 Test the bind configuration.\r
d7ce7006 1145\r
a88c3163 1146 @param [in] pPort Address of the ::ESL_PORT structure.\r
1147 @param [in] ErrnoValue errno value if test fails\r
d7ce7006 1148\r
a88c3163 1149 @retval EFI_SUCCESS The connection was successfully established.\r
1150 @retval Others The connection attempt failed.\r
d7ce7006 1151\r
1152 **/\r
1153EFI_STATUS\r
a88c3163 1154EslSocketBindTest (\r
1155 IN ESL_PORT * pPort,\r
1156 IN int ErrnoValue\r
d7ce7006 1157 );\r
1158\r
1159/**\r
a88c3163 1160 Copy a fragmented buffer into a destination buffer.\r
d7ce7006 1161\r
a88c3163 1162 This support routine copies a fragmented buffer to the caller specified buffer.\r
d7ce7006 1163\r
a88c3163 1164 This routine is called by ::EslIp4Receive and ::EslUdp4Receive.\r
d7ce7006 1165\r
a88c3163 1166 @param [in] FragmentCount Number of fragments in the table\r
d7ce7006 1167\r
a88c3163 1168 @param [in] pFragmentTable Address of an EFI_IP4_FRAGMENT_DATA structure\r
d7ce7006 1169\r
a88c3163 1170 @param [in] BufferLength Length of the the buffer\r
d7ce7006 1171\r
a88c3163 1172 @param [in] pBuffer Address of a buffer to receive the data.\r
1173\r
1174 @param [in] pDataLength Number of received data bytes in the buffer.\r
1175\r
1176 @return Returns the address of the next free byte in the buffer.\r
d7ce7006 1177\r
1178**/\r
a88c3163 1179UINT8 *\r
1180EslSocketCopyFragmentedBuffer (\r
1181 IN UINT32 FragmentCount,\r
1182 IN EFI_IP4_FRAGMENT_DATA * pFragmentTable,\r
1183 IN size_t BufferLength,\r
1184 IN UINT8 * pBuffer,\r
1185 OUT size_t * pDataLength\r
d7ce7006 1186 );\r
1187\r
1188/**\r
a88c3163 1189 Free the ESL_IO_MGMT event and structure\r
d7ce7006 1190\r
a88c3163 1191 This support routine walks the free list to close the event in\r
1192 the ESL_IO_MGMT structure and remove the structure from the free\r
1193 list.\r
d7ce7006 1194\r
a88c3163 1195 See the \ref TransmitEngine section.\r
d7ce7006 1196\r
a88c3163 1197 @param [in] pPort Address of an ::ESL_PORT structure\r
1198 @param [in] ppFreeQueue Address of the free queue head\r
1199 @param [in] DebugFlags Flags for debug messages\r
1200 @param [in] pEventName Zero terminated string containing the event name\r
1201\r
1202 @retval EFI_SUCCESS - The structures were properly initialized\r
d7ce7006 1203\r
1204**/\r
1205EFI_STATUS\r
a88c3163 1206EslSocketIoFree (\r
1207 IN ESL_PORT * pPort,\r
1208 IN ESL_IO_MGMT ** ppFreeQueue,\r
1209 IN UINTN DebugFlags,\r
1210 IN CHAR8 * pEventName\r
d7ce7006 1211 );\r
1212\r
1213/**\r
a88c3163 1214 Initialize the ESL_IO_MGMT structures\r
d7ce7006 1215\r
a88c3163 1216 This support routine initializes the ESL_IO_MGMT structure and\r
1217 places them on to a free list.\r
d7ce7006 1218\r
a88c3163 1219 This routine is called by the PortAllocate routines to prepare\r
1220 the transmit engines. See the \ref TransmitEngine section.\r
d7ce7006 1221\r
a88c3163 1222 @param [in] pPort Address of an ::ESL_PORT structure\r
1223 @param [in, out] ppIo Address containing the first structure address. Upon\r
1224 return this buffer contains the next structure address.\r
1225 @param [in] TokenCount Number of structures to initialize\r
1226 @param [in] ppFreeQueue Address of the free queue head\r
1227 @param [in] DebugFlags Flags for debug messages\r
1228 @param [in] pEventName Zero terminated string containing the event name\r
1229 @param [in] pfnCompletion Completion routine address\r
d7ce7006 1230\r
a88c3163 1231 @retval EFI_SUCCESS - The structures were properly initialized\r
1232\r
1233**/\r
d7ce7006 1234EFI_STATUS\r
a88c3163 1235EslSocketIoInit (\r
1236 IN ESL_PORT * pPort,\r
1237 IN ESL_IO_MGMT ** ppIo,\r
1238 IN UINTN TokenCount,\r
1239 IN ESL_IO_MGMT ** ppFreeQueue,\r
1240 IN UINTN DebugFlags,\r
1241 IN CHAR8 * pEventName,\r
58081f2c 1242 IN PFN_API_IO_COMPLETE pfnCompletion\r
d7ce7006 1243 );\r
1244\r
1245/**\r
a88c3163 1246 Determine if the socket is configured\r
d7ce7006 1247\r
a88c3163 1248 This support routine is called to determine if the socket if the\r
1249 configuration call was made to the network layer. The following\r
1250 routines call this routine to verify that they may be successful\r
1251 in their operations:\r
1252 <ul>\r
1253 <li>::EslSocketGetLocalAddress</li>\r
1254 <li>::EslSocketGetPeerAddress</li>\r
1255 <li>::EslSocketPoll</li>\r
1256 <li>::EslSocketReceive</li>\r
1257 <li>::EslSocketTransmit</li>\r
1258 </ul>\r
d7ce7006 1259\r
a88c3163 1260 @param [in] pSocket Address of an ::ESL_SOCKET structure\r
d7ce7006 1261\r
a88c3163 1262 @retval EFI_SUCCESS - The socket is configured\r
d7ce7006 1263\r
1264**/\r
1265EFI_STATUS\r
a88c3163 1266EslSocketIsConfigured (\r
1267 IN ESL_SOCKET * pSocket\r
d7ce7006 1268 );\r
1269\r
1270/**\r
a88c3163 1271 Allocate a packet for a receive or transmit operation\r
d7ce7006 1272\r
a88c3163 1273 This support routine is called by ::EslSocketRxStart and the\r
1274 network specific TxBuffer routines to get buffer space for the\r
1275 next operation.\r
d7ce7006 1276\r
a88c3163 1277 @param [in] ppPacket Address to receive the ::ESL_PACKET structure\r
1278 @param [in] LengthInBytes Length of the packet structure\r
1279 @param [in] ZeroBytes Length of packet to zero\r
1280 @param [in] DebugFlags Flags for debug messages\r
d7ce7006 1281\r
a88c3163 1282 @retval EFI_SUCCESS - The packet was allocated successfully\r
d7ce7006 1283\r
a88c3163 1284 **/\r
d7ce7006 1285EFI_STATUS\r
a88c3163 1286EslSocketPacketAllocate (\r
1287 IN ESL_PACKET ** ppPacket,\r
1288 IN size_t LengthInBytes,\r
1289 IN size_t ZeroBytes,\r
1290 IN UINTN DebugFlags\r
d7ce7006 1291 );\r
1292\r
1293/**\r
a88c3163 1294 Free a packet used for receive or transmit operation\r
d7ce7006 1295\r
a88c3163 1296 This support routine is called by the network specific Close\r
1297 and TxComplete routines and during error cases in RxComplete\r
1298 and TxBuffer. Note that the network layers typically place\r
1299 receive packets on the ESL_SOCKET::pRxFree list for reuse.\r
d7ce7006 1300\r
a88c3163 1301 @param [in] pPacket Address of an ::ESL_PACKET structure\r
1302 @param [in] DebugFlags Flags for debug messages\r
d7ce7006 1303\r
a88c3163 1304 @retval EFI_SUCCESS - The packet was allocated successfully\r
d7ce7006 1305\r
a88c3163 1306 **/\r
1307EFI_STATUS\r
1308EslSocketPacketFree (\r
1309 IN ESL_PACKET * pPacket,\r
1310 IN UINTN DebugFlags\r
1311 );\r
d7ce7006 1312\r
a88c3163 1313/**\r
1314 Allocate and initialize a ESL_PORT structure.\r
d7ce7006 1315\r
a88c3163 1316 This routine initializes an ::ESL_PORT structure for use by\r
1317 the socket. This routine calls a routine via\r
1318 ESL_PROTOCOL_API::pfnPortAllocate to initialize the network\r
1319 specific resources. The resources are released later by the\r
1320 \ref PortCloseStateMachine.\r
d7ce7006 1321\r
a88c3163 1322 This support routine is called by ::EslSocketBind and\r
1323 ::EslTcp4ListenComplete to connect the socket with the\r
1324 underlying network adapter to the socket.\r
d7ce7006 1325\r
a88c3163 1326 @param [in] pSocket Address of an ::ESL_SOCKET structure.\r
1327 @param [in] pService Address of an ::ESL_SERVICE structure.\r
1328 @param [in] ChildHandle TCP4 child handle\r
1329 @param [in] pSockAddr Address of a sockaddr structure that contains the\r
1330 connection point on the local machine. An IPv4 address\r
1331 of INADDR_ANY specifies that the connection is made to\r
1332 all of the network stacks on the platform. Specifying a\r
1333 specific IPv4 address restricts the connection to the\r
1334 network stack supporting that address. Specifying zero\r
1335 for the port causes the network layer to assign a port\r
1336 number from the dynamic range. Specifying a specific\r
1337 port number causes the network layer to use that port.\r
1338 @param [in] bBindTest TRUE if EslSocketBindTest should be called\r
1339 @param [in] DebugFlags Flags for debug messages\r
1340 @param [out] ppPort Buffer to receive new ::ESL_PORT structure address\r
d7ce7006 1341\r
a88c3163 1342 @retval EFI_SUCCESS - Socket successfully created\r
d7ce7006 1343\r
a88c3163 1344 **/\r
d7ce7006 1345EFI_STATUS\r
a88c3163 1346EslSocketPortAllocate (\r
1347 IN ESL_SOCKET * pSocket,\r
1348 IN ESL_SERVICE * pService,\r
1349 IN EFI_HANDLE ChildHandle,\r
1350 IN CONST struct sockaddr * pSockAddr,\r
1351 IN BOOLEAN bBindTest,\r
1352 IN UINTN DebugFlags,\r
1353 OUT ESL_PORT ** ppPort\r
d7ce7006 1354 );\r
1355\r
1356/**\r
a88c3163 1357 Close a port.\r
1358\r
1359 This routine releases the resources allocated by ::EslSocketPortAllocate.\r
1360 This routine calls ESL_PROTOCOL_API::pfnPortClose to release the network\r
1361 specific resources.\r
1362\r
1363 This routine is called by:\r
1364 <ul>\r
1365 <li>::EslIp4PortAllocate - Port initialization failure</li>\r
1366 <li>::EslSocketPortCloseRxDone - Last step of close processing</li>\r
1367 <li>::EslTcp4ConnectComplete - Connection failure and reducint the port list to a single port</li>\r
1368 <li>::EslTcp4PortAllocate - Port initialization failure</li>\r
1369 <li>::EslUdp4PortAllocate - Port initialization failure</li>\r
1370 </ul>\r
1371 See the \ref PortCloseStateMachine section.\r
d7ce7006 1372 \r
a88c3163 1373 @param [in] pPort Address of an ::ESL_PORT structure.\r
d7ce7006 1374\r
a88c3163 1375 @retval EFI_SUCCESS The port is closed\r
1376 @retval other Port close error\r
1377\r
1378**/\r
d7ce7006 1379EFI_STATUS\r
a88c3163 1380EslSocketPortClose (\r
1381 IN ESL_PORT * pPort\r
d7ce7006 1382 );\r
1383\r
1384/**\r
a88c3163 1385 Process the port close completion event\r
d7ce7006 1386\r
a88c3163 1387 This routine attempts to complete the port close operation.\r
d7ce7006 1388\r
a88c3163 1389 This routine is called by the TCP layer upon completion of\r
1390 the close operation.\r
1391 See the \ref PortCloseStateMachine section.\r
d7ce7006 1392\r
a88c3163 1393 @param [in] Event The close completion event\r
1394\r
1395 @param [in] pPort Address of an ::ESL_PORT structure.\r
d7ce7006 1396\r
1397**/\r
1398VOID\r
a88c3163 1399EslSocketPortCloseComplete (\r
d7ce7006 1400 IN EFI_EVENT Event,\r
a88c3163 1401 IN ESL_PORT * pPort\r
d7ce7006 1402 );\r
1403\r
1404/**\r
a88c3163 1405 Port close state 3\r
d7ce7006 1406\r
a88c3163 1407 This routine determines the state of the receive operations and\r
1408 continues the close operation after the pending receive operations\r
1409 are cancelled.\r
d7ce7006 1410\r
a88c3163 1411 This routine is called by\r
1412 <ul>\r
1413 <li>::EslIp4RxComplete</li>\r
1414 <li>::EslSocketPortCloseComplete</li>\r
1415 <li>::EslSocketPortCloseTxDone</li>\r
1416 <li>::EslUdp4RxComplete</li>\r
1417 </ul>\r
1418 to determine the state of the receive operations.\r
1419 See the \ref PortCloseStateMachine section.\r
1420\r
1421 @param [in] pPort Address of an ::ESL_PORT structure.\r
1422\r
1423 @retval EFI_SUCCESS The port is closed\r
1424 @retval EFI_NOT_READY The port is still closing\r
1425 @retval EFI_ALREADY_STARTED Error, the port is in the wrong state,\r
1426 most likely the routine was called already.\r
1427\r
1428**/\r
1429EFI_STATUS\r
1430EslSocketPortCloseRxDone (\r
1431 IN ESL_PORT * pPort\r
d7ce7006 1432 );\r
1433\r
1434/**\r
a88c3163 1435 Start the close operation on a port, state 1.\r
d7ce7006 1436\r
a88c3163 1437 This routine marks the port as closed and initiates the \ref\r
1438 PortCloseStateMachine. The first step is to allow the \ref\r
1439 TransmitEngine to run down.\r
d7ce7006 1440\r
a88c3163 1441 This routine is called by ::EslSocketCloseStart to initiate the socket\r
1442 network specific close operation on the socket.\r
d7ce7006 1443\r
a88c3163 1444 @param [in] pPort Address of an ::ESL_PORT structure.\r
1445 @param [in] bCloseNow Set TRUE to abort active transfers\r
1446 @param [in] DebugFlags Flags for debug messages\r
1447\r
1448 @retval EFI_SUCCESS The port is closed, not normally returned\r
1449 @retval EFI_NOT_READY The port has started the closing process\r
1450 @retval EFI_ALREADY_STARTED Error, the port is in the wrong state,\r
1451 most likely the routine was called already.\r
1452\r
1453**/\r
1454EFI_STATUS\r
1455EslSocketPortCloseStart (\r
1456 IN ESL_PORT * pPort,\r
1457 IN BOOLEAN bCloseNow,\r
1458 IN UINTN DebugFlags\r
d7ce7006 1459 );\r
1460\r
1461/**\r
a88c3163 1462 Port close state 2\r
1463\r
1464 This routine determines the state of the transmit engine and\r
1465 continue the close operation after the transmission is complete.\r
1466 The next step is to stop the \ref ReceiveEngine.\r
1467 See the \ref PortCloseStateMachine section.\r
d7ce7006 1468\r
a88c3163 1469 This routine is called by ::EslSocketPortCloseStart to determine\r
1470 if the transmission is complete.\r
d7ce7006 1471\r
a88c3163 1472 @param [in] pPort Address of an ::ESL_PORT structure.\r
1473\r
1474 @retval EFI_SUCCESS The port is closed, not normally returned\r
1475 @retval EFI_NOT_READY The port is still closing\r
1476 @retval EFI_ALREADY_STARTED Error, the port is in the wrong state,\r
1477 most likely the routine was called already.\r
d7ce7006 1478\r
1479**/\r
a88c3163 1480EFI_STATUS\r
1481EslSocketPortCloseTxDone (\r
1482 IN ESL_PORT * pPort\r
d7ce7006 1483 );\r
1484\r
1485/**\r
a88c3163 1486 Cancel the receive operations\r
d7ce7006 1487\r
a88c3163 1488 This routine cancels a pending receive operation.\r
1489 See the \ref ReceiveEngine section.\r
d7ce7006 1490\r
a88c3163 1491 This routine is called by ::EslSocketShutdown when the socket\r
1492 layer is being shutdown.\r
d7ce7006 1493\r
a88c3163 1494 @param [in] pPort Address of an ::ESL_PORT structure\r
1495 @param [in] pIo Address of an ::ESL_IO_MGMT structure\r
1496\r
1497 **/\r
d7ce7006 1498VOID\r
a88c3163 1499EslSocketRxCancel (\r
1500 IN ESL_PORT * pPort,\r
1501 IN ESL_IO_MGMT * pIo\r
d7ce7006 1502 );\r
1503\r
1504/**\r
a88c3163 1505 Process the receive completion\r
d7ce7006 1506\r
a88c3163 1507 This routine queues the data in FIFO order in either the urgent\r
1508 or normal data queues depending upon the type of data received.\r
1509 See the \ref ReceiveEngine section.\r
d7ce7006 1510\r
a88c3163 1511 This routine is called when some data is received by:\r
1512 <ul>\r
1513 <li>::EslIp4RxComplete</li>\r
1514 <li>::EslTcp4RxComplete</li>\r
1515 <li>::EslUdp4RxComplete</li>\r
1516 </ul>\r
d7ce7006 1517\r
a88c3163 1518 @param [in] pIo Address of an ::ESL_IO_MGMT structure\r
1519 @param [in] Status Receive status\r
1520 @param [in] LengthInBytes Length of the receive data\r
1521 @param [in] bUrgent TRUE if urgent data is received and FALSE\r
1522 for normal data.\r
d7ce7006 1523\r
a88c3163 1524**/\r
1525VOID\r
1526EslSocketRxComplete (\r
1527 IN ESL_IO_MGMT * pIo,\r
1528 IN EFI_STATUS Status,\r
1529 IN UINTN LengthInBytes,\r
1530 IN BOOLEAN bUrgent\r
1531 );\r
d7ce7006 1532\r
3bdf9aae 1533/**\r
1534 Poll a socket for pending receive activity.\r
1535\r
1536 This routine is called at elivated TPL and extends the idle\r
1537 loop which polls a socket down into the LAN driver layer to\r
1538 determine if there is any receive activity.\r
1539\r
1540 The ::EslSocketPoll, ::EslSocketReceive and ::EslSocketTransmit\r
1541 routines call this routine when there is nothing to do.\r
1542\r
1543 @param [in] pSocket Address of an ::EFI_SOCKET structure.\r
1544\r
1545 **/\r
1546VOID\r
1547EslSocketRxPoll (\r
1548 IN ESL_SOCKET * pSocket\r
1549 );\r
1550\r
a88c3163 1551/**\r
1552 Start a receive operation\r
d7ce7006 1553\r
a88c3163 1554 This routine posts a receive buffer to the network adapter.\r
1555 See the \ref ReceiveEngine section.\r
d7ce7006 1556\r
a88c3163 1557 This support routine is called by:\r
1558 <ul>\r
1559 <li>::EslIp4Receive to restart the receive engine to release flow control.</li>\r
1560 <li>::EslIp4RxComplete to continue the operation of the receive engine if flow control is not being applied.</li>\r
1561 <li>::EslIp4SocketIsConfigured to start the recevie engine for the new socket.</li>\r
1562 <li>::EslTcp4ListenComplete to start the recevie engine for the new socket.</li>\r
1563 <li>::EslTcp4Receive to restart the receive engine to release flow control.</li>\r
1564 <li>::EslTcp4RxComplete to continue the operation of the receive engine if flow control is not being applied.</li>\r
1565 <li>::EslUdp4Receive to restart the receive engine to release flow control.</li>\r
1566 <li>::EslUdp4RxComplete to continue the operation of the receive engine if flow control is not being applied.</li>\r
1567 <li>::EslUdp4SocketIsConfigured to start the recevie engine for the new socket.</li>\r
1568 </ul>\r
d7ce7006 1569\r
a88c3163 1570 @param [in] pPort Address of an ::ESL_PORT structure.\r
d7ce7006 1571\r
a88c3163 1572 **/\r
1573VOID\r
1574EslSocketRxStart (\r
1575 IN ESL_PORT * pPort\r
1576 );\r
d7ce7006 1577\r
a88c3163 1578/**\r
1579 Complete the transmit operation\r
1580\r
1581 This support routine handles the transmit completion processing for\r
1582 the various network layers. It frees the ::ESL_IO_MGMT structure\r
1583 and and frees packet resources by calling ::EslSocketPacketFree.\r
1584 Transmit errors are logged in ESL_SOCKET::TxError.\r
1585 See the \ref TransmitEngine section.\r
1586\r
1587 This routine is called by:\r
1588 <ul>\r
1589 <li>::EslIp4TxComplete</li>\r
1590 <li>::EslTcp4TxComplete</li>\r
1591 <li>::EslTcp4TxOobComplete</li>\r
1592 <li>::EslUdp4TxComplete</li>\r
1593 </ul>\r
1594\r
1595 @param [in] pIo Address of an ::ESL_IO_MGMT structure\r
1596 @param [in] LengthInBytes Length of the data in bytes\r
1597 @param [in] Status Transmit operation status\r
1598 @param [in] pQueueType Zero terminated string describing queue type\r
1599 @param [in] ppQueueHead Transmit queue head address\r
1600 @param [in] ppQueueTail Transmit queue tail address\r
1601 @param [in] ppActive Active transmit queue address\r
1602 @param [in] ppFree Free transmit queue address\r
d7ce7006 1603\r
a88c3163 1604 **/\r
1605VOID\r
1606EslSocketTxComplete (\r
1607 IN ESL_IO_MGMT * pIo,\r
1608 IN UINT32 LengthInBytes,\r
1609 IN EFI_STATUS Status,\r
1610 IN CONST CHAR8 * pQueueType,\r
1611 IN ESL_PACKET ** ppQueueHead,\r
1612 IN ESL_PACKET ** ppQueueTail,\r
1613 IN ESL_IO_MGMT ** ppActive,\r
1614 IN ESL_IO_MGMT ** ppFree\r
d7ce7006 1615 );\r
1616\r
1617/**\r
1618 Transmit data using a network connection.\r
1619\r
a88c3163 1620 This support routine starts a transmit operation on the\r
1621 underlying network layer.\r
1622\r
1623 The network specific code calls this routine to start a\r
1624 transmit operation. See the \ref TransmitEngine section.\r
1625\r
1626 @param [in] pPort Address of an ::ESL_PORT structure\r
1627 @param [in] ppQueueHead Transmit queue head address\r
1628 @param [in] ppQueueTail Transmit queue tail address\r
1629 @param [in] ppActive Active transmit queue address\r
1630 @param [in] ppFree Free transmit queue address\r
d7ce7006 1631\r
1632 **/\r
1633VOID\r
a88c3163 1634EslSocketTxStart (\r
1635 IN ESL_PORT * pPort,\r
1636 IN ESL_PACKET ** ppQueueHead,\r
1637 IN ESL_PACKET ** ppQueueTail,\r
1638 IN ESL_IO_MGMT ** ppActive,\r
1639 IN ESL_IO_MGMT ** ppFree\r
d7ce7006 1640 );\r
1641\r
1642//------------------------------------------------------------------------------\r
1643\r
1644#endif // _SOCKET_H_\r