inet6_opt_set_val()--Insert Data Items into IPv6 Option
Syntax
#include <netinet/ip6.h> int inet6_opt_set_val(void *data_buffer, socklen_t offset, void *value_buffer, int value_buffer_length)
Service Program Name: QSOSRV1IP6
Default Public Authority: *USE
Threadsafe: Yes
The inet6_opt_set_val() function inserts data items of various sizes into the data portion of the IPv6 option.
Parameters
- data_buffer
- (Input) Pointer to a buffer where the data portion of the option is to be placed.
The value returned in data_bufferp from inet6_opt_append() can be used here. - offset
- (Input) Offset in the data portion of the option to insert the data value.
The first byte after the option type and length is accessed by specifying an offset of zero. - value_buffer
- (Input) Pointer to a buffer that contains the data to be inserted.
- value_buffer_length
- (Input) Length of data to be inserted.
Authorities
No authorization is required.
Return Value
inet6_opt_set_val() returns an integer. Possible values are:
- -1 (unsuccessful)
- n (successful), where n is the offset for the next field in the extension header
Error Conditions
When inet6_opt_set_val() fails, errno can be set to one of the following:
[EFAULT] | Bad address.
The system detected an address that was not valid while attempting to access the buffer pointed to by the data_buffer or value_buffer parameter. |
[EINVAL] | Parameter not valid.
This error code indicates the following:
|
Usage Notes
- The return value can be used as the offset value in subsequent calls to set information for an option with multiple fields.
- The caller must ensure that each field is aligned on its natural boundaries as described in Appendix B of [RFC-2460].
Related Information
- inet6_opt_append()--Append New Option to IPv6 Extension Header
- inet6_opt_find()--Extract Option of Specified Type from IPv6 Extension Header
- inet6_opt_finish()--Finish Adding Options to IPv6 Extension Header
- inet6_opt_get_val()--Retrieve Data Item from an IPv6 Option
- inet6_opt_init()--Get Length of IPv6 Extension Header
- inet6_opt_next()--Extract the Next Option from the IPv6 Extension Header
API introduced: V6R1