inet6_opt_finish() — Return the updated total length of extension header
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
RFC3542 |
both | z/OS® V1R7 |
Format
#define _OPEN_SYS_SOCK_IPV6
#include <netinet/in.h>
int inet6_opt_finish(void *extbuf, socklen_t extlen, int offset);
General description
inet6_opt_finish() returns the updated total length taking into account the final padding of the extension header to make it 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.
Returned value
If successful, inet6_opt_finish() returns the total length of the extension header including the final padding.
Upon failure, returns -1 and errno is set to one of the following:
EINVAL If one of the following is true:
- extbuf is NULL and extlen is non-zero;
- extbuf is non-NULL and extlen is not a positive multiple of 8;
- extbuf is non-NULL and offset is greater than extlen;
- offset is less than the size of the empty extension header.
Usage notes
offset should be the length returned by inet6_opt_init() or inet6_opt_append().
Related information
- netinet/in.h
- inet6_opt_append() — Add an option with length "len" and alignment "align"
- inet6_opt_find() — Search for an option specified by the caller
- inet6_opt_get_val() — Extract data items in the data portion of the option
- inet6_opt_init() — Return the number of bytes for empty extension header
- inet6_opt_next() — Parse received option headers returning the next option
- inet6_opt_set_val() — Insert data items into the data portion of the option