inet6_opt_append Subroutine

Purpose

Returns the updated total length of the extension header.

Syntax

int inet6_opt_append(void *extbuf, socklen_t extlen, int offset,
                           uint8_t type, socklen_t len, uint_t align,
                           void **databufp);

Description

The inet6_opt_append subroutine returns the updated total length of the extension header, taking into account adding an option with length len and alignment align. If extbuf is not NULL, then, in addition to returning the length, the subroutine inserts any needed pad option, initializes the option (setting the type and length fields), and returns a pointer to the location for the option content in databufp. After inet6_opt_append() has been called, the application can use the databuf directly, or use inet6_opt_set_val() to specify the content of the option.

Parameters

Item Description
extbuf If NULL, inet6_opt_append will return only the updated length. If extbuf is not NULL, in addition to returning the length, the function inserts any needed pad option, initializes the option (setting the type and length fields) and returns a pointer to the location for the option content in databufp.
extlen Size of the buffer pointed to by extbuf.
offset The length returned by inet6_opt_init() or a previous inet6_opt_append().
type 8-bit option type. Must have a value from 2 to 255, inclusive. (0 and 1 are reserved for the Pad1 and PadN options, respectively.)
len Length of the option data (excluding the option type and option length fields). Must be a value between 0 and 255, inclusive, and is the length of the option data that follows.
align Alignment of the option data. Must be a value of 1, 2, 4, or 8. The align value can not exceed the value of len.
databufp Specifies the content of the option.

Return Values

Item Description
-1 Option content does not fit in the extension header buffer.
integer value Updated total length of the extension header.