Revision f4a60a9b nest/route.h

View differences:

nest/route.h
12 12
#include "lib/lists.h"
13 13
#include "lib/resource.h"
14 14
#include "lib/timer.h"
15
#include "nest/protocol.h"
15
//#include "nest/protocol.h"
16 16

  
17
struct ea_list;
17 18
struct protocol;
18 19
struct proto;
20
struct rte_src;
19 21
struct symbol;
20 22
struct filter;
21 23
struct cli;
......
57 59
  uint hash_order;			/* Binary logarithm of hash_size */
58 60
  uint hash_shift;			/* 32 - hash_order */
59 61
  uint addr_type;			/* Type of address data stored in fib (NET_*) */
60
  uint node_size;	/* XXXX */
61
  uint node_offset;	/* XXXX */
62
  uint node_size;			/* FIB node size, 0 for nonuniform */
63
  uint node_offset;			/* Offset of fib_node struct inside of user data */
62 64
  uint entries;				/* Number of entries */
63 65
  uint entries_min, entries_max;	/* Entry count limits (else start rehashing) */
64 66
  fib_init_fn init;			/* Constructor */
......
146 148
  node n;				/* Node in list of all tables */
147 149
  struct fib fib;
148 150
  char *name;				/* Name of this table */
149
  list hooks;				/* List of announcement hooks */
151
  list channels;			/* List of attached channels (struct channel) */
150 152
  uint addr_type;			/* Type of address data stored in table (NET_*) */
151 153
  int pipe_busy;			/* Pipe loop detection */
152 154
  int use_count;			/* Number of protocols using this table */
......
159 161
  struct event *rt_event;		/* Routing table event */
160 162
  int gc_counter;			/* Number of operations since last GC */
161 163
  bird_clock_t gc_time;			/* Time of last GC */
162
  byte gc_scheduled;			/* GC is scheduled */
163 164
  byte prune_state;			/* Table prune state, 1 -> scheduled, 2-> running */
164 165
  byte hcu_scheduled;			/* Hostcache update is scheduled */
165 166
  byte nhu_state;			/* Next Hop Update state */
......
167 168
  struct fib_iterator nhu_fit;		/* Next Hop Update FIB iterator */
168 169
} rtable;
169 170

  
170
#define RPS_NONE	0
171
#define RPS_SCHEDULED	1
172
#define RPS_RUNNING	2
173

  
174 171
typedef struct network {
175 172
  struct rte *routes;			/* Available routes for this network */
176 173
  struct fib_node n;			/* FIB flags reserved for kernel syncer */
......
206 203
typedef struct rte {
207 204
  struct rte *next;
208 205
  net *net;				/* Network this RTE belongs to */
209
  struct announce_hook *sender;		/* Announce hook used to send the route to the routing table */
206
  struct channel *sender;		/* Channel used to send the route to the routing table */
210 207
  struct rta *attrs;			/* Attributes of this route */
211 208
  byte flags;				/* Flags (REF_...) */
212 209
  byte pflags;				/* Protocol-specific flags */
......
279 276

  
280 277
rte *rte_find(net *net, struct rte_src *src);
281 278
rte *rte_get_temp(struct rta *);
282
void rte_update2(struct announce_hook *ah, net *net, rte *new, struct rte_src *src);
283
static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_ahook, net, new, p->main_source); }
279
void rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src);
280
/* rte_update() moved to protocol.h to avoid dependency conflicts */
284 281
void rte_discard(rtable *tab, rte *old);
285 282
int rt_examine(rtable *t, net_addr *a, struct proto *p, struct filter *filter);
286
rte *rt_export_merged(struct announce_hook *ah, net *net, rte **rt_free, struct ea_list **tmpa, int silent);
287
void rt_refresh_begin(rtable *t, struct announce_hook *ah);
288
void rt_refresh_end(rtable *t, struct announce_hook *ah);
283
rte *rt_export_merged(struct channel *c, net *net, rte **rt_free, struct ea_list **tmpa, int silent);
284
void rt_refresh_begin(rtable *t, struct channel *c);
285
void rt_refresh_end(rtable *t, struct channel *c);
286
void rt_schedule_prune(rtable *t);
289 287
void rte_dump(rte *);
290 288
void rte_free(rte *);
291 289
rte *rte_do_cow(rte *);
......
293 291
rte *rte_cow_rta(rte *r, linpool *lp);
294 292
void rt_dump(rtable *);
295 293
void rt_dump_all(void);
296
int rt_feed_baby(struct proto *p);
297
void rt_feed_baby_abort(struct proto *p);
298
int rt_prune_loop(void);
294
int rt_feed_channel(struct channel *c);
295
void rt_feed_channel_abort(struct channel *c);
299 296
struct rtable_config *rt_new_table(struct symbol *s, uint addr_type);
300 297

  
301
static inline void
302
rt_mark_for_prune(rtable *tab)
303
{
304
  if (tab->prune_state == RPS_RUNNING)
305
    fit_get(&tab->fib, &tab->prune_fit);
306

  
307
  tab->prune_state = RPS_SCHEDULED;
308
}
309 298

  
310 299
struct rt_show_data {
311 300
  net_addr *addr;
......
315 304
  struct fib_iterator fit;
316 305
  struct proto *show_protocol;
317 306
  struct proto *export_protocol;
307
  struct channel *export_channel;
318 308
  int export_mode, primary_only, filtered;
319 309
  struct config *running_on_config;
320 310
  int net_counter, rt_counter, show_counter;
......
561 551
#define DEF_PREF_OSPF		150	/* OSPF intra-area, inter-area and type 1 external routes */
562 552
#define DEF_PREF_RIP		120	/* RIP */
563 553
#define DEF_PREF_BGP		100	/* BGP */
564
#define DEF_PREF_PIPE		70	/* Routes piped from other tables */
565 554
#define DEF_PREF_INHERITED	10	/* Routes inherited from other routing daemons */
566 555

  
567 556
/*

Also available in: Unified diff