"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "rde.h" see the
Fossies "Dox" file reference documentation.
1 /* $OpenBSD: rde.h,v 1.35 2009/01/07 21:16:36 claudio Exp $ */
2
3 /*
4 * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef _RDE_H_
20 #define _RDE_H_
21
22 #include <sys/types.h>
23 #include <sys/time.h>
24 #include <sys/tree.h>
25 #include <sys/queue.h>
26 #include <event.h>
27 #include <limits.h>
28
29 struct v_nexthop {
30 TAILQ_ENTRY(v_nexthop) entry;
31 struct vertex *prev;
32 struct in_addr nexthop;
33 };
34
35 TAILQ_HEAD(v_nexthead, v_nexthop);
36
37 struct vertex {
38 RB_ENTRY(vertex) entry;
39 TAILQ_ENTRY(vertex) cand;
40 struct v_nexthead nexthop;
41 struct event ev;
42 struct area *area;
43 struct lsa *lsa;
44 time_t changed;
45 time_t stamp;
46 u_int32_t cost;
47 u_int32_t peerid; /* neighbor unique imsg ID */
48 u_int32_t ls_id;
49 u_int32_t adv_rtr;
50 u_int8_t type;
51 u_int8_t flooded;
52 u_int8_t deleted;
53 u_int8_t self;
54 };
55
56 struct rde_req_entry {
57 TAILQ_ENTRY(rde_req_entry) entry;
58 u_int32_t ls_id;
59 u_int32_t adv_rtr;
60 u_int8_t type;
61 };
62
63 /* just the info RDE needs */
64 struct rde_nbr {
65 LIST_ENTRY(rde_nbr) entry, hash;
66 struct in_addr id;
67 struct in_addr area_id;
68 TAILQ_HEAD(, rde_req_entry) req_list;
69 struct area *area;
70 u_int32_t peerid; /* unique ID in DB */
71 int state;
72 int self;
73 };
74
75 struct rt_nexthop {
76 TAILQ_ENTRY(rt_nexthop) entry;
77 struct in_addr nexthop;
78 struct in_addr adv_rtr;
79 time_t uptime;
80 u_int8_t connected;
81 u_int8_t invalid;
82 };
83
84 struct rt_node {
85 RB_ENTRY(rt_node) entry;
86 TAILQ_HEAD(,rt_nexthop) nexthop;
87 struct in_addr prefix;
88 struct in_addr area;
89 u_int32_t cost;
90 u_int32_t cost2;
91 u_int32_t ext_tag;
92 enum path_type p_type;
93 enum dst_type d_type;
94 u_int8_t flags;
95 u_int8_t prefixlen;
96 u_int8_t invalid;
97 };
98
99 struct abr_rtr {
100 struct in_addr addr;
101 struct in_addr abr_id;
102 struct in_addr dst_ip;
103 struct in_addr area;
104 u_int16_t metric;
105 };
106
107 extern struct lsa_tree asext_tree;
108
109 /* rde.c */
110 pid_t rde(struct ospfd_conf *, int [2], int [2], int [2]);
111 int rde_imsg_compose_ospfe(int, u_int32_t, pid_t, void *,
112 u_int16_t);
113 u_int32_t rde_router_id(void);
114 struct area *rde_backbone_area(void);
115 void rde_send_change_kroute(struct rt_node *);
116 void rde_send_delete_kroute(struct rt_node *);
117 void rde_nbr_del(struct rde_nbr *);
118 int rde_nbr_loading(struct area *);
119 struct rde_nbr *rde_nbr_self(struct area *);
120 void rde_summary_update(struct rt_node *, struct area *);
121 struct lsa *orig_sum_lsa(struct rt_node *, struct area *, u_int8_t, int);
122
123 /* rde_lsdb.c */
124 void lsa_init(struct lsa_tree *);
125 int lsa_compare(struct vertex *, struct vertex *);
126 void vertex_free(struct vertex *);
127 int lsa_newer(struct lsa_hdr *, struct lsa_hdr *);
128 int lsa_check(struct rde_nbr *, struct lsa *, u_int16_t);
129 int lsa_self(struct rde_nbr *, struct lsa *, struct vertex *);
130 int lsa_add(struct rde_nbr *, struct lsa *);
131 void lsa_del(struct rde_nbr *, struct lsa_hdr *);
132 void lsa_age(struct vertex *);
133 struct vertex *lsa_find(struct area *, u_int8_t, u_int32_t, u_int32_t);
134 struct vertex *lsa_find_net(struct area *area, u_int32_t);
135 u_int16_t lsa_num_links(struct vertex *);
136 void lsa_snap(struct area *, u_int32_t);
137 void lsa_dump(struct lsa_tree *, int, pid_t);
138 void lsa_merge(struct rde_nbr *, struct lsa *, struct vertex *);
139 void lsa_remove_invalid_sums(struct area *);
140 void lsa_generate_stub_sums(struct area *);
141
142 /* rde_spf.c */
143 void spf_calc(struct area *);
144 void rt_calc(struct vertex *, struct area *, struct ospfd_conf *);
145 void asext_calc(struct vertex *);
146 void spf_tree_clr(struct area *);
147
148 void cand_list_init(void);
149 void cand_list_add(struct vertex *);
150 struct vertex *cand_list_pop(void);
151 int cand_list_present(struct vertex *);
152 void cand_list_clr(void);
153
154 void spf_timer(int, short, void *);
155 void start_spf_timer(void);
156 void stop_spf_timer(struct ospfd_conf *);
157 void start_spf_holdtimer(struct ospfd_conf *);
158
159 void rt_init(void);
160 int rt_compare(struct rt_node *, struct rt_node *);
161 struct rt_node *rt_find(in_addr_t, u_int8_t, enum dst_type);
162 int rt_insert(struct rt_node *);
163 int rt_remove(struct rt_node *);
164 void rt_clear(void);
165 void rt_dump(struct in_addr, pid_t, u_int8_t);
166 struct rt_node *rt_lookup(enum dst_type, in_addr_t);
167
168 struct lsa_rtr_link *get_rtr_link(struct vertex *, int);
169 struct lsa_net_link *get_net_link(struct vertex *, int);
170
171 RB_PROTOTYPE(lsa_tree, vertex, entry, lsa_compare)
172
173 #endif /* _RDE_H_ */