This function is similar to the previously described
inet6_option_next() function, except this function lets the caller specify the option type to be searched for, instead of always returning the next option in the ancillary data object.
cmsg is a pointer to
cmsghdr structure of which
cmsg_level equals
IPPROTO_IPV6 and
cmsg_type equals either
IPV6_HOPOPTS or
IPV6_DSTOPTS.
tptrp is a pointer to a pointer to an 8-bit byte and
*tptrp is used by the function to remember its place in the ancillary data object each time the function is called. The first time this function is called for a given ancillary data object,
*tptrp must be set to
NULL.
~ This function starts searching for an option of the specified type beginning after the value of
*tptrp. If an option of the specified type is located, this function returns
0 and
*tptrp points to the 8- bit option type field for the option of the specified type. If an option of the specified type is not located, the return value is
-1 and
*tptrp is
NULL. If an error occurs, the return value is
-1 and
*tptrp is not
NULL.