Statistics
| Branch: | Revision:

iof-bird-daemon / proto / rip / rip.h @ 1d941de4

History | View | Annotate | Download (1.31 KB)

1
/*
2
 * Structures for RIP protocol
3
 */
4

    
5
struct rip_connection {
6
  node n;
7

    
8
  int num;
9
  struct proto *proto;
10
  ip_addr addr;
11
  struct rip_entry *sendptr;
12
  sock *send;
13
};
14

    
15
struct rip_packet_heading {
16
  u8 command;
17
#define RIPCMD_REQUEST          1       /* want info */
18
#define RIPCMD_RESPONSE         2       /* responding to request */
19
#define RIPCMD_TRACEON          3       /* turn tracing on */
20
#define RIPCMD_TRACEOFF         4       /* turn it off */
21
#define RIPCMD_MAX              5
22
  u8 version;
23
#define RIP_V1 1
24
#define RIP_V2 2
25
  u16 unused;
26
};
27

    
28
struct rip_block {
29
  u16 family;        /* 0xffff on first message means this is authentication */
30
  u16 tag;
31
  ip_addr network;
32
  ip_addr netmask;
33
  ip_addr nexthop;
34
  u32 metric;
35
};
36

    
37
struct rip_entry {
38
  node n;
39

    
40
  ip_addr whotoldme;
41
  ip_addr network;
42
  int pxlen;
43
  ip_addr nexthop;
44
  int metric;
45
  u16 tag;
46

    
47
  bird_clock_t updated, changed;
48
  int flags;
49
#define RIP_F_EXTERNAL 1
50
};
51

    
52
struct rip_packet {
53
  struct rip_packet_heading heading;
54
  struct rip_block block[25];
55
};
56

    
57
struct rip_data {
58
  struct proto inherited;
59
  sock *listen;
60
  timer *timer;
61
  list connections;
62
  list rtable;
63
  int magic;
64
};
65

    
66
#define P ((struct rip_data *) p)
67
#define E ((struct rip_entry *) e)
68

    
69
#define RIP_MAGIC 81861253
70
#define CHK_MAGIC do { if (P->magic != RIP_MAGIC) die( "Not enough magic\n" ); } while (0)