Statistics
| Branch: | Revision:

iof-bird / bird-2.0.1 / nest / bfd.h @ 6b3f1a54

History | View | Annotate | Download (1.16 KB)

1
/*
2
 *        BIRD -- Bidirectional Forwarding Detection (BFD)
3
 *
4
 *        Can be freely distributed and used under the terms of the GNU GPL.
5
 */
6

    
7
#ifndef _BIRD_NBFD_H_
8
#define _BIRD_NBFD_H_
9

    
10
#include "lib/lists.h"
11
#include "lib/resource.h"
12

    
13
struct bfd_session;
14

    
15
struct bfd_request {
16
  resource r;
17
  node n;
18

    
19
  ip_addr addr;
20
  ip_addr local;
21
  struct iface *iface;
22

    
23
  void (*hook)(struct bfd_request *);
24
  void *data;
25

    
26
  struct bfd_session *session;
27

    
28
  u8 state;
29
  u8 diag;
30
  u8 old_state;
31
  u8 down;
32
};
33

    
34

    
35
#define BFD_STATE_ADMIN_DOWN        0
36
#define BFD_STATE_DOWN                1
37
#define BFD_STATE_INIT                2
38
#define BFD_STATE_UP                3
39

    
40

    
41
#ifdef CONFIG_BFD
42

    
43
struct bfd_request * bfd_request_session(pool *p, ip_addr addr, ip_addr local, struct iface *iface, void (*hook)(struct bfd_request *), void *data);
44

    
45
static inline void cf_check_bfd(int use UNUSED) { }
46

    
47
#else
48

    
49
static inline struct bfd_request * bfd_request_session(pool *p UNUSED, ip_addr addr UNUSED, ip_addr local UNUSED, struct iface *iface UNUSED, void (*hook)(struct bfd_request *) UNUSED, void *data UNUSED) { return NULL; }
50

    
51
static inline void cf_check_bfd(int use) { if (use) cf_error("BFD not available"); }
52

    
53
#endif /* CONFIG_BFD */
54

    
55

    
56

    
57
#endif /* _BIRD_NBFD_H_ */