xref: /openbsd/usr.sbin/ripd/rde.h (revision 4cfece93)
1 /*	$OpenBSD: rde.h,v 1.4 2007/10/24 20:38:03 claudio Exp $ */
2 
3 /*
4  * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
5  * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef _RDE_H_
21 #define _RDE_H_
22 
23 #include <sys/types.h>
24 #include <sys/time.h>
25 #include <sys/tree.h>
26 #include <sys/queue.h>
27 #include <event.h>
28 #include <limits.h>
29 
30 struct rt_node {
31 	RB_ENTRY(rt_node)	 entry;
32 	struct event		 timeout_timer;
33 	struct event		 garbage_timer;
34 	struct in_addr		 prefix;
35 	struct in_addr		 netmask;
36 	struct in_addr		 nexthop;
37 	u_short			 ifindex;
38 	u_int16_t		 flags;
39 	u_int8_t		 metric;
40 };
41 
42 /* rde.c */
43 pid_t		 rde(struct ripd_conf *, int [2], int [2], int [2]);
44 void		 rde_send_change_kroute(struct rt_node *);
45 void		 rde_send_delete_kroute(struct rt_node *);
46 int		 rde_imsg_compose_ripe(int, u_int32_t, pid_t, void *,
47 		     u_int16_t);
48 
49 /* rde_rib.c */
50 void		 rt_init(void);
51 int		 rt_compare(struct rt_node *, struct rt_node *);
52 struct rt_node	*rt_find(in_addr_t, in_addr_t);
53 struct rt_node	*rt_new_kr(struct kroute *);
54 struct rt_node	*rt_new_rr(struct rip_route *, u_int8_t);
55 int		 rt_insert(struct rt_node *);
56 int		 rt_remove(struct rt_node *);
57 void		 rt_complete(struct rip_route *);
58 void		 rt_snap(u_int32_t);
59 void		 rt_clear(void);
60 void		 route_reset_timers(struct rt_node *);
61 int		 route_start_timeout(struct rt_node *);
62 void		 route_start_garbage(struct rt_node *);
63 void		 rt_dump(pid_t);
64 
65 #endif /* _RDE_H_ */
66