diff options
Diffstat (limited to 'src/lib/libc/net/inet6_rthdr_space.3')
-rw-r--r-- | src/lib/libc/net/inet6_rthdr_space.3 | 314 |
1 files changed, 314 insertions, 0 deletions
diff --git a/src/lib/libc/net/inet6_rthdr_space.3 b/src/lib/libc/net/inet6_rthdr_space.3 new file mode 100644 index 0000000000..3287bfe009 --- /dev/null +++ b/src/lib/libc/net/inet6_rthdr_space.3 | |||
@@ -0,0 +1,314 @@ | |||
1 | .\" $OpenBSD: inet6_rthdr_space.3,v 1.20 2007/05/31 19:19:30 jmc Exp $ | ||
2 | .\" $KAME: inet6_rthdr_space.3,v 1.11 2005/01/05 03:00:44 itojun Exp $ | ||
3 | .\" | ||
4 | .\" Copyright (C) 2004 WIDE Project. | ||
5 | .\" All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" 1. Redistributions of source code must retain the above copyright | ||
11 | .\" notice, this list of conditions and the following disclaimer. | ||
12 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
13 | .\" notice, this list of conditions and the following disclaimer in the | ||
14 | .\" documentation and/or other materials provided with the distribution. | ||
15 | .\" 3. Neither the name of the project nor the names of its contributors | ||
16 | .\" may be used to endorse or promote products derived from this software | ||
17 | .\" without specific prior written permission. | ||
18 | .\" | ||
19 | .\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND | ||
20 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
21 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
22 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | ||
23 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
24 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
25 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
26 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
27 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
29 | .\" SUCH DAMAGE. | ||
30 | .\" | ||
31 | .Dd $Mdocdate: May 31 2007 $ | ||
32 | .Dt INET6_RTHDR_SPACE 3 | ||
33 | .Os | ||
34 | .\" | ||
35 | .Sh NAME | ||
36 | .Nm inet6_rthdr_space , | ||
37 | .Nm inet6_rthdr_init , | ||
38 | .Nm inet6_rthdr_add , | ||
39 | .Nm inet6_rthdr_lasthop , | ||
40 | .Nm inet6_rthdr_reverse , | ||
41 | .Nm inet6_rthdr_segments , | ||
42 | .Nm inet6_rthdr_getaddr , | ||
43 | .Nm inet6_rthdr_getflags | ||
44 | .Nd IPv6 Routing Header Options Manipulation | ||
45 | .\" | ||
46 | .Sh SYNOPSIS | ||
47 | .In sys/types.h | ||
48 | .In netinet/in.h | ||
49 | .Ft size_t | ||
50 | .Fn inet6_rthdr_space "int type" "int segments" | ||
51 | .Ft "struct cmsghdr *" | ||
52 | .Fn inet6_rthdr_init "void *bp" "int type" | ||
53 | .Ft int | ||
54 | .Fn inet6_rthdr_add "struct cmsghdr *cmsg" "const struct in6_addr *addr" "unsigned int flags" | ||
55 | .Ft int | ||
56 | .Fn inet6_rthdr_lasthop "struct cmsghdr *cmsg" "unsigned int flags" | ||
57 | .Ft int | ||
58 | .Fn inet6_rthdr_reverse "const struct cmsghdr *in" "struct cmsghdr *out" | ||
59 | .Ft int | ||
60 | .Fn inet6_rthdr_segments "const struct cmsghdr *cmsg" | ||
61 | .Ft "struct in6_addr *" | ||
62 | .Fn inet6_rthdr_getaddr "struct cmsghdr *cmsg" "int index" | ||
63 | .Ft int | ||
64 | .Fn inet6_rthdr_getflags "const struct cmsghdr *cmsg" "int index" | ||
65 | .\" | ||
66 | .Sh DESCRIPTION | ||
67 | .\"The RFC 2292 IPv6 Advanced API has been deprecated in favor of the | ||
68 | .\"newer, RFC 3542 APIs. | ||
69 | .\"On platforms that support it, currently only | ||
70 | .\"FreeBSD, please use the newer API to manipulate routing header | ||
71 | .\"options. | ||
72 | .\".Pp | ||
73 | Note: | ||
74 | RFC 2292 has been superseded by RFC 3542. | ||
75 | The use of functions described in this page is deprecated. | ||
76 | See | ||
77 | .Xr inet6_rth_space 3 . | ||
78 | .Pp | ||
79 | The RFC 2292 IPv6 Advanced API defined eight functions for | ||
80 | applications to use for building and parsing routing headers. | ||
81 | The | ||
82 | eight functions are split into two groups, the first of which builds | ||
83 | the header and the second of which can parse it. | ||
84 | The function prototypes for these functions are all in the | ||
85 | .Aq Pa netinet/in.h | ||
86 | header. | ||
87 | Although direct manipulation of a routing header is possible, | ||
88 | this set of APIs make it unnecessary and such direct manipulation | ||
89 | should be avoided so that changes to the underlying structures do not | ||
90 | break applications. | ||
91 | .Pp | ||
92 | Please note that RFC 2292 uses the term | ||
93 | .Dq segments | ||
94 | instead of the term | ||
95 | .Dq addresses | ||
96 | but they are considered equivalent for this manual page. | ||
97 | .\" | ||
98 | .Ss inet6_rthdr_space | ||
99 | The | ||
100 | .Fn inet6_rthdr_space | ||
101 | function returns the number of bytes required to hold a routing header | ||
102 | of the specified | ||
103 | .Fa type | ||
104 | and containing the specified number of | ||
105 | .Fa segments . | ||
106 | Only one | ||
107 | .Fa type | ||
108 | is supported, | ||
109 | .Dv IPV6_RTHDR_TYPE_0 , | ||
110 | and it can hold from 1 to 23 segments. | ||
111 | The return value includes the | ||
112 | size of the | ||
113 | .Vt cmsghdr | ||
114 | structure that precedes the routing header and | ||
115 | any required padding. | ||
116 | .Pp | ||
117 | A return value of 0 indicates an error. | ||
118 | Either the type was specified | ||
119 | incorrectly, or the number of segments was less than one or greater | ||
120 | than 23. | ||
121 | .Pp | ||
122 | Note: The | ||
123 | .Fn inet6_rthdr_space | ||
124 | function only returns the size required by the routing header and does | ||
125 | not allocate memory for the caller. | ||
126 | .\" | ||
127 | .Ss inet6_rthdr_init | ||
128 | The | ||
129 | .Fn inet6_rthdr_init | ||
130 | function initializes a buffer, pointed to by | ||
131 | .Fa bp | ||
132 | with an appropriate | ||
133 | .Li cmsghdr | ||
134 | structure followed by a routing header of the specified | ||
135 | .Fa type . | ||
136 | .Pp | ||
137 | The caller must use the | ||
138 | .Fn inet6_rthdr_space | ||
139 | function to determine the size of the buffer, and then allocate that | ||
140 | buffer before calling | ||
141 | .Fn inet6_rthdr_init . | ||
142 | .Pp | ||
143 | The return value is a pointer to a | ||
144 | .Li cmsghdr | ||
145 | structure, which is used as the first argument to the | ||
146 | .Fn inet6_rthdr_add | ||
147 | and | ||
148 | .Fn inet6_rthdr_lasthop | ||
149 | functions in order to construct the routing header. | ||
150 | When an error occurs the return value is | ||
151 | .Dv NULL . | ||
152 | .\" | ||
153 | .Ss inet6_rthdr_add | ||
154 | The | ||
155 | .Fn inet6_rthdr_add | ||
156 | function adds the IPv6 address pointed to by | ||
157 | .Fa addr | ||
158 | to the end of the | ||
159 | routing header being constructed and sets the type of this address to the | ||
160 | value of | ||
161 | .Fa flags . | ||
162 | The | ||
163 | .Fa flags | ||
164 | must be either | ||
165 | .Dv IPV6_RTHDR_LOOSE | ||
166 | or | ||
167 | .Dv IPV6_RTHDR_STRICT | ||
168 | indicating whether loose or strict source routing is required. | ||
169 | .Pp | ||
170 | When the function succeeds it returns 0, otherwise \-1 is returned. | ||
171 | .\" | ||
172 | .Ss inet6_rthdr_lasthop | ||
173 | The | ||
174 | .Fn inet6_rthdr_lasthop | ||
175 | function specifies the strict or loose flag for the final hop of a | ||
176 | routing header. | ||
177 | The | ||
178 | .Fa flags | ||
179 | argument must be either | ||
180 | .Dv IPV6_RTHDR_LOOSE | ||
181 | or | ||
182 | .Dv IPV6_RTHDR_STRICT . | ||
183 | .Pp | ||
184 | The return value of the function is 0 upon success, and \-1 when an | ||
185 | error has occurred. | ||
186 | .Pp | ||
187 | Please note that a routing header specifying | ||
188 | .Li N | ||
189 | intermediate nodes requires | ||
190 | .Li N+1 | ||
191 | strict or loose flags meaning that | ||
192 | .Fn inet6_rthdr_add | ||
193 | must be called | ||
194 | .Li N | ||
195 | times and then | ||
196 | .Fn inet6_rthdr_lasthop | ||
197 | must be called once. | ||
198 | .\" | ||
199 | .Ss inet6_rthdr_reverse | ||
200 | This function was never implemented. | ||
201 | .Pp | ||
202 | The following three functions provide an API for parsing a received | ||
203 | routing header: | ||
204 | .\" | ||
205 | .Ss inet6_rthdr_segments | ||
206 | The | ||
207 | .Fn inet6_rthdr_segments | ||
208 | function returns the number of segments contained in the routing | ||
209 | header pointed to by the | ||
210 | .Fa cmsg | ||
211 | argument. | ||
212 | On success the return value is from 1 to 23. | ||
213 | When an error occurs, \-1 is returned. | ||
214 | .\" | ||
215 | .Ss inet6_rthdr_getaddr | ||
216 | The | ||
217 | .Fn inet6_rthdr_getaddr | ||
218 | function returns a pointer to the IPv6 address specified by the | ||
219 | .Fa index | ||
220 | argument from the routing header pointed to by | ||
221 | .Fa cmsg . | ||
222 | The index must be between 1 and the number returned by | ||
223 | .Fn inet6_rthdr_segments , | ||
224 | described above. | ||
225 | An application must call | ||
226 | .Fn inet6_rthdr_segments | ||
227 | to obtain the number of segments in the routing header. | ||
228 | .Pp | ||
229 | If an error occurs, | ||
230 | .Dv NULL | ||
231 | is returned. | ||
232 | .\" | ||
233 | .Ss inet6_rthdr_getflags | ||
234 | The | ||
235 | .Fn inet6_rthdr_getflags | ||
236 | function returns the flags value of the segment specified by | ||
237 | .Fa index | ||
238 | of the routing header pointed to by | ||
239 | .Fa cmsg . | ||
240 | The | ||
241 | .Fa index | ||
242 | argument must be between 0 and the value returned by | ||
243 | .Fn inet6_rthdr_segments . | ||
244 | The return value will be either | ||
245 | .Dv IPV6_RTHDR_LOOSE | ||
246 | or | ||
247 | .Dv IPV6_RTHDR_STRICT | ||
248 | indicating whether loose or strict source routing was requested for | ||
249 | that segment. | ||
250 | .Pp | ||
251 | When an error occurs, \-1 is returned. | ||
252 | .Pp | ||
253 | Note: Flags begin at index 0 while segments begin at index 1, to | ||
254 | maintain consistency with the terminology and figures in RFC 2460. | ||
255 | .\" | ||
256 | .Sh EXAMPLES | ||
257 | RFC 2292 gives comprehensive examples in chapter 8. | ||
258 | .\" | ||
259 | .Sh DIAGNOSTICS | ||
260 | The | ||
261 | .Fn inet6_rthdr_space | ||
262 | function returns 0 when an error occurs. | ||
263 | .Pp | ||
264 | The | ||
265 | .Fn inet6_rthdr_add | ||
266 | and | ||
267 | .Fn inet6_rthdr_lasthop | ||
268 | functions return 0 on success, and \-1 on error. | ||
269 | .Pp | ||
270 | The | ||
271 | .Fn inet6_rthdr_init | ||
272 | and | ||
273 | .Fn inet6_rthdr_getaddr | ||
274 | functions | ||
275 | return | ||
276 | .Dv NULL | ||
277 | on error. | ||
278 | .Pp | ||
279 | The | ||
280 | .Fn inet6_rthdr_segments | ||
281 | and | ||
282 | .Fn inet6_rthdr_getflags | ||
283 | functions return \-1 on error. | ||
284 | .\" | ||
285 | .Sh SEE ALSO | ||
286 | .Xr inet6 4 , | ||
287 | .Xr ip6 4 | ||
288 | .Rs | ||
289 | .%A W. Stevens | ||
290 | .%A M. Thomas | ||
291 | .%T "Advanced Sockets API for IPv6" | ||
292 | .%N RFC 2292 | ||
293 | .%D February 1998 | ||
294 | .Re | ||
295 | .Rs | ||
296 | .%A S. Deering | ||
297 | .%A R. Hinden | ||
298 | .%T "Internet Protocol, Version 6 (IPv6) Specification" | ||
299 | .%N RFC 2460 | ||
300 | .%D December 1998 | ||
301 | .Re | ||
302 | .\" | ||
303 | .Sh HISTORY | ||
304 | This implementation first appeared in the KAME advanced networking kit. | ||
305 | .\" | ||
306 | .Sh BUGS | ||
307 | The | ||
308 | .Fn inet6_rthdr_reverse | ||
309 | function was never implemented. | ||
310 | .\".Pp | ||
311 | .\"This API is deprecated in favor of | ||
312 | .\".Xr inet6_rth_space 3 | ||
313 | .\".Sh SEE ALSO | ||
314 | .\".Xr inet6_rth_space 3 | ||