acpiioctl() can be left without ACPI_UNLOCK(), leading to
[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.4 2006/05/20 02:42:12 dillon 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 #ifndef NETINET6_IN6_PREFIX_H_
35 #define NETINET6_IN6_PREFIX_H_
36
37 #ifndef _SYS_CALLOUT_H_
38 #include <sys/callout.h>
39 #endif
40 #ifndef _SYS_QUEUE_H_
41 #include <sys/queue.h>
42 #endif
43 #ifndef _NET_IF_VAR_H_
44 #include <net/if_var.h>
45 #endif
46 #ifndef _NETINET_IN_H_
47 #include <netinet/in.h>
48 #endif
49 #ifndef _NETINET6_IN6_VAR_H_
50 #include <netinet6/in6_var.h>
51 #endif
52
53 struct rr_prefix {
54         struct ifprefix rp_ifpr;
55         LIST_ENTRY(rr_prefix) rp_entry;
56         LIST_HEAD(rp_addrhead, rp_addr) rp_addrhead;
57         struct sockaddr_in6 rp_prefix;  /* prefix */
58         u_int32_t rp_vltime;    /* advertised valid lifetime */
59         u_int32_t rp_pltime;    /* advertised preferred lifetime */
60         time_t rp_expire;       /* expiration time of the prefix */
61         time_t rp_preferred;    /* preferred time of the prefix */
62         struct in6_prflags rp_flags;
63         u_char  rp_origin; /* from where this prefix info is obtained */
64         struct  rp_stateflags {
65                 /* if some prefix should be added to this prefix */
66                 u_char addmark : 1;
67                 u_char delmark : 1; /* if this prefix will be deleted */
68         } rp_stateflags;
69 };
70
71 #define rp_type         rp_ifpr.ifpr_type
72 #define rp_ifp          rp_ifpr.ifpr_ifp
73 #define rp_plen         rp_ifpr.ifpr_plen
74
75 #define rp_raf          rp_flags.prf_ra
76 #define rp_raf_onlink           rp_flags.prf_ra.onlink
77 #define rp_raf_auto             rp_flags.prf_ra.autonomous
78
79 #define rp_statef_addmark       rp_stateflags.addmark
80 #define rp_statef_delmark       rp_stateflags.delmark
81
82 #define rp_rrf          rp_flags.prf_rr
83 #define rp_rrf_decrvalid        rp_flags.prf_rr.decrvalid
84 #define rp_rrf_decrprefd        rp_flags.prf_rr.decrprefd
85
86 struct rp_addr {
87         LIST_ENTRY(rp_addr)     ra_entry;
88         struct in6_addr         ra_ifid;
89         struct in6_ifaddr       *ra_addr;
90         struct ra_flags {
91                 u_char anycast : 1;
92         } ra_flags;
93 };
94
95 #define ifpr2rp(ifpr)   ((struct rr_prefix *)(ifpr))
96 #define rp2ifpr(rp)     ((struct ifprefix *)(rp))
97
98 #define RP_IN6(rp)      (&(rp)->rp_prefix.sin6_addr)
99
100 #define RR_INFINITE_LIFETIME            0xffffffff
101
102
103 LIST_HEAD(rr_prhead, rr_prefix);
104
105 extern struct rr_prhead rr_prefix;
106
107 void in6_rr_timer (void *);
108 extern struct callout in6_rr_timer_ch;
109 int delete_each_prefix  (struct rr_prefix *rpp, u_char origin);
110
111 #endif