]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/BsdSocketLib/read.c
Add missing IPv6 address definitions.
[mirror_edk2.git] / StdLib / BsdSocketLib / read.c
CommitLineData
d7ce7006 1/** @file\r
2 Implement the read API.\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#include <SocketInternals.h>\r
16\r
17\r
18/**\r
19 Read support routine for sockets\r
20\r
a88c3163 21 The BslSocketRead routine is called indirectly by the read file\r
22 system routine. This routine is typically used for SOCK_STREAM\r
23 because it waits for receive data from the target system specified\r
24 in the ::connect call.\r
25\r
d7ce7006 26 @param [in] pDescriptor Descriptor address for the file\r
27 @param [in] pOffset File offset\r
28 @param [in] LengthInBytes Number of bytes to read\r
29 @param [in] pBuffer Address of the buffer to receive the data\r
30\r
7dc13291 31 @return The number of bytes read or -1 if an error occurs.\r
a88c3163 32 In the case of an error, ::errno contains more details.\r
d7ce7006 33\r
34**/\r
35ssize_t\r
7700f0f5 36EFIAPI\r
d7ce7006 37BslSocketRead (\r
38 struct __filedes *pDescriptor,\r
39 off_t * pOffset,\r
40 size_t LengthInBytes,\r
41 void * pBuffer\r
42 )\r
43{\r
44 ssize_t BytesRead;\r
45\r
46 //\r
47 // Receive the data from the remote system\r
48 //\r
49 BytesRead = recvfrom ( pDescriptor->MyFD,\r
50 pBuffer,\r
51 LengthInBytes,\r
52 0,\r
53 NULL,\r
54 NULL );\r
55\r
56 //\r
57 // Return the number of bytes read\r
58 //\r
59 return BytesRead;\r
60}\r