inet6_opt_next Subroutine

Item Description
–1 There are no more options or the option extension header is malformed.

Purpose

Parses received option extension headers returning the next option.

Syntax

int inet6_opt_next(void *extbuf, socklen_t extlen, int offset,
                         uint8_t *typep, socklen_t *lenp,
                         void **databufp);

Description

The inet6_opt_next subroutine parses received option extension headers, returning the next option. The next option is returned by updating the typep, lenp, and databufp parameters.

Parameters

Item Description
extbuf Specifies the extension header.
extlen Size of the buffer pointed to by extbuf.
offset Specifies the position where scanning of the extension buffer can continue. Should either be 0 (for the first option) or the length returned by a previous call to inet6_opt_next() or inet6_opt_find().
typep Stores the option type.
lenp Stores the length of the option data (excluding the option type and option length fields).
databufp Points to the data field of the option.

Return Values

The inet6_opt_next subroutine returns the updated "previous" length computed by advancing past the option that was returned. This returned "previous" length can then be passed to subsequent calls to inet6_opt_next(). This function does not return any PAD1 or PADN options.