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:


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:

  • The extension_length field contains a value that is not a positive multiple of 8.
  • The offset field contains a value that is not a valid offset.
  • The option_type field contains a value that is not in the range from 2 to 255, inclusive.
  • The options extension header is malformed.


Usage Notes

  1. 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




API introduced: V6R1

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