+++ /dev/null
-/** @file\r
- Implement the read API.\r
-\r
- Copyright (c) 2011, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. 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
-**/\r
-\r
-#include <SocketInternals.h>\r
-\r
-\r
-/**\r
- Read support routine for sockets\r
-\r
- The BslSocketRead routine is called indirectly by the read file\r
- system routine. This routine is typically used for SOCK_STREAM\r
- because it waits for receive data from the target system specified\r
- in the ::connect call.\r
-\r
- @param [in] pDescriptor Descriptor address for the file\r
- @param [in] pOffset File offset\r
- @param [in] LengthInBytes Number of bytes to read\r
- @param [in] pBuffer Address of the buffer to receive the data\r
-\r
- @return The number of bytes read or -1 if an error occurs.\r
- In the case of an error, ::errno contains more details.\r
-\r
-**/\r
-ssize_t\r
-EFIAPI\r
-BslSocketRead (\r
- struct __filedes *pDescriptor,\r
- off_t * pOffset,\r
- size_t LengthInBytes,\r
- void * pBuffer\r
- )\r
-{\r
- ssize_t BytesRead;\r
-\r
- //\r
- // Receive the data from the remote system\r
- //\r
- BytesRead = recvfrom ( pDescriptor->MyFD,\r
- pBuffer,\r
- LengthInBytes,\r
- 0,\r
- NULL,\r
- NULL );\r
-\r
- //\r
- // Return the number of bytes read\r
- //\r
- return BytesRead;\r
-}\r