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 Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 24 | #include "bgp_attr.h" |
| 25 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 26 | /* sort of packet direction */ |
| 27 | #define DUMP_ON 1 |
| 28 | #define DUMP_SEND 2 |
| 29 | #define DUMP_RECV 4 |
| 30 | |
| 31 | /* for dump_update */ |
| 32 | #define DUMP_WITHDRAW 8 |
| 33 | #define DUMP_NLRI 16 |
| 34 | |
| 35 | /* dump detail */ |
| 36 | #define DUMP_DETAIL 32 |
| 37 | |
| 38 | extern int dump_open; |
| 39 | extern int dump_update; |
| 40 | extern int dump_keepalive; |
| 41 | extern int dump_notify; |
| 42 | |
| 43 | extern int Debug_Event; |
| 44 | extern int Debug_Keepalive; |
| 45 | extern int Debug_Update; |
| 46 | extern int Debug_Radix; |
| 47 | |
| 48 | #define NLRI 1 |
| 49 | #define WITHDRAW 2 |
| 50 | #define NO_OPT 3 |
| 51 | #define SEND 4 |
| 52 | #define RECV 5 |
| 53 | #define DETAIL 6 |
| 54 | |
| 55 | /* Prototypes. */ |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 56 | extern void bgp_debug_init (void); |
| 57 | extern void bgp_packet_dump (struct stream *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 58 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 59 | extern int debug (unsigned int option); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 60 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 61 | extern unsigned long conf_bgp_debug_as4; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 62 | extern unsigned long conf_bgp_debug_fsm; |
| 63 | extern unsigned long conf_bgp_debug_events; |
| 64 | extern unsigned long conf_bgp_debug_packet; |
| 65 | extern unsigned long conf_bgp_debug_filter; |
| 66 | extern unsigned long conf_bgp_debug_keepalive; |
| 67 | extern unsigned long conf_bgp_debug_update; |
| 68 | extern unsigned long conf_bgp_debug_normal; |
Andrew J. Schorr | a39275d | 2006-11-30 16:36:57 +0000 | [diff] [blame] | 69 | extern unsigned long conf_bgp_debug_zebra; |
Lou Berger | f53585d | 2016-05-17 07:10:36 -0400 | [diff] [blame^] | 70 | extern unsigned long conf_bgp_debug_allow_martians; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 71 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 72 | extern unsigned long term_bgp_debug_as4; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 73 | extern unsigned long term_bgp_debug_fsm; |
| 74 | extern unsigned long term_bgp_debug_events; |
| 75 | extern unsigned long term_bgp_debug_packet; |
| 76 | extern unsigned long term_bgp_debug_filter; |
| 77 | extern unsigned long term_bgp_debug_keepalive; |
| 78 | extern unsigned long term_bgp_debug_update; |
| 79 | extern unsigned long term_bgp_debug_normal; |
Andrew J. Schorr | a39275d | 2006-11-30 16:36:57 +0000 | [diff] [blame] | 80 | extern unsigned long term_bgp_debug_zebra; |
Lou Berger | f53585d | 2016-05-17 07:10:36 -0400 | [diff] [blame^] | 81 | extern unsigned long term_bgp_debug_allow_martians; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 82 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 83 | #define BGP_DEBUG_AS4 0x01 |
| 84 | #define BGP_DEBUG_AS4_SEGMENT 0x02 |
| 85 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 86 | #define BGP_DEBUG_FSM 0x01 |
| 87 | #define BGP_DEBUG_EVENTS 0x01 |
| 88 | #define BGP_DEBUG_PACKET 0x01 |
| 89 | #define BGP_DEBUG_FILTER 0x01 |
| 90 | #define BGP_DEBUG_KEEPALIVE 0x01 |
| 91 | #define BGP_DEBUG_UPDATE_IN 0x01 |
| 92 | #define BGP_DEBUG_UPDATE_OUT 0x02 |
| 93 | #define BGP_DEBUG_NORMAL 0x01 |
Andrew J. Schorr | a39275d | 2006-11-30 16:36:57 +0000 | [diff] [blame] | 94 | #define BGP_DEBUG_ZEBRA 0x01 |
Lou Berger | f53585d | 2016-05-17 07:10:36 -0400 | [diff] [blame^] | 95 | #define BGP_DEBUG_ALLOW_MARTIANS 0x01 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 96 | |
| 97 | #define BGP_DEBUG_PACKET_SEND 0x01 |
| 98 | #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02 |
| 99 | |
| 100 | #define BGP_DEBUG_PACKET_RECV 0x01 |
| 101 | #define BGP_DEBUG_PACKET_RECV_DETAIL 0x02 |
| 102 | |
| 103 | #define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b)) |
| 104 | #define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b)) |
| 105 | |
| 106 | #define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b)) |
| 107 | #define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b)) |
| 108 | |
| 109 | #define DEBUG_ON(a, b) \ |
| 110 | do { \ |
| 111 | CONF_DEBUG_ON(a, b); \ |
| 112 | TERM_DEBUG_ON(a, b); \ |
| 113 | } while (0) |
| 114 | #define DEBUG_OFF(a, b) \ |
| 115 | do { \ |
| 116 | CONF_DEBUG_OFF(a, b); \ |
| 117 | TERM_DEBUG_OFF(a, b); \ |
| 118 | } while (0) |
| 119 | |
| 120 | #define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b) |
| 121 | #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b) |
| 122 | |
Paul Jakma | 6d58272 | 2007-08-06 15:21:45 +0000 | [diff] [blame] | 123 | extern const char *bgp_type_str[]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 124 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 125 | extern int bgp_dump_attr (struct peer *, struct attr *, char *, size_t); |
| 126 | extern void bgp_notify_print (struct peer *, struct bgp_notify *, const char *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 127 | |
Stephen Hemminger | b2d933f | 2009-05-15 10:48:03 -0700 | [diff] [blame] | 128 | extern const struct message bgp_status_msg[]; |
| 129 | extern const int bgp_status_msg_max; |
paul | 00d252c | 2005-05-23 14:19:54 +0000 | [diff] [blame] | 130 | |
| 131 | #endif /* _QUAGGA_BGP_DEBUG_H */ |