summaryrefslogtreecommitdiffstats
path: root/nest/protocol.h
blob: adca11491584e0f354cd89c00299c543877603a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 *	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_

#include <lib/resource.h>

/*
 *	Routing Protocol
 */

struct protocol {
  char *name;
  unsigned type;			/* ??? List values ??? */
  unsigned debug;			/* Default debugging flags */

  void (*init)(struct protocol *);	/* Boot time */
  void (*preconfig)(struct protocol *);	/* Just before configuring */
  void (*postconfig)(struct protocol *); /* After configuring */
};

void protos_init(void);
void protos_preconfig(void);
void protos_postconfig(void);

/*
 *	Known protocols
 */

extern struct protocol proto_static;

/*
 *	Routing Protocol Instance
 */

struct proto {
  struct proto *next;
  struct protocol *proto;		/* Protocol */
  char *name;				/* Name of this instance */
  unsigned debug;			/* Debugging flags */
  pool *pool;				/* Local objects */
  unsigned preference;			/* Default route preference */

  void (*if_notify)(struct proto *, struct iface *old, struct iface *new);
  void (*rt_notify)(struct proto *, struct rte *old, struct rte *new);
  void (*debug)(struct proto *);		/* Debugging dump */
  void (*start)(struct proto *);		/* Start the instance */
  void (*shutdown)(struct proto *, int time);	/* Stop the instance */

  /* Reconfigure function? */
  /* Interface patterns */
  /* Input/output filters */
  /* Connection to routing tables? */

  /* Hic sunt protocol-specific data */
};

void *proto_new(struct protocol *, unsigned size);

#endif