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