inet6_opt_find()--Extract Option of Specified Type from IPv6 Extension Header
Syntax
#include <netinet/in.h> int inet6_opt_find(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_find() function parses a received option extension header and returns the next option of specified option_type.
Parameters
- extension_buffer
- (Input) Pointer to a buffer that contains the extension header.
- extension_length
- (Input) Length in bytes of the extension header. Must be a positive multiple of 8.
- 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
- (Input) Type of option to find.
- option_length
- (I/O) Pointer to the length of the option found, excluding option type and length.
- data_bufferp
- (I/O) Pointer to a buffer that contains the option data.
Authorities
No authorization is required.
Return Value
inet6_opt_find() returns an integer. Possible values are:
- -1 (successful)
- n (successful), where n is the offset in which to begin the next search of the extension header
Error Conditions
When inet6_opt_find() fails, errno can be set to one of the following:
[ENOREC] | Record is not found.
There was no option found in the extension header of the type specified in the option_type parameter. |
[EFAULT] | Bad address.
The system detected an address that was not valid while attempting to access the buffer pointed to by the extension_buffer, data_bufferp, or option_length parameter. |
[EINVAL] | Parameter not valid.
This error code indicates one of the following:
|
Usage Notes
- To search for the next option in the extension header of the same type, use the function's return value as the offset value on the following call to inet6_opt_find().
Related Information
- inet6_opt_append()--Append New Option to 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
- inet6_opt_set_val()--Insert Data Items into IPv6 Option
API introduced: V6R1