xref: /freebsd/usr.sbin/rtsold/rtsold.h (revision aa0a1e58)
1 /*	$KAME: rtsold.h,v 1.19 2003/04/16 09:48:15 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$
32  */
33 
34 struct 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 	u_int32_t linkid;	/* link ID of this interface */
40 	int active;		/* interface status */
41 	int probeinterval;	/* interval of probe timer (if necessary) */
42 	int probetimer;		/* rest of probe timer */
43 	int mediareqok;		/* wheter the IF supports SIOCGIFMEDIA */
44 	int otherconfig;	/* need a separate protocol for the "other"
45 				 * configuration */
46 	int state;
47 	int probes;
48 	int dadcount;
49 	struct timeval timer;
50 	struct timeval expire;
51 	int errors;		/* # of errors we've got - detect wedge */
52 
53 	int racnt;		/* total # of valid RAs it have got */
54 
55 	size_t rs_datalen;
56 	u_char *rs_data;
57 };
58 
59 /* per interface status */
60 #define IFS_IDLE	0
61 #define IFS_DELAY	1
62 #define IFS_PROBE	2
63 #define IFS_DOWN	3
64 #define IFS_TENTATIVE	4
65 
66 /* rtsold.c */
67 extern struct timeval tm_max;
68 extern int dflag;
69 extern int aflag;
70 extern int Fflag;
71 extern char *otherconf_script;
72 extern int ifconfig(char *);
73 extern void iflist_init(void);
74 struct ifinfo *find_ifinfo(int);
75 void rtsol_timer_update(struct ifinfo *);
76 extern void warnmsg(int, const char *, const char *, ...)
77      __attribute__((__format__(__printf__, 3, 4)));
78 extern char **autoifprobe(void);
79 
80 /* if.c */
81 extern int ifinit(void);
82 extern int interface_up(char *);
83 extern int interface_status(struct ifinfo *);
84 extern int lladdropt_length(struct sockaddr_dl *);
85 extern void lladdropt_fill(struct sockaddr_dl *, struct nd_opt_hdr *);
86 extern struct sockaddr_dl *if_nametosdl(char *);
87 extern int getinet6sysctl(int);
88 extern int setinet6sysctl(int, int);
89 
90 /* rtsol.c */
91 extern int sockopen(void);
92 extern void sendpacket(struct ifinfo *);
93 extern void rtsol_input(int);
94 
95 /* probe.c */
96 extern int probe_init(void);
97 extern void defrouter_probe(struct ifinfo *);
98 
99 /* dump.c */
100 extern void rtsold_dump_file(const char *);
101 
102 /* rtsock.c */
103 extern int rtsock_open(void);
104 extern int rtsock_input(int);
105