getsockopt
Name
getsockopt -- get socket options
Synopsis
#include <sys/socket.h>
#include <netinet/ip.h> |
int
getsockopt
(int
socket, int
level, int
option_name, void * restrict
option_value, socklen_t * restrict
option_len);
Description
The getsockopt() function shall behave as specified in
POSIX 1003.1-2008 (ISO/IEC 9945-2009),
with the following extensions.
IP Protocol Level Options
If the level parameter is
IPPROTO_IP
, the following values shall be supported for
option_name (see RFC 791:Internet Protocol for
further details):
IP_OPTIONS | | Get the Internet Protocol options sent with
every packet from this socket.
The option_value shall point to a
memory buffer in which the options shall be placed;
on entry option_len shall point to an integer value
indicating the maximum size of the memory buffer, in bytes. On successful
return, the value referenced by option_len shall
be updated to the size of data copied to the buffer. For IPv4, the
maximum length of options is 40 bytes. |
IP_TTL | | Get the current unicast Internet Protocol
Time To Live value used when sending packets with this socket.
The option_value shall point to a buffer large
enough to hold the time to live value (at least 1 byte),
and option_len
shall point to an integer value holding the maximum size of that buffer.
On successful return, the value
referenced by option_len shall be updated
to contain the number of bytes copied into the buffer, which shall be no
larger than the initial value,
and option_value
shall point to an integer containing the time to live value. |
IP_TOS | | Get the Internet Protocol type of service indicator
used when sending packets with this socket.
The option_value shall point to a buffer large
enough to hold the type of service indicator (at least 1 byte),
and option_len
shall point to an integer value holding the maximum size of that buffer.
On successful return, the value
referenced by option_len shall be updated
to contain the number of bytes copied into the buffer, which shall be no
larger than the initial value,
and option_value
shall point to an integer containing the time to live value. |