inet6_opt_append(3) — Subroutines
NAME
inet6_opt_append − Return the length of an IPv6 extension header with a new option and append the option
SYNOPSIS
#include <netinet/ip6.h>
int inet6_opt_append(
void ∗extbuf,
size_t extlen,
int prevlen,
uint8_t type,
size_t len,
uint_t align,
void ∗∗databufp );
LIBRARY
Standard C Library (libc)
PARAMETERS
extbuf
Points to a buffer that contains an extension header. This is either a valid pointer or a NULL pointer.
extlen
Specifies the length of the extension header to initialize. Valid values are 0 if extbufequals 0, a value returned by inet6_opt_finish(), or any number that is a multiple of 8.
prevlen
Specifies the length of the existing extension header. Obtain this value from a prior call to inet6_opt_init() or inet6_opt_append().
typeSpecifies the type of option. Valid values range from 2 to 255, inclusive, excluding 194.
lenSpecifies the length of the option data, excluding the option type and option length fields. Valid values range from 0 to 255, inclusive.
align
Specifies the alignment of the option. Valid values are 1, 2, 4, and 8.
databufp
Points to a buffer that contains the option data.
DESCRIPTION
The inet6_opt_append() function when called with extbuf as a NULL pointer and extlen as 0, returns the updated number of bytes in an extension header.
If you specify extbuf as a valid pointer and valid len and align parameters, the function returns the same information as in the previous case, but also inserts the pad option, initializes the type and length fields, and returns a pointer to the location for the option content.
After you call inet6_opt_append(), you can then use the databuf directly or call inet6_opt_set_val() to specify the option contents.
RETURN VALUES
Upon successful completion, the inet6_opt_append() function returns the updated number of bytes in an extension header. Upon failure, it returns a -1.
SEE ALSO
Functions: inet6_opt_find(3), inet6_opt_finish(3), inet6_opt_get_val(3), inet6_opt_init(3), inet6_opt_next(3), inet6_opt_set_val(3).
Network Programmer’s Guide