]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP message debug header. |
896014f4 DL |
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 along | |
17 | * with this program; see the file COPYING; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
718e3744 | 20 | |
00d252cb | 21 | #ifndef _QUAGGA_BGP_DEBUG_H |
22 | #define _QUAGGA_BGP_DEBUG_H | |
23 | ||
0b2aa3a0 | 24 | #include "bgp_attr.h" |
3f9c7369 | 25 | #include "bgp_updgrp.h" |
0b2aa3a0 | 26 | |
718e3744 | 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 | ||
906ad49b | 39 | /* RD + Prefix + Path-Id */ |
40 | #define BGP_PRD_PATH_STRLEN (PREFIX_STRLEN + RD_ADDRSTRLEN + 20) | |
41 | ||
718e3744 | 42 | extern int dump_open; |
43 | extern int dump_update; | |
44 | extern int dump_keepalive; | |
45 | extern int dump_notify; | |
46 | ||
47 | extern int Debug_Event; | |
48 | extern int Debug_Keepalive; | |
49 | extern int Debug_Update; | |
50 | extern int Debug_Radix; | |
51 | ||
52 | #define NLRI 1 | |
53 | #define WITHDRAW 2 | |
54 | #define NO_OPT 3 | |
55 | #define SEND 4 | |
56 | #define RECV 5 | |
57 | #define DETAIL 6 | |
58 | ||
59 | /* Prototypes. */ | |
94f2b392 | 60 | extern void bgp_debug_init (void); |
61 | extern void bgp_packet_dump (struct stream *); | |
718e3744 | 62 | |
94f2b392 | 63 | extern int debug (unsigned int option); |
718e3744 | 64 | |
0b2aa3a0 | 65 | extern unsigned long conf_bgp_debug_as4; |
16286195 | 66 | extern unsigned long conf_bgp_debug_neighbor_events; |
718e3744 | 67 | extern unsigned long conf_bgp_debug_packet; |
718e3744 | 68 | extern unsigned long conf_bgp_debug_keepalive; |
69 | extern unsigned long conf_bgp_debug_update; | |
9fbdd100 | 70 | extern unsigned long conf_bgp_debug_bestpath; |
a39275d7 | 71 | extern unsigned long conf_bgp_debug_zebra; |
cebb7440 | 72 | extern unsigned long conf_bgp_debug_allow_martians; |
fb018d25 | 73 | extern unsigned long conf_bgp_debug_nht; |
3f9c7369 | 74 | extern unsigned long conf_bgp_debug_update_groups; |
718e3744 | 75 | |
0b2aa3a0 | 76 | extern unsigned long term_bgp_debug_as4; |
16286195 | 77 | extern unsigned long term_bgp_debug_neighbor_events; |
718e3744 | 78 | extern unsigned long term_bgp_debug_packet; |
718e3744 | 79 | extern unsigned long term_bgp_debug_keepalive; |
80 | extern unsigned long term_bgp_debug_update; | |
9fbdd100 | 81 | extern unsigned long term_bgp_debug_bestpath; |
a39275d7 | 82 | extern unsigned long term_bgp_debug_zebra; |
cebb7440 | 83 | extern unsigned long term_bgp_debug_allow_martians; |
fb018d25 | 84 | extern unsigned long term_bgp_debug_nht; |
3f9c7369 | 85 | extern unsigned long term_bgp_debug_update_groups; |
718e3744 | 86 | |
16286195 DS |
87 | extern struct list *bgp_debug_neighbor_events_peers; |
88 | extern struct list *bgp_debug_keepalive_peers; | |
89 | extern struct list *bgp_debug_update_in_peers; | |
90 | extern struct list *bgp_debug_update_out_peers; | |
91 | extern struct list *bgp_debug_update_prefixes; | |
9fbdd100 | 92 | extern struct list *bgp_debug_bestpath_prefixes; |
16286195 DS |
93 | extern struct list *bgp_debug_zebra_prefixes; |
94 | ||
95 | struct bgp_debug_filter | |
96 | { | |
167d390a | 97 | char *host; |
16286195 DS |
98 | struct prefix *p; |
99 | }; | |
100 | ||
0b2aa3a0 PJ |
101 | #define BGP_DEBUG_AS4 0x01 |
102 | #define BGP_DEBUG_AS4_SEGMENT 0x02 | |
103 | ||
9fbdd100 | 104 | #define BGP_DEBUG_BESTPATH 0x01 |
16286195 | 105 | #define BGP_DEBUG_NEIGHBOR_EVENTS 0x01 |
718e3744 | 106 | #define BGP_DEBUG_PACKET 0x01 |
718e3744 | 107 | #define BGP_DEBUG_KEEPALIVE 0x01 |
108 | #define BGP_DEBUG_UPDATE_IN 0x01 | |
109 | #define BGP_DEBUG_UPDATE_OUT 0x02 | |
16286195 | 110 | #define BGP_DEBUG_UPDATE_PREFIX 0x04 |
a39275d7 | 111 | #define BGP_DEBUG_ZEBRA 0x01 |
cebb7440 | 112 | #define BGP_DEBUG_ALLOW_MARTIANS 0x01 |
fb018d25 | 113 | #define BGP_DEBUG_NHT 0x01 |
3f9c7369 | 114 | #define BGP_DEBUG_UPDATE_GROUPS 0x01 |
718e3744 | 115 | |
116 | #define BGP_DEBUG_PACKET_SEND 0x01 | |
117 | #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02 | |
118 | ||
718e3744 | 119 | #define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b)) |
120 | #define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b)) | |
121 | ||
122 | #define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b)) | |
123 | #define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b)) | |
124 | ||
125 | #define DEBUG_ON(a, b) \ | |
126 | do { \ | |
127 | CONF_DEBUG_ON(a, b); \ | |
128 | TERM_DEBUG_ON(a, b); \ | |
129 | } while (0) | |
130 | #define DEBUG_OFF(a, b) \ | |
131 | do { \ | |
132 | CONF_DEBUG_OFF(a, b); \ | |
133 | TERM_DEBUG_OFF(a, b); \ | |
134 | } while (0) | |
135 | ||
136 | #define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b) | |
137 | #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b) | |
138 | ||
6d58272b | 139 | extern const char *bgp_type_str[]; |
718e3744 | 140 | |
9ff63e6f | 141 | extern int bgp_dump_attr (struct attr *, char *, size_t); |
167d390a | 142 | extern int bgp_debug_peer_updout_enabled(char *host); |
3a8c7ba1 DW |
143 | extern const char *bgp_notify_code_str(char); |
144 | extern const char *bgp_notify_subcode_str(char, char); | |
94f2b392 | 145 | extern void bgp_notify_print (struct peer *, struct bgp_notify *, const char *); |
718e3744 | 146 | |
b2d933f8 | 147 | extern const struct message bgp_status_msg[]; |
16286195 DS |
148 | extern int bgp_debug_neighbor_events(struct peer *peer); |
149 | extern int bgp_debug_keepalive(struct peer *peer); | |
3f9c7369 DS |
150 | extern int bgp_debug_update(struct peer *peer, struct prefix *p, |
151 | struct update_group *updgrp, unsigned int inbound); | |
9fbdd100 | 152 | extern int bgp_debug_bestpath(struct prefix *p); |
16286195 | 153 | extern int bgp_debug_zebra(struct prefix *p); |
00d252cb | 154 | |
90dcf2d7 | 155 | extern int bgp_debug_count(void); |
b16031a2 | 156 | extern const char *bgp_debug_rdpfxpath2str (afi_t, safi_t, struct prefix_rd *, |
157 | union prefixconstptr, mpls_label_t *, | |
906ad49b | 158 | int, u_int32_t, char *, int); |
38de8d02 DL |
159 | const char *bgp_notify_admin_message(char *buf, size_t bufsz, u_char *data, size_t datalen); |
160 | ||
00d252cb | 161 | #endif /* _QUAGGA_BGP_DEBUG_H */ |