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