summaryrefslogtreecommitdiffstats
path: root/nhrpd/nhrpd.h
blob: 016ab34e605183612e814eae8567fcf7052ac90a (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

#define NHRP_DEBUG_COMMON	(1 << 0)
#define NHRP_DEBUG_KERNEL	(1 << 1)
#define NHRP_DEBUG_ROUTE	(1 << 2)
#define NHRP_DEBUG_ALL		(0xFFFF)

#define NHRP_VTY_PORT		2610
#define NHRP_DEFAULT_CONFIG	"nhrpd.conf"

#if defined(__GNUC__) && (__GNUC__ >= 3)
#define likely(_x) __builtin_expect(!!(_x), 1)
#define unlikely(_x) __builtin_expect(!!(_x), 0)
#else
#define likely(_x) !!(_x)
#define unlikely(_x) !!(_x)
#endif

extern unsigned int debug_flags;

#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L

#define debugf(level, ...) \
	do {						\
		if (unlikely(debug_flags & level))	\
			zlog_debug(__VA_ARGS__);	\
	} while(0)

#elif defined __GNUC__

#define debugf(level, _args...)				\
	do {						\
		if (unlikely(debug_flags & level))	\
			zlog_debug(_args);		\
	} while(0)

#else

static inline void debugf(int level, const char *format, ...) { }

void nhrp_zebra_init(void);
void nhrp_zebra_terminate(void);

#endif