Returns the number of bytes required for an IPv6 routing header.
Format
#include <in6.h>
size_t inet6_rth_space ( int type, int segments );
1 – Arguments
type
Specifies the type of routing header. The valid value is IPV6_
RTHDR_TYPE_0 for IPv6 routing header type 0.
segments
Specifies the number of segments or addresses that are to be
included in the routing header. The valid value is from 0 to 127,
inclusive.
2 – Description
This function determines the amount of space, in bytes, required
for a routing header. Although the function returns the amount of
space required, it does not allocate buffer space. This enables
the application to allocate a larger buffer.
If the application uses ancillary data, it must pass the returned
length to CMSG_LEN() to determine the amount of memory required
for the ancillary data object, including the cmsghdr structure.
NOTE
If an application wants to send other ancillary data
objects, it must specify them to sendmsg() as a single msg_
control buffer.
3 – Return Values
x Upon successful completion, the inet6_rth_
space() function returns the length, in bytes,
of the routing header and the specified number
of segments.
0 (zero) Failure, if the type is not supported or the
number of segments is invalid for the type of
routing header.