]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_debug.h
bgpd: cleanup vty bgp_node_afi/safi utils
[mirror_frr.git] / bgpd / bgp_debug.h
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
21 #ifndef _QUAGGA_BGP_DEBUG_H
22 #define _QUAGGA_BGP_DEBUG_H
23
24 #include "bgp_attr.h"
25 #include "bgp_updgrp.h"
26
27 /* sort of packet direction */
28 #define DUMP_ON 1
29 #define DUMP_SEND 2
30 #define DUMP_RECV 4
31
32 /* for dump_update */
33 #define DUMP_WITHDRAW 8
34 #define DUMP_NLRI 16
35
36 /* dump detail */
37 #define DUMP_DETAIL 32
38
39 extern int dump_open;
40 extern int dump_update;
41 extern int dump_keepalive;
42 extern int dump_notify;
43
44 extern int Debug_Event;
45 extern int Debug_Keepalive;
46 extern int Debug_Update;
47 extern int Debug_Radix;
48
49 #define NLRI 1
50 #define WITHDRAW 2
51 #define NO_OPT 3
52 #define SEND 4
53 #define RECV 5
54 #define DETAIL 6
55
56 /* Prototypes. */
57 extern void bgp_debug_init (void);
58 extern void bgp_packet_dump (struct stream *);
59
60 extern int debug (unsigned int option);
61
62 extern unsigned long conf_bgp_debug_as4;
63 extern unsigned long conf_bgp_debug_neighbor_events;
64 extern unsigned long conf_bgp_debug_packet;
65 extern unsigned long conf_bgp_debug_keepalive;
66 extern unsigned long conf_bgp_debug_update;
67 extern unsigned long conf_bgp_debug_bestpath;
68 extern unsigned long conf_bgp_debug_zebra;
69 extern unsigned long conf_bgp_debug_nht;
70 extern unsigned long conf_bgp_debug_update_groups;
71
72 extern unsigned long term_bgp_debug_as4;
73 extern unsigned long term_bgp_debug_neighbor_events;
74 extern unsigned long term_bgp_debug_packet;
75 extern unsigned long term_bgp_debug_keepalive;
76 extern unsigned long term_bgp_debug_update;
77 extern unsigned long term_bgp_debug_bestpath;
78 extern unsigned long term_bgp_debug_zebra;
79 extern unsigned long term_bgp_debug_nht;
80 extern unsigned long term_bgp_debug_update_groups;
81
82 extern struct list *bgp_debug_neighbor_events_peers;
83 extern struct list *bgp_debug_keepalive_peers;
84 extern struct list *bgp_debug_update_in_peers;
85 extern struct list *bgp_debug_update_out_peers;
86 extern struct list *bgp_debug_update_prefixes;
87 extern struct list *bgp_debug_bestpath_prefixes;
88 extern struct list *bgp_debug_zebra_prefixes;
89
90 struct bgp_debug_filter
91 {
92 char *host;
93 struct prefix *p;
94 };
95
96 #define BGP_DEBUG_AS4 0x01
97 #define BGP_DEBUG_AS4_SEGMENT 0x02
98
99 #define BGP_DEBUG_BESTPATH 0x01
100 #define BGP_DEBUG_NEIGHBOR_EVENTS 0x01
101 #define BGP_DEBUG_PACKET 0x01
102 #define BGP_DEBUG_KEEPALIVE 0x01
103 #define BGP_DEBUG_UPDATE_IN 0x01
104 #define BGP_DEBUG_UPDATE_OUT 0x02
105 #define BGP_DEBUG_UPDATE_PREFIX 0x04
106 #define BGP_DEBUG_ZEBRA 0x01
107 #define BGP_DEBUG_NHT 0x01
108 #define BGP_DEBUG_UPDATE_GROUPS 0x01
109
110 #define BGP_DEBUG_PACKET_SEND 0x01
111 #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
112
113 #define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
114 #define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
115
116 #define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
117 #define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
118
119 #define DEBUG_ON(a, b) \
120 do { \
121 CONF_DEBUG_ON(a, b); \
122 TERM_DEBUG_ON(a, b); \
123 } while (0)
124 #define DEBUG_OFF(a, b) \
125 do { \
126 CONF_DEBUG_OFF(a, b); \
127 TERM_DEBUG_OFF(a, b); \
128 } while (0)
129
130 #define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
131 #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
132
133 extern const char *bgp_type_str[];
134
135 extern int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
136 extern int bgp_debug_peer_updout_enabled(char *host);
137 extern const char *bgp_notify_code_str(char);
138 extern const char *bgp_notify_subcode_str(char, char);
139 extern void bgp_notify_print (struct peer *, struct bgp_notify *, const char *);
140
141 extern const struct message bgp_status_msg[];
142 extern const int bgp_status_msg_max;
143 extern int bgp_debug_neighbor_events(struct peer *peer);
144 extern int bgp_debug_keepalive(struct peer *peer);
145 extern int bgp_debug_update(struct peer *peer, struct prefix *p,
146 struct update_group *updgrp, unsigned int inbound);
147 extern int bgp_debug_bestpath(struct prefix *p);
148 extern int bgp_debug_zebra(struct prefix *p);
149
150 #endif /* _QUAGGA_BGP_DEBUG_H */