1*86d7f5d3SJohn Marino /* $KAME: rtsold.h,v 1.11 2000/10/10 06:18:04 itojun Exp $ */ 2*86d7f5d3SJohn Marino 3*86d7f5d3SJohn Marino /* 4*86d7f5d3SJohn Marino * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5*86d7f5d3SJohn Marino * All rights reserved. 6*86d7f5d3SJohn Marino * 7*86d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without 8*86d7f5d3SJohn Marino * modification, are permitted provided that the following conditions 9*86d7f5d3SJohn Marino * are met: 10*86d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright 11*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer. 12*86d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 13*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the 14*86d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution. 15*86d7f5d3SJohn Marino * 3. Neither the name of the project nor the names of its contributors 16*86d7f5d3SJohn Marino * may be used to endorse or promote products derived from this software 17*86d7f5d3SJohn Marino * without specific prior written permission. 18*86d7f5d3SJohn Marino * 19*86d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 20*86d7f5d3SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21*86d7f5d3SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22*86d7f5d3SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 23*86d7f5d3SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24*86d7f5d3SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25*86d7f5d3SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26*86d7f5d3SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27*86d7f5d3SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28*86d7f5d3SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29*86d7f5d3SJohn Marino * SUCH DAMAGE. 30*86d7f5d3SJohn Marino * 31*86d7f5d3SJohn Marino * $FreeBSD: src/usr.sbin/rtsold/rtsold.h,v 1.1.2.3 2001/07/03 11:02:16 ume Exp $ 32*86d7f5d3SJohn Marino * $DragonFly: src/usr.sbin/rtsold/rtsold.h,v 1.4 2005/02/15 00:26:00 cpressey Exp $ 33*86d7f5d3SJohn Marino */ 34*86d7f5d3SJohn Marino 35*86d7f5d3SJohn Marino struct ifinfo { 36*86d7f5d3SJohn Marino struct ifinfo *next; /* pointer to the next interface */ 37*86d7f5d3SJohn Marino 38*86d7f5d3SJohn Marino struct sockaddr_dl *sdl; /* link-layer address */ 39*86d7f5d3SJohn Marino char ifname[IF_NAMESIZE]; /* interface name */ 40*86d7f5d3SJohn Marino int active; /* interface status */ 41*86d7f5d3SJohn Marino int probeinterval; /* interval of probe timer(if necessary) */ 42*86d7f5d3SJohn Marino int probetimer; /* rest of probe timer */ 43*86d7f5d3SJohn Marino int mediareqok; /* wheter the IF supports SIOCGIFMEDIA */ 44*86d7f5d3SJohn Marino int state; 45*86d7f5d3SJohn Marino int probes; 46*86d7f5d3SJohn Marino int dadcount; 47*86d7f5d3SJohn Marino struct timeval timer; 48*86d7f5d3SJohn Marino struct timeval expire; 49*86d7f5d3SJohn Marino int errors; /* # of errors we've got - detect wedge */ 50*86d7f5d3SJohn Marino 51*86d7f5d3SJohn Marino int racnt; /* total # of valid RAs it have got */ 52*86d7f5d3SJohn Marino 53*86d7f5d3SJohn Marino size_t rs_datalen; 54*86d7f5d3SJohn Marino u_char *rs_data; 55*86d7f5d3SJohn Marino }; 56*86d7f5d3SJohn Marino 57*86d7f5d3SJohn Marino /* per interface status */ 58*86d7f5d3SJohn Marino #define IFS_IDLE 0 59*86d7f5d3SJohn Marino #define IFS_DELAY 1 60*86d7f5d3SJohn Marino #define IFS_PROBE 2 61*86d7f5d3SJohn Marino #define IFS_DOWN 3 62*86d7f5d3SJohn Marino #define IFS_TENTATIVE 4 63*86d7f5d3SJohn Marino 64*86d7f5d3SJohn Marino /* rtsold.c */ 65*86d7f5d3SJohn Marino extern struct timeval tm_max; 66*86d7f5d3SJohn Marino extern int dflag; 67*86d7f5d3SJohn Marino struct ifinfo *find_ifinfo(int ifindex); 68*86d7f5d3SJohn Marino void rtsol_timer_update(struct ifinfo *ifinfo); 69*86d7f5d3SJohn Marino extern void warnmsg(int, const char *, const char *, ...) 70*86d7f5d3SJohn Marino __attribute__((__format__(__printf__, 3, 4))); 71*86d7f5d3SJohn Marino 72*86d7f5d3SJohn Marino /* if.c */ 73*86d7f5d3SJohn Marino extern int ifinit(void); 74*86d7f5d3SJohn Marino extern int interface_up(char *name); 75*86d7f5d3SJohn Marino extern int interface_status(struct ifinfo*); 76*86d7f5d3SJohn Marino extern int lladdropt_length(struct sockaddr_dl *sdl); 77*86d7f5d3SJohn Marino extern void lladdropt_fill(struct sockaddr_dl *sdl, 78*86d7f5d3SJohn Marino struct nd_opt_hdr *ndopt); 79*86d7f5d3SJohn Marino extern struct sockaddr_dl *if_nametosdl(char *name); 80*86d7f5d3SJohn Marino extern int getinet6sysctl(int code); 81*86d7f5d3SJohn Marino 82*86d7f5d3SJohn Marino /* rtsol.c */ 83*86d7f5d3SJohn Marino extern int sockopen(void); 84*86d7f5d3SJohn Marino extern void sendpacket(struct ifinfo *ifinfo); 85*86d7f5d3SJohn Marino extern void rtsol_input(int s); 86*86d7f5d3SJohn Marino 87*86d7f5d3SJohn Marino /* probe.c */ 88*86d7f5d3SJohn Marino extern int probe_init(void); 89*86d7f5d3SJohn Marino extern void defrouter_probe(int ifindex); 90*86d7f5d3SJohn Marino 91*86d7f5d3SJohn Marino /* dump.c */ 92*86d7f5d3SJohn Marino extern void rtsold_dump_file(const char *); 93*86d7f5d3SJohn Marino 94*86d7f5d3SJohn Marino /* rtsock.c */ 95*86d7f5d3SJohn Marino extern int rtsock_open(void); 96*86d7f5d3SJohn Marino extern int rtsock_input(int); 97