]> git.saurik.com Git - apple/xnu.git/blob - bsd/netinet6/in6_prefix.h
906c01989393c456a2b28082b6de4337b026f314
[apple/xnu.git] / bsd / netinet6 / in6_prefix.h
1 /*
2 * Copyright (C) 1995, 1996, 1997, 1998 and 1999 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the project nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30 struct rr_prefix {
31 struct ifprefix rp_ifpr;
32 LIST_ENTRY(rr_prefix) rp_entry;
33 LIST_HEAD(rp_addrhead, rp_addr) rp_addrhead;
34 struct sockaddr_in6 rp_prefix; /* prefix */
35 u_int32_t rp_vltime; /* advertised valid lifetime */
36 u_int32_t rp_pltime; /* advertised preferred lifetime */
37 time_t rp_expire; /* expiration time of the prefix */
38 time_t rp_preferred; /* preferred time of the prefix */
39 struct in6_prflags rp_flags;
40 u_char rp_origin; /* from where this prefix info is obtained */
41 struct rp_stateflags {
42 /* if some prefix should be added to this prefix */
43 u_char addmark : 1;
44 u_char delmark : 1; /* if this prefix will be deleted */
45 } rp_stateflags;
46 };
47
48 #define rp_type rp_ifpr.ifpr_type
49 #define rp_ifp rp_ifpr.ifpr_ifp
50 #define rp_plen rp_ifpr.ifpr_plen
51
52 #define rp_raf rp_flags.prf_ra
53 #define rp_raf_onlink rp_flags.prf_ra.onlink
54 #define rp_raf_auto rp_flags.prf_ra.autonomous
55
56 #define rp_statef_addmark rp_stateflags.addmark
57 #define rp_statef_delmark rp_stateflags.delmark
58
59 #define rp_rrf rp_flags.prf_rr
60 #define rp_rrf_decrvalid rp_flags.prf_rr.decrvalid
61 #define rp_rrf_decrprefd rp_flags.prf_rr.decrprefd
62
63 struct rp_addr {
64 LIST_ENTRY(rp_addr) ra_entry;
65 struct in6_addr ra_ifid;
66 struct in6_ifaddr *ra_addr;
67 struct ra_flags {
68 u_char anycast : 1;
69 } ra_flags;
70 };
71
72 #define ifpr2rp(ifpr) ((struct rr_prefix *)(ifpr))
73 #define rp2ifpr(rp) ((struct ifprefix *)(rp))
74
75 #define RP_IN6(rp) (&(rp)->rp_prefix.sin6_addr)
76
77 #define RR_INFINITE_LIFETIME 0xffffffff
78
79
80 LIST_HEAD(rr_prhead, rr_prefix);
81
82 extern struct rr_prhead rr_prefix;
83
84 void in6_rr_timer __P((void *));
85 int delete_each_prefix __P((struct rr_prefix *rpp, u_char origin));