inet6_opt_append
The inet6_opt_append function can perform two different jobs. When a valid extbuf argument is supplied it appends an option to the extension buffer and returns the updated total length as well as a pointer to the newly created option in databufp. If the value of extbuf is NULL then the inet6_opt_append function only reports what the total length would be if the option were actually appended. The len and align arguments specify the length of the option and the required data alignment which must be used when appending the option. The offset argument should be the length returned by the inet6_opt_init function or a previous call to inet6_opt_append. The type argument is the 8-bit option type.
After inet6_opt_append has been called, the application can use the buffer pointed to by databufp directly, or use inet6_opt_set_val to specify the data to be contained in the option.
Option types of 0 and 1 are reserved for the Pad1 and PadN options. All other values from 2 through 255 may be used by applications.
The length of the option data is contained in an 8-bit value and so may contain any value from 0 through 255.