Revision 8b58f565 proto/babel/babel.h

View differences:

proto/babel/babel.h
32 32
#define BABEL_INFINITY		0xFFFF
33 33

  
34 34

  
35
#define BABEL_HELLO_INTERVAL_WIRED	4	/* Default hello intervals in seconds */
36
#define BABEL_HELLO_INTERVAL_WIRELESS	4
35
#define BABEL_HELLO_INTERVAL_WIRED	(4 S_)	/* Default hello intervals in seconds */
36
#define BABEL_HELLO_INTERVAL_WIRELESS	(4 S_)
37 37
#define BABEL_UPDATE_INTERVAL_FACTOR	4
38 38
#define BABEL_IHU_INTERVAL_FACTOR	3
39
#define BABEL_IHU_EXPIRY_FACTOR(X)	((X)*3/2)	/* 1.5 */
40
#define BABEL_HELLO_EXPIRY_FACTOR(X)	((X)*3/2)	/* 1.5 */
41
#define BABEL_ROUTE_EXPIRY_FACTOR(X)	((X)*7/2)	/* 3.5 */
42
#define BABEL_ROUTE_REFRESH_INTERVAL	2	/* Seconds before route expiry to send route request */
43
#define BABEL_HOLD_TIME			10	/* Expiry time for our own routes */
39
#define BABEL_IHU_EXPIRY_FACTOR(X)	((btime)(X)*3/2)	/* 1.5 */
40
#define BABEL_HELLO_EXPIRY_FACTOR(X)	((btime)(X)*3/2)	/* 1.5 */
41
#define BABEL_ROUTE_EXPIRY_FACTOR(X)	((btime)(X)*7/2)	/* 3.5 */
42
#define BABEL_ROUTE_REFRESH_INTERVAL	(2 S_)	/* Time before route expiry to send route request */
43
#define BABEL_HOLD_TIME			(10 S_)	/* Expiry time for our own routes */
44
#define BABEL_SEQNO_REQUEST_EXPIRY	(60 S_)
45
#define BABEL_GARBAGE_INTERVAL		(300 S_)
44 46
#define BABEL_RXCOST_WIRED		96
45 47
#define BABEL_RXCOST_WIRELESS		256
46 48
#define BABEL_INITIAL_HOP_COUNT		255
47
#define BABEL_MAX_SEND_INTERVAL		5
48
#define BABEL_TIME_UNITS		100	/* On-wire times are counted in centiseconds */
49
#define BABEL_SEQNO_REQUEST_EXPIRY	60
50
#define BABEL_GARBAGE_INTERVAL		300
49
#define BABEL_MAX_SEND_INTERVAL		5	/* Unused ? */
51 50

  
52 51
/* Max interval that will not overflow when carried as 16-bit centiseconds */
53
#define BABEL_MAX_INTERVAL		(0xFFFF/BABEL_TIME_UNITS)
52
#define BABEL_TIME_UNITS		10000	/* On-wire times are counted in centiseconds */
53
#define BABEL_MIN_INTERVAL		(0x0001 * BABEL_TIME_UNITS)
54
#define BABEL_MAX_INTERVAL		(0xFFFF * BABEL_TIME_UNITS)
54 55

  
55 56
#define BABEL_OVERHEAD		(IP6_HEADER_LENGTH+UDP_HEADER_LENGTH)
56 57
#define BABEL_MIN_MTU		(512 + BABEL_OVERHEAD)
......
113 114
  u8 type;
114 115
  u8 check_link;
115 116
  uint port;
116
  u16 hello_interval;
117
  u16 ihu_interval;
118
  u16 update_interval;
117
  uint hello_interval;			/* Hello interval, in us */
118
  uint ihu_interval;			/* IHU interval, in us */
119
  uint update_interval;			/* Update interval, in us */
119 120

  
120 121
  u16 rx_buffer;			/* RX buffer size, 0 for MTU */
121 122
  u16 tx_length;			/* TX packet length limit (including headers), 0 for MTU */
......
172 173

  
173 174
  u16 hello_seqno;			/* To be increased on each hello */
174 175

  
175
  bird_clock_t next_hello;
176
  bird_clock_t next_regular;
177
  bird_clock_t next_triggered;
178
  bird_clock_t want_triggered;
176
  btime next_hello;
177
  btime next_regular;
178
  btime next_triggered;
179
  btime want_triggered;
179 180

  
180 181
  timer *timer;
181 182
  event *send_event;
......
191 192
  u16 hello_map;
192 193
  u16 next_hello_seqno;
193 194
  /* expiry timers */
194
  bird_clock_t hello_expiry;
195
  bird_clock_t ihu_expiry;
195
  btime hello_expiry;
196
  btime ihu_expiry;
196 197

  
197 198
  list routes;				/* Routes this neighbour has sent us (struct babel_route) */
198 199
};
......
203 204
  u64 router_id;
204 205
  u16 seqno;
205 206
  u16 metric;
206
  bird_clock_t expires;
207
  btime expires;
207 208
};
208 209

  
209 210
struct babel_route {
......
217 218
  u16 metric;
218 219
  u64 router_id;
219 220
  ip_addr next_hop;
220
  bird_clock_t refresh_time;
221
  bird_clock_t expires;
222
  u16 expiry_interval;
221
  btime refresh_time;
222
  btime expires;
223
  btime expiry_interval;
223 224
};
224 225

  
225 226
struct babel_entry {
......
227 228
  struct babel_route *selected_in;
228 229
  struct babel_route *selected_out;
229 230

  
230
  bird_clock_t updated;
231
  btime updated;
231 232

  
232 233
  list sources;				/* Source entries for this prefix (struct babel_source). */
233 234
  list routes;				/* Routes for this prefix (struct babel_route) */
......
241 242
  net_addr net;
242 243
  u64 router_id;
243 244
  u16 seqno;
244
  bird_clock_t updated;
245
  btime updated;
245 246
};
246 247

  
247 248

  
......
252 253
struct babel_msg_ack_req {
253 254
  u8 type;
254 255
  u16 nonce;
255
  u16 interval;
256
  uint interval;
256 257
  ip_addr sender;
257 258
};
258 259

  
......
264 265
struct babel_msg_hello {
265 266
  u8 type;
266 267
  u16 seqno;
267
  u16 interval;
268
  uint interval;
268 269
  ip_addr sender;
269 270
};
270 271

  
......
272 273
  u8 type;
273 274
  u8 ae;
274 275
  u16 rxcost;
275
  u16 interval;
276
  uint interval;
276 277
  ip_addr addr;
277 278
  ip_addr sender;
278 279
};
......
280 281
struct babel_msg_update {
281 282
  u8 type;
282 283
  u8 wildcard;
283
  u16 interval;
284
  uint interval;
284 285
  u16 seqno;
285 286
  u16 metric;
286 287
  u64 router_id;

Also available in: Unified diff