inet6_rth_space Subroutine

Purpose

Returns the required number of bytes to hold a Routing header.

Syntax

socklen_t inet6_rth_space(int type, int segments);

Description

The inet6_rth_space subroutine returns the number of bytes required to hold a Routing header of the specified type containing the specified number of segments (addresses). For an IPv6 Type 0 Routing header, the number of segments must be between 0 and 127, inclusive. For an IPv6 Type 2 Routing Header, the number of segments must be 1. The return value is simply the space for the Routing header. When the application uses ancillary data, the application must pass the returned length to CMSG_SPACE() in order to determine how much memory is needed for the ancillary data object (including the cmsghdr structure).

Note: Although inet6_rth_space returns the size of the ancillary data, it does not allocate the space required for the ancillary data. This allows an application to allocate a larger buffer, so that other ancillary data objects can be added, because all the ancillary data objects must be specified to sendmsg() as a single msg_control buffer.

Parameters

Item Description
type Specifies the type of Routing header to be held.
segments Specifies the number of addresses within the Routing header.

Return Values

Item Description
0 Either the type of the Routing header is not supported by this implementation or the number of segments is invalid for this type of Routing header.
length Determines how much memory is needed for the ancillary data object.