rtadvd.h revision 1.1 1 1.1 itojun /*
2 1.1 itojun * Copyright (C) 1998 WIDE Project.
3 1.1 itojun * All rights reserved.
4 1.1 itojun *
5 1.1 itojun * Redistribution and use in source and binary forms, with or without
6 1.1 itojun * modification, are permitted provided that the following conditions
7 1.1 itojun * are met:
8 1.1 itojun * 1. Redistributions of source code must retain the above copyright
9 1.1 itojun * notice, this list of conditions and the following disclaimer.
10 1.1 itojun * 2. Redistributions in binary form must reproduce the above copyright
11 1.1 itojun * notice, this list of conditions and the following disclaimer in the
12 1.1 itojun * documentation and/or other materials provided with the distribution.
13 1.1 itojun * 3. Neither the name of the project nor the names of its contributors
14 1.1 itojun * may be used to endorse or promote products derived from this software
15 1.1 itojun * without specific prior written permission.
16 1.1 itojun *
17 1.1 itojun * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18 1.1 itojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 1.1 itojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 1.1 itojun * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21 1.1 itojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 1.1 itojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 1.1 itojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 1.1 itojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 1.1 itojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 1.1 itojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 1.1 itojun * SUCH DAMAGE.
28 1.1 itojun */
29 1.1 itojun
30 1.1 itojun #define ALLNODES "ff02::1"
31 1.1 itojun #define ALLROUTERS "ff02::2"
32 1.1 itojun #define ANY "::"
33 1.1 itojun #define RTSOLLEN 8
34 1.1 itojun
35 1.1 itojun /* protocol constants and default values */
36 1.1 itojun #define DEF_MAXRTRADVINTERVAL 600
37 1.1 itojun #define DEF_ADVLINKMTU 0
38 1.1 itojun #define DEF_ADVREACHABLETIME 0
39 1.1 itojun #define DEF_ADVRETRANSTIMER 0
40 1.1 itojun #define DEF_ADVCURHOPLIMIT 64
41 1.1 itojun #define DEF_ADVVALIDLIFETIME 2592000
42 1.1 itojun #define DEF_ADVPREFERREDLIFETIME 604800
43 1.1 itojun
44 1.1 itojun #define MAXROUTERLIFETIME 9000
45 1.1 itojun #define MIN_MAXINTERVAL 4
46 1.1 itojun #define MAX_MAXINTERVAL 1800
47 1.1 itojun #define MIN_MININTERVAL 3
48 1.1 itojun #define MAXREACHABLETIME 3600000
49 1.1 itojun
50 1.1 itojun #define MAX_INITIAL_RTR_ADVERT_INTERVAL 16
51 1.1 itojun #define MAX_INITIAL_RTR_ADVERTISEMENTS 3
52 1.1 itojun #define MAX_FINAL_RTR_ADVERTISEMENTS 3
53 1.1 itojun #define MIN_DELAY_BETWEEN_RAS 3
54 1.1 itojun #define MAX_RA_DELAY_TIME 500000 /* usec */
55 1.1 itojun
56 1.1 itojun struct prefix {
57 1.1 itojun struct prefix *next; /* forward link */
58 1.1 itojun struct prefix *prev; /* previous link */
59 1.1 itojun
60 1.1 itojun u_int32_t validlifetime; /* AdvValidLifetime */
61 1.1 itojun u_int32_t preflifetime; /* AdvPreferredLifetime */
62 1.1 itojun u_int onlinkflg; /* bool: AdvOnLinkFlag */
63 1.1 itojun u_int autoconfflg; /* bool: AdvAutonomousFlag */
64 1.1 itojun int prefixlen;
65 1.1 itojun struct in6_addr prefix;
66 1.1 itojun };
67 1.1 itojun
68 1.1 itojun struct rainfo {
69 1.1 itojun /* pointer for list */
70 1.1 itojun struct rainfo *next;
71 1.1 itojun
72 1.1 itojun /* timer related parameters */
73 1.1 itojun struct rtadvd_timer *timer;
74 1.1 itojun int initcounter; /* counter for the first few advertisements */
75 1.1 itojun struct timeval lastsent; /* timestamp when the lates RA was sent */
76 1.1 itojun int waiting; /* number of RS waiting for RA */
77 1.1 itojun
78 1.1 itojun /* interface information */
79 1.1 itojun int ifindex;
80 1.1 itojun int advlinkopt; /* bool: whether include link-layer addr opt */
81 1.1 itojun struct sockaddr_dl *sdl;
82 1.1 itojun char ifname[16];
83 1.1 itojun int phymtu; /* mtu of the physical interface */
84 1.1 itojun
85 1.1 itojun /* Router configuration variables */
86 1.1 itojun u_short lifetime; /* AdvDefaultLifetime */
87 1.1 itojun u_int maxinterval; /* MaxRtrAdvInterval */
88 1.1 itojun u_int mininterval; /* MinRtrAdvInterval */
89 1.1 itojun int managedflg; /* AdvManagedFlag */
90 1.1 itojun int otherflg; /* AdvOtherConfigFlag */
91 1.1 itojun u_int32_t linkmtu; /* AdvLinkMTU */
92 1.1 itojun u_int32_t reachabletime; /* AdvReachableTime */
93 1.1 itojun u_int32_t retranstimer; /* AdvRetransTimer */
94 1.1 itojun u_int hoplimit; /* AdvCurHopLimit */
95 1.1 itojun struct prefix prefix; /* AdvPrefixList(link head) */
96 1.1 itojun int pfxs; /* number of prefixes */
97 1.1 itojun
98 1.1 itojun /* actual RA packet data and its length */
99 1.1 itojun size_t ra_datalen;
100 1.1 itojun u_char *ra_data;
101 1.1 itojun };
102 1.1 itojun
103 1.1 itojun void ra_timeout __P((void *));
104 1.1 itojun void ra_timer_update __P((void *, struct timeval *));
105