Determine the space required by an IPv6 routing header
#include <netinet/in.h> size_t inet6_rthdr_space(int type, int segments);
- The type of IPv6 Routing header (e.g. Type 0 as defined in <netinet/in.h>).
- The number of segments (addresses) in the Routing header.
Use the -l socket option to qcc to link against this library.
This function returns the number of bytes required to hold a Routing header of the specified type containing a specified number of segments (addresses). For an IPv6 Type 0 Routing header, the number of segments must be between 1 and 23, inclusive. The return value includes the size of the cmsghdr structure that precedes the Routing header, and any required padding.
This function returns the size but doesn't allocate the space required for the ancillary data. This allows an application to allocate a larger buffer, if other ancillary data objects are desired. All the ancillary data objects must be specified to sendmsg() as a single msg_control buffer in the msghdr structure msg_control member.
- W. Stevens and M. Thomas, Advanced Sockets API for IPv6, RFC 2292, February 1998. Contains good examples.
- S. Deering and R. Hinden, Internet Protocol, Version 6 (IPv6) Specification, RFC 2460, December 1998.
0, for either of the two situations: the type of the routing header isn't supported by this implementation or the number of segments is invalid for this type of routing header.
Last modified: 2013-12-23