inet6_opt_finish Subroutine

Purpose

Returns the final length of an extension header.

Syntax

int inet6_opt_finish(void *extbuf, socklen_t extlen, int offset);

Description

The inet6_opt_finish subroutine returns the final length of an extension header, taking into account the final padding of the extension header to make it a multiple of 8 bytes.

Parameters

Item Description
extbuf If NULL, inet6_opt_finish will only return the final length. If extbuf is not NULL, in addition to returning the length, the function initializes the option by inserting a Pad1 or PadN option of the proper length.
extlen Size of the buffer pointed to by extbuf.
offset The length returned by inet6_opt_init() or a previous inet6_opt_append().

Return Values

Item Description
-1 The necessary pad does not fit in the extension header buffer.
integer value Final length of the extension header.