Home | History | Annotate | Line # | Download | only in rtadvd
rtadvd.h revision 1.3
      1  1.3  itojun /*	$NetBSD: rtadvd.h,v 1.3 2000/03/13 06:16:46 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.3  itojun /*XXX int-to-double comparison for INTERVAL items */
     47  1.3  itojun #ifndef MIP6
     48  1.3  itojun #define mobileip6 0
     49  1.3  itojun #endif
     50  1.3  itojun 
     51  1.1  itojun #define MAXROUTERLIFETIME 9000
     52  1.3  itojun #define MIN_MAXINTERVAL (mobileip6 ? 1.5 : 4.0)
     53  1.1  itojun #define MAX_MAXINTERVAL 1800
     54  1.3  itojun #define MIN_MININTERVAL	(mobileip6 ? 0.5 : 3)
     55  1.1  itojun #define MAXREACHABLETIME 3600000
     56  1.1  itojun 
     57  1.3  itojun #ifndef MIP6
     58  1.3  itojun #undef miobileip6
     59  1.3  itojun #endif
     60  1.3  itojun 
     61  1.1  itojun #define MAX_INITIAL_RTR_ADVERT_INTERVAL  16
     62  1.1  itojun #define MAX_INITIAL_RTR_ADVERTISEMENTS    3
     63  1.1  itojun #define MAX_FINAL_RTR_ADVERTISEMENTS      3
     64  1.1  itojun #define MIN_DELAY_BETWEEN_RAS             3
     65  1.1  itojun #define MAX_RA_DELAY_TIME                 500000 /* usec */
     66  1.1  itojun 
     67  1.1  itojun struct prefix {
     68  1.1  itojun 	struct prefix *next;	/* forward link */
     69  1.1  itojun 	struct prefix *prev;	/* previous link */
     70  1.1  itojun 
     71  1.1  itojun 	u_int32_t validlifetime; /* AdvValidLifetime */
     72  1.1  itojun 	u_int32_t preflifetime;	/* AdvPreferredLifetime */
     73  1.1  itojun 	u_int onlinkflg;	/* bool: AdvOnLinkFlag */
     74  1.1  itojun 	u_int autoconfflg;	/* bool: AdvAutonomousFlag */
     75  1.3  itojun #ifdef MIP6
     76  1.3  itojun 	u_int routeraddr;	/* bool: RouterAddress */
     77  1.3  itojun #endif
     78  1.1  itojun 	int	prefixlen;
     79  1.1  itojun 	struct in6_addr prefix;
     80  1.1  itojun };
     81  1.1  itojun 
     82  1.1  itojun struct	rainfo {
     83  1.1  itojun 	/* pointer for list */
     84  1.1  itojun 	struct	rainfo *next;
     85  1.1  itojun 
     86  1.1  itojun 	/* timer related parameters */
     87  1.1  itojun 	struct rtadvd_timer *timer;
     88  1.1  itojun 	int initcounter; /* counter for the first few advertisements */
     89  1.1  itojun 	struct timeval lastsent; /* timestamp when the lates RA was sent */
     90  1.1  itojun 	int waiting;		/* number of RS waiting for RA */
     91  1.1  itojun 
     92  1.1  itojun 	/* interface information */
     93  1.1  itojun 	int	ifindex;
     94  1.1  itojun 	int	advlinkopt;	/* bool: whether include link-layer addr opt */
     95  1.1  itojun 	struct sockaddr_dl *sdl;
     96  1.1  itojun 	char	ifname[16];
     97  1.1  itojun 	int	phymtu;		/* mtu of the physical interface */
     98  1.1  itojun 
     99  1.1  itojun 	/* Router configuration variables */
    100  1.1  itojun 	u_short lifetime;	/* AdvDefaultLifetime */
    101  1.1  itojun 	u_int	maxinterval;	/* MaxRtrAdvInterval */
    102  1.1  itojun 	u_int	mininterval;	/* MinRtrAdvInterval */
    103  1.1  itojun 	int 	managedflg;	/* AdvManagedFlag */
    104  1.1  itojun 	int	otherflg;	/* AdvOtherConfigFlag */
    105  1.3  itojun #ifdef MIP6
    106  1.3  itojun 	int	haflg;		/* HAFlag */
    107  1.3  itojun #endif
    108  1.1  itojun 	u_int32_t linkmtu;	/* AdvLinkMTU */
    109  1.1  itojun 	u_int32_t reachabletime; /* AdvReachableTime */
    110  1.1  itojun 	u_int32_t retranstimer;	/* AdvRetransTimer */
    111  1.1  itojun 	u_int	hoplimit;	/* AdvCurHopLimit */
    112  1.1  itojun 	struct prefix prefix;	/* AdvPrefixList(link head) */
    113  1.1  itojun 	int	pfxs;		/* number of prefixes */
    114  1.1  itojun 
    115  1.3  itojun #ifdef MIP6
    116  1.3  itojun 	u_short	hapref;		/* Home Agent Preference */
    117  1.3  itojun 	u_short	hatime;		/* Home Agent Lifetime */
    118  1.3  itojun #endif
    119  1.3  itojun 
    120  1.1  itojun 	/* actual RA packet data and its length */
    121  1.1  itojun 	size_t ra_datalen;
    122  1.1  itojun 	u_char *ra_data;
    123  1.1  itojun };
    124  1.1  itojun 
    125  1.1  itojun void ra_timeout __P((void *));
    126  1.1  itojun void ra_timer_update __P((void *, struct timeval *));
    127  1.3  itojun 
    128  1.3  itojun #ifdef MIP6
    129  1.3  itojun extern int mobileip6;
    130  1.3  itojun #endif
    131