Manual Reference Pages - INET6_RTH_GETADDR (3)
- IPv6 Routing Header Options manipulation
inet6_rth_space int int
inet6_rth_init void * socklen_t int int
inet6_rth_add void * const struct in6_addr *
inet6_rth_reverse const void * void *
inet6_rth_segments const void *
struct in6_addr *
inet6_rth_getaddr const void * int
The IPv6 Advanced API, RFC 3542, defines the functions that an
application calls to build and examine IPv6 Routing headers.
Routing headers are used to perform source routing in IPv6 networks.
The RFC uses the word
to describe addresses and that is the term used here as well.
All of the functions are defined in the
The functions described in this manual page all operate
on routing header structures which are defined in
but which should not need to be modified outside the use of this API.
The size and shape of the route header structures may change, so using
the APIs is a more portable, long term, solution.
The functions in the API are split into two groups, those that build a
routing header and those that parse a received routing header.
We will describe the builder functions followed by the parser functions.
function returns the number of bytes required to hold a Routing Header
of the type, specified in the
argument and containing the number of addresses specified in the
When the type is
the number of segments must be from 0 through 127.
Routing headers of type
contain only one segment, and are only used with Mobile IPv6.
The return value from this function is the number of bytes required to
store the routing header.
If the value 0 is returned then either the
route header type was not recognized or another error occurred.
function initializes the pre-allocated buffer pointed to by
to contain a routing header of the specified type.
argument is used to verify that the buffer is large enough.
The caller must allocate the buffer pointed to by bp.
The necessary buffer size should be determined by calling
described in the previous sections.
function returns a pointer to
on success and
when there is an error.
function adds the IPv6 address pointed to by
to the end of the routing header being constructed.
A successful addition results in the function returning 0, otherwise
-1 is returned.
function takes a routing header, pointed to by the
and writes a new routing header into the argument pointed to by
The routing header at that sends datagrams along the reverse of that
Both arguments are allowed to point to the same buffer meaning
that the reversal can occur in place.
The return value of the function is 0 on success, or -1 when
there is an error.
The next set of functions operate on a routing header that the
application wants to parse.
In the usual case such a routing header
is received from the network, although these functions can also be
used with routing headers that the application itself created.
function returns the number of segments contained in the
routing header pointed to by
The return value is the number of segments contained in the routing
header, or -1 if an error occurred.
It is not an error for 0 to be
returned as a routing header may contain 0 segments.
function is used to retrieve a single address from a routing header.
is the location in the routing header from which the application wants
to retrieve an address.
parameter must have a value between 0 and one less than the number of
segments present in the routing header.
function, described in the last section, should be used to determine
the total number of segments in the routing header.
function returns a pointer to an IPv6 address on success or
when an error has occurred.
RFC 3542 gives extensive examples in Section 21, Appendix B.
KAME also provides examples in the advapitest directory of its kit.
functions return 0 on errors.
functions return 0 on success, or -1 upon an error.
Advanced Sockets API for IPv6
Internet Protocol, Version 6 (IPv6) Specification
The implementation first appeared in KAME advanced networking kit.
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.