]>
git.proxmox.com Git - mirror_frr.git/blob - ldpd/ldp_debug.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2016 by Open Source Routing.
11 #define LDP_DEBUG_HELLO_RECV 0x01
12 #define LDP_DEBUG_HELLO_SEND 0x02
15 #define LDP_DEBUG_ERRORS 0x01
18 #define LDP_DEBUG_EVENT 0x01
21 #define LDP_DEBUG_LABELS 0x01
24 #define LDP_DEBUG_MSG_RECV 0x01
25 #define LDP_DEBUG_MSG_RECV_ALL 0x02
26 #define LDP_DEBUG_MSG_SEND 0x04
27 #define LDP_DEBUG_MSG_SEND_ALL 0x08
30 #define LDP_DEBUG_ZEBRA 0x01
33 #define LDP_DEBUG_SYNC 0x01
36 extern struct ldp_debug conf_ldp_debug
;
37 extern struct ldp_debug ldp_debug
;
39 #define CONF_DEBUG_ON(a, b) (conf_ldp_debug.a |= (b))
40 #define CONF_DEBUG_OFF(a, b) (conf_ldp_debug.a &= ~(b))
42 #define TERM_DEBUG_ON(a, b) (ldp_debug.a |= (b))
43 #define TERM_DEBUG_OFF(a, b) (ldp_debug.a &= ~(b))
45 #define DEBUG_ON(a, b) \
47 if (vty->node == CONFIG_NODE) { \
48 CONF_DEBUG_ON(a, b); \
49 TERM_DEBUG_ON(a, b); \
51 TERM_DEBUG_ON(a, b); \
53 #define DEBUG_OFF(a, b) \
55 CONF_DEBUG_OFF(a, b); \
56 TERM_DEBUG_OFF(a, b); \
59 #define LDP_DEBUG(a, b) (ldp_debug.a & b)
60 #define CONF_LDP_DEBUG(a, b) (conf_ldp_debug.a & b)
62 #define debug_hello_recv(emsg, ...) \
64 if (LDP_DEBUG(hello, LDP_DEBUG_HELLO_RECV)) \
65 log_debug("discovery[recv]: " emsg, __VA_ARGS__); \
68 #define debug_hello_send(emsg, ...) \
70 if (LDP_DEBUG(hello, LDP_DEBUG_HELLO_SEND)) \
71 log_debug("discovery[send]: " emsg, __VA_ARGS__); \
74 #define debug_err(emsg, ...) \
76 if (LDP_DEBUG(errors, LDP_DEBUG_ERRORS)) \
77 log_debug("error: " emsg, __VA_ARGS__); \
80 #define debug_evt(emsg, ...) \
82 if (LDP_DEBUG(event, LDP_DEBUG_EVENT)) \
83 log_debug("event: " emsg, __VA_ARGS__); \
86 #define debug_labels(emsg, ...) \
88 if (LDP_DEBUG(labels, LDP_DEBUG_LABELS)) \
89 log_debug("labels: " emsg, __VA_ARGS__); \
92 #define debug_msg_recv(emsg, ...) \
94 if (LDP_DEBUG(msg, LDP_DEBUG_MSG_RECV)) \
95 log_debug("msg[in]: " emsg, __VA_ARGS__); \
98 #define debug_msg_send(emsg, ...) \
100 if (LDP_DEBUG(msg, LDP_DEBUG_MSG_SEND)) \
101 log_debug("msg[out]: " emsg, __VA_ARGS__); \
104 #define debug_msg(out, emsg, ...) \
107 debug_msg_send(emsg, __VA_ARGS__); \
109 debug_msg_recv(emsg, __VA_ARGS__); \
112 #define debug_kalive_recv(emsg, ...) \
114 if (LDP_DEBUG(msg, LDP_DEBUG_MSG_RECV_ALL)) \
115 log_debug("kalive[in]: " emsg, __VA_ARGS__); \
118 #define debug_kalive_send(emsg, ...) \
120 if (LDP_DEBUG(msg, LDP_DEBUG_MSG_SEND_ALL)) \
121 log_debug("kalive[out]: " emsg, __VA_ARGS__); \
124 #define debug_zebra_in(emsg, ...) \
126 if (LDP_DEBUG(zebra, LDP_DEBUG_ZEBRA)) \
127 log_debug("zebra[in]: " emsg, __VA_ARGS__); \
130 #define debug_zebra_out(emsg, ...) \
132 if (LDP_DEBUG(zebra, LDP_DEBUG_ZEBRA)) \
133 log_debug("zebra[out]: " emsg, __VA_ARGS__); \
136 #define debug_evt_ldp_sync(emsg, ...) \
138 if (LDP_DEBUG(sync, LDP_DEBUG_SYNC)) \
139 log_debug("sync: " emsg, __VA_ARGS__); \
142 #endif /* _LDP_DEBUG_H_ */