bfd.h 1.16 KB
Newer Older
Ondřej Zajíček's avatar
Ondřej Zajíček committed
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
/*
 *	BIRD -- Bidirectional Forwarding Detection (BFD)
 *
 *	Can be freely distributed and used under the terms of the GNU GPL.
 */

#ifndef _BIRD_NBFD_H_
#define _BIRD_NBFD_H_

#include "lib/lists.h"
#include "lib/resource.h"

struct bfd_session;

struct bfd_request {
  resource r;
  node n;

  ip_addr addr;
  ip_addr local;
  struct iface *iface;

  void (*hook)(struct bfd_request *);
  void *data;

  struct bfd_session *session;

  u8 state;
  u8 diag;
  u8 old_state;
  u8 down;
};


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


Ondřej Zajíček's avatar
Ondřej Zajíček committed
41 42 43 44
#ifdef CONFIG_BFD

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

45
static inline void cf_check_bfd(int use UNUSED) { }
Ondřej Zajíček's avatar
Ondřej Zajíček committed
46 47 48

#else

Ondřej Zajíček's avatar
Ondřej Zajíček committed
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; }
Ondřej Zajíček's avatar
Ondřej Zajíček committed
50 51 52 53 54 55 56 57

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

#endif /* CONFIG_BFD */



#endif /* _BIRD_NBFD_H_ */