]> git.saurik.com Git - apple/xnu.git/blob - bsd/netinet6/in6_prefix.h
xnu-792.6.61.tar.gz
[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 #include <sys/appleapiopts.h>
30
31 #include <sys/callout.h>
32
33 #ifdef KERNEL_PRIVATE
34 struct rr_prefix {
35 struct ifprefix rp_ifpr;
36 LIST_ENTRY(rr_prefix) rp_entry;
37 LIST_HEAD(rp_addrhead, rp_addr) rp_addrhead;
38 struct sockaddr_in6 rp_prefix; /* prefix */
39 u_int32_t rp_vltime; /* advertised valid lifetime */
40 u_int32_t rp_pltime; /* advertised preferred lifetime */
41 time_t rp_expire; /* expiration time of the prefix */
42 time_t rp_preferred; /* preferred time of the prefix */
43 struct in6_prflags rp_flags;
44 u_char rp_origin; /* from where this prefix info is obtained */
45 struct rp_stateflags {
46 /* if some prefix should be added to this prefix */
47 u_char addmark : 1;
48 u_char delmark : 1; /* if this prefix will be deleted */
49 } rp_stateflags;
50 };
51
52 #define rp_type rp_ifpr.ifpr_type
53 #define rp_ifp rp_ifpr.ifpr_ifp
54 #define rp_plen rp_ifpr.ifpr_plen
55
56 #define rp_raf rp_flags.prf_ra
57 #define rp_raf_onlink rp_flags.prf_ra.onlink
58 #define rp_raf_auto rp_flags.prf_ra.autonomous
59
60 #define rp_statef_addmark rp_stateflags.addmark
61 #define rp_statef_delmark rp_stateflags.delmark
62
63 #define rp_rrf rp_flags.prf_rr
64 #define rp_rrf_decrvalid rp_flags.prf_rr.decrvalid
65 #define rp_rrf_decrprefd rp_flags.prf_rr.decrprefd
66
67 struct rp_addr {
68 LIST_ENTRY(rp_addr) ra_entry;
69 struct in6_addr ra_ifid;
70 struct in6_ifaddr *ra_addr;
71 struct ra_flags {
72 u_char anycast : 1;
73 } ra_flags;
74 };
75
76 #define ifpr2rp(ifpr) ((struct rr_prefix *)(ifpr))
77 #define rp2ifpr(rp) ((struct ifprefix *)(rp))
78
79 #define RP_IN6(rp) (&(rp)->rp_prefix.sin6_addr)
80
81 #define RR_INFINITE_LIFETIME 0xffffffff
82
83
84 LIST_HEAD(rr_prhead, rr_prefix);
85
86 extern struct rr_prhead rr_prefix;
87
88 void in6_rr_timer(void *);
89 int delete_each_prefix (struct rr_prefix *rpp, u_char origin);
90
91 #endif KERNEL_PRIVATE