zebra: remove unused function to fix warning
[jleu-quagga.git] / zebra / debug.c
blob175029b8a2e20626b4b14c38e6ed6695ec2c3c17
1 /*
2 * Zebra debug related function
3 * Copyright (C) 1999 Kunihiro Ishiguro
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Zebra; see the file COPYING. If not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #include <zebra.h>
24 #include "command.h"
25 #include "debug.h"
27 /* For debug statement. */
28 unsigned long zebra_debug_event;
29 unsigned long zebra_debug_packet;
30 unsigned long zebra_debug_kernel;
31 unsigned long zebra_debug_rib;
33 DEFUN (show_debugging_zebra,
34 show_debugging_zebra_cmd,
35 "show debugging zebra",
36 SHOW_STR
37 "Zebra configuration\n"
38 "Debugging information\n")
40 vty_out (vty, "Zebra debugging status:%s", VTY_NEWLINE);
42 if (IS_ZEBRA_DEBUG_EVENT)
43 vty_out (vty, " Zebra event debugging is on%s", VTY_NEWLINE);
45 if (IS_ZEBRA_DEBUG_PACKET)
47 if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV)
49 vty_out (vty, " Zebra packet%s debugging is on%s",
50 IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
51 VTY_NEWLINE);
53 else
55 if (IS_ZEBRA_DEBUG_SEND)
56 vty_out (vty, " Zebra packet send%s debugging is on%s",
57 IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
58 VTY_NEWLINE);
59 else
60 vty_out (vty, " Zebra packet receive%s debugging is on%s",
61 IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
62 VTY_NEWLINE);
66 if (IS_ZEBRA_DEBUG_KERNEL)
67 vty_out (vty, " Zebra kernel debugging is on%s", VTY_NEWLINE);
69 if (IS_ZEBRA_DEBUG_RIB)
70 vty_out (vty, " Zebra RIB debugging is on%s", VTY_NEWLINE);
71 if (IS_ZEBRA_DEBUG_RIB_Q)
72 vty_out (vty, " Zebra RIB queue debugging is on%s", VTY_NEWLINE);
74 return CMD_SUCCESS;
77 DEFUN (debug_zebra_events,
78 debug_zebra_events_cmd,
79 "debug zebra events",
80 DEBUG_STR
81 "Zebra configuration\n"
82 "Debug option set for zebra events\n")
84 zebra_debug_event = ZEBRA_DEBUG_EVENT;
85 return CMD_WARNING;
88 DEFUN (debug_zebra_packet,
89 debug_zebra_packet_cmd,
90 "debug zebra packet",
91 DEBUG_STR
92 "Zebra configuration\n"
93 "Debug option set for zebra packet\n")
95 zebra_debug_packet = ZEBRA_DEBUG_PACKET;
96 zebra_debug_packet |= ZEBRA_DEBUG_SEND;
97 zebra_debug_packet |= ZEBRA_DEBUG_RECV;
98 return CMD_SUCCESS;
101 DEFUN (debug_zebra_packet_direct,
102 debug_zebra_packet_direct_cmd,
103 "debug zebra packet (recv|send)",
104 DEBUG_STR
105 "Zebra configuration\n"
106 "Debug option set for zebra packet\n"
107 "Debug option set for receive packet\n"
108 "Debug option set for send packet\n")
110 zebra_debug_packet = ZEBRA_DEBUG_PACKET;
111 if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
112 zebra_debug_packet |= ZEBRA_DEBUG_SEND;
113 if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
114 zebra_debug_packet |= ZEBRA_DEBUG_RECV;
115 zebra_debug_packet &= ~ZEBRA_DEBUG_DETAIL;
116 return CMD_SUCCESS;
119 DEFUN (debug_zebra_packet_detail,
120 debug_zebra_packet_detail_cmd,
121 "debug zebra packet (recv|send) detail",
122 DEBUG_STR
123 "Zebra configuration\n"
124 "Debug option set for zebra packet\n"
125 "Debug option set for receive packet\n"
126 "Debug option set for send packet\n"
127 "Debug option set detaied information\n")
129 zebra_debug_packet = ZEBRA_DEBUG_PACKET;
130 if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
131 zebra_debug_packet |= ZEBRA_DEBUG_SEND;
132 if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
133 zebra_debug_packet |= ZEBRA_DEBUG_RECV;
134 zebra_debug_packet |= ZEBRA_DEBUG_DETAIL;
135 return CMD_SUCCESS;
138 DEFUN (debug_zebra_kernel,
139 debug_zebra_kernel_cmd,
140 "debug zebra kernel",
141 DEBUG_STR
142 "Zebra configuration\n"
143 "Debug option set for zebra between kernel interface\n")
145 zebra_debug_kernel = ZEBRA_DEBUG_KERNEL;
146 return CMD_SUCCESS;
149 DEFUN (debug_zebra_rib,
150 debug_zebra_rib_cmd,
151 "debug zebra rib",
152 DEBUG_STR
153 "Zebra configuration\n"
154 "Debug RIB events\n")
156 SET_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB);
157 return CMD_SUCCESS;
160 DEFUN (debug_zebra_rib_q,
161 debug_zebra_rib_q_cmd,
162 "debug zebra rib queue",
163 DEBUG_STR
164 "Zebra configuration\n"
165 "Debug RIB events\n"
166 "Debug RIB queueing\n")
168 SET_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB_Q);
169 return CMD_SUCCESS;
172 DEFUN (no_debug_zebra_events,
173 no_debug_zebra_events_cmd,
174 "no debug zebra events",
175 NO_STR
176 DEBUG_STR
177 "Zebra configuration\n"
178 "Debug option set for zebra events\n")
180 zebra_debug_event = 0;
181 return CMD_SUCCESS;
184 DEFUN (no_debug_zebra_packet,
185 no_debug_zebra_packet_cmd,
186 "no debug zebra packet",
187 NO_STR
188 DEBUG_STR
189 "Zebra configuration\n"
190 "Debug option set for zebra packet\n")
192 zebra_debug_packet = 0;
193 return CMD_SUCCESS;
196 DEFUN (no_debug_zebra_packet_direct,
197 no_debug_zebra_packet_direct_cmd,
198 "no debug zebra packet (recv|send)",
199 NO_STR
200 DEBUG_STR
201 "Zebra configuration\n"
202 "Debug option set for zebra packet\n"
203 "Debug option set for receive packet\n"
204 "Debug option set for send packet\n")
206 if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
207 zebra_debug_packet &= ~ZEBRA_DEBUG_SEND;
208 if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
209 zebra_debug_packet &= ~ZEBRA_DEBUG_RECV;
210 return CMD_SUCCESS;
213 DEFUN (no_debug_zebra_kernel,
214 no_debug_zebra_kernel_cmd,
215 "no debug zebra kernel",
216 NO_STR
217 DEBUG_STR
218 "Zebra configuration\n"
219 "Debug option set for zebra between kernel interface\n")
221 zebra_debug_kernel = 0;
222 return CMD_SUCCESS;
225 DEFUN (no_debug_zebra_rib,
226 no_debug_zebra_rib_cmd,
227 "no debug zebra rib",
228 NO_STR
229 DEBUG_STR
230 "Zebra configuration\n"
231 "Debug zebra RIB\n")
233 zebra_debug_rib = 0;
234 return CMD_SUCCESS;
237 DEFUN (no_debug_zebra_rib_q,
238 no_debug_zebra_rib_q_cmd,
239 "no debug zebra rib queue",
240 NO_STR
241 DEBUG_STR
242 "Zebra configuration\n"
243 "Debug zebra RIB\n"
244 "Debug RIB queueing\n")
246 UNSET_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB_Q);
247 return CMD_SUCCESS;
250 /* Debug node. */
251 struct cmd_node debug_node =
253 DEBUG_NODE,
254 "", /* Debug node has no interface. */
258 static int
259 config_write_debug (struct vty *vty)
261 int write = 0;
263 if (IS_ZEBRA_DEBUG_EVENT)
265 vty_out (vty, "debug zebra events%s", VTY_NEWLINE);
266 write++;
268 if (IS_ZEBRA_DEBUG_PACKET)
270 if (IS_ZEBRA_DEBUG_SEND && IS_ZEBRA_DEBUG_RECV)
272 vty_out (vty, "debug zebra packet%s%s",
273 IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
274 VTY_NEWLINE);
275 write++;
277 else
279 if (IS_ZEBRA_DEBUG_SEND)
280 vty_out (vty, "debug zebra packet send%s%s",
281 IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
282 VTY_NEWLINE);
283 else
284 vty_out (vty, "debug zebra packet recv%s%s",
285 IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
286 VTY_NEWLINE);
287 write++;
290 if (IS_ZEBRA_DEBUG_KERNEL)
292 vty_out (vty, "debug zebra kernel%s", VTY_NEWLINE);
293 write++;
295 if (IS_ZEBRA_DEBUG_RIB)
297 vty_out (vty, "debug zebra rib%s", VTY_NEWLINE);
298 write++;
300 if (IS_ZEBRA_DEBUG_RIB_Q)
302 vty_out (vty, "debug zebra rib queue%s", VTY_NEWLINE);
303 write++;
305 return write;
308 void
309 zebra_debug_init (void)
311 zebra_debug_event = 0;
312 zebra_debug_packet = 0;
313 zebra_debug_kernel = 0;
314 zebra_debug_rib = 0;
316 install_node (&debug_node, config_write_debug);
318 install_element (VIEW_NODE, &show_debugging_zebra_cmd);
320 install_element (ENABLE_NODE, &show_debugging_zebra_cmd);
321 install_element (ENABLE_NODE, &debug_zebra_events_cmd);
322 install_element (ENABLE_NODE, &debug_zebra_packet_cmd);
323 install_element (ENABLE_NODE, &debug_zebra_packet_direct_cmd);
324 install_element (ENABLE_NODE, &debug_zebra_packet_detail_cmd);
325 install_element (ENABLE_NODE, &debug_zebra_kernel_cmd);
326 install_element (ENABLE_NODE, &debug_zebra_rib_cmd);
327 install_element (ENABLE_NODE, &debug_zebra_rib_q_cmd);
328 install_element (ENABLE_NODE, &no_debug_zebra_events_cmd);
329 install_element (ENABLE_NODE, &no_debug_zebra_packet_cmd);
330 install_element (ENABLE_NODE, &no_debug_zebra_kernel_cmd);
331 install_element (ENABLE_NODE, &no_debug_zebra_rib_cmd);
332 install_element (ENABLE_NODE, &no_debug_zebra_rib_q_cmd);
334 install_element (CONFIG_NODE, &debug_zebra_events_cmd);
335 install_element (CONFIG_NODE, &debug_zebra_packet_cmd);
336 install_element (CONFIG_NODE, &debug_zebra_packet_direct_cmd);
337 install_element (CONFIG_NODE, &debug_zebra_packet_detail_cmd);
338 install_element (CONFIG_NODE, &debug_zebra_kernel_cmd);
339 install_element (CONFIG_NODE, &debug_zebra_rib_cmd);
340 install_element (CONFIG_NODE, &debug_zebra_rib_q_cmd);
341 install_element (CONFIG_NODE, &no_debug_zebra_events_cmd);
342 install_element (CONFIG_NODE, &no_debug_zebra_packet_cmd);
343 install_element (CONFIG_NODE, &no_debug_zebra_kernel_cmd);
344 install_element (CONFIG_NODE, &no_debug_zebra_rib_cmd);
345 install_element (CONFIG_NODE, &no_debug_zebra_rib_q_cmd);