VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/StdLib/BsdSocketLib/setsockopt.c@ 61103

Last change on this file since 61103 was 58466, checked in by vboxsync, 9 years ago

EFI/Firmware: Merged in the svn:eol-style, svn:mime-type and trailing whitespace cleanup that was done after the initial UDK2014.SP1 import: svn merge /vendor/edk2/UDK2014.SP1 /vendor/edk2/current .

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1/** @file
2 Implement the setsockopt API.
3
4 Copyright (c) 2011, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15#include <SocketInternals.h>
16
17
18/**
19 Set the socket options
20
21 The
22 <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html">POSIX</a>
23 documentation is available online.
24
25 @param [in] s Socket file descriptor returned from ::socket.
26 @param [in] level Option protocol level
27 @param [in] option_name Name of the option
28 @param [in] option_value Buffer containing the option value
29 @param [in] option_len Length of the value in bytes
30
31 @return This routine returns zero (0) upon success and -1 when an error occurs.
32 In the case of an error, ::errno contains more details.
33
34**/
35int
36setsockopt (
37 IN int s,
38 IN int level,
39 IN int option_name,
40 IN CONST void * option_value,
41 IN socklen_t option_len
42 )
43{
44 int OptionStatus;
45 EFI_SOCKET_PROTOCOL * pSocketProtocol;
46 EFI_STATUS Status;
47
48 //
49 // Locate the context for this socket
50 //
51 pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );
52 if ( NULL != pSocketProtocol ) {
53 //
54 // Set the socket option
55 //
56 Status = pSocketProtocol->pfnOptionSet ( pSocketProtocol,
57 level,
58 option_name,
59 option_value,
60 option_len,
61 &errno );
62 }
63
64 //
65 // Return the operation stauts
66 //
67 OptionStatus = ( 0 == errno ) ? 0 : -1;
68 return OptionStatus;
69}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette