paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* BGP message debug header. |
| 2 | Copyright (C) 1996, 97, 98 Kunihiro Ishiguro |
| 3 | |
| 4 | This file is part of GNU Zebra. |
| 5 | |
| 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 |
| 9 | later version. |
| 10 | |
| 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. |
| 15 | |
| 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 |
| 19 | 02111-1307, USA. */ |
| 20 | |
paul | 00d252c | 2005-05-23 14:19:54 +0000 | [diff] [blame] | 21 | #ifndef _QUAGGA_BGP_DEBUG_H |
| 22 | #define _QUAGGA_BGP_DEBUG_H |
| 23 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 24 | /* sort of packet direction */ |
| 25 | #define DUMP_ON 1 |
| 26 | #define DUMP_SEND 2 |
| 27 | #define DUMP_RECV 4 |
| 28 | |
| 29 | /* for dump_update */ |
| 30 | #define DUMP_WITHDRAW 8 |
| 31 | #define DUMP_NLRI 16 |
| 32 | |
| 33 | /* dump detail */ |
| 34 | #define DUMP_DETAIL 32 |
| 35 | |
| 36 | extern int dump_open; |
| 37 | extern int dump_update; |
| 38 | extern int dump_keepalive; |
| 39 | extern int dump_notify; |
| 40 | |
| 41 | extern int Debug_Event; |
| 42 | extern int Debug_Keepalive; |
| 43 | extern int Debug_Update; |
| 44 | extern int Debug_Radix; |
| 45 | |
| 46 | #define NLRI 1 |
| 47 | #define WITHDRAW 2 |
| 48 | #define NO_OPT 3 |
| 49 | #define SEND 4 |
| 50 | #define RECV 5 |
| 51 | #define DETAIL 6 |
| 52 | |
| 53 | /* Prototypes. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 54 | extern void bgp_debug_init (void); |
| 55 | extern void bgp_packet_dump (struct stream *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 56 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 57 | extern int debug (unsigned int option); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 58 | |
| 59 | extern unsigned long conf_bgp_debug_fsm; |
| 60 | extern unsigned long conf_bgp_debug_events; |
| 61 | extern unsigned long conf_bgp_debug_packet; |
| 62 | extern unsigned long conf_bgp_debug_filter; |
| 63 | extern unsigned long conf_bgp_debug_keepalive; |
| 64 | extern unsigned long conf_bgp_debug_update; |
| 65 | extern unsigned long conf_bgp_debug_normal; |
| 66 | |
| 67 | extern unsigned long term_bgp_debug_fsm; |
| 68 | extern unsigned long term_bgp_debug_events; |
| 69 | extern unsigned long term_bgp_debug_packet; |
| 70 | extern unsigned long term_bgp_debug_filter; |
| 71 | extern unsigned long term_bgp_debug_keepalive; |
| 72 | extern unsigned long term_bgp_debug_update; |
| 73 | extern unsigned long term_bgp_debug_normal; |
| 74 | |
| 75 | #define BGP_DEBUG_FSM 0x01 |
| 76 | #define BGP_DEBUG_EVENTS 0x01 |
| 77 | #define BGP_DEBUG_PACKET 0x01 |
| 78 | #define BGP_DEBUG_FILTER 0x01 |
| 79 | #define BGP_DEBUG_KEEPALIVE 0x01 |
| 80 | #define BGP_DEBUG_UPDATE_IN 0x01 |
| 81 | #define BGP_DEBUG_UPDATE_OUT 0x02 |
| 82 | #define BGP_DEBUG_NORMAL 0x01 |
| 83 | |
| 84 | #define BGP_DEBUG_PACKET_SEND 0x01 |
| 85 | #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02 |
| 86 | |
| 87 | #define BGP_DEBUG_PACKET_RECV 0x01 |
| 88 | #define BGP_DEBUG_PACKET_RECV_DETAIL 0x02 |
| 89 | |
| 90 | #define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b)) |
| 91 | #define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b)) |
| 92 | |
| 93 | #define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b)) |
| 94 | #define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b)) |
| 95 | |
| 96 | #define DEBUG_ON(a, b) \ |
| 97 | do { \ |
| 98 | CONF_DEBUG_ON(a, b); \ |
| 99 | TERM_DEBUG_ON(a, b); \ |
| 100 | } while (0) |
| 101 | #define DEBUG_OFF(a, b) \ |
| 102 | do { \ |
| 103 | CONF_DEBUG_OFF(a, b); \ |
| 104 | TERM_DEBUG_OFF(a, b); \ |
| 105 | } while (0) |
| 106 | |
| 107 | #define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b) |
| 108 | #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b) |
| 109 | |
paul | fd79ac9 | 2004-10-13 05:06:08 +0000 | [diff] [blame] | 110 | const extern char *bgp_type_str[]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 111 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 112 | extern int bgp_dump_attr (struct peer *, struct attr *, char *, size_t); |
| 113 | extern void bgp_notify_print (struct peer *, struct bgp_notify *, const char *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 114 | |
| 115 | extern struct message bgp_status_msg[]; |
| 116 | extern int bgp_status_msg_max; |
paul | 00d252c | 2005-05-23 14:19:54 +0000 | [diff] [blame] | 117 | |
| 118 | #endif /* _QUAGGA_BGP_DEBUG_H */ |