]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - StdLib/Include/Efi/EfiSocketLib.h
MdeModulePkg: Delete never touched code
[mirror_edk2.git] / StdLib / Include / Efi / EfiSocketLib.h
... / ...
CommitLineData
1/** @file\r
2 Definitions for the EFI Socket layer library.\r
3\r
4 Copyright (c) 2011 - 2015, 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\r
15#ifndef _EFI_SOCKET_LIB_H_\r
16#define _EFI_SOCKET_LIB_H_\r
17\r
18#include <Uefi.h>\r
19\r
20#include <Library/BaseMemoryLib.h>\r
21#include <Library/DebugLib.h>\r
22#include <Library/MemoryAllocationLib.h>\r
23#include <Library/UefiBootServicesTableLib.h>\r
24#include <Library/UefiLib.h>\r
25\r
26#include <Protocol/EfiSocket.h>\r
27#include <Protocol/Ip4Config2.h>\r
28#include <Protocol/Ip6Config.h>\r
29#include <Protocol/ServiceBinding.h>\r
30#include <Protocol/Tcp4.h>\r
31#include <Protocol/Tcp6.h>\r
32#include <Protocol/Udp4.h>\r
33#include <Protocol/Udp6.h>\r
34\r
35#include <sys/time.h>\r
36\r
37//------------------------------------------------------------------------------\r
38// Constants\r
39//------------------------------------------------------------------------------\r
40\r
41#define DEBUG_TPL 0x40000000 ///< Display TPL change messages\r
42\r
43#define TPL_SOCKETS TPL_CALLBACK ///< TPL for routine synchronization\r
44\r
45//------------------------------------------------------------------------------\r
46// Macros\r
47//------------------------------------------------------------------------------\r
48\r
49#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */\r
50#define DBG_ENTER() DEBUG (( DEBUG_INFO, "Entering " __FUNCTION__ "\n" )) ///< Display routine entry\r
51#define DBG_EXIT() DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ "\n" )) ///< Display routine exit\r
52#define DBG_EXIT_DEC(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: %d\n", Status )) ///< Display routine exit with decimal value\r
53#define DBG_EXIT_HEX(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: 0x%08x\n", Status )) ///< Display routine exit with hex value\r
54#define DBG_EXIT_STATUS(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: %r\n", Status )) ///< Display routine exit with status value\r
55#define DBG_EXIT_TF(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", returning %s\n", (FALSE == Status) ? L"FALSE" : L"TRUE" )) ///< Display routine with TRUE/FALSE value\r
56#else // _MSC_VER\r
57#define DBG_ENTER() ///< Display routine entry\r
58#define DBG_EXIT() ///< Display routine exit\r
59#define DBG_EXIT_DEC(Status) ///< Display routine exit with decimal value\r
60#define DBG_EXIT_HEX(Status) ///< Display routine exit with hex value\r
61#define DBG_EXIT_STATUS(Status) ///< Display routine exit with status value\r
62#define DBG_EXIT_TF(Status) ///< Display routine with TRUE/FALSE value\r
63#endif // _MSC_VER\r
64\r
65#define DIM(x) ( sizeof ( x ) / sizeof ( x[0] )) ///< Compute the number of entries in an array\r
66\r
67/**\r
68 Verify new TPL value\r
69\r
70 This macro which is enabled when debug is enabled verifies that\r
71 the new TPL value is >= the current TPL value.\r
72**/\r
73#ifdef VERIFY_TPL\r
74#undef VERIFY_TPL\r
75#endif // VERIFY_TPL\r
76\r
77#if !defined(MDEPKG_NDEBUG)\r
78\r
79/**\r
80 Verify that the TPL is at the correct level\r
81**/\r
82#define VERIFY_AT_TPL(tpl) \\r
83{ \\r
84 EFI_TPL PreviousTpl; \\r
85 \\r
86 PreviousTpl = EfiGetCurrentTpl ( ); \\r
87 if ( PreviousTpl != tpl ) { \\r
88 DEBUG (( DEBUG_ERROR | DEBUG_TPL, \\r
89 "Current TPL: %d, New TPL: %d\r\n", \\r
90 PreviousTpl, tpl )); \\r
91 ASSERT ( PreviousTpl == tpl ); \\r
92 } \\r
93}\r
94\r
95#define VERIFY_TPL(tpl) \\r
96{ \\r
97 EFI_TPL PreviousTpl; \\r
98 \\r
99 PreviousTpl = EfiGetCurrentTpl ( ); \\r
100 if ( PreviousTpl > tpl ) { \\r
101 DEBUG (( DEBUG_ERROR | DEBUG_TPL, \\r
102 "Current TPL: %d, New TPL: %d\r\n", \\r
103 PreviousTpl, tpl )); \\r
104 ASSERT ( PreviousTpl <= tpl ); \\r
105 } \\r
106}\r
107\r
108#else // MDEPKG_NDEBUG\r
109\r
110#define VERIFY_AT_TPL(tpl) ///< Verify that the TPL is at the correct level\r
111#define VERIFY_TPL(tpl) ///< Verify that the TPL is at the correct level\r
112\r
113#endif // MDEPKG_NDEBUG\r
114\r
115/**\r
116 Raise TPL to the specified level\r
117**/\r
118#define RAISE_TPL(PreviousTpl, tpl) \\r
119 VERIFY_TPL ( tpl ); \\r
120 PreviousTpl = gBS->RaiseTPL ( tpl );\r
121\r
122/**\r
123 Restore the TPL to the previous value\r
124**/\r
125#define RESTORE_TPL(tpl) \\r
126 gBS->RestoreTPL ( tpl )\r
127\r
128//------------------------------------------------------------------------------\r
129// Data Types\r
130//------------------------------------------------------------------------------\r
131\r
132typedef struct _ESL_SERVICE ESL_SERVICE; ///< Forward delcaration\r
133\r
134/**\r
135 Protocol binding and installation control structure\r
136\r
137 The driver uses this structure to simplify the driver binding processing.\r
138**/\r
139typedef struct {\r
140 CHAR16 * pName; ///< Protocol name\r
141 EFI_GUID * pNetworkBinding; ///< Network service binding protocol for socket support\r
142 EFI_GUID * pNetworkProtocolGuid;///< Network protocol GUID\r
143 CONST EFI_GUID * pTagGuid; ///< Tag to mark protocol in use\r
144 UINTN ServiceListOffset; ///< Offset in ::ESL_LAYER for the list of services\r
145 UINTN RxIo; ///< Number of receive ESL_IO_MGMT structures for data\r
146 UINTN TxIoNormal; ///< Number of transmit ESL_IO_MGMT structures for normal data\r
147 UINTN TxIoUrgent; ///< Number of transmit ESL_IO_MGMT structures for urgent data\r
148} ESL_SOCKET_BINDING;\r
149\r
150//------------------------------------------------------------------------------\r
151// GUIDs\r
152//------------------------------------------------------------------------------\r
153\r
154extern CONST EFI_GUID mEslIp4ServiceGuid; ///< Tag GUID for the IPv4 layer\r
155extern CONST EFI_GUID mEslIp6ServiceGuid; ///< Tag GUID for the IPv6 layer\r
156extern CONST EFI_GUID mEslTcp4ServiceGuid; ///< Tag GUID for the TCPv4 layer\r
157extern CONST EFI_GUID mEslTcp6ServiceGuid; ///< Tag GUID for the TCPv6 layer\r
158extern CONST EFI_GUID mEslUdp4ServiceGuid; ///< Tag GUID for the UDPv4 layer\r
159extern CONST EFI_GUID mEslUdp6ServiceGuid; ///< Tag GUID for the UDPv6 layer\r
160\r
161//------------------------------------------------------------------------------\r
162// Data\r
163//------------------------------------------------------------------------------\r
164\r
165extern CONST ESL_SOCKET_BINDING cEslSocketBinding[];///< List of network service bindings\r
166extern CONST UINTN cEslSocketBindingEntries; ///< Number of network service bindings\r
167\r
168//------------------------------------------------------------------------------\r
169// DXE Support Routines\r
170//------------------------------------------------------------------------------\r
171\r
172/**\r
173 Creates a child handle and installs a protocol.\r
174\r
175 When the socket application is linked against UseSocketDxe, the ::socket\r
176 routine indirectly calls this routine in SocketDxe to create a child\r
177 handle if necessary and install the socket protocol on the handle.\r
178 Upon return, EslServiceGetProtocol in UseSocketLib returns the\r
179 ::EFI_SOCKET_PROTOCOL address to the socket routine.\r
180\r
181 @param [in] pThis Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
182 @param [in] pChildHandle Pointer to the handle of the child to create. If it is NULL,\r
183 then a new handle is created. If it is a pointer to an existing UEFI handle, \r
184 then the protocol is added to the existing UEFI handle.\r
185\r
186 @retval EFI_SUCCESS The protocol was added to ChildHandle.\r
187 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
188 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r
189 the child\r
190 @retval other The child handle was not created\r
191\r
192**/\r
193EFI_STATUS\r
194EFIAPI\r
195EslDxeCreateChild (\r
196 IN EFI_SERVICE_BINDING_PROTOCOL * pThis,\r
197 IN OUT EFI_HANDLE * pChildHandle\r
198 );\r
199\r
200/**\r
201 Destroys a child handle with a protocol installed on it.\r
202 \r
203 When the socket application is linked against UseSocketDxe, the ::close\r
204 routine indirectly calls this routine in SocketDxe to undo the operations\r
205 done by the ::EslDxeCreateChild routine. This routine removes the socket\r
206 protocol from the handle and then destroys the child handle if there are\r
207 no other protocols attached.\r
208\r
209 @param [in] pThis Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
210 @param [in] ChildHandle Handle of the child to destroy\r
211\r
212 @retval EFI_SUCCESS The protocol was removed from ChildHandle.\r
213 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r
214 @retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.\r
215 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle\r
216 because its services are being used.\r
217 @retval other The child handle was not destroyed\r
218\r
219**/\r
220EFI_STATUS\r
221EFIAPI\r
222EslDxeDestroyChild (\r
223 IN EFI_SERVICE_BINDING_PROTOCOL * pThis,\r
224 IN EFI_HANDLE ChildHandle\r
225 );\r
226\r
227/**\r
228Install the socket service\r
229\r
230SocketDxe uses this routine to announce the socket interface to\r
231the rest of EFI.\r
232\r
233@param [in] pImageHandle Address of the image handle\r
234\r
235@retval EFI_SUCCESS Service installed successfully\r
236**/\r
237EFI_STATUS\r
238EFIAPI\r
239EslDxeInstall (\r
240 IN EFI_HANDLE * pImageHandle\r
241 );\r
242\r
243/**\r
244Uninstall the socket service\r
245\r
246SocketDxe uses this routine to notify EFI that the socket layer\r
247is no longer available.\r
248\r
249@param [in] ImageHandle Handle for the image.\r
250\r
251@retval EFI_SUCCESS Service installed successfully\r
252**/\r
253EFI_STATUS\r
254EFIAPI\r
255EslDxeUninstall (\r
256 IN EFI_HANDLE ImageHandle\r
257 );\r
258\r
259//------------------------------------------------------------------------------\r
260// Service Support Routines\r
261//------------------------------------------------------------------------------\r
262\r
263/**\r
264 Connect to the network service bindings\r
265\r
266 Walk the network service protocols on the controller handle and\r
267 locate any that are not in use. Create ::ESL_SERVICE structures to\r
268 manage the network layer interfaces for the socket driver. Tag\r
269 each of the network interfaces that are being used. Finally, this\r
270 routine calls ESL_SOCKET_BINDING::pfnInitialize to prepare the network\r
271 interface for use by the socket layer.\r
272\r
273 @param [in] BindingHandle Handle for protocol binding.\r
274 @param [in] Controller Handle of device to work with.\r
275\r
276 @retval EFI_SUCCESS This driver is added to Controller.\r
277 @retval other This driver does not support this device.\r
278\r
279**/\r
280EFI_STATUS\r
281EFIAPI\r
282EslServiceConnect (\r
283 IN EFI_HANDLE BindingHandle,\r
284 IN EFI_HANDLE Controller\r
285 );\r
286\r
287/**\r
288 Shutdown the connections to the network layer by locating the\r
289 tags on the network interfaces established by ::EslServiceConnect.\r
290 This routine calls ESL_SOCKET_BINDING::pfnShutdown to shutdown the any\r
291 activity on the network interface and then free the ::ESL_SERVICE\r
292 structures.\r
293\r
294 @param [in] BindingHandle Handle for protocol binding.\r
295 @param [in] Controller Handle of device to stop driver on.\r
296\r
297 @retval EFI_SUCCESS This driver is removed Controller.\r
298 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
299 @retval other This driver was not removed from this device.\r
300\r
301**/\r
302EFI_STATUS\r
303EFIAPI\r
304EslServiceDisconnect (\r
305 IN EFI_HANDLE BindingHandle,\r
306 IN EFI_HANDLE Controller\r
307 );\r
308\r
309/**\r
310Initialize the service layer\r
311\r
312@param [in] ImageHandle Handle for the image.\r
313\r
314**/\r
315VOID\r
316EFIAPI\r
317EslServiceLoad (\r
318 IN EFI_HANDLE ImageHandle\r
319 );\r
320\r
321/**\r
322 Shutdown the service layer\r
323\r
324**/\r
325VOID\r
326EFIAPI\r
327EslServiceUnload (\r
328 VOID\r
329 );\r
330\r
331//------------------------------------------------------------------------------\r
332// Socket Protocol Routines\r
333//------------------------------------------------------------------------------\r
334\r
335/**\r
336 Bind a name to a socket.\r
337\r
338 This routine calls the network specific layer to save the network\r
339 address of the local connection point.\r
340\r
341 The ::bind routine calls this routine to connect a name\r
342 (network address and port) to a socket on the local machine.\r
343\r
344 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
345\r
346 @param [in] pSockAddr Address of a sockaddr structure that contains the\r
347 connection point on the local machine. An IPv4 address\r
348 of INADDR_ANY specifies that the connection is made to\r
349 all of the network stacks on the platform. Specifying a\r
350 specific IPv4 address restricts the connection to the\r
351 network stack supporting that address. Specifying zero\r
352 for the port causes the network layer to assign a port\r
353 number from the dynamic range. Specifying a specific\r
354 port number causes the network layer to use that port.\r
355\r
356 @param [in] SockAddrLength Specifies the length in bytes of the sockaddr structure.\r
357\r
358 @param [out] pErrno Address to receive the errno value upon completion.\r
359\r
360 @retval EFI_SUCCESS - Socket successfully created\r
361\r
362 **/\r
363EFI_STATUS\r
364EslSocketBind (\r
365 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
366 IN CONST struct sockaddr * pSockAddr,\r
367 IN socklen_t SockAddrLength,\r
368 OUT int * pErrno\r
369 );\r
370\r
371/**\r
372 Determine if the socket is closed\r
373\r
374 This routine checks the state of the socket to determine if\r
375 the network specific layer has completed the close operation.\r
376\r
377 The ::close routine polls this routine to determine when the\r
378 close operation is complete. The close operation needs to\r
379 reverse the operations of the ::EslSocketAllocate routine.\r
380\r
381 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
382 @param [out] pErrno Address to receive the errno value upon completion.\r
383\r
384 @retval EFI_SUCCESS Socket successfully closed\r
385 @retval EFI_NOT_READY Close still in progress\r
386 @retval EFI_ALREADY Close operation already in progress\r
387 @retval Other Failed to close the socket\r
388\r
389**/\r
390EFI_STATUS\r
391EslSocketClosePoll (\r
392 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
393 IN int * pErrno\r
394 );\r
395\r
396/**\r
397 Start the close operation on the socket\r
398\r
399 This routine calls the network specific layer to initiate the\r
400 close state machine. This routine then calls the network\r
401 specific layer to determine if the close state machine has gone\r
402 to completion. The result from this poll is returned to the\r
403 caller.\r
404\r
405 The ::close routine calls this routine to start the close\r
406 operation which reverses the operations of the\r
407 ::EslSocketAllocate routine. The close routine then polls\r
408 the ::EslSocketClosePoll routine to determine when the\r
409 socket is closed.\r
410\r
411 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
412 @param [in] bCloseNow Boolean to control close behavior\r
413 @param [out] pErrno Address to receive the errno value upon completion.\r
414\r
415 @retval EFI_SUCCESS Socket successfully closed\r
416 @retval EFI_NOT_READY Close still in progress\r
417 @retval EFI_ALREADY Close operation already in progress\r
418 @retval Other Failed to close the socket\r
419\r
420**/\r
421EFI_STATUS\r
422EslSocketCloseStart (\r
423 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
424 IN BOOLEAN bCloseNow,\r
425 IN int * pErrno\r
426 );\r
427\r
428/**\r
429 Connect to a remote system via the network.\r
430\r
431 This routine calls the network specific layer to establish\r
432 the remote system address and establish the connection to\r
433 the remote system.\r
434\r
435 The ::connect routine calls this routine to establish a\r
436 connection with the specified remote system. This routine\r
437 is designed to be polled by the connect routine for completion\r
438 of the network connection.\r
439 \r
440 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
441\r
442 @param [in] pSockAddr Network address of the remote system.\r
443 \r
444 @param [in] SockAddrLength Length in bytes of the network address.\r
445 \r
446 @param [out] pErrno Address to receive the errno value upon completion.\r
447 \r
448 @retval EFI_SUCCESS The connection was successfully established.\r
449 @retval EFI_NOT_READY The connection is in progress, call this routine again.\r
450 @retval Others The connection attempt failed.\r
451\r
452 **/\r
453EFI_STATUS\r
454EslSocketConnect (\r
455 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
456 IN const struct sockaddr * pSockAddr,\r
457 IN socklen_t SockAddrLength,\r
458 IN int * pErrno\r
459 );\r
460\r
461/**\r
462 Get the local address.\r
463\r
464 This routine calls the network specific layer to get the network\r
465 address of the local host connection point.\r
466\r
467 The ::getsockname routine calls this routine to obtain the network\r
468 address associated with the local host connection point.\r
469\r
470 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
471 \r
472 @param [out] pAddress Network address to receive the local system address\r
473\r
474 @param [in,out] pAddressLength Length of the local network address structure\r
475\r
476 @param [out] pErrno Address to receive the errno value upon completion.\r
477\r
478 @retval EFI_SUCCESS - Local address successfully returned\r
479\r
480 **/\r
481EFI_STATUS\r
482EslSocketGetLocalAddress (\r
483 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
484 OUT struct sockaddr * pAddress,\r
485 IN OUT socklen_t * pAddressLength,\r
486 IN int * pErrno\r
487 );\r
488\r
489/**\r
490 Get the peer address.\r
491\r
492 This routine calls the network specific layer to get the remote\r
493 system connection point.\r
494\r
495 The ::getpeername routine calls this routine to obtain the network\r
496 address of the remote connection point.\r
497\r
498 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
499 \r
500 @param [out] pAddress Network address to receive the remote system address\r
501\r
502 @param [in,out] pAddressLength Length of the remote network address structure\r
503\r
504 @param [out] pErrno Address to receive the errno value upon completion.\r
505\r
506 @retval EFI_SUCCESS - Remote address successfully returned\r
507\r
508 **/\r
509EFI_STATUS\r
510EslSocketGetPeerAddress (\r
511 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
512 OUT struct sockaddr * pAddress,\r
513 IN OUT socklen_t * pAddressLength,\r
514 IN int * pErrno\r
515 );\r
516\r
517/**\r
518 Establish the known port to listen for network connections.\r
519\r
520 This routine calls into the network protocol layer to establish\r
521 a handler that is called upon connection completion. The handler\r
522 is responsible for inserting the connection into the FIFO.\r
523\r
524 The ::listen routine indirectly calls this routine to place the\r
525 socket into a state that enables connection attempts. Connections\r
526 are placed in a FIFO that is serviced by the application. The\r
527 application calls the ::accept (::EslSocketAccept) routine to\r
528 remove the next connection from the FIFO and get the associated\r
529 socket and address.\r
530\r
531 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
532\r
533 @param [in] Backlog Backlog specifies the maximum FIFO depth for\r
534 the connections waiting for the application\r
535 to call accept. Connection attempts received\r
536 while the queue is full are refused.\r
537\r
538 @param [out] pErrno Address to receive the errno value upon completion.\r
539\r
540 @retval EFI_SUCCESS - Socket successfully created\r
541 @retval Other - Failed to enable the socket for listen\r
542\r
543**/\r
544EFI_STATUS\r
545EslSocketListen (\r
546 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
547 IN INT32 Backlog,\r
548 OUT int * pErrno\r
549 );\r
550\r
551/**\r
552 Get the socket options\r
553\r
554 This routine handles the socket level options and passes the\r
555 others to the network specific layer.\r
556\r
557 The ::getsockopt routine calls this routine to retrieve the\r
558 socket options one at a time by name.\r
559\r
560 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
561 @param [in] level Option protocol level\r
562 @param [in] OptionName Name of the option\r
563 @param [out] pOptionValue Buffer to receive the option value\r
564 @param [in,out] pOptionLength Length of the buffer in bytes,\r
565 upon return length of the option value in bytes\r
566 @param [out] pErrno Address to receive the errno value upon completion.\r
567\r
568 @retval EFI_SUCCESS - Socket data successfully received\r
569\r
570 **/\r
571EFI_STATUS\r
572EslSocketOptionGet (\r
573 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
574 IN int level,\r
575 IN int option_name,\r
576 OUT void * __restrict option_value,\r
577 IN OUT socklen_t * __restrict option_len,\r
578 IN int * pErrno\r
579 );\r
580\r
581/**\r
582 Set the socket options\r
583\r
584 This routine handles the socket level options and passes the\r
585 others to the network specific layer.\r
586\r
587 The ::setsockopt routine calls this routine to adjust the socket\r
588 options one at a time by name.\r
589\r
590 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
591 @param [in] level Option protocol level\r
592 @param [in] OptionName Name of the option\r
593 @param [in] pOptionValue Buffer containing the option value\r
594 @param [in] OptionLength Length of the buffer in bytes\r
595 @param [out] pErrno Address to receive the errno value upon completion.\r
596\r
597 @retval EFI_SUCCESS - Option successfully set\r
598\r
599 **/\r
600EFI_STATUS\r
601EslSocketOptionSet (\r
602 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
603 IN int level,\r
604 IN int option_name,\r
605 IN CONST void * option_value,\r
606 IN socklen_t option_len,\r
607 IN int * pErrno\r
608 );\r
609\r
610/**\r
611 Poll a socket for pending activity.\r
612\r
613 This routine builds a detected event mask which is returned to\r
614 the caller in the buffer provided.\r
615\r
616 The ::poll routine calls this routine to determine if the socket\r
617 needs to be serviced as a result of connection, error, receive or\r
618 transmit activity.\r
619\r
620 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
621\r
622 @param [in] Events Events of interest for this socket\r
623\r
624 @param [in] pEvents Address to receive the detected events\r
625\r
626 @param [out] pErrno Address to receive the errno value upon completion.\r
627\r
628 @retval EFI_SUCCESS - Socket successfully polled\r
629 @retval EFI_INVALID_PARAMETER - When pEvents is NULL\r
630\r
631 **/\r
632EFI_STATUS\r
633EslSocketPoll (\r
634 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
635 IN short Events,\r
636 IN short * pEvents,\r
637 IN int * pErrno\r
638 );\r
639\r
640/**\r
641 Receive data from a network connection.\r
642\r
643 This routine calls the network specific routine to remove the\r
644 next portion of data from the receive queue and return it to the\r
645 caller.\r
646\r
647 The ::recvfrom routine calls this routine to determine if any data\r
648 is received from the remote system. Note that the other routines\r
649 ::recv and ::read are layered on top of ::recvfrom.\r
650\r
651 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
652 \r
653 @param [in] Flags Message control flags\r
654 \r
655 @param [in] BufferLength Length of the the buffer\r
656 \r
657 @param [in] pBuffer Address of a buffer to receive the data.\r
658 \r
659 @param [in] pDataLength Number of received data bytes in the buffer.\r
660\r
661 @param [out] pAddress Network address to receive the remote system address\r
662\r
663 @param [in,out] pAddressLength Length of the remote network address structure\r
664\r
665 @param [out] pErrno Address to receive the errno value upon completion.\r
666\r
667 @retval EFI_SUCCESS - Socket data successfully received\r
668\r
669 **/\r
670EFI_STATUS\r
671EslSocketReceive (\r
672 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
673 IN INT32 Flags,\r
674 IN size_t BufferLength,\r
675 IN UINT8 * pBuffer,\r
676 OUT size_t * pDataLength,\r
677 OUT struct sockaddr * pAddress,\r
678 IN OUT socklen_t * pAddressLength,\r
679 IN int * pErrno\r
680 );\r
681\r
682/**\r
683 Shutdown the socket receive and transmit operations\r
684\r
685 This routine sets a flag to stop future transmissions and calls\r
686 the network specific layer to cancel the pending receive operation.\r
687\r
688 The ::shutdown routine calls this routine to stop receive and transmit\r
689 operations on the socket.\r
690\r
691 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
692 \r
693 @param [in] How Which operations to stop\r
694 \r
695 @param [out] pErrno Address to receive the errno value upon completion.\r
696\r
697 @retval EFI_SUCCESS - Socket operations successfully shutdown\r
698\r
699 **/\r
700EFI_STATUS\r
701EslSocketShutdown (\r
702 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
703 IN int How,\r
704 IN int * pErrno\r
705 );\r
706\r
707/**\r
708 Send data using a network connection.\r
709\r
710 This routine calls the network specific layer to queue the data\r
711 for transmission. Eventually the buffer will reach the head of\r
712 the queue and will get transmitted over the network. For datagram\r
713 sockets there is no guarantee that the data reaches the application\r
714 running on the remote system.\r
715\r
716 The ::sendto routine calls this routine to send data to the remote\r
717 system. Note that ::send and ::write are layered on top of ::sendto.\r
718\r
719 @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
720 \r
721 @param [in] Flags Message control flags\r
722 \r
723 @param [in] BufferLength Length of the the buffer\r
724 \r
725 @param [in] pBuffer Address of a buffer containing the data to send\r
726 \r
727 @param [in] pDataLength Address to receive the number of data bytes sent\r
728\r
729 @param [in] pAddress Network address of the remote system address\r
730\r
731 @param [in] AddressLength Length of the remote network address structure\r
732\r
733 @param [out] pErrno Address to receive the errno value upon completion.\r
734\r
735 @retval EFI_SUCCESS - Socket data successfully queued for transmit\r
736\r
737 **/\r
738EFI_STATUS\r
739EslSocketTransmit (\r
740 IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
741 IN int Flags,\r
742 IN size_t BufferLength,\r
743 IN CONST UINT8 * pBuffer,\r
744 OUT size_t * pDataLength,\r
745 IN const struct sockaddr * pAddress,\r
746 IN socklen_t AddressLength,\r
747 IN int * pErrno\r
748 );\r
749\r
750//------------------------------------------------------------------------------\r
751\r
752#endif // _EFI_SOCKET_LIB_H_\r