xref: /freebsd/usr.sbin/rtsold/rtsold.h (revision eb87e699b2a33a2274c7995984d540f982a60595)
19a364ca3SHajimu UMEMOTO /*	$KAME: rtsold.h,v 1.19 2003/04/16 09:48:15 itojun Exp $	*/
2804c83d4SKris Kennaway 
37d56d374SYoshinobu Inoue /*
47d56d374SYoshinobu Inoue  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
57d56d374SYoshinobu Inoue  * All rights reserved.
67d56d374SYoshinobu Inoue  *
77d56d374SYoshinobu Inoue  * Redistribution and use in source and binary forms, with or without
87d56d374SYoshinobu Inoue  * modification, are permitted provided that the following conditions
97d56d374SYoshinobu Inoue  * are met:
107d56d374SYoshinobu Inoue  * 1. Redistributions of source code must retain the above copyright
117d56d374SYoshinobu Inoue  *    notice, this list of conditions and the following disclaimer.
127d56d374SYoshinobu Inoue  * 2. Redistributions in binary form must reproduce the above copyright
137d56d374SYoshinobu Inoue  *    notice, this list of conditions and the following disclaimer in the
147d56d374SYoshinobu Inoue  *    documentation and/or other materials provided with the distribution.
157d56d374SYoshinobu Inoue  * 3. Neither the name of the project nor the names of its contributors
167d56d374SYoshinobu Inoue  *    may be used to endorse or promote products derived from this software
177d56d374SYoshinobu Inoue  *    without specific prior written permission.
187d56d374SYoshinobu Inoue  *
197d56d374SYoshinobu Inoue  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
207d56d374SYoshinobu Inoue  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
217d56d374SYoshinobu Inoue  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
227d56d374SYoshinobu Inoue  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
237d56d374SYoshinobu Inoue  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
247d56d374SYoshinobu Inoue  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
257d56d374SYoshinobu Inoue  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
267d56d374SYoshinobu Inoue  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
277d56d374SYoshinobu Inoue  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
287d56d374SYoshinobu Inoue  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
297d56d374SYoshinobu Inoue  * SUCH DAMAGE.
307d56d374SYoshinobu Inoue  *
317d56d374SYoshinobu Inoue  * $FreeBSD$
327d56d374SYoshinobu Inoue  */
337d56d374SYoshinobu Inoue 
347d56d374SYoshinobu Inoue struct ifinfo {
357d56d374SYoshinobu Inoue 	struct ifinfo *next;	/* pointer to the next interface */
367d56d374SYoshinobu Inoue 
377d56d374SYoshinobu Inoue 	struct sockaddr_dl *sdl; /* link-layer address */
38259df286SKris Kennaway 	char ifname[IF_NAMESIZE]; /* interface name */
399a364ca3SHajimu UMEMOTO 	u_int32_t linkid;	/* link ID of this interface */
407d56d374SYoshinobu Inoue 	int active;		/* interface status */
417d56d374SYoshinobu Inoue 	int probeinterval;	/* interval of probe timer (if necessary) */
427d56d374SYoshinobu Inoue 	int probetimer;		/* rest of probe timer */
437d56d374SYoshinobu Inoue 	int mediareqok;		/* wheter the IF supports SIOCGIFMEDIA */
4486b032afSHajimu UMEMOTO 	int otherconfig;	/* need a separate protocol for the "other"
4586b032afSHajimu UMEMOTO 				 * configuration */
467d56d374SYoshinobu Inoue 	int state;
477d56d374SYoshinobu Inoue 	int probes;
487d56d374SYoshinobu Inoue 	int dadcount;
497d56d374SYoshinobu Inoue 	struct timeval timer;
507d56d374SYoshinobu Inoue 	struct timeval expire;
51259df286SKris Kennaway 	int errors;		/* # of errors we've got - detect wedge */
527d56d374SYoshinobu Inoue 
537d56d374SYoshinobu Inoue 	int racnt;		/* total # of valid RAs it have got */
547d56d374SYoshinobu Inoue 
557d56d374SYoshinobu Inoue 	size_t rs_datalen;
567d56d374SYoshinobu Inoue 	u_char *rs_data;
577d56d374SYoshinobu Inoue };
587d56d374SYoshinobu Inoue 
597d56d374SYoshinobu Inoue /* per interface status */
607d56d374SYoshinobu Inoue #define IFS_IDLE	0
617d56d374SYoshinobu Inoue #define IFS_DELAY	1
627d56d374SYoshinobu Inoue #define IFS_PROBE	2
637d56d374SYoshinobu Inoue #define IFS_DOWN	3
647d56d374SYoshinobu Inoue #define IFS_TENTATIVE	4
657d56d374SYoshinobu Inoue 
667d56d374SYoshinobu Inoue /* rtsold.c */
677d56d374SYoshinobu Inoue extern struct timeval tm_max;
687d56d374SYoshinobu Inoue extern int dflag;
699a364ca3SHajimu UMEMOTO extern int aflag;
70eb87e699SHiroki Sato extern int Fflag;
7186b032afSHajimu UMEMOTO extern char *otherconf_script;
72784bddbcSKevin Lo extern int ifconfig(char *);
73784bddbcSKevin Lo extern void iflist_init(void);
74784bddbcSKevin Lo struct ifinfo *find_ifinfo(int);
75784bddbcSKevin Lo void rtsol_timer_update(struct ifinfo *);
76784bddbcSKevin Lo extern void warnmsg(int, const char *, const char *, ...)
77804c83d4SKris Kennaway      __attribute__((__format__(__printf__, 3, 4)));
78784bddbcSKevin Lo extern char **autoifprobe(void);
797d56d374SYoshinobu Inoue 
807d56d374SYoshinobu Inoue /* if.c */
81784bddbcSKevin Lo extern int ifinit(void);
82784bddbcSKevin Lo extern int interface_up(char *);
83784bddbcSKevin Lo extern int interface_status(struct ifinfo *);
84784bddbcSKevin Lo extern int lladdropt_length(struct sockaddr_dl *);
85784bddbcSKevin Lo extern void lladdropt_fill(struct sockaddr_dl *, struct nd_opt_hdr *);
86784bddbcSKevin Lo extern struct sockaddr_dl *if_nametosdl(char *);
87784bddbcSKevin Lo extern int getinet6sysctl(int);
88784bddbcSKevin Lo extern int setinet6sysctl(int, int);
897d56d374SYoshinobu Inoue 
907d56d374SYoshinobu Inoue /* rtsol.c */
91784bddbcSKevin Lo extern int sockopen(void);
92784bddbcSKevin Lo extern void sendpacket(struct ifinfo *);
93784bddbcSKevin Lo extern void rtsol_input(int);
947d56d374SYoshinobu Inoue 
957d56d374SYoshinobu Inoue /* probe.c */
96784bddbcSKevin Lo extern int probe_init(void);
97784bddbcSKevin Lo extern void defrouter_probe(struct ifinfo *);
987d56d374SYoshinobu Inoue 
997d56d374SYoshinobu Inoue /* dump.c */
100784bddbcSKevin Lo extern void rtsold_dump_file(char *);
10133841545SHajimu UMEMOTO 
10233841545SHajimu UMEMOTO /* rtsock.c */
103784bddbcSKevin Lo extern int rtsock_open(void);
104784bddbcSKevin Lo extern int rtsock_input(int);
105