]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/Protocol/EfiSocket.h
Fixed close for socket to properly release the socket context structure and the handle.
[mirror_edk2.git] / StdLib / Include / Protocol / EfiSocket.h
CommitLineData
d7ce7006 1/** @file\r
2 Definitions for the EFI Socket protocol.\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.php\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\r
15#ifndef _EFI_SOCKET_H_\r
16#define _EFI_SOCKET_H_\r
17\r
18#include <errno.h>\r
19#include <Uefi.h>\r
20\r
21#include <netinet/in.h>\r
22\r
23#include <sys/poll.h>\r
24#include <sys/socket.h>\r
25\r
26//------------------------------------------------------------------------------\r
27// Data Types\r
28//------------------------------------------------------------------------------\r
29\r
a88c3163 30/**\r
31EfiSocketLib (SocketDxe) interface \r
32**/\r
d7ce7006 33typedef struct _EFI_SOCKET_PROTOCOL EFI_SOCKET_PROTOCOL;\r
34\r
35/**\r
36 Constructor/Destructor\r
37\r
38 @retval EFI_SUCCESS The operation was successful\r
39\r
40 **/\r
41typedef\r
42EFI_STATUS\r
43(* PFN_ESL_xSTRUCTOR) (\r
44 VOID\r
45 );\r
46\r
47//------------------------------------------------------------------------------\r
48// Data\r
49//------------------------------------------------------------------------------\r
50\r
a88c3163 51extern PFN_ESL_xSTRUCTOR mpfnEslConstructor; ///< Constructor address for EslSocketLib\r
52extern PFN_ESL_xSTRUCTOR mpfnEslDestructor; ///< Destructor address for EslSocketLib\r
d7ce7006 53\r
a88c3163 54extern EFI_GUID gEfiSocketProtocolGuid; ///< Socket protocol GUID\r
55extern EFI_GUID gEfiSocketServiceBindingProtocolGuid; ///< Socket layer service binding protocol GUID\r
d7ce7006 56\r
57//------------------------------------------------------------------------------\r
58// Socket API\r
59//------------------------------------------------------------------------------\r
60\r
61/**\r
62 Accept a network connection.\r
63\r
a88c3163 64 This routine calls the network specific layer to remove the next\r
65 connection from the FIFO.\r
d7ce7006 66\r
a88c3163 67 The ::accept calls this routine to poll for a network\r
68 connection to the socket. When a connection is available\r
69 this routine returns the ::EFI_SOCKET_PROTOCOL structure address\r
70 associated with the new socket and the remote network address\r
71 if requested.\r
72\r
73 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
d7ce7006 74\r
75 @param [in] pSockAddr Address of a buffer to receive the remote\r
76 network address.\r
77\r
78 @param [in, out] pSockAddrLength Length in bytes of the address buffer.\r
79 On output specifies the length of the\r
80 remote network address.\r
81\r
a88c3163 82 @param [out] ppSocketProtocol Address of a buffer to receive the\r
83 ::EFI_SOCKET_PROTOCOL instance\r
84 associated with the new socket.\r
d7ce7006 85\r
86 @param [out] pErrno Address to receive the errno value upon completion.\r
87\r
88 @retval EFI_SUCCESS New connection successfully created\r
89 @retval EFI_NOT_READY No connection is available\r
90\r
91 **/\r
92typedef\r
93EFI_STATUS\r
94(* PFN_ACCEPT) (\r
95 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
96 IN struct sockaddr * pSockAddr,\r
97 IN OUT socklen_t * pSockAddrLength,\r
98 IN EFI_SOCKET_PROTOCOL ** ppSocketProtocol,\r
99 IN int * pErrno\r
100 );\r
101\r
102/**\r
103 Bind a name to a socket.\r
104\r
a88c3163 105 This routine calls the network specific layer to save the network\r
106 address of the local connection point.\r
d7ce7006 107\r
a88c3163 108 The ::bind routine calls this routine to connect a name\r
109 (network address and port) to a socket on the local machine.\r
110\r
111 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
d7ce7006 112\r
113 @param [in] pSockAddr Address of a sockaddr structure that contains the\r
114 connection point on the local machine. An IPv4 address\r
115 of INADDR_ANY specifies that the connection is made to\r
116 all of the network stacks on the platform. Specifying a\r
117 specific IPv4 address restricts the connection to the\r
118 network stack supporting that address. Specifying zero\r
119 for the port causes the network layer to assign a port\r
120 number from the dynamic range. Specifying a specific\r
121 port number causes the network layer to use that port.\r
122\r
123 @param [in] SockAddrLen Specifies the length in bytes of the sockaddr structure.\r
124\r
125 @param [out] pErrno Address to receive the errno value upon completion.\r
126\r
127 @retval EFI_SUCCESS - Socket successfully created\r
128\r
129 **/\r
130typedef\r
131EFI_STATUS\r
132(* PFN_BIND) (\r
133 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
134 IN const struct sockaddr * pSockAddr,\r
135 IN socklen_t SockAddrLength,\r
136 OUT int * pErrno\r
137 );\r
138\r
139/**\r
140 Determine if the socket is closed\r
141\r
a88c3163 142 This routine checks the state of the socket to determine if\r
143 the network specific layer has completed the close operation.\r
d7ce7006 144\r
a88c3163 145 The ::close routine polls this routine to determine when the\r
146 close operation is complete. The close operation needs to\r
147 reverse the operations of the ::EslSocketAllocate routine.\r
148\r
149 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
d7ce7006 150 @param [out] pErrno Address to receive the errno value upon completion.\r
151\r
152 @retval EFI_SUCCESS Socket successfully closed\r
153 @retval EFI_NOT_READY Close still in progress\r
154 @retval EFI_ALREADY Close operation already in progress\r
155 @retval Other Failed to close the socket\r
156\r
157**/\r
158typedef\r
159EFI_STATUS\r
160(* PFN_CLOSE_POLL) (\r
161 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
162 IN int * pErrno\r
163 );\r
164\r
165/**\r
166 Start the close operation on the socket\r
167\r
a88c3163 168 This routine calls the network specific layer to initiate the\r
169 close state machine. This routine then calls the network\r
170 specific layer to determine if the close state machine has gone\r
171 to completion. The result from this poll is returned to the\r
172 caller.\r
d7ce7006 173\r
a88c3163 174 The ::close routine calls this routine to start the close\r
175 operation which reverses the operations of the\r
176 ::EslSocketAllocate routine. The close routine then polls\r
177 the ::EslSocketClosePoll routine to determine when the\r
178 socket is closed.\r
179\r
180 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
d7ce7006 181 @param [in] bCloseNow Boolean to control close behavior\r
182 @param [out] pErrno Address to receive the errno value upon completion.\r
183\r
184 @retval EFI_SUCCESS Socket successfully closed\r
185 @retval EFI_NOT_READY Close still in progress\r
186 @retval EFI_ALREADY Close operation already in progress\r
187 @retval Other Failed to close the socket\r
188\r
189**/\r
190typedef\r
191EFI_STATUS\r
192(* PFN_CLOSE_START) (\r
193 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
194 IN BOOLEAN bCloseNow,\r
195 IN int * pErrno\r
196 );\r
197\r
198/**\r
199 Connect to a remote system via the network.\r
200\r
a88c3163 201 This routine calls the network specific layer to establish\r
202 the remote system address and establish the connection to\r
203 the remote system.\r
d7ce7006 204\r
a88c3163 205 The ::connect routine calls this routine to establish a\r
206 connection with the specified remote system. This routine\r
207 is designed to be polled by the connect routine for completion\r
208 of the network connection.\r
209 \r
210 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
d7ce7006 211\r
212 @param [in] pSockAddr Network address of the remote system.\r
a88c3163 213 \r
d7ce7006 214 @param [in] SockAddrLength Length in bytes of the network address.\r
a88c3163 215 \r
d7ce7006 216 @param [out] pErrno Address to receive the errno value upon completion.\r
a88c3163 217 \r
d7ce7006 218 @retval EFI_SUCCESS The connection was successfully established.\r
219 @retval EFI_NOT_READY The connection is in progress, call this routine again.\r
220 @retval Others The connection attempt failed.\r
221\r
222 **/\r
223typedef\r
224EFI_STATUS\r
225(* PFN_CONNECT) (\r
226 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
227 IN const struct sockaddr * pSockAddr,\r
228 IN socklen_t SockAddrLength,\r
229 IN int * pErrno\r
230 );\r
231\r
232/**\r
233 Get the local address.\r
234\r
a88c3163 235 This routine calls the network specific layer to get the network\r
236 address of the local host connection point.\r
7dc13291 237\r
a88c3163 238 The ::getsockname routine calls this routine to obtain the network\r
239 address associated with the local host connection point.\r
240\r
241 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
242 \r
d7ce7006 243 @param [out] pAddress Network address to receive the local system address\r
244\r
245 @param [in,out] pAddressLength Length of the local network address structure\r
246\r
247 @param [out] pErrno Address to receive the errno value upon completion.\r
248\r
249 @retval EFI_SUCCESS - Local address successfully returned\r
250\r
251 **/\r
252typedef\r
253EFI_STATUS\r
254(* PFN_GET_LOCAL) (\r
255 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
256 OUT struct sockaddr * pAddress,\r
257 IN OUT socklen_t * pAddressLength,\r
258 IN int * pErrno\r
259 );\r
260\r
261/**\r
262 Get the peer address.\r
263\r
a88c3163 264 This routine calls the network specific layer to get the remote\r
265 system connection point.\r
7dc13291 266\r
a88c3163 267 The ::getpeername routine calls this routine to obtain the network\r
268 address of the remote connection point.\r
269\r
270 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
271 \r
d7ce7006 272 @param [out] pAddress Network address to receive the remote system address\r
273\r
274 @param [in,out] pAddressLength Length of the remote network address structure\r
275\r
276 @param [out] pErrno Address to receive the errno value upon completion.\r
277\r
278 @retval EFI_SUCCESS - Remote address successfully returned\r
279\r
280 **/\r
281typedef\r
282EFI_STATUS\r
283(* PFN_GET_PEER) (\r
284 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
285 OUT struct sockaddr * pAddress,\r
286 IN OUT socklen_t * pAddressLength,\r
287 IN int * pErrno\r
288 );\r
289\r
290/**\r
291 Establish the known port to listen for network connections.\r
292\r
a88c3163 293 This routine calls into the network protocol layer to establish\r
294 a handler that is called upon connection completion. The handler\r
295 is responsible for inserting the connection into the FIFO.\r
296\r
297 The ::listen routine indirectly calls this routine to place the\r
298 socket into a state that enables connection attempts. Connections\r
299 are placed in a FIFO that is serviced by the application. The\r
300 application calls the ::accept (::EslSocketAccept) routine to\r
301 remove the next connection from the FIFO and get the associated\r
302 socket and address.\r
d7ce7006 303\r
304 @param [in] pSocketProtocol Address of the socket protocol structure.\r
305\r
306 @param [in] Backlog Backlog specifies the maximum FIFO depth for\r
307 the connections waiting for the application\r
308 to call accept. Connection attempts received\r
309 while the queue is full are refused.\r
310\r
311 @param [out] pErrno Address to receive the errno value upon completion.\r
312\r
313 @retval EFI_SUCCESS - Socket successfully created\r
314 @retval Other - Failed to enable the socket for listen\r
315\r
316**/\r
317typedef\r
318EFI_STATUS\r
319(* PFN_LISTEN) (\r
320 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
321 IN INT32 Backlog,\r
322 OUT int * pErrno\r
323 );\r
324\r
325/**\r
326 Get the socket options\r
327\r
a88c3163 328 This routine handles the socket level options and passes the\r
329 others to the network specific layer.\r
330\r
331 The ::getsockopt routine calls this routine to retrieve the\r
332 socket options one at a time by name.\r
d7ce7006 333\r
a88c3163 334 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
d7ce7006 335 @param [in] level Option protocol level\r
336 @param [in] OptionName Name of the option\r
337 @param [out] pOptionValue Buffer to receive the option value\r
338 @param [in,out] pOptionLength Length of the buffer in bytes,\r
339 upon return length of the option value in bytes\r
340 @param [out] pErrno Address to receive the errno value upon completion.\r
341\r
342 @retval EFI_SUCCESS - Socket data successfully received\r
343\r
344 **/\r
345typedef\r
346EFI_STATUS\r
347(* PFN_OPTION_GET) (\r
348 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
349 IN int level,\r
350 IN int OptionName,\r
351 OUT void * __restrict pOptionValue,\r
352 IN OUT socklen_t * __restrict pOptionLength,\r
353 IN int * pErrno\r
354 );\r
355\r
356/**\r
357 Set the socket options\r
358\r
a88c3163 359 This routine handles the socket level options and passes the\r
360 others to the network specific layer.\r
d7ce7006 361\r
a88c3163 362 The ::setsockopt routine calls this routine to adjust the socket\r
363 options one at a time by name.\r
364\r
365 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
d7ce7006 366 @param [in] level Option protocol level\r
367 @param [in] OptionName Name of the option\r
368 @param [in] pOptionValue Buffer containing the option value\r
369 @param [in] OptionLength Length of the buffer in bytes\r
370 @param [out] pErrno Address to receive the errno value upon completion.\r
371\r
a88c3163 372 @retval EFI_SUCCESS - Option successfully set\r
d7ce7006 373\r
374 **/\r
375typedef\r
376EFI_STATUS\r
377(* PFN_OPTION_SET) (\r
378 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
379 IN int level,\r
380 IN int OptionName,\r
381 IN CONST void * pOptionValue,\r
382 IN socklen_t OptionLength,\r
383 IN int * pErrno\r
384 );\r
385\r
386/**\r
387 Poll a socket for pending activity.\r
388\r
a88c3163 389 This routine builds a detected event mask which is returned to\r
390 the caller in the buffer provided.\r
d7ce7006 391\r
a88c3163 392 The ::poll routine calls this routine to determine if the socket\r
393 needs to be serviced as a result of connection, error, receive or\r
394 transmit activity.\r
395\r
396 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
d7ce7006 397\r
398 @param [in] Events Events of interest for this socket\r
399\r
400 @param [in] pEvents Address to receive the detected events\r
401\r
402 @param [out] pErrno Address to receive the errno value upon completion.\r
403\r
404 @retval EFI_SUCCESS - Socket successfully polled\r
405 @retval EFI_INVALID_PARAMETER - When pEvents is NULL\r
406\r
407 **/\r
408typedef\r
409EFI_STATUS\r
410(* PFN_POLL) (\r
411 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
412 IN short Events,\r
413 IN short * pEvents,\r
414 IN int * pErrno\r
415 );\r
416\r
417/**\r
418 Receive data from a network connection.\r
419\r
a88c3163 420 This routine calls the network specific routine to remove the\r
421 next portion of data from the receive queue and return it to the\r
422 caller.\r
d7ce7006 423\r
a88c3163 424 The ::recvfrom routine calls this routine to determine if any data\r
425 is received from the remote system. Note that the other routines\r
426 ::recv and ::read are layered on top of ::recvfrom.\r
7dc13291 427\r
a88c3163 428 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
429 \r
d7ce7006 430 @param [in] Flags Message control flags\r
a88c3163 431 \r
d7ce7006 432 @param [in] BufferLength Length of the the buffer\r
a88c3163 433 \r
d7ce7006 434 @param [in] pBuffer Address of a buffer to receive the data.\r
a88c3163 435 \r
d7ce7006 436 @param [in] pDataLength Number of received data bytes in the buffer.\r
437\r
438 @param [out] pAddress Network address to receive the remote system address\r
439\r
440 @param [in,out] pAddressLength Length of the remote network address structure\r
441\r
442 @param [out] pErrno Address to receive the errno value upon completion.\r
443\r
444 @retval EFI_SUCCESS - Socket data successfully received\r
445\r
446 **/\r
447typedef\r
448EFI_STATUS\r
449(* PFN_RECEIVE) (\r
450 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
451 IN int Flags,\r
452 IN size_t BufferLength,\r
453 IN UINT8 * pBuffer,\r
454 OUT size_t * pDataLength,\r
455 OUT struct sockaddr * pAddress,\r
456 IN OUT socklen_t * pAddressLength,\r
457 IN int * pErrno\r
458 );\r
459\r
d7ce7006 460/**\r
461 Shutdown the socket receive and transmit operations\r
462\r
a88c3163 463 This routine sets a flag to stop future transmissions and calls\r
464 the network specific layer to cancel the pending receive operation.\r
d7ce7006 465\r
a88c3163 466 The ::shutdown routine calls this routine to stop receive and transmit\r
467 operations on the socket.\r
7dc13291 468\r
a88c3163 469 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
470 \r
d7ce7006 471 @param [in] How Which operations to stop\r
a88c3163 472 \r
d7ce7006 473 @param [out] pErrno Address to receive the errno value upon completion.\r
474\r
475 @retval EFI_SUCCESS - Socket operations successfully shutdown\r
476\r
477 **/\r
478typedef\r
479EFI_STATUS\r
480(* PFN_SHUTDOWN) (\r
481 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
482 IN int How,\r
483 IN int * pErrno\r
484 );\r
485\r
486/**\r
487 Initialize an endpoint for network communication.\r
488\r
a88c3163 489 This routine initializes the communication endpoint.\r
d7ce7006 490\r
a88c3163 491 The ::socket routine calls this routine indirectly to create\r
492 the communication endpoint.\r
d7ce7006 493\r
a88c3163 494 @param [in] pSocketProtocol Address of the socket protocol structure.\r
d7ce7006 495 @param [in] domain Select the family of protocols for the client or server\r
a88c3163 496 application. See the ::socket documentation for values.\r
497 @param [in] type Specifies how to make the network connection.\r
498 See the ::socket documentation for values.\r
499 @param [in] protocol Specifies the lower layer protocol to use.\r
500 See the ::socket documentation for values.\r
d7ce7006 501 @param [out] pErrno Address to receive the errno value upon completion.\r
502\r
503 @retval EFI_SUCCESS - Socket successfully created\r
504 @retval EFI_INVALID_PARAMETER - Invalid domain value, errno = EAFNOSUPPORT\r
505 @retval EFI_INVALID_PARAMETER - Invalid type value, errno = EINVAL\r
506 @retval EFI_INVALID_PARAMETER - Invalid protocol value, errno = EINVAL\r
507\r
508 **/\r
509typedef\r
510EFI_STATUS\r
511(*PFN_SOCKET) (\r
512 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
513 IN int domain,\r
514 IN int type,\r
515 IN int protocol,\r
516 IN int * pErrno\r
517 );\r
518\r
a88c3163 519/**\r
520 Send data using a network connection.\r
521\r
522 This routine calls the network specific layer to queue the data\r
523 for transmission. Eventually the buffer will reach the head of\r
524 the queue and will get transmitted over the network. For datagram\r
525 sockets there is no guarantee that the data reaches the application\r
526 running on the remote system.\r
527\r
528 The ::sendto routine calls this routine to send data to the remote\r
529 system. Note that ::send and ::write are layered on top of ::sendto.\r
530\r
531 @param [in] pSocketProtocol Address of the ::EFI_SOCKET_PROTOCOL structure.\r
532 \r
533 @param [in] Flags Message control flags\r
534 \r
535 @param [in] BufferLength Length of the the buffer\r
536 \r
537 @param [in] pBuffer Address of a buffer containing the data to send\r
538 \r
539 @param [in] pDataLength Address to receive the number of data bytes sent\r
540\r
541 @param [in] pAddress Network address of the remote system address\r
542\r
543 @param [in] AddressLength Length of the remote network address structure\r
544\r
545 @param [out] pErrno Address to receive the errno value upon completion.\r
546\r
547 @retval EFI_SUCCESS - Socket data successfully queued for transmit\r
548\r
549 **/\r
550typedef\r
551EFI_STATUS\r
552(* PFN_TRANSMIT) (\r
553 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
554 IN int Flags,\r
555 IN size_t BufferLength,\r
556 IN CONST UINT8 * pBuffer,\r
557 OUT size_t * pDataLength,\r
558 IN const struct sockaddr * pAddress,\r
559 IN socklen_t AddressLength,\r
560 IN int * pErrno\r
561 );\r
562\r
d7ce7006 563//------------------------------------------------------------------------------\r
564// Socket Protocol\r
565//------------------------------------------------------------------------------\r
566\r
567/**\r
568 Socket protocol declaration\r
569**/\r
570typedef struct _EFI_SOCKET_PROTOCOL {\r
571 EFI_HANDLE SocketHandle; ///< Handle for the socket\r
572 PFN_ACCEPT pfnAccept; ///< Accept a network connection\r
573 PFN_BIND pfnBind; ///< Bind a local address to the socket\r
574 PFN_CLOSE_POLL pfnClosePoll; ///< Determine if the socket is closed\r
575 PFN_CLOSE_START pfnCloseStart; ///< Start the close operation\r
576 PFN_CONNECT pfnConnect; ///< Connect to a remote system\r
577 PFN_GET_LOCAL pfnGetLocal; ///< Get local address\r
578 PFN_GET_PEER pfnGetPeer; ///< Get peer address\r
579 PFN_LISTEN pfnListen; ///< Enable connection attempts on known port\r
d7ce7006 580 PFN_OPTION_GET pfnOptionGet; ///< Get socket options\r
581 PFN_OPTION_SET pfnOptionSet; ///< Set socket options\r
a88c3163 582 PFN_POLL pfnPoll; ///< Poll for socket activity\r
d7ce7006 583 PFN_RECEIVE pfnReceive; ///< Receive data from a socket\r
d7ce7006 584 PFN_SHUTDOWN pfnShutdown; ///< Shutdown receive and transmit operations\r
585 PFN_SOCKET pfnSocket; ///< Initialize the socket\r
a88c3163 586 PFN_TRANSMIT pfnTransmit; ///< Transmit data using the socket\r
d7ce7006 587} GCC_EFI_SOCKET_PROTOCOL;\r
588\r
589//------------------------------------------------------------------------------\r
590// Non-blocking routines\r
591//------------------------------------------------------------------------------\r
592\r
593/**\r
a88c3163 594 Non blocking version of ::accept.\r
d7ce7006 595\r
596 @param [in] s Socket file descriptor returned from ::socket.\r
597\r
598 @param [in] address Address of a buffer to receive the remote network address.\r
599\r
600 @param [in, out] address_len Address of a buffer containing the Length in bytes\r
601 of the remote network address buffer. Upon return,\r
602 contains the length of the remote network address.\r
603\r
7dc13291 604 @return This routine returns zero if successful and -1 when an error occurs.\r
a88c3163 605 In the case of an error, ::errno contains more details.\r
d7ce7006 606\r
607 **/\r
608int\r
609AcceptNB (\r
610 int s,\r
611 struct sockaddr * address,\r
612 socklen_t * address_len\r
613 );\r
614\r
4652be0c 615/**\r
616 Free the socket resources\r
617\r
618 This releases the socket resources allocated by calling\r
619 EslServiceGetProtocol.\r
620\r
621 This routine is called from the ::close routine in BsdSocketLib\r
622 to release the socket resources.\r
623\r
624 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL\r
625 structure\r
626\r
627 @return Value for ::errno, zero (0) indicates success.\r
628\r
629 **/\r
630int\r
631EslServiceFreeProtocol (\r
632 IN EFI_SOCKET_PROTOCOL * pSocketProtocol\r
633 );\r
634\r
d7ce7006 635/**\r
a88c3163 636 Connect to the EFI socket library\r
d7ce7006 637\r
638 @param [in] ppSocketProtocol Address to receive the socket protocol address\r
639\r
a88c3163 640 @return Value for ::errno, zero (0) indicates success.\r
641\r
d7ce7006 642 **/\r
643int\r
644EslServiceGetProtocol (\r
645 IN EFI_SOCKET_PROTOCOL ** ppSocketProtocol\r
646 );\r
647\r
648//------------------------------------------------------------------------------\r
649\r
650#endif // _EFI_SOCKET_H_\r