1998-04-22 20:58:34 +08:00
|
|
|
/*
|
|
|
|
* BIRD Internet Routing Daemon -- Protocols
|
|
|
|
*
|
|
|
|
* (c) 1998 Martin Mares <mj@ucw.cz>
|
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BIRD_PROTOCOL_H_
|
|
|
|
#define _BIRD_PROTOCOL_H_
|
|
|
|
|
1998-05-20 19:54:33 +08:00
|
|
|
#include "lib/lists.h"
|
1998-04-28 22:39:34 +08:00
|
|
|
#include "lib/resource.h"
|
1998-04-22 20:58:34 +08:00
|
|
|
|
1998-05-20 19:54:33 +08:00
|
|
|
struct iface;
|
|
|
|
struct rte;
|
|
|
|
struct neighbor;
|
|
|
|
struct rtattr;
|
1998-09-01 05:13:42 +08:00
|
|
|
struct network;
|
1998-05-20 19:54:33 +08:00
|
|
|
|
1998-04-22 20:58:34 +08:00
|
|
|
/*
|
|
|
|
* Routing Protocol
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct protocol {
|
1998-06-03 16:38:06 +08:00
|
|
|
node n;
|
1998-04-22 20:58:34 +08:00
|
|
|
char *name;
|
|
|
|
unsigned debug; /* Default debugging flags */
|
|
|
|
|
|
|
|
void (*init)(struct protocol *); /* Boot time */
|
|
|
|
void (*preconfig)(struct protocol *); /* Just before configuring */
|
|
|
|
void (*postconfig)(struct protocol *); /* After configuring */
|
|
|
|
};
|
|
|
|
|
1998-10-18 19:53:21 +08:00
|
|
|
void protos_build(void);
|
1998-04-22 20:58:34 +08:00
|
|
|
void protos_init(void);
|
|
|
|
void protos_preconfig(void);
|
|
|
|
void protos_postconfig(void);
|
1998-06-03 16:38:06 +08:00
|
|
|
void protos_start(void);
|
1998-07-10 03:36:52 +08:00
|
|
|
void protos_dump_all(void);
|
1998-06-03 16:38:06 +08:00
|
|
|
|
|
|
|
extern list protocol_list;
|
1998-04-22 20:58:34 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Known protocols
|
|
|
|
*/
|
|
|
|
|
1998-06-03 16:38:06 +08:00
|
|
|
extern struct protocol proto_device;
|
1998-07-10 03:36:52 +08:00
|
|
|
extern struct protocol proto_rip;
|
1998-12-07 02:21:23 +08:00
|
|
|
extern struct protocol proto_static;
|
1998-04-22 20:58:34 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Routing Protocol Instance
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct proto {
|
1998-05-20 19:54:33 +08:00
|
|
|
node n;
|
1998-04-22 20:58:34 +08:00
|
|
|
struct protocol *proto; /* Protocol */
|
|
|
|
char *name; /* Name of this instance */
|
|
|
|
unsigned debug; /* Debugging flags */
|
|
|
|
pool *pool; /* Local objects */
|
|
|
|
unsigned preference; /* Default route preference */
|
1998-10-20 01:45:29 +08:00
|
|
|
unsigned state; /* PRS_... */
|
1998-11-29 22:40:39 +08:00
|
|
|
unsigned disabled; /* Manually disabled */
|
1998-04-22 20:58:34 +08:00
|
|
|
|
1998-06-03 16:38:06 +08:00
|
|
|
void (*if_notify)(struct proto *, unsigned flags, struct iface *new, struct iface *old);
|
1998-09-01 05:13:42 +08:00
|
|
|
void (*rt_notify)(struct proto *, struct network *net, struct rte *new, struct rte *old);
|
1998-06-02 05:41:11 +08:00
|
|
|
void (*neigh_notify)(struct neighbor *neigh);
|
1998-05-20 19:54:33 +08:00
|
|
|
void (*dump)(struct proto *); /* Debugging dump */
|
1998-04-22 20:58:34 +08:00
|
|
|
void (*start)(struct proto *); /* Start the instance */
|
|
|
|
void (*shutdown)(struct proto *, int time); /* Stop the instance */
|
|
|
|
|
1998-05-20 19:54:33 +08:00
|
|
|
int (*rta_same)(struct rtattr *, struct rtattr *);
|
|
|
|
int (*rte_better)(struct rte *, struct rte *);
|
1998-10-20 23:17:38 +08:00
|
|
|
void (*rte_insert)(struct network *, struct rte *);
|
|
|
|
void (*rte_remove)(struct network *, struct rte *);
|
1998-05-20 19:54:33 +08:00
|
|
|
|
1998-04-22 20:58:34 +08:00
|
|
|
/* Reconfigure function? */
|
|
|
|
/* Input/output filters */
|
|
|
|
/* Connection to routing tables? */
|
|
|
|
|
|
|
|
/* Hic sunt protocol-specific data */
|
|
|
|
};
|
|
|
|
|
1998-10-20 01:45:29 +08:00
|
|
|
#define PRS_DOWN 0 /* Inactive */
|
|
|
|
#define PRS_STARTING 1
|
|
|
|
#define PRS_UP 2
|
|
|
|
|
1998-04-22 20:58:34 +08:00
|
|
|
void *proto_new(struct protocol *, unsigned size);
|
|
|
|
|
1998-10-17 19:05:18 +08:00
|
|
|
extern list proto_list, inactive_proto_list;
|
1998-05-20 19:54:33 +08:00
|
|
|
|
1998-11-30 06:03:58 +08:00
|
|
|
/*
|
|
|
|
* Known unique protocol instances as referenced by config routines
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern struct proto *cf_dev_proto;
|
|
|
|
|
1998-04-22 20:58:34 +08:00
|
|
|
#endif
|