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