inet6_opt_get_val()--Retrieve Data Item from an IPv6 Option
Syntax
#include <netinet/in.h>
int inet6_opt_get_val(void *data_buffer,
socklen_t offset,
void *value_buffer,
int value_buffer_length)
Service Program Name: QSOSRV1IP6
Default Public Authority: *USE
Threadsafe: Yes
The inet6_opt_get_val() function extracts data items of various sizes from the data portion of the IPv6 option.
Parameters
data_buffer
(Input) Pointer to a buffer where the data portion of the option is to be extracted.
The value returned in data_buffer from inet6_opt_next() or inet6_opt_find() can be used here.
offset
(Input) Offset in the data portion of the option to extract the data value.
The first byte after the option type and length is accessed by specifying an offset of zero.
value_buffer
(Input/Output) Pointer to a destination buffer for the extracted data.
value_buffer_length
(Input) Maximum length of data to be extracted.
Authorities
No authorization is required.
Return Value
inet6_opt_get_val() returns an integer. Possible values are:
-1 (unsuccessful)
n (successful), where n is the offset for the next field in
the extension header
Error Conditions
When inet6_opt_get_val() fails, errno can be set to
one of the following:
[EFAULT]
Bad address.
The system detected an address that was not valid while attempting to access
the buffer pointed to by the data_buffer or value_buffer
parameter.
[EINVAL]
Parameter not valid.
This error code indicates one of the following:
The offset field contains a value that
is not positive.
The value_buffer_length field contains a value that is
not positive.
Usage Notes
The return value can be used as the offset value in subsequent calls to extract information from an
option with multiple fields.
It is expected that each field is aligned on its natural boundaries as described in Appendix B of [RFC-2460].