1998-07-09 19:39:04 +00:00
|
|
|
/*
|
|
|
|
* Structures for RIP protocol
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct rip_connection {
|
1998-07-28 21:44:11 +00:00
|
|
|
node n;
|
|
|
|
|
|
|
|
int num;
|
|
|
|
struct proto *proto;
|
1998-07-09 19:39:04 +00:00
|
|
|
ip_addr addr;
|
|
|
|
struct rip_entry *sendptr;
|
|
|
|
sock *send;
|
1998-10-26 15:35:19 +00:00
|
|
|
struct rip_interface *rif;
|
|
|
|
|
|
|
|
ip_addr daddr;
|
|
|
|
int dport;
|
1998-07-09 19:39:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rip_packet_heading {
|
|
|
|
u8 command;
|
1998-07-28 21:44:11 +00:00
|
|
|
#define RIPCMD_REQUEST 1 /* want info */
|
|
|
|
#define RIPCMD_RESPONSE 2 /* responding to request */
|
|
|
|
#define RIPCMD_TRACEON 3 /* turn tracing on */
|
|
|
|
#define RIPCMD_TRACEOFF 4 /* turn it off */
|
|
|
|
#define RIPCMD_MAX 5
|
1998-07-09 19:39:04 +00:00
|
|
|
u8 version;
|
|
|
|
#define RIP_V1 1
|
|
|
|
#define RIP_V2 2
|
|
|
|
u16 unused;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rip_block {
|
|
|
|
u16 family; /* 0xffff on first message means this is authentication */
|
|
|
|
u16 tag;
|
1998-07-28 21:44:11 +00:00
|
|
|
ip_addr network;
|
|
|
|
ip_addr netmask;
|
|
|
|
ip_addr nexthop;
|
1998-07-09 19:39:04 +00:00
|
|
|
u32 metric;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rip_entry {
|
|
|
|
node n;
|
|
|
|
|
1998-10-07 19:33:50 +00:00
|
|
|
ip_addr whotoldme;
|
1998-07-09 19:39:04 +00:00
|
|
|
ip_addr network;
|
1998-07-28 21:44:11 +00:00
|
|
|
int pxlen;
|
1998-07-09 19:39:04 +00:00
|
|
|
ip_addr nexthop;
|
|
|
|
int metric;
|
|
|
|
u16 tag;
|
|
|
|
|
|
|
|
bird_clock_t updated, changed;
|
1998-10-07 19:33:50 +00:00
|
|
|
int flags;
|
|
|
|
#define RIP_F_EXTERNAL 1
|
1998-07-09 19:39:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rip_packet {
|
|
|
|
struct rip_packet_heading heading;
|
|
|
|
struct rip_block block[25];
|
|
|
|
};
|
|
|
|
|
1998-10-26 15:35:19 +00:00
|
|
|
struct rip_interface {
|
|
|
|
node n;
|
|
|
|
struct proto *proto;
|
|
|
|
struct iface *iface;
|
|
|
|
sock *sock;
|
|
|
|
struct rip_connection *busy;
|
|
|
|
};
|
|
|
|
|
1998-07-09 19:39:04 +00:00
|
|
|
struct rip_data {
|
|
|
|
struct proto inherited;
|
|
|
|
timer *timer;
|
|
|
|
list connections;
|
|
|
|
list rtable;
|
1998-10-20 16:12:43 +00:00
|
|
|
list garbage;
|
1998-10-26 15:35:19 +00:00
|
|
|
list interfaces;
|
1998-07-09 19:39:04 +00:00
|
|
|
int magic;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define P ((struct rip_data *) p)
|
|
|
|
#define E ((struct rip_entry *) e)
|
|
|
|
|
|
|
|
#define RIP_MAGIC 81861253
|
|
|
|
#define CHK_MAGIC do { if (P->magic != RIP_MAGIC) die( "Not enough magic\n" ); } while (0)
|
1998-11-27 21:08:37 +00:00
|
|
|
|
|
|
|
void rip_init_instance(struct proto *p);
|