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:


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:

  • The extension_length field contains a value that is not positive.
  • The offset field contains a value that is not positive, or was larger than the options extension header.
  • The options extension header is malformed.


Usage Notes

  1. Pad options, PAD1 or PADN, that are used for alignment, will not be returned.
  2. 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




API introduced: V6R1

[ Back to top | UNIX-Type APIs | APIs by category ]