inet6_opt_get_val Subroutine

Purpose

Extracts data items of various sizes in the data portion of the option.

Syntax

int inet6_opt_get_val(void *databuf, int offset, void *val,
                            socklen_t vallen);

Description

The inet6_opt_get_val subroutine extracts data items of various sizes in the data portion of the option. It is expected that each field is aligned on its natural boundaries, but the subroutine will not rely on the alignment.

Parameters

Item Description
databuf Pointer to the data content returned by inet6_opt_next() or inet6_opt_find().
offset Specifies 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 0.
val Pointer to the destination for the extracted data.
vallen Specifies the size of the data content to be extracted.

Return Values

The inet6_opt_get_val subroutine returns the offset for the next field (that is, offset + vallen), which can be used when extracting option content with multiple fields.