inet6_opt_next()--Extract the Next Option from the IPv6 Extension Header
Syntax
#include <netinet/in.h>
int inet6_opt_next(void *extension_buffer,
socklen_t extension_length,
int offset,
uint8_t *option_type,
socklen_t *option_length,
void **data_bufferp)
Service Program Name: QSOSRV1IP6
Default Public Authority: *USE
Threadsafe: Yes
The inet6_opt_next() function parses a received option extension header and returns the next option.
Parameters
- extension_buffer
- (Input) Pointer to a buffer that contains the extension header.
- extension_length
- (Input) Total length in bytes of the extension header.
- offset
- (Input) Offset in the extension header to continue scanning.
An offset of zero will return the first option, or the value returned from a previous call to inet6_opt_find() or inet6_opt_next() can be used to continue parsing. - option_type
- (I/O) Pointer to the type of the option found.
- option_length
- (I/O) Pointer to the length of the option found, excluding option type and length.
- data_bufferp
- (I/O) Pointer to the data field of the option found.
Authorities
No authorization is required.
Return Value
inet6_opt_next() returns an integer. Possible values are:
- -1 (unsuccessful)
- n (successful), where n is the offset of the next option in the extension header.
Error Conditions
When inet6_opt_next() fails, errno can be set to one of the following:
| [ENOREC] | Record is not found.
There were no more options found in the extension header. |
| [EFAULT] | Bad address.
The system detected an address that was not valid while attempting to access the buffer pointed to by the extension_buffer, option_type, option_length, or data_bufferp parameter. |
| [EINVAL] | Parameter not valid.
This error code indicates one of the following:
|
Usage Notes
- Pad options, PAD1 or PADN, that are used for alignment, will not be returned.
- To search for the next option in the extension header, use the function's return value as the offset value on the following call to inet6_opt_next().
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_set_val()--Insert Data Items into IPv6 Option
API introduced: V6R1