| 1 | .\" Copyright (c) 1983, 1987, 1991, 1993 |
| 2 | .\" The Regents of the University of California. All rights reserved. |
| 3 | .\" |
| 4 | .\" Redistribution and use in source and binary forms, with or without |
| 5 | .\" modification, are permitted provided that the following conditions |
| 6 | .\" are met: |
| 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. |
| 19 | .\" |
| 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 |
| 30 | .\" SUCH DAMAGE. |
| 31 | .\" |
| 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 $ |
| 34 | .\" |
| 35 | .Dd December 10, 1999 |
| 36 | .Dt INET6_RTHDR_SPACE 3 |
| 37 | .Os |
| 38 | .\" |
| 39 | .Sh NAME |
| 40 | .Nm inet6_rthdr_space , |
| 41 | .Nm inet6_rthdr_init , |
| 42 | .Nm inet6_rthdr_add , |
| 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 |
| 49 | .\" |
| 50 | .Sh LIBRARY |
| 51 | .Lb libc |
| 52 | .Sh SYNOPSIS |
| 53 | .Fd #include <sys/types.h> |
| 54 | .Fd #include <netinet/in.h> |
| 55 | .Ft size_t |
| 56 | .Fn inet6_rthdr_space "int type" "int segments" |
| 57 | .Ft "struct cmsghdr *" |
| 58 | .Fn inet6_rthdr_init "void *bp" "int type" |
| 59 | .Ft int |
| 60 | .Fn inet6_rthdr_add "struct cmsghdr *cmsg" "const struct in6_addr *addr" "unsigned int flags" |
| 61 | .Ft int |
| 62 | .Fn inet6_rthdr_lasthop "struct cmsghdr *cmsg" "unsigned int flags" |
| 63 | .Ft int |
| 64 | .Fn inet6_rthdr_reverse "const struct cmsghdr *in" "struct cmsghdr *out" |
| 65 | .Ft int |
| 66 | .Fn inet6_rthdr_segments "const struct cmsghdr *cmsg" |
| 67 | .Ft "struct in6_addr *" |
| 68 | .Fn inet6_rthdr_getaddr "struct cmsghdr *cmsg" "int index" |
| 69 | .Ft int |
| 70 | .Fn inet6_rthdr_getflags "const struct cmsghdr *cmsg" "int index" |
| 71 | .\" |
| 72 | .Sh DESCRIPTION |
| 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: |
| 76 | .Bl -hang |
| 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 |
| 85 | .El |
| 86 | .Pp |
| 87 | Four functions deal with a returned Routing header: |
| 88 | .Bl -hang |
| 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 |
| 97 | .El |
| 98 | .Pp |
| 99 | The function prototypes for these functions are all in the |
| 100 | .Aq Li netinet/in.h |
| 101 | header. |
| 102 | .Pp |
| 103 | The full description of these functions is available in RFC2292. |
| 104 | .\" |
| 105 | .Sh DIAGNOSTICS |
| 106 | .Fn inet6_rthdr_space |
| 107 | returns 0 on errors. |
| 108 | .Pp |
| 109 | .Fn inet6_rthdr_add , |
| 110 | .Fn inet6_rthdr_lasthop |
| 111 | and |
| 112 | .Fn inet6_rthdr_reverse |
| 113 | return 0 on success, and returns -1 on error. |
| 114 | .Pp |
| 115 | .Fn inet6_rthdr_init |
| 116 | and |
| 117 | .Fn inet6_rthdr_getaddr |
| 118 | return |
| 119 | .Dv NULL |
| 120 | on error. |
| 121 | .Pp |
| 122 | .Fn inet6_rthdr_segments |
| 123 | and |
| 124 | .Fn inet6_rthdr_getflags |
| 125 | return -1 on error. |
| 126 | .\" |
| 127 | .Sh EXAMPLES |
| 128 | RFC2292 gives comprehensive examples in chapter 8. |
| 129 | .\" |
| 130 | .Sh SEE ALSO |
| 131 | .Rs |
| 132 | .%A W. Stevens |
| 133 | .%A M. Thomas |
| 134 | .%T "Advanced Sockets API for IPv6" |
| 135 | .%N RFC2292 |
| 136 | .%D February 1998 |
| 137 | .Re |
| 138 | .Rs |
| 139 | .%A S. Deering |
| 140 | .%A R. Hinden |
| 141 | .%T "Internet Protocol, Version 6 (IPv6) Specification" |
| 142 | .%N RFC2460 |
| 143 | .%D December 1998 |
| 144 | .Re |
| 145 | .\" |
| 146 | .Sh HISTORY |
| 147 | The implementation first appeared in KAME advanced networking kit. |
| 148 | .\" |
| 149 | .Sh STANDARDS |
| 150 | The functions |
| 151 | are documented in |
| 152 | .Dq Advanced Sockets API for IPv6 |
| 153 | (RFC2292). |
| 154 | .\" |
| 155 | .Sh BUGS |
| 156 | The text was shamelessly copied from RFC2292. |
| 157 | .Pp |
| 158 | .Fn inet6_rthdr_reverse |
| 159 | is not implemented yet. |