inet6_opt_init.3n (2010 09)

i
inet6_opt_init(3N) inet6_opt_init(3N)
NAME
inet6_opt_init(), inet6_opt_append(), inet6_opt_find(), inet6_opt_finish(), inet6_opt_get_val(),
inet6_opt_next(), inet6_opt_set_val() - IPv6 Hop-by-Hop and Destination options manipulation functions.
SYNOPSIS
#include <netinet/in.h>
int inet6_opt_append(void *extbuf, socklen_t extlen, int offset,
uint8_t type, socklen_t len, uint8_t align,
void **databufp);
int inet6_opt_find(void *extbuf, socklen_t extlen, int offset,
uint8_t type, socklen_t *lenp,
void **databufp);
int inet6_opt_finish(void *extbuf, socklen_t extlen, int offset);
int inet6_opt_get_val(void *databuf, int offset, void *val,
socklen_t vallen);
int inet6_opt_init(void *extbuf, socklen_t extlen);
int inet6_opt_next(void *extbuf, socklen_t extlen, int offset,
uint8_t *typep, socklen_t *lenp,
void **databufp);
int inet6_opt_set_val(void *databuf, int offset, void *val,
socklen_t vallen);
DESCRIPTION
These functions can be used by applications to build and parse the IPv6 Hop-by-Hop and Destination
options header. The Hop-by-Hop option header is used to carry optional information that must be exam-
ined by every node along a packet’s delivery path and the Destination option header is used to carry
optional information that needs to be examined only by a packet’s destination node(s).
inet6_opt_init()
This function returns the number of bytes needed for the empty extension header without any
options. If extbuf is not NULL, it also initializes the extension header to have the correct length
field. If the extlen value is not a positive multiple of 8, the function fails and returns -1.
inet6_opt_append()
This function returns the updated total length required to add an option with length len and align-
ment align .Ifextbuf is not NULL, then in addition to returning the length, this function also
inserts any needed pad option, initializes the option (sets the type and length fields), and returns a
pointer to the location for the option content in databufp . If the option specified by type does not fit
in the extension header buffer then the function returns -1.
The third parameter offset should be the length returned by
inet6_opt_init() or by a previous
inet6_opt_append().
The parameter type is the 8-bit option type and it must be a value from 2 to 255, inclusive. 0 and 1
are reserved for the Pad1 and PadN options, respectively.
The parameter len is the length of the option data excluding the option type and option length fields.
It must have a value between 0 and 255, inclusive, and it specifies the length of the option data that
follows the option header.
The align parameter must have a value of 1, 2, 4, or 8. The align value can not exceed the value of
len. If the len parameter is 0, the align parameter is ignored.
Once
inet6_opt_append() has been called, the application can use databuf directly, or use
inet6_opt_set_val() to specify (set) the contents of the option.
inet6_opt_finish()
This function returns the updated total length including the final padding of the extension header to
make the header a multiple of 8 bytes.
If extbuf is not NULL, the function also initializes the option by inserting a Pad1 or PadN option of
the proper length. If the necessary pad does not fit in the extension header buffer, the function
returns -1.
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (4 pages)