inet6_opt_set_val Subroutine

Purpose

Inserts data items into the data portion of an option.

Syntax

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

Description

The inet6_opt_set_val subroutine inserts data items of various sizes into the data portion of the option. The caller must ensure that each field is aligned on its natural boundaries. However, even when the alignment requirement is not satisfied, inet6_opt_set_val will just copy the data as required.

Parameters

Item Description
databuf Pointer to the data area returned by inet6_opt_append().
offset Specifies where in the data portion of the option the value should be inserted; the first byte after the option type and length is accessed by specifying an offset of 0.
val Pointer to the data content to be inserted.
vallen Specifies the size of the data content to be inserted.

Return Values

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