]>
git.proxmox.com Git - mirror_frr.git/blob - ldpd/ldp_debug.h
2 * Copyright (C) 2016 by Open Source Routing.
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 #define LDP_DEBUG_HELLO_RECV 0x01
28 #define LDP_DEBUG_HELLO_SEND 0x02
31 #define LDP_DEBUG_ERRORS 0x01
34 #define LDP_DEBUG_EVENT 0x01
37 #define LDP_DEBUG_MSG_RECV 0x01
38 #define LDP_DEBUG_MSG_RECV_ALL 0x02
39 #define LDP_DEBUG_MSG_SEND 0x04
40 #define LDP_DEBUG_MSG_SEND_ALL 0x08
43 #define LDP_DEBUG_ZEBRA 0x01
45 extern struct ldp_debug conf_ldp_debug
;
46 extern struct ldp_debug ldp_debug
;
48 #define CONF_DEBUG_ON(a, b) (conf_ldp_debug.a |= (LDP_DEBUG_ ## b))
49 #define CONF_DEBUG_OFF(a, b) (conf_ldp_debug.a &= ~(LDP_DEBUG_ ## b))
51 #define TERM_DEBUG_ON(a, b) (ldp_debug.a |= (LDP_DEBUG_ ## b))
52 #define TERM_DEBUG_OFF(a, b) (ldp_debug.a &= ~(LDP_DEBUG_ ## b))
54 #define DEBUG_ON(a, b) \
56 if (vty->node == CONFIG_NODE) { \
57 CONF_DEBUG_ON(a, b); \
58 TERM_DEBUG_ON(a, b); \
60 TERM_DEBUG_ON(a, b); \
62 #define DEBUG_OFF(a, b) \
64 CONF_DEBUG_OFF(a, b); \
65 TERM_DEBUG_OFF(a, b); \
68 #define LDP_DEBUG(a, b) (ldp_debug.a & LDP_DEBUG_ ## b)
69 #define CONF_LDP_DEBUG(a, b) (conf_ldp_debug.a & LDP_DEBUG_ ## b)
71 #define debug_hello_recv(emsg, ...) \
73 if (LDP_DEBUG(hello, HELLO_RECV)) \
74 log_debug("discovery[recv]: " emsg, __VA_ARGS__); \
77 #define debug_hello_send(emsg, ...) \
79 if (LDP_DEBUG(hello, HELLO_SEND)) \
80 log_debug("discovery[send]: " emsg, __VA_ARGS__); \
83 #define debug_err(emsg, ...) \
85 if (LDP_DEBUG(errors, ERRORS)) \
86 log_debug("error: " emsg, __VA_ARGS__); \
89 #define debug_evt(emsg, ...) \
91 if (LDP_DEBUG(event, EVENT)) \
92 log_debug("event: " emsg, __VA_ARGS__); \
95 #define debug_msg_recv(emsg, ...) \
97 if (LDP_DEBUG(msg, MSG_RECV)) \
98 log_debug("msg[in]: " emsg, __VA_ARGS__); \
101 #define debug_msg_send(emsg, ...) \
103 if (LDP_DEBUG(msg, MSG_SEND)) \
104 log_debug("msg[out]: " emsg, __VA_ARGS__); \
107 #define debug_kalive_recv(emsg, ...) \
109 if (LDP_DEBUG(msg, MSG_RECV_ALL)) \
110 log_debug("kalive[in]: " emsg, __VA_ARGS__); \
113 #define debug_kalive_send(emsg, ...) \
115 if (LDP_DEBUG(msg, MSG_SEND_ALL)) \
116 log_debug("kalive[out]: " emsg, __VA_ARGS__); \
119 #define debug_zebra_in(emsg, ...) \
121 if (LDP_DEBUG(zebra, ZEBRA)) \
122 log_debug("zebra[in]: " emsg, __VA_ARGS__); \
125 #define debug_zebra_out(emsg, ...) \
127 if (LDP_DEBUG(zebra, ZEBRA)) \
128 log_debug("zebra[out]: " emsg, __VA_ARGS__); \
131 #endif /* _LDP_DEBUG_H_ */