inet6_opt_find() — Search for an option specified by the caller
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
RFC3542 |
both | z/OS® V1R7 |
Format
#define _OPEN_SYS_SOCK_IPV6
#include <netinet/in.h>
int inet6_opt_find(void *extbuf, socklen_t extlen, int offset,
uint8_t type, socklen_t *lenp, void **databufp);
General description
inet6_opt_find() is similar to inet6_opt_next(), except it lets the caller specify the option type to be searched for.
Returned value
If successful, inet6_opt_find() 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.
Upon failure, returns -1 and errno is set to one of the following:
EINVAL If one of the following is true:
- extbuf is NULL;
- extlen is not a positive multiple of 8;
- offset is less than 0 or greater than or equal to extlen;
- lenp or databufp is NULL;
- the option was not located;
- the extension header is malformed.
Usage notes
The returned "previous" length can be passed to subsequent calls of inet6_opt_find() for finding the next occurrence of the same option type.
Related information
- netinet/in.h
- inet6_opt_append() — Add an option with length "len" and alignment "align"
- inet6_opt_finish() — Return the updated total length of extension header
- inet6_opt_get_val() — Extract data items in the data portion of the option
- inet6_opt_init() — Return the number of bytes for empty extension header
- inet6_opt_next() — Parse received option headers returning the next option
- inet6_opt_set_val() — Insert data items into the data portion of the option