+++ /dev/null
-/** @file\r
- Implement the getsockopt 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
-/** Get the socket options\r
-\r
- The\r
- <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html#">POSIX</a>\r
- documentation is available online.\r
-\r
- @param [in] s Socket file descriptor returned from ::socket.\r
- @param [in] level Option protocol level\r
- @param [in] option_name Name of the option\r
- @param [out] option_value Buffer to receive the option value\r
- @param [in,out] option_len Length of the buffer in bytes,\r
- upon return length of the option value in bytes\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
-getsockopt (\r
- IN int s,\r
- IN int level,\r
- IN int option_name,\r
- OUT void * __restrict option_value,\r
- IN OUT socklen_t * __restrict option_len\r
- )\r
-{\r
- int OptionStatus;\r
- EFI_SOCKET_PROTOCOL * pSocketProtocol;\r
-\r
- // Locate the context for this socket\r
- pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );\r
- if ( NULL != pSocketProtocol ) {\r
- // Get the socket option\r
- (void) pSocketProtocol->pfnOptionGet ( pSocketProtocol,\r
- level,\r
- option_name,\r
- option_value,\r
- option_len,\r
- &errno );\r
- }\r
- // Return the operation stauts\r
- OptionStatus = ( 0 == errno ) ? 0 : -1;\r
- return OptionStatus;\r
-}\r