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