2 * RIPng debug output routines
3 * Copyright (C) 1998 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
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 Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 #include "ripngd/ripng_debug.h"
27 /* For debug statement. */
28 unsigned long ripng_debug_event
= 0;
29 unsigned long ripng_debug_packet
= 0;
30 unsigned long ripng_debug_zebra
= 0;
32 DEFUN (show_debugging_ripng
,
33 show_debugging_ripng_cmd
,
34 "show debugging ripng",
37 "RIPng configuration\n")
39 vty_out (vty
, "RIPng debugging status:%s", VTY_NEWLINE
);
41 if (IS_RIPNG_DEBUG_EVENT
)
42 vty_out (vty
, " RIPng event debugging is on%s", VTY_NEWLINE
);
44 if (IS_RIPNG_DEBUG_PACKET
)
46 if (IS_RIPNG_DEBUG_SEND
&& IS_RIPNG_DEBUG_RECV
)
48 vty_out (vty
, " RIPng packet debugging is on%s",
53 if (IS_RIPNG_DEBUG_SEND
)
54 vty_out (vty
, " RIPng packet send debugging is on%s",
57 vty_out (vty
, " RIPng packet receive debugging is on%s",
62 if (IS_RIPNG_DEBUG_ZEBRA
)
63 vty_out (vty
, " RIPng zebra debugging is on%s", VTY_NEWLINE
);
68 DEFUN (debug_ripng_events
,
69 debug_ripng_events_cmd
,
72 "RIPng configuration\n"
73 "Debug option set for ripng events\n")
75 ripng_debug_event
= RIPNG_DEBUG_EVENT
;
79 DEFUN (debug_ripng_packet
,
80 debug_ripng_packet_cmd
,
83 "RIPng configuration\n"
84 "Debug option set for ripng packet\n")
86 ripng_debug_packet
= RIPNG_DEBUG_PACKET
;
87 ripng_debug_packet
|= RIPNG_DEBUG_SEND
;
88 ripng_debug_packet
|= RIPNG_DEBUG_RECV
;
92 DEFUN (debug_ripng_packet_direct
,
93 debug_ripng_packet_direct_cmd
,
94 "debug ripng packet <recv|send>",
96 "RIPng configuration\n"
97 "Debug option set for ripng packet\n"
98 "Debug option set for receive packet\n"
99 "Debug option set for send packet\n")
101 int idx_recv_send
= 3;
102 ripng_debug_packet
|= RIPNG_DEBUG_PACKET
;
103 if (strncmp ("send", argv
[idx_recv_send
]->arg
, strlen (argv
[idx_recv_send
]->arg
)) == 0)
104 ripng_debug_packet
|= RIPNG_DEBUG_SEND
;
105 if (strncmp ("recv", argv
[idx_recv_send
]->arg
, strlen (argv
[idx_recv_send
]->arg
)) == 0)
106 ripng_debug_packet
|= RIPNG_DEBUG_RECV
;
111 DEFUN (debug_ripng_zebra
,
112 debug_ripng_zebra_cmd
,
115 "RIPng configuration\n"
116 "Debug option set for ripng and zebra communication\n")
118 ripng_debug_zebra
= RIPNG_DEBUG_ZEBRA
;
122 DEFUN (no_debug_ripng_events
,
123 no_debug_ripng_events_cmd
,
124 "no debug ripng events",
127 "RIPng configuration\n"
128 "Debug option set for ripng events\n")
130 ripng_debug_event
= 0;
134 DEFUN (no_debug_ripng_packet
,
135 no_debug_ripng_packet_cmd
,
136 "no debug ripng packet",
139 "RIPng configuration\n"
140 "Debug option set for ripng packet\n")
142 ripng_debug_packet
= 0;
146 DEFUN (no_debug_ripng_packet_direct
,
147 no_debug_ripng_packet_direct_cmd
,
148 "no debug ripng packet <recv|send>",
151 "RIPng configuration\n"
152 "Debug option set for ripng packet\n"
153 "Debug option set for receive packet\n"
154 "Debug option set for send packet\n")
156 int idx_recv_send
= 4;
157 if (strncmp ("send", argv
[idx_recv_send
]->arg
, strlen (argv
[idx_recv_send
]->arg
)) == 0)
159 if (IS_RIPNG_DEBUG_RECV
)
160 ripng_debug_packet
&= ~RIPNG_DEBUG_SEND
;
162 ripng_debug_packet
= 0;
164 else if (strncmp ("recv", argv
[idx_recv_send
]->arg
, strlen (argv
[idx_recv_send
]->arg
)) == 0)
166 if (IS_RIPNG_DEBUG_SEND
)
167 ripng_debug_packet
&= ~RIPNG_DEBUG_RECV
;
169 ripng_debug_packet
= 0;
174 DEFUN (no_debug_ripng_zebra
,
175 no_debug_ripng_zebra_cmd
,
176 "no debug ripng zebra",
179 "RIPng configuration\n"
180 "Debug option set for ripng and zebra communication\n")
182 ripng_debug_zebra
= 0;
187 static struct cmd_node debug_node
=
190 "", /* Debug node has no interface. */
195 config_write_debug (struct vty
*vty
)
199 if (IS_RIPNG_DEBUG_EVENT
)
201 vty_out (vty
, "debug ripng events%s", VTY_NEWLINE
);
204 if (IS_RIPNG_DEBUG_PACKET
)
206 if (IS_RIPNG_DEBUG_SEND
&& IS_RIPNG_DEBUG_RECV
)
208 vty_out (vty
, "debug ripng packet%s",
214 if (IS_RIPNG_DEBUG_SEND
)
215 vty_out (vty
, "debug ripng packet send%s",
218 vty_out (vty
, "debug ripng packet recv%s",
223 if (IS_RIPNG_DEBUG_ZEBRA
)
225 vty_out (vty
, "debug ripng zebra%s", VTY_NEWLINE
);
234 ripng_debug_event
= 0;
235 ripng_debug_packet
= 0;
236 ripng_debug_zebra
= 0;
242 ripng_debug_event
= 0;
243 ripng_debug_packet
= 0;
244 ripng_debug_zebra
= 0;
246 install_node (&debug_node
, config_write_debug
);
248 install_element (VIEW_NODE
, &show_debugging_ripng_cmd
);
250 install_element (ENABLE_NODE
, &debug_ripng_events_cmd
);
251 install_element (ENABLE_NODE
, &debug_ripng_packet_cmd
);
252 install_element (ENABLE_NODE
, &debug_ripng_packet_direct_cmd
);
253 install_element (ENABLE_NODE
, &debug_ripng_zebra_cmd
);
254 install_element (ENABLE_NODE
, &no_debug_ripng_events_cmd
);
255 install_element (ENABLE_NODE
, &no_debug_ripng_packet_cmd
);
256 install_element (ENABLE_NODE
, &no_debug_ripng_packet_direct_cmd
);
257 install_element (ENABLE_NODE
, &no_debug_ripng_zebra_cmd
);
259 install_element (CONFIG_NODE
, &debug_ripng_events_cmd
);
260 install_element (CONFIG_NODE
, &debug_ripng_packet_cmd
);
261 install_element (CONFIG_NODE
, &debug_ripng_packet_direct_cmd
);
262 install_element (CONFIG_NODE
, &debug_ripng_zebra_cmd
);
263 install_element (CONFIG_NODE
, &no_debug_ripng_events_cmd
);
264 install_element (CONFIG_NODE
, &no_debug_ripng_packet_cmd
);
265 install_element (CONFIG_NODE
, &no_debug_ripng_packet_direct_cmd
);
266 install_element (CONFIG_NODE
, &no_debug_ripng_zebra_cmd
);