+++ /dev/null
-/** @file\r
- Implement the listen API.\r
-\r
- Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available under\r
- the terms and conditions of the BSD License that accompanies this distribution.\r
- The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#include <SocketInternals.h>\r
-\r
-\r
-/** Establish the known port to listen for network connections.\r
-\r
- The listen routine places the port into a state that enables connection\r
- attempts. Connections are placed into FIFO order in a queue to be serviced\r
- by the application. The application calls the ::accept routine to remove\r
- the next connection from the queue and get the associated socket.\r
-\r
- The\r
- <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html">POSIX</a>\r
- documentation is available online.\r
-\r
- @param [in] s Socket file descriptor returned from ::socket.\r
-\r
- @param [in] backlog backlog specifies the maximum FIFO depth for the connections\r
- waiting for the application to call ::accept. Connection attempts\r
- received while the queue is full are refused.\r
-\r
- @return This routine returns zero (0) if successful or -1 when an error occurs.\r
- In the case of an error, ::errno contains more details.\r
- **/\r
-int\r
-listen (\r
- IN int s,\r
- IN int backlog\r
- )\r
-{\r
- int ListenStatus;\r
- EFI_SOCKET_PROTOCOL * pSocketProtocol;\r
-\r
- // Locate the context for this socket\r
- pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );\r
- if ( NULL != pSocketProtocol ) {\r
- // Enable connections on the known port\r
- (void) pSocketProtocol->pfnListen ( pSocketProtocol,\r
- backlog,\r
- &errno );\r
- }\r
- // Return the operation stauts\r
- ListenStatus = ( 0 == errno ) ? 0 : -1;\r
- return ListenStatus;\r
-}\r