.\" Copyright (c) 1983, 1987, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $Id: inet6_rthdr_space.3,v 1.3 2005/01/19 00:30:03 majka Exp $ .\" $FreeBSD: src/lib/libc/net/inet6_rthdr_space.3,v 1.1.2.5 2001/08/17 15:42:38 ru Exp $ .\" .Dd December 10, 1999 .Dt INET6_RTHDR_SPACE 3 .Os .\" .Sh NAME .Nm inet6_rthdr_space , .Nm inet6_rthdr_init , .Nm inet6_rthdr_add , .Nm inet6_rthdr_lasthop , .Nm inet6_rthdr_reverse , .Nm inet6_rthdr_segments , .Nm inet6_rthdr_getaddr , .Nm inet6_rthdr_getflags .Nd IPv6 Routing Header Options manipulation .\" .Sh LIBRARY .Lb libc .Sh SYNOPSIS .Fd #include .Fd #include .Ft size_t .Fn inet6_rthdr_space "int type" "int segments" .Ft "struct cmsghdr *" .Fn inet6_rthdr_init "void *bp" "int type" .Ft int .Fn inet6_rthdr_add "struct cmsghdr *cmsg" "const struct in6_addr *addr" "unsigned int flags" .Ft int .Fn inet6_rthdr_lasthop "struct cmsghdr *cmsg" "unsigned int flags" .Ft int .Fn inet6_rthdr_reverse "const struct cmsghdr *in" "struct cmsghdr *out" .Ft int .Fn inet6_rthdr_segments "const struct cmsghdr *cmsg" .Ft "struct in6_addr *" .Fn inet6_rthdr_getaddr "struct cmsghdr *cmsg" "int index" .Ft int .Fn inet6_rthdr_getflags "const struct cmsghdr *cmsg" "int index" .\" .Sh DESCRIPTION RFC2292 IPv6 advanced API defines eight functions that the application calls to build and examine a Routing header. Four functions build a Routing header: .Bl -hang .It Fn inet6_rthdr_space return #bytes required for ancillary data .It Fn inet6_rthdr_init initialize ancillary data for Routing header .It Fn inet6_rthdr_add add IPv6 address & flags to Routing header .It Fn inet6_rthdr_lasthop specify the flags for the final hop .El .Pp Four functions deal with a returned Routing header: .Bl -hang .It Fn inet6_rthdr_reverse reverse a Routing header .It Fn inet6_rthdr_segments return #segments in a Routing header .It Fn inet6_rthdr_getaddr fetch one address from a Routing header .It Fn inet6_rthdr_getflags fetch one flag from a Routing header .El .Pp The function prototypes for these functions are all in the .Aq Li netinet/in.h header. .Pp The full description of these functions is available in RFC2292. .\" .Sh DIAGNOSTICS .Fn inet6_rthdr_space returns 0 on errors. .Pp .Fn inet6_rthdr_add , .Fn inet6_rthdr_lasthop and .Fn inet6_rthdr_reverse return 0 on success, and returns -1 on error. .Pp .Fn inet6_rthdr_init and .Fn inet6_rthdr_getaddr return .Dv NULL on error. .Pp .Fn inet6_rthdr_segments and .Fn inet6_rthdr_getflags return -1 on error. .\" .Sh EXAMPLES RFC2292 gives comprehensive examples in chapter 8. .\" .Sh SEE ALSO .Rs .%A W. Stevens .%A M. Thomas .%T "Advanced Sockets API for IPv6" .%N RFC2292 .%D February 1998 .Re .Rs .%A S. Deering .%A R. Hinden .%T "Internet Protocol, Version 6 (IPv6) Specification" .%N RFC2460 .%D December 1998 .Re .\" .Sh HISTORY The implementation first appeared in KAME advanced networking kit. .\" .Sh STANDARDS The functions are documented in .Dq Advanced Sockets API for IPv6 (RFC2292). .\" .Sh BUGS The text was shamelessly copied from RFC2292. .Pp .Fn inet6_rthdr_reverse is not implemented yet.