rtsold.h revision 119026
1168404Spjd/*	$KAME: rtsold.h,v 1.19 2003/04/16 09:48:15 itojun Exp $	*/
2168404Spjd
3168404Spjd/*
4168404Spjd * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5185029Spjd * All rights reserved.
6185029Spjd *
7168404Spjd * Redistribution and use in source and binary forms, with or without
8168404Spjd * modification, are permitted provided that the following conditions
9168404Spjd * are met:
10168404Spjd * 1. Redistributions of source code must retain the above copyright
11168404Spjd *    notice, this list of conditions and the following disclaimer.
12168404Spjd * 2. Redistributions in binary form must reproduce the above copyright
13168404Spjd *    notice, this list of conditions and the following disclaimer in the
14168404Spjd *    documentation and/or other materials provided with the distribution.
15168404Spjd * 3. Neither the name of the project nor the names of its contributors
16168404Spjd *    may be used to endorse or promote products derived from this software
17168404Spjd *    without specific prior written permission.
18168404Spjd *
19168404Spjd * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20168404Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21168404Spjd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22219089Spjd * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23168404Spjd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24168404Spjd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25168404Spjd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26168404Spjd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27168404Spjd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28168404Spjd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29168404Spjd * SUCH DAMAGE.
30168404Spjd *
31168404Spjd * $FreeBSD: head/usr.sbin/rtsold/rtsold.h 119026 2003-08-17 11:11:32Z ume $
32168404Spjd */
33168404Spjd
34168404Spjdstruct ifinfo {
35168404Spjd	struct ifinfo *next;	/* pointer to the next interface */
36168404Spjd
37168404Spjd	struct sockaddr_dl *sdl; /* link-layer address */
38168404Spjd	char ifname[IF_NAMESIZE]; /* interface name */
39168404Spjd	u_int32_t linkid;	/* link ID of this interface */
40168404Spjd	int active;		/* interface status */
41168404Spjd	int probeinterval;	/* interval of probe timer (if necessary) */
42168404Spjd	int probetimer;		/* rest of probe timer */
43168404Spjd	int mediareqok;		/* wheter the IF supports SIOCGIFMEDIA */
44168404Spjd	int otherconfig;	/* need a separate protocol for the "other"
45168404Spjd				 * configuration */
46168404Spjd	int state;
47168404Spjd	int probes;
48168404Spjd	int dadcount;
49168404Spjd	struct timeval timer;
50168404Spjd	struct timeval expire;
51168404Spjd	int errors;		/* # of errors we've got - detect wedge */
52168404Spjd
53168404Spjd	int racnt;		/* total # of valid RAs it have got */
54168404Spjd
55168404Spjd	size_t rs_datalen;
56168404Spjd	u_char *rs_data;
57168404Spjd};
58168404Spjd
59168404Spjd/* per interface status */
60168404Spjd#define IFS_IDLE	0
61168404Spjd#define IFS_DELAY	1
62168404Spjd#define IFS_PROBE	2
63168404Spjd#define IFS_DOWN	3
64168404Spjd#define IFS_TENTATIVE	4
65168404Spjd
66168404Spjd/* rtsold.c */
67168404Spjdextern struct timeval tm_max;
68168404Spjdextern int dflag;
69168404Spjdextern int aflag;
70168404Spjdextern char *otherconf_script;
71168404Spjdextern int ifconfig __P((char *));
72168404Spjdextern void iflist_init __P((void));
73168404Spjdstruct ifinfo *find_ifinfo __P((int));
74168404Spjdvoid rtsol_timer_update __P((struct ifinfo *));
75168404Spjdextern void warnmsg __P((int, const char *, const char *, ...))
76168404Spjd     __attribute__((__format__(__printf__, 3, 4)));
77168404Spjdextern char **autoifprobe __P((void));
78168404Spjd
79168404Spjd/* if.c */
80168404Spjdextern int ifinit __P((void));
81168404Spjdextern int interface_up __P((char *));
82168404Spjdextern int interface_status __P((struct ifinfo *));
83168404Spjdextern int lladdropt_length __P((struct sockaddr_dl *));
84168404Spjdextern void lladdropt_fill __P((struct sockaddr_dl *, struct nd_opt_hdr *));
85168404Spjdextern struct sockaddr_dl *if_nametosdl __P((char *));
86168404Spjdextern int getinet6sysctl __P((int));
87168404Spjd
88168404Spjd/* rtsol.c */
89168404Spjdextern int sockopen __P((void));
90168404Spjdextern void sendpacket __P((struct ifinfo *));
91168404Spjdextern void rtsol_input __P((int));
92168404Spjd
93168404Spjd/* probe.c */
94168404Spjdextern int probe_init __P((void));
95168404Spjdextern void defrouter_probe __P((struct ifinfo *));
96168404Spjd
97168404Spjd/* dump.c */
98168404Spjdextern void rtsold_dump_file __P((char *));
99168404Spjd
100168404Spjd/* rtsock.c */
101168404Spjdextern int rtsock_open __P((void));
102168404Spjdextern int rtsock_input __P((int));
103168404Spjd