Finds a specific option in an extension header.
Format
#include <in6.h>
int inet6_opt_find ( void *extbuf, size_t extlen, int offset,
uint8_t type, size_t *lenp, void **databufp
);
1 – Arguments
extbuf
Points to a buffer that contains an extension header.
extlen
Specifies the length, in bytes, of the extension header.
offset
Specifies the location in the extension header of an option.
Valid values are either 0 (zero) for the first option or the
length returned from a previous call to either inet6_opt_next()
or inet6_opt_find().
type
Specifies the type of option to find.
lenp
Points to the length of the option found.
databufp
Points to the option data.
2 – Description
This function searches a received option extension header for an
option specified by type. If it finds the specified option, it
returns the option length and a pointer to the option data. It
also returns an offset to the next option, which you can specify
in the offset argument to subsequent calls to inet6_opt_next()
in order to search for additional occurrences of the same option
type.
3 – Return Values
x Upon successful completion, the inet6_opt_
find() function returns an offset from which
you can begin the next search in the data
buffer.
-1 Failure