1 .\" Copyright (c) 1983, 1987, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" $Id: inet6_rthdr_space.3,v 1.3 2005/01/19 00:30:03 majka Exp $
33 .\" $FreeBSD: src/lib/libc/net/inet6_rthdr_space.3,v 1.1.2.5 2001/08/17 15:42:38 ru Exp $
36 .Dt INET6_RTHDR_SPACE 3
40 .Nm inet6_rthdr_space ,
41 .Nm inet6_rthdr_init ,
43 .Nm inet6_rthdr_lasthop ,
44 .Nm inet6_rthdr_reverse ,
45 .Nm inet6_rthdr_segments ,
46 .Nm inet6_rthdr_getaddr ,
47 .Nm inet6_rthdr_getflags
48 .Nd IPv6 Routing Header Options manipulation
53 .Fd #include <sys/types.h>
54 .Fd #include <netinet/in.h>
56 .Fn inet6_rthdr_space "int type" "int segments"
57 .Ft "struct cmsghdr *"
58 .Fn inet6_rthdr_init "void *bp" "int type"
60 .Fn inet6_rthdr_add "struct cmsghdr *cmsg" "const struct in6_addr *addr" "unsigned int flags"
62 .Fn inet6_rthdr_lasthop "struct cmsghdr *cmsg" "unsigned int flags"
64 .Fn inet6_rthdr_reverse "const struct cmsghdr *in" "struct cmsghdr *out"
66 .Fn inet6_rthdr_segments "const struct cmsghdr *cmsg"
67 .Ft "struct in6_addr *"
68 .Fn inet6_rthdr_getaddr "struct cmsghdr *cmsg" "int index"
70 .Fn inet6_rthdr_getflags "const struct cmsghdr *cmsg" "int index"
73 RFC2292 IPv6 advanced API defines eight
74 functions that the application calls to build and examine a Routing
75 header. Four functions build a Routing header:
77 .It Fn inet6_rthdr_space
78 return #bytes required for ancillary data
79 .It Fn inet6_rthdr_init
80 initialize ancillary data for Routing header
81 .It Fn inet6_rthdr_add
82 add IPv6 address & flags to Routing header
83 .It Fn inet6_rthdr_lasthop
84 specify the flags for the final hop
87 Four functions deal with a returned Routing header:
89 .It Fn inet6_rthdr_reverse
90 reverse a Routing header
91 .It Fn inet6_rthdr_segments
92 return #segments in a Routing header
93 .It Fn inet6_rthdr_getaddr
94 fetch one address from a Routing header
95 .It Fn inet6_rthdr_getflags
96 fetch one flag from a Routing header
99 The function prototypes for these functions are all in the
103 The full description of these functions is available in RFC2292.
106 .Fn inet6_rthdr_space
109 .Fn inet6_rthdr_add ,
110 .Fn inet6_rthdr_lasthop
112 .Fn inet6_rthdr_reverse
113 return 0 on success, and returns -1 on error.
117 .Fn inet6_rthdr_getaddr
122 .Fn inet6_rthdr_segments
124 .Fn inet6_rthdr_getflags
128 RFC2292 gives comprehensive examples in chapter 8.
134 .%T "Advanced Sockets API for IPv6"
141 .%T "Internet Protocol, Version 6 (IPv6) Specification"
147 The implementation first appeared in KAME advanced networking kit.
152 .Dq Advanced Sockets API for IPv6
156 The text was shamelessly copied from RFC2292.
158 .Fn inet6_rthdr_reverse
159 is not implemented yet.