inet6_rth_space(3N)inet6_rth_space(3N)NAMEinet6_rth_add(), inet6_rth_getaddr(), inet6_rth_init(),
inet6_rth_reverse(), inet6_rth_segments(), inet6_rth_space() - IPv6
Routing header options manipulation functions.
SYNOPSISDESCRIPTION
These functions can be used by an application to build and examine an
IPv6 Routing header. The Routing header can be used by an IPv6 source
to list one or more intermediate nodes to be visited on the way to a
packet's destination.
These three functions build a Routing header: returns the number of
bytes required for a Routing header.
initializes the buffer data for a Routing header.
adds one IPv6 address to the Routing header.
Three functions deal with a returned Routing header: reverses a Routing
header.
returns the number of segments in a Routing header.
fetches one address from a Routing header.
These functions are described below:
This function 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 num‐
ber of segments must be between 0 and 127, inclusive. The return
value is just the space for the Routing header. When the applica‐
tion uses ancillary data, it must pass the returned length to to
determine how much memory is needed for the ancillary data object
(including the structure).
If the return value is 0, then 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.
This function returns the size but does not allocate the space
required for the ancillary data.
Note: If type is 2 (Routing Header Type 2), segments must be 1
(RFC 4584).
This function initializes the buffer pointed to by
bp to contain a Routing header of the specified type. bp_len is
only used to verify if the buffer is large enough.
The caller must allocate the buffer, and its size can be deter‐
mined by calling
Upon success, the return value is the pointer to the buffer (bp),
and the pointer is then used as the first argument to the func‐
tion. Upon an error, the return value is NULL.
Note: If type is 2 (Routing Header Type 2), segments must be 1
(RFC 4584).
This function adds the IPv6 address pointed to by
addr to the end of the Routing header being constructed.
If successful, the member of the Routing header is updated to
account for the new address in the Routing header and the return
value of the function is 0. Upon an error the return value of the
function is -1.
Note: If the Routing header is type 2, this function can only be
called once.
This function takes a Routing header extension header pointed to by
the first argument in and writes a new Routing header. The new
Routing header sends datagrams along the reverse of that route.
The function reverses the order of the addresses and sets the mem‐
ber in the new routing header to the number of segments. Both
arguments are allowed to point to the same buffer (that is, the
reversal can occur in place).
The return value of the function is 0 on success, or -1 upon an
error.
Note: If Routing header is type 2, this function returns -1 (RFC
4584).
This function returns the number of segments (addresses) contained in
the Routing header described by bp which can be 0 or greater.
The return value of the function is -1 upon an error.
This function returns a pointer to the IPv6 address specified by
index (which must be a value between 0 and one less than the value
returned by in the Routing header described by bp.
An application should first call to obtain the number of segments
in the Routing header.
Upon an error, the return value of the function is NULL.
Note: If Routing header is type 2, this function returns a pointer
to the IPv6 home address specified by the ip6r2_homeaddr field in
which is pointed by bp. The index must be zero.
Notes
To use these functions, the application must be compiled with:
To receive a Routing header, the application must enable the socket
option:
To send a Routing header, the application specifies it either as ancil‐
lary data in a call to or using (see send(2) and getsockopt(2), respec‐
tively).
EXAMPLES
gives a comprehensive example in Appendix B.
SEE ALSOsend(2), getsockopt(2), IPv6(7P), xopen_networking(7).
inet6_rth_space(3N)