Returns the length of an IPv6 extension header with a new option
and appends the option.
Format
#include <in6.h>
int inet6_opt_append ( void *extbuf, size_t extlen, int
offset, uint8_t type, size_t len, uint_t
align, void **databufp );
1 – Arguments
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 extbuf equals 0, a value returned by inet6_opt_
finish(), or any number that is a multiple of 8.
offset
Specifies the length of the existing extension header. Obtain
this value from a prior call to inet6_opt_init() or inet6_opt_
append().
type
Specifies the type of option. Specify a value from 2 to 255,
inclusive, excluding 194.
len
Specifies the length of the option data, excluding the option
type and option length fields. Specify a value from 0 to 255,
inclusive.
align
Specifies the alignment of the option. Specify one of the
following values: 1, 2, 4, or 8.
databufp
Points to a buffer that contains the option data.
2 – Description
This 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 extlen and
align arguments, the function returns the same information as in
the previous case, but also inserts the pad option, initializes
the type and len fields, and returns a pointer to the location
for the option content.
After you call inet6_opt_append(), you can then use the data
buffer directly or call inet6_opt_set_val() to specify the option
contents.
3 – Return Values
x Upon successful completion, the inet6_opt_
append() function returns the updated number
of bytes in an extension header.
-1 Failure
4 – Errors
EBADF The socket descriptor is invalid.
ECONNABORTED A connection has been aborted.
EFAULT The addr argument is not in a writable part of
the user address space.
EINTR The accept() function was interrupted by a
signal before a valid connection arrived.
EINVAL The socket is not accepting connections.
EMFILE There are too many open file descriptors.
ENFILE The maximum number of file descriptors in the
system is already open.
ENETDOWN TCP/IP Services was not started.
ENOBUFS The system has insufficient resources to
complete the call.
ENOMEM The system was unable to allocate kernel
memory.
ENOTSOCK The socket descriptor is invalid.
EOPNOTSUPP The reference socket is not of type SOCK_
STREAM.
EPROTO A protocol error occurred.
EWOULDBLOCK The socket is marked nonblocking, and no
connections are present to be accepted.