1804c83d4SKris Kennaway /* $KAME: rtsold.h,v 1.9 2000/08/13 06:15:00 itojun Exp $ */ 2804c83d4SKris Kennaway 37d56d374SYoshinobu Inoue /* 47d56d374SYoshinobu Inoue * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 57d56d374SYoshinobu Inoue * All rights reserved. 67d56d374SYoshinobu Inoue * 77d56d374SYoshinobu Inoue * Redistribution and use in source and binary forms, with or without 87d56d374SYoshinobu Inoue * modification, are permitted provided that the following conditions 97d56d374SYoshinobu Inoue * are met: 107d56d374SYoshinobu Inoue * 1. Redistributions of source code must retain the above copyright 117d56d374SYoshinobu Inoue * notice, this list of conditions and the following disclaimer. 127d56d374SYoshinobu Inoue * 2. Redistributions in binary form must reproduce the above copyright 137d56d374SYoshinobu Inoue * notice, this list of conditions and the following disclaimer in the 147d56d374SYoshinobu Inoue * documentation and/or other materials provided with the distribution. 157d56d374SYoshinobu Inoue * 3. Neither the name of the project nor the names of its contributors 167d56d374SYoshinobu Inoue * may be used to endorse or promote products derived from this software 177d56d374SYoshinobu Inoue * without specific prior written permission. 187d56d374SYoshinobu Inoue * 197d56d374SYoshinobu Inoue * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 207d56d374SYoshinobu Inoue * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 217d56d374SYoshinobu Inoue * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 227d56d374SYoshinobu Inoue * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 237d56d374SYoshinobu Inoue * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 247d56d374SYoshinobu Inoue * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 257d56d374SYoshinobu Inoue * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 267d56d374SYoshinobu Inoue * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 277d56d374SYoshinobu Inoue * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 287d56d374SYoshinobu Inoue * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 297d56d374SYoshinobu Inoue * SUCH DAMAGE. 307d56d374SYoshinobu Inoue * 317d56d374SYoshinobu Inoue * $FreeBSD$ 327d56d374SYoshinobu Inoue */ 337d56d374SYoshinobu Inoue 347d56d374SYoshinobu Inoue struct ifinfo { 357d56d374SYoshinobu Inoue struct ifinfo *next; /* pointer to the next interface */ 367d56d374SYoshinobu Inoue 377d56d374SYoshinobu Inoue struct sockaddr_dl *sdl; /* link-layer address */ 38259df286SKris Kennaway char ifname[IF_NAMESIZE]; /* interface name */ 397d56d374SYoshinobu Inoue int active; /* interface status */ 407d56d374SYoshinobu Inoue int probeinterval; /* interval of probe timer(if necessary) */ 417d56d374SYoshinobu Inoue int probetimer; /* rest of probe timer */ 427d56d374SYoshinobu Inoue int mediareqok; /* wheter the IF supports SIOCGIFMEDIA */ 437d56d374SYoshinobu Inoue int state; 447d56d374SYoshinobu Inoue int probes; 457d56d374SYoshinobu Inoue int dadcount; 467d56d374SYoshinobu Inoue struct timeval timer; 477d56d374SYoshinobu Inoue struct timeval expire; 48259df286SKris Kennaway int errors; /* # of errors we've got - detect wedge */ 497d56d374SYoshinobu Inoue 507d56d374SYoshinobu Inoue int racnt; /* total # of valid RAs it have got */ 517d56d374SYoshinobu Inoue 527d56d374SYoshinobu Inoue size_t rs_datalen; 537d56d374SYoshinobu Inoue u_char *rs_data; 547d56d374SYoshinobu Inoue }; 557d56d374SYoshinobu Inoue 567d56d374SYoshinobu Inoue /* per interface status */ 577d56d374SYoshinobu Inoue #define IFS_IDLE 0 587d56d374SYoshinobu Inoue #define IFS_DELAY 1 597d56d374SYoshinobu Inoue #define IFS_PROBE 2 607d56d374SYoshinobu Inoue #define IFS_DOWN 3 617d56d374SYoshinobu Inoue #define IFS_TENTATIVE 4 627d56d374SYoshinobu Inoue 637d56d374SYoshinobu Inoue /* rtsold.c */ 647d56d374SYoshinobu Inoue extern struct timeval tm_max; 657d56d374SYoshinobu Inoue extern int dflag; 667d56d374SYoshinobu Inoue struct ifinfo *find_ifinfo __P((int ifindex)); 677d56d374SYoshinobu Inoue void rtsol_timer_update __P((struct ifinfo *ifinfo)); 68804c83d4SKris Kennaway extern void warnmsg __P((int, const char *, const char *, ...)) 69804c83d4SKris Kennaway __attribute__((__format__(__printf__, 3, 4))); 707d56d374SYoshinobu Inoue 717d56d374SYoshinobu Inoue /* if.c */ 727d56d374SYoshinobu Inoue extern int ifinit __P((void)); 737d56d374SYoshinobu Inoue extern int interface_up __P((char *name)); 747d56d374SYoshinobu Inoue extern int interface_status __P((struct ifinfo*)); 757d56d374SYoshinobu Inoue extern int lladdropt_length __P((struct sockaddr_dl *sdl)); 767d56d374SYoshinobu Inoue extern void lladdropt_fill __P((struct sockaddr_dl *sdl, 777d56d374SYoshinobu Inoue struct nd_opt_hdr *ndopt)); 787d56d374SYoshinobu Inoue extern struct sockaddr_dl *if_nametosdl __P((char *name)); 797d56d374SYoshinobu Inoue extern int getinet6sysctl __P((int code)); 807d56d374SYoshinobu Inoue 817d56d374SYoshinobu Inoue /* rtsol.c */ 827d56d374SYoshinobu Inoue extern int sockopen __P((void)); 837d56d374SYoshinobu Inoue extern void sendpacket __P((struct ifinfo *ifinfo)); 847d56d374SYoshinobu Inoue extern void rtsol_input __P((int s)); 857d56d374SYoshinobu Inoue 867d56d374SYoshinobu Inoue /* probe.c */ 877d56d374SYoshinobu Inoue extern int probe_init __P((void)); 887d56d374SYoshinobu Inoue extern void defrouter_probe __P((int ifindex)); 897d56d374SYoshinobu Inoue 907d56d374SYoshinobu Inoue /* dump.c */ 917d56d374SYoshinobu Inoue extern void rtsold_dump_file __P((char *)); 92