inet6_opt_get_val() — Extract data items in the data portion of the option
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
RFC3542
|
both | z/OS® V1R7 |
Format
#define _OPEN_SYS_SOCK_IPV6
#include <netinet/in.h>
int inet6_opt_get_val(void *databuf, int offset,
void *val, socklen_t vallen);
General description
inet6_opt_get_val() extracts data items of various sizes in the data portion of the option.
Returned value
If successful, inet6_opt_get_val() returns the offset for the next field (offset + vallen) that can be used when extracting option content with multiple fields.
Upon failure, returns -1 and sets errno to one of the following:
EINVAL If one of the following is true:
- databuf is NULL;
- val is null;
- offset is less than 0;
- offset + vallen is greater than the option length.
Usage notes
- databuf should be a pointer returned by inet6_opt_next() or inet6_opt_find().
- val should point to the destination for the extracted data.
- offset specifies from where in the data portion of the option the value should be extracted; the first byte after the option type and length is accessed by specifying an offset of zero.
Related information
- netinet/in.h — Internet protocol family
- inet6_opt_append() — Add an option with length "len" and alignment "align"
- inet6_opt_find() — Search for an option specified by the caller
- inet6_opt_finish() — Return the updated total length of extension header
- inet6_opt_init() — Return the number of bytes for empty extension header
- inet6_opt_next() — Parse received option headers returning the next option
- inet6_opt_set_val() — Insert data items into the data portion of the option