diff options
Diffstat (limited to 'src/lib/libc/net/inet6_rthdr_space.3')
-rw-r--r-- | src/lib/libc/net/inet6_rthdr_space.3 | 308 |
1 files changed, 308 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..7c00c42e42 --- /dev/null +++ b/src/lib/libc/net/inet6_rthdr_space.3 | |||
@@ -0,0 +1,308 @@ | |||
1 | .\" $OpenBSD: inet6_rthdr_space.3,v 1.17 2005/01/11 17:45:41 jaredy 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 December 27, 2004 | ||
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 | The RFC 2292 IPv6 Advanced API defined eight functions for | ||
74 | applications to use for building and parsing routing headers. | ||
75 | The | ||
76 | eight functions are split into two groups, the first of which builds | ||
77 | the header and the second of which can parse it. | ||
78 | The function prototypes for these functions are all in the | ||
79 | .Aq Pa netinet/in.h | ||
80 | header. | ||
81 | Although direct manipulation of a routing header is possible, | ||
82 | this set of APIs make it unnecessary and such direct manipulation | ||
83 | should be avoided so that changes to the underlying structures do not | ||
84 | break applications. | ||
85 | .Pp | ||
86 | Please note that RFC 2292 uses the term | ||
87 | .Dq segments | ||
88 | instead of the term | ||
89 | .Dq addresses | ||
90 | but they are considered equivalent for this manual page. | ||
91 | .\" | ||
92 | .Ss inet6_rthdr_space | ||
93 | The | ||
94 | .Fn inet6_rthdr_space | ||
95 | function returns the number of bytes required to hold a routing header | ||
96 | of the specified | ||
97 | .Fa type | ||
98 | and containing the specified number of | ||
99 | .Fa segments . | ||
100 | Only one | ||
101 | .Fa type | ||
102 | is supported, | ||
103 | .Dv IPV6_RTHDR_TYPE_0 , | ||
104 | and it can hold from 1 to 23 segments. | ||
105 | The return value includes the | ||
106 | size of the | ||
107 | .Vt cmsghdr | ||
108 | structure that precedes the routing header and | ||
109 | any required padding. | ||
110 | .Pp | ||
111 | A return value of 0 indicates an error. | ||
112 | Either the type was specified | ||
113 | incorrectly, or the number of segments was less than one or greater | ||
114 | than 23. | ||
115 | .Pp | ||
116 | Note: The | ||
117 | .Fn inet6_rthdr_space | ||
118 | function only returns the size required by the routing header and does | ||
119 | not allocate memory for the caller. | ||
120 | .\" | ||
121 | .Ss inet6_rthdr_init | ||
122 | The | ||
123 | .Fn inet6_rthdr_init | ||
124 | function initializes a buffer, pointed to by | ||
125 | .Fa bp | ||
126 | with an appropriate | ||
127 | .Li cmsghdr | ||
128 | structure followed by a routing header of the specified | ||
129 | .Fa type . | ||
130 | .Pp | ||
131 | The caller must use the | ||
132 | .Fn inet6_rthdr_space | ||
133 | function to determine the size of the buffer, and then allocate that | ||
134 | buffer before calling | ||
135 | .Fn inet6_rthdr_init . | ||
136 | .Pp | ||
137 | The return value is a pointer to a | ||
138 | .Li cmsghdr | ||
139 | structure, which is used as the first argument to the | ||
140 | .Fn inet6_rthdr_add | ||
141 | and | ||
142 | .Fn inet6_rthdr_lasthop | ||
143 | functions in order to construct the routing header. | ||
144 | When an error occurs the return value is | ||
145 | .Dv NULL . | ||
146 | .\" | ||
147 | .Ss inet6_rthdr_add | ||
148 | The | ||
149 | .Fn inet6_rthdr_add | ||
150 | function adds the IPv6 address pointed to by | ||
151 | .Fa addr | ||
152 | to the end of the | ||
153 | routing header being constructed and sets the type of this address to the | ||
154 | value of | ||
155 | .Fa flags . | ||
156 | The | ||
157 | .Fa flags | ||
158 | must be either | ||
159 | .Dv IPV6_RTHDR_LOOSE | ||
160 | or | ||
161 | .Dv IPV6_RTHDR_STRICT | ||
162 | indicating whether loose or strict source routing is required. | ||
163 | .Pp | ||
164 | When the function succeeds it returns 0, otherwise \-1 is returned. | ||
165 | .\" | ||
166 | .Ss inet6_rthdr_lasthop | ||
167 | The | ||
168 | .Fn inet6_rthdr_lasthop | ||
169 | function specifies the strict or loose flag for the final hop of a | ||
170 | routing header. | ||
171 | The | ||
172 | .Fa flags | ||
173 | argument must be either | ||
174 | .Dv IPV6_RTHDR_LOOSE | ||
175 | or | ||
176 | .Dv IPV6_RTHDR_STRICT . | ||
177 | .Pp | ||
178 | The return value of the function is 0 upon success, and \-1 when an | ||
179 | error has occurred. | ||
180 | .Pp | ||
181 | Please note that a routing header specifying | ||
182 | .Li N | ||
183 | intermediate nodes requires | ||
184 | .Li N+1 | ||
185 | strict or loose flags meaning that | ||
186 | .Fn inet6_rthdr_add | ||
187 | must be called | ||
188 | .Li N | ||
189 | times and then | ||
190 | .Fn inet6_rthdr_lasthop | ||
191 | must be called once. | ||
192 | .\" | ||
193 | .Ss inet6_rthdr_reverse | ||
194 | This function was never implemented. | ||
195 | .Pp | ||
196 | The following three functions provide an API for parsing a received | ||
197 | routing header: | ||
198 | .\" | ||
199 | .Ss inet6_rthdr_segments | ||
200 | The | ||
201 | .Fn inet6_rthdr_segments | ||
202 | function returns the number of segments contained in the routing | ||
203 | header pointed to by the | ||
204 | .Fa cmsg | ||
205 | argument. | ||
206 | On success the return value is from 1 to 23. | ||
207 | When an error occurs, \-1 is returned. | ||
208 | .\" | ||
209 | .Ss inet6_rthdr_getaddr | ||
210 | The | ||
211 | .Fn inet6_rthdr_getaddr | ||
212 | function returns a pointer to the IPv6 address specified by the | ||
213 | .Fa index | ||
214 | argument from the routing header pointed to by | ||
215 | .Fa cmsg . | ||
216 | The index must be between 1 and the number returned by | ||
217 | .Fn inet6_rthdr_segments , | ||
218 | described above. | ||
219 | An application must call | ||
220 | .Fn inet6_rthdr_segments | ||
221 | to obtain the number of segments in the routing header. | ||
222 | .Pp | ||
223 | If an error occurs, | ||
224 | .Dv NULL | ||
225 | is returned. | ||
226 | .\" | ||
227 | .Ss inet6_rthdr_getflags | ||
228 | The | ||
229 | .Fn inet6_rthdr_getflags | ||
230 | function returns the flags value of the segment specified by | ||
231 | .Fa index | ||
232 | of the routing header pointed to by | ||
233 | .Fa cmsg . | ||
234 | The | ||
235 | .Fa index | ||
236 | argument must be between 0 and the value returned by | ||
237 | .Fn inet6_rthdr_segments . | ||
238 | The return value will be either | ||
239 | .Dv IPV6_RTHDR_LOOSE | ||
240 | or | ||
241 | .Dv IPV6_RTHDR_STRICT | ||
242 | indicating whether loose or strict source routing was requested for | ||
243 | that segment. | ||
244 | .Pp | ||
245 | When an error occurs, \-1 is returned. | ||
246 | .Pp | ||
247 | Note: Flags begin at index 0 while segments begin at index 1, to | ||
248 | maintain consistency with the terminology and figures in RFC 2460. | ||
249 | .\" | ||
250 | .Sh EXAMPLES | ||
251 | RFC 2292 gives comprehensive examples in chapter 8. | ||
252 | .\" | ||
253 | .Sh DIAGNOSTICS | ||
254 | The | ||
255 | .Fn inet6_rthdr_space | ||
256 | function returns 0 when an error occurs. | ||
257 | .Pp | ||
258 | The | ||
259 | .Fn inet6_rthdr_add | ||
260 | and | ||
261 | .Fn inet6_rthdr_lasthop | ||
262 | functions return 0 on success, and \-1 on error. | ||
263 | .Pp | ||
264 | The | ||
265 | .Fn inet6_rthdr_init | ||
266 | and | ||
267 | .Fn inet6_rthdr_getaddr | ||
268 | functions | ||
269 | return | ||
270 | .Dv NULL | ||
271 | on error. | ||
272 | .Pp | ||
273 | The | ||
274 | .Fn inet6_rthdr_segments | ||
275 | and | ||
276 | .Fn inet6_rthdr_getflags | ||
277 | functions return \-1 on error. | ||
278 | .\" | ||
279 | .Sh SEE ALSO | ||
280 | .Xr inet6 4 , | ||
281 | .Xr ip6 4 | ||
282 | .Rs | ||
283 | .%A W. Stevens | ||
284 | .%A M. Thomas | ||
285 | .%T "Advanced Sockets API for IPv6" | ||
286 | .%N RFC 2292 | ||
287 | .%D February 1998 | ||
288 | .Re | ||
289 | .Rs | ||
290 | .%A S. Deering | ||
291 | .%A R. Hinden | ||
292 | .%T "Internet Protocol, Version 6 (IPv6) Specification" | ||
293 | .%N RFC 2460 | ||
294 | .%D December 1998 | ||
295 | .Re | ||
296 | .\" | ||
297 | .Sh HISTORY | ||
298 | This implementation first appeared in the KAME advanced networking kit. | ||
299 | .\" | ||
300 | .Sh BUGS | ||
301 | The | ||
302 | .Fn inet6_rthdr_reverse | ||
303 | function was never implemented. | ||
304 | .\".Pp | ||
305 | .\"This API is deprecated in favor of | ||
306 | .\".Xr inet6_rth_space 3 | ||
307 | .\".Sh SEE ALSO | ||
308 | .\".Xr inet6_rth_space 3 | ||