blob: 7015cb77ad20991f3fa71fa3d9a5fc8e59129443 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* BGP message debug header.
2 Copyright (C) 1996, 97, 98 Kunihiro Ishiguro
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
paul00d252c2005-05-23 14:19:54 +000021#ifndef _QUAGGA_BGP_DEBUG_H
22#define _QUAGGA_BGP_DEBUG_H
23
paul718e3742002-12-13 20:15:29 +000024/* 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
36extern int dump_open;
37extern int dump_update;
38extern int dump_keepalive;
39extern int dump_notify;
40
41extern int Debug_Event;
42extern int Debug_Keepalive;
43extern int Debug_Update;
44extern 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. */
paul94f2b392005-06-28 12:44:16 +000054extern void bgp_debug_init (void);
55extern void bgp_packet_dump (struct stream *);
paul718e3742002-12-13 20:15:29 +000056
paul94f2b392005-06-28 12:44:16 +000057extern int debug (unsigned int option);
paul718e3742002-12-13 20:15:29 +000058
59extern unsigned long conf_bgp_debug_fsm;
60extern unsigned long conf_bgp_debug_events;
61extern unsigned long conf_bgp_debug_packet;
62extern unsigned long conf_bgp_debug_filter;
63extern unsigned long conf_bgp_debug_keepalive;
64extern unsigned long conf_bgp_debug_update;
65extern unsigned long conf_bgp_debug_normal;
Andrew J. Schorra39275d2006-11-30 16:36:57 +000066extern unsigned long conf_bgp_debug_zebra;
paul718e3742002-12-13 20:15:29 +000067
68extern unsigned long term_bgp_debug_fsm;
69extern unsigned long term_bgp_debug_events;
70extern unsigned long term_bgp_debug_packet;
71extern unsigned long term_bgp_debug_filter;
72extern unsigned long term_bgp_debug_keepalive;
73extern unsigned long term_bgp_debug_update;
74extern unsigned long term_bgp_debug_normal;
Andrew J. Schorra39275d2006-11-30 16:36:57 +000075extern unsigned long term_bgp_debug_zebra;
paul718e3742002-12-13 20:15:29 +000076
77#define BGP_DEBUG_FSM 0x01
78#define BGP_DEBUG_EVENTS 0x01
79#define BGP_DEBUG_PACKET 0x01
80#define BGP_DEBUG_FILTER 0x01
81#define BGP_DEBUG_KEEPALIVE 0x01
82#define BGP_DEBUG_UPDATE_IN 0x01
83#define BGP_DEBUG_UPDATE_OUT 0x02
84#define BGP_DEBUG_NORMAL 0x01
Andrew J. Schorra39275d2006-11-30 16:36:57 +000085#define BGP_DEBUG_ZEBRA 0x01
paul718e3742002-12-13 20:15:29 +000086
87#define BGP_DEBUG_PACKET_SEND 0x01
88#define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
89
90#define BGP_DEBUG_PACKET_RECV 0x01
91#define BGP_DEBUG_PACKET_RECV_DETAIL 0x02
92
93#define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
94#define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
95
96#define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
97#define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
98
99#define DEBUG_ON(a, b) \
100 do { \
101 CONF_DEBUG_ON(a, b); \
102 TERM_DEBUG_ON(a, b); \
103 } while (0)
104#define DEBUG_OFF(a, b) \
105 do { \
106 CONF_DEBUG_OFF(a, b); \
107 TERM_DEBUG_OFF(a, b); \
108 } while (0)
109
110#define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
111#define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
112
Paul Jakma6d582722007-08-06 15:21:45 +0000113extern const char *bgp_type_str[];
paul718e3742002-12-13 20:15:29 +0000114
paul94f2b392005-06-28 12:44:16 +0000115extern int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
116extern void bgp_notify_print (struct peer *, struct bgp_notify *, const char *);
paul718e3742002-12-13 20:15:29 +0000117
118extern struct message bgp_status_msg[];
119extern int bgp_status_msg_max;
paul00d252c2005-05-23 14:19:54 +0000120
121#endif /* _QUAGGA_BGP_DEBUG_H */