Looks for a specified option in the extension header.
int inet6_opt_find(void *extbuf, socklen_t extlen, int offset,
uint8_t *typep, socklen_t *lenp,
void **databufp);
The inet6_opt_find subroutine is similar to the inet6_opt_next() function, except this subroutine lets the caller specify the option type to be searched for, instead of always returning the next option in the extension header.
Item | Description |
---|---|
extbuf | Specifies the extension header. |
extlen | Size of the buffer pointed to by extbuf. |
offset | Specifies the position where scanning of the extension buffer can continue. Should either be 0 (for the first option) or the length returned by a previous call to inet6_opt_next() or inet6_opt_find(). |
typep | Stores the option type. |
lenp | Stores the length of the option data (excluding the option type and option length fields). |
databufp | Points to the data field of the option. |
The inet6_opt_find subroutine returns the updated "previous" total length computed by advancing past the option that was returned and past any options that did not match the type. This returned "previous" length can then be passed to subsequent calls to inet6_opt_find() for finding the next occurrence of the same option type.
Item | Description |
---|---|
–1 | The option cannot be located, there are no more options, or the option extension header is malformed. |