blob: 253bd7fe6a6ec526a3e6efbe537ba2fbc92ee720 [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
Paul Jakma0b2aa3a2007-10-14 22:32:21 +000024#include "bgp_attr.h"
25
paul718e3742002-12-13 20:15:29 +000026/* 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
38extern int dump_open;
39extern int dump_update;
40extern int dump_keepalive;
41extern int dump_notify;
42
43extern int Debug_Event;
44extern int Debug_Keepalive;
45extern int Debug_Update;
46extern 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. */
paul94f2b392005-06-28 12:44:16 +000056extern void bgp_debug_init (void);
57extern void bgp_packet_dump (struct stream *);
paul718e3742002-12-13 20:15:29 +000058
paul94f2b392005-06-28 12:44:16 +000059extern int debug (unsigned int option);
paul718e3742002-12-13 20:15:29 +000060
Paul Jakma0b2aa3a2007-10-14 22:32:21 +000061extern unsigned long conf_bgp_debug_as4;
paul718e3742002-12-13 20:15:29 +000062extern unsigned long conf_bgp_debug_fsm;
63extern unsigned long conf_bgp_debug_events;
64extern unsigned long conf_bgp_debug_packet;
65extern unsigned long conf_bgp_debug_filter;
66extern unsigned long conf_bgp_debug_keepalive;
67extern unsigned long conf_bgp_debug_update;
68extern unsigned long conf_bgp_debug_normal;
Andrew J. Schorra39275d2006-11-30 16:36:57 +000069extern unsigned long conf_bgp_debug_zebra;
Lou Bergerf53585d2016-05-17 07:10:36 -040070extern unsigned long conf_bgp_debug_allow_martians;
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -050071extern unsigned long conf_bgp_debug_nht;
paul718e3742002-12-13 20:15:29 +000072
Paul Jakma0b2aa3a2007-10-14 22:32:21 +000073extern unsigned long term_bgp_debug_as4;
paul718e3742002-12-13 20:15:29 +000074extern unsigned long term_bgp_debug_fsm;
75extern unsigned long term_bgp_debug_events;
76extern unsigned long term_bgp_debug_packet;
77extern unsigned long term_bgp_debug_filter;
78extern unsigned long term_bgp_debug_keepalive;
79extern unsigned long term_bgp_debug_update;
80extern unsigned long term_bgp_debug_normal;
Andrew J. Schorra39275d2006-11-30 16:36:57 +000081extern unsigned long term_bgp_debug_zebra;
Lou Bergerf53585d2016-05-17 07:10:36 -040082extern unsigned long term_bgp_debug_allow_martians;
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -050083extern unsigned long term_bgp_debug_nht;
paul718e3742002-12-13 20:15:29 +000084
Paul Jakma0b2aa3a2007-10-14 22:32:21 +000085#define BGP_DEBUG_AS4 0x01
86#define BGP_DEBUG_AS4_SEGMENT 0x02
87
paul718e3742002-12-13 20:15:29 +000088#define BGP_DEBUG_FSM 0x01
89#define BGP_DEBUG_EVENTS 0x01
90#define BGP_DEBUG_PACKET 0x01
91#define BGP_DEBUG_FILTER 0x01
92#define BGP_DEBUG_KEEPALIVE 0x01
93#define BGP_DEBUG_UPDATE_IN 0x01
94#define BGP_DEBUG_UPDATE_OUT 0x02
95#define BGP_DEBUG_NORMAL 0x01
Andrew J. Schorra39275d2006-11-30 16:36:57 +000096#define BGP_DEBUG_ZEBRA 0x01
Lou Bergerf53585d2016-05-17 07:10:36 -040097#define BGP_DEBUG_ALLOW_MARTIANS 0x01
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -050098#define BGP_DEBUG_NHT 0x01
paul718e3742002-12-13 20:15:29 +000099
100#define BGP_DEBUG_PACKET_SEND 0x01
101#define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
102
103#define BGP_DEBUG_PACKET_RECV 0x01
104#define BGP_DEBUG_PACKET_RECV_DETAIL 0x02
105
106#define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
107#define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
108
109#define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
110#define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
111
112#define DEBUG_ON(a, b) \
113 do { \
114 CONF_DEBUG_ON(a, b); \
115 TERM_DEBUG_ON(a, b); \
116 } while (0)
117#define DEBUG_OFF(a, b) \
118 do { \
119 CONF_DEBUG_OFF(a, b); \
120 TERM_DEBUG_OFF(a, b); \
121 } while (0)
122
123#define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
124#define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
125
Paul Jakma6d582722007-08-06 15:21:45 +0000126extern const char *bgp_type_str[];
paul718e3742002-12-13 20:15:29 +0000127
paul94f2b392005-06-28 12:44:16 +0000128extern int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
129extern void bgp_notify_print (struct peer *, struct bgp_notify *, const char *);
paul718e3742002-12-13 20:15:29 +0000130
Stephen Hemmingerb2d933f2009-05-15 10:48:03 -0700131extern const struct message bgp_status_msg[];
132extern const int bgp_status_msg_max;
paul00d252c2005-05-23 14:19:54 +0000133
134#endif /* _QUAGGA_BGP_DEBUG_H */