/src/frr/lib/plist_clippy.c
Line | Count | Source |
1 | | /* show_ip_prefix_list => "show ip prefix-list [WORD [seq$dseq (1-4294967295)$arg]] [json$uj]" */ |
2 | | DEFUN_CMD_FUNC_DECL(show_ip_prefix_list) |
3 | | #define funcdecl_show_ip_prefix_list static int show_ip_prefix_list_magic(\ |
4 | | const struct cmd_element *self __attribute__ ((unused)),\ |
5 | | struct vty *vty __attribute__ ((unused)),\ |
6 | | int argc __attribute__ ((unused)),\ |
7 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
8 | | const char * prefix_list,\ |
9 | | const char * dseq,\ |
10 | | long arg,\ |
11 | | const char * arg_str __attribute__ ((unused)),\ |
12 | | const char * uj) |
13 | | funcdecl_show_ip_prefix_list; |
14 | | DEFUN_CMD_FUNC_TEXT(show_ip_prefix_list) |
15 | 0 | { |
16 | 0 | #if 4 /* anything to parse? */ |
17 | 0 | int _i; |
18 | 0 | #if 1 /* anything that can fail? */ |
19 | 0 | unsigned _fail = 0, _failcnt = 0; |
20 | 0 | #endif |
21 | 0 | const char *prefix_list = NULL; |
22 | 0 | const char *dseq = NULL; |
23 | 0 | long arg = 0; |
24 | 0 | const char *arg_str = NULL; |
25 | 0 | const char *uj = NULL; |
26 | |
|
27 | 0 | for (_i = 0; _i < argc; _i++) { |
28 | 0 | if (!argv[_i]->varname) |
29 | 0 | continue; |
30 | 0 | #if 1 /* anything that can fail? */ |
31 | 0 | _fail = 0; |
32 | 0 | #endif |
33 | |
|
34 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
35 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
36 | 0 | } |
37 | 0 | if (!strcmp(argv[_i]->varname, "dseq")) { |
38 | 0 | dseq = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
39 | 0 | } |
40 | 0 | if (!strcmp(argv[_i]->varname, "arg")) { |
41 | 0 | arg_str = argv[_i]->arg; |
42 | 0 | char *_end; |
43 | 0 | arg = strtol(argv[_i]->arg, &_end, 10); |
44 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
45 | 0 | } |
46 | 0 | if (!strcmp(argv[_i]->varname, "uj")) { |
47 | 0 | uj = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
48 | 0 | } |
49 | 0 | #if 1 /* anything that can fail? */ |
50 | 0 | if (_fail) |
51 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
52 | 0 | argv[_i]->varname, argv[_i]->arg); |
53 | 0 | _failcnt += _fail; |
54 | 0 | #endif |
55 | 0 | } |
56 | 0 | #if 1 /* anything that can fail? */ |
57 | 0 | if (_failcnt) |
58 | 0 | return CMD_WARNING; |
59 | 0 | #endif |
60 | 0 | #endif |
61 | | |
62 | 0 | return show_ip_prefix_list_magic(self, vty, argc, argv, prefix_list, dseq, arg, arg_str, uj); |
63 | 0 | } |
64 | | |
65 | | /* show_ip_prefix_list_prefix => "show ip prefix-list WORD A.B.C.D/M$prefix [longer$dl|first-match$dfm]" */ |
66 | | DEFUN_CMD_FUNC_DECL(show_ip_prefix_list_prefix) |
67 | | #define funcdecl_show_ip_prefix_list_prefix static int show_ip_prefix_list_prefix_magic(\ |
68 | | const struct cmd_element *self __attribute__ ((unused)),\ |
69 | | struct vty *vty __attribute__ ((unused)),\ |
70 | | int argc __attribute__ ((unused)),\ |
71 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
72 | | const char * prefix_list,\ |
73 | | const struct prefix_ipv4 * prefix,\ |
74 | | const char * prefix_str __attribute__ ((unused)),\ |
75 | | const char * dl,\ |
76 | | const char * dfm) |
77 | | funcdecl_show_ip_prefix_list_prefix; |
78 | | DEFUN_CMD_FUNC_TEXT(show_ip_prefix_list_prefix) |
79 | 0 | { |
80 | 0 | #if 4 /* anything to parse? */ |
81 | 0 | int _i; |
82 | 0 | #if 1 /* anything that can fail? */ |
83 | 0 | unsigned _fail = 0, _failcnt = 0; |
84 | 0 | #endif |
85 | 0 | const char *prefix_list = NULL; |
86 | 0 | struct prefix_ipv4 prefix = { }; |
87 | 0 | const char *prefix_str = NULL; |
88 | 0 | const char *dl = NULL; |
89 | 0 | const char *dfm = NULL; |
90 | |
|
91 | 0 | for (_i = 0; _i < argc; _i++) { |
92 | 0 | if (!argv[_i]->varname) |
93 | 0 | continue; |
94 | 0 | #if 1 /* anything that can fail? */ |
95 | 0 | _fail = 0; |
96 | 0 | #endif |
97 | |
|
98 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
99 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
100 | 0 | } |
101 | 0 | if (!strcmp(argv[_i]->varname, "prefix")) { |
102 | 0 | prefix_str = argv[_i]->arg; |
103 | 0 | _fail = !str2prefix_ipv4(argv[_i]->arg, &prefix); |
104 | 0 | } |
105 | 0 | if (!strcmp(argv[_i]->varname, "dl")) { |
106 | 0 | dl = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
107 | 0 | } |
108 | 0 | if (!strcmp(argv[_i]->varname, "dfm")) { |
109 | 0 | dfm = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
110 | 0 | } |
111 | 0 | #if 1 /* anything that can fail? */ |
112 | 0 | if (_fail) |
113 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
114 | 0 | argv[_i]->varname, argv[_i]->arg); |
115 | 0 | _failcnt += _fail; |
116 | 0 | #endif |
117 | 0 | } |
118 | 0 | #if 1 /* anything that can fail? */ |
119 | 0 | if (_failcnt) |
120 | 0 | return CMD_WARNING; |
121 | 0 | #endif |
122 | 0 | #endif |
123 | 0 | if (!prefix_list) { |
124 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "prefix_list"); |
125 | 0 | return CMD_WARNING; |
126 | 0 | } |
127 | 0 | if (!prefix_str) { |
128 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "prefix_str"); |
129 | 0 | return CMD_WARNING; |
130 | 0 | } |
131 | | |
132 | 0 | return show_ip_prefix_list_prefix_magic(self, vty, argc, argv, prefix_list, &prefix, prefix_str, dl, dfm); |
133 | 0 | } |
134 | | |
135 | | /* show_ip_prefix_list_summary => "show ip prefix-list summary [WORD$prefix_list] [json$uj]" */ |
136 | | DEFUN_CMD_FUNC_DECL(show_ip_prefix_list_summary) |
137 | | #define funcdecl_show_ip_prefix_list_summary static int show_ip_prefix_list_summary_magic(\ |
138 | | const struct cmd_element *self __attribute__ ((unused)),\ |
139 | | struct vty *vty __attribute__ ((unused)),\ |
140 | | int argc __attribute__ ((unused)),\ |
141 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
142 | | const char * prefix_list,\ |
143 | | const char * uj) |
144 | | funcdecl_show_ip_prefix_list_summary; |
145 | | DEFUN_CMD_FUNC_TEXT(show_ip_prefix_list_summary) |
146 | 0 | { |
147 | 0 | #if 2 /* anything to parse? */ |
148 | 0 | int _i; |
149 | | #if 0 /* anything that can fail? */ |
150 | | unsigned _fail = 0, _failcnt = 0; |
151 | | #endif |
152 | 0 | const char *prefix_list = NULL; |
153 | 0 | const char *uj = NULL; |
154 | |
|
155 | 0 | for (_i = 0; _i < argc; _i++) { |
156 | 0 | if (!argv[_i]->varname) |
157 | 0 | continue; |
158 | | #if 0 /* anything that can fail? */ |
159 | | _fail = 0; |
160 | | #endif |
161 | | |
162 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
163 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
164 | 0 | } |
165 | 0 | if (!strcmp(argv[_i]->varname, "uj")) { |
166 | 0 | uj = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
167 | 0 | } |
168 | | #if 0 /* anything that can fail? */ |
169 | | if (_fail) |
170 | | vty_out (vty, "%% invalid input for %s: %s\n", |
171 | | argv[_i]->varname, argv[_i]->arg); |
172 | | _failcnt += _fail; |
173 | | #endif |
174 | 0 | } |
175 | | #if 0 /* anything that can fail? */ |
176 | | if (_failcnt) |
177 | | return CMD_WARNING; |
178 | | #endif |
179 | 0 | #endif |
180 | |
|
181 | 0 | return show_ip_prefix_list_summary_magic(self, vty, argc, argv, prefix_list, uj); |
182 | 0 | } |
183 | | |
184 | | /* show_ip_prefix_list_detail => "show ip prefix-list detail [WORD$prefix_list] [json$uj]" */ |
185 | | DEFUN_CMD_FUNC_DECL(show_ip_prefix_list_detail) |
186 | | #define funcdecl_show_ip_prefix_list_detail static int show_ip_prefix_list_detail_magic(\ |
187 | | const struct cmd_element *self __attribute__ ((unused)),\ |
188 | | struct vty *vty __attribute__ ((unused)),\ |
189 | | int argc __attribute__ ((unused)),\ |
190 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
191 | | const char * prefix_list,\ |
192 | | const char * uj) |
193 | | funcdecl_show_ip_prefix_list_detail; |
194 | | DEFUN_CMD_FUNC_TEXT(show_ip_prefix_list_detail) |
195 | 0 | { |
196 | 0 | #if 2 /* anything to parse? */ |
197 | 0 | int _i; |
198 | | #if 0 /* anything that can fail? */ |
199 | | unsigned _fail = 0, _failcnt = 0; |
200 | | #endif |
201 | 0 | const char *prefix_list = NULL; |
202 | 0 | const char *uj = NULL; |
203 | |
|
204 | 0 | for (_i = 0; _i < argc; _i++) { |
205 | 0 | if (!argv[_i]->varname) |
206 | 0 | continue; |
207 | | #if 0 /* anything that can fail? */ |
208 | | _fail = 0; |
209 | | #endif |
210 | | |
211 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
212 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
213 | 0 | } |
214 | 0 | if (!strcmp(argv[_i]->varname, "uj")) { |
215 | 0 | uj = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
216 | 0 | } |
217 | | #if 0 /* anything that can fail? */ |
218 | | if (_fail) |
219 | | vty_out (vty, "%% invalid input for %s: %s\n", |
220 | | argv[_i]->varname, argv[_i]->arg); |
221 | | _failcnt += _fail; |
222 | | #endif |
223 | 0 | } |
224 | | #if 0 /* anything that can fail? */ |
225 | | if (_failcnt) |
226 | | return CMD_WARNING; |
227 | | #endif |
228 | 0 | #endif |
229 | |
|
230 | 0 | return show_ip_prefix_list_detail_magic(self, vty, argc, argv, prefix_list, uj); |
231 | 0 | } |
232 | | |
233 | | /* clear_ip_prefix_list => "clear ip prefix-list [WORD [A.B.C.D/M$prefix]]" */ |
234 | | DEFUN_CMD_FUNC_DECL(clear_ip_prefix_list) |
235 | | #define funcdecl_clear_ip_prefix_list static int clear_ip_prefix_list_magic(\ |
236 | | const struct cmd_element *self __attribute__ ((unused)),\ |
237 | | struct vty *vty __attribute__ ((unused)),\ |
238 | | int argc __attribute__ ((unused)),\ |
239 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
240 | | const char * prefix_list,\ |
241 | | const struct prefix_ipv4 * prefix,\ |
242 | | const char * prefix_str __attribute__ ((unused))) |
243 | | funcdecl_clear_ip_prefix_list; |
244 | | DEFUN_CMD_FUNC_TEXT(clear_ip_prefix_list) |
245 | 0 | { |
246 | 0 | #if 2 /* anything to parse? */ |
247 | 0 | int _i; |
248 | 0 | #if 1 /* anything that can fail? */ |
249 | 0 | unsigned _fail = 0, _failcnt = 0; |
250 | 0 | #endif |
251 | 0 | const char *prefix_list = NULL; |
252 | 0 | struct prefix_ipv4 prefix = { }; |
253 | 0 | const char *prefix_str = NULL; |
254 | |
|
255 | 0 | for (_i = 0; _i < argc; _i++) { |
256 | 0 | if (!argv[_i]->varname) |
257 | 0 | continue; |
258 | 0 | #if 1 /* anything that can fail? */ |
259 | 0 | _fail = 0; |
260 | 0 | #endif |
261 | |
|
262 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
263 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
264 | 0 | } |
265 | 0 | if (!strcmp(argv[_i]->varname, "prefix")) { |
266 | 0 | prefix_str = argv[_i]->arg; |
267 | 0 | _fail = !str2prefix_ipv4(argv[_i]->arg, &prefix); |
268 | 0 | } |
269 | 0 | #if 1 /* anything that can fail? */ |
270 | 0 | if (_fail) |
271 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
272 | 0 | argv[_i]->varname, argv[_i]->arg); |
273 | 0 | _failcnt += _fail; |
274 | 0 | #endif |
275 | 0 | } |
276 | 0 | #if 1 /* anything that can fail? */ |
277 | 0 | if (_failcnt) |
278 | 0 | return CMD_WARNING; |
279 | 0 | #endif |
280 | 0 | #endif |
281 | | |
282 | 0 | return clear_ip_prefix_list_magic(self, vty, argc, argv, prefix_list, &prefix, prefix_str); |
283 | 0 | } |
284 | | |
285 | | /* show_ipv6_prefix_list => "show ipv6 prefix-list [WORD [seq$dseq (1-4294967295)$arg]] [json$uj]" */ |
286 | | DEFUN_CMD_FUNC_DECL(show_ipv6_prefix_list) |
287 | | #define funcdecl_show_ipv6_prefix_list static int show_ipv6_prefix_list_magic(\ |
288 | | const struct cmd_element *self __attribute__ ((unused)),\ |
289 | | struct vty *vty __attribute__ ((unused)),\ |
290 | | int argc __attribute__ ((unused)),\ |
291 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
292 | | const char * prefix_list,\ |
293 | | const char * dseq,\ |
294 | | long arg,\ |
295 | | const char * arg_str __attribute__ ((unused)),\ |
296 | | const char * uj) |
297 | | funcdecl_show_ipv6_prefix_list; |
298 | | DEFUN_CMD_FUNC_TEXT(show_ipv6_prefix_list) |
299 | 0 | { |
300 | 0 | #if 4 /* anything to parse? */ |
301 | 0 | int _i; |
302 | 0 | #if 1 /* anything that can fail? */ |
303 | 0 | unsigned _fail = 0, _failcnt = 0; |
304 | 0 | #endif |
305 | 0 | const char *prefix_list = NULL; |
306 | 0 | const char *dseq = NULL; |
307 | 0 | long arg = 0; |
308 | 0 | const char *arg_str = NULL; |
309 | 0 | const char *uj = NULL; |
310 | |
|
311 | 0 | for (_i = 0; _i < argc; _i++) { |
312 | 0 | if (!argv[_i]->varname) |
313 | 0 | continue; |
314 | 0 | #if 1 /* anything that can fail? */ |
315 | 0 | _fail = 0; |
316 | 0 | #endif |
317 | |
|
318 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
319 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
320 | 0 | } |
321 | 0 | if (!strcmp(argv[_i]->varname, "dseq")) { |
322 | 0 | dseq = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
323 | 0 | } |
324 | 0 | if (!strcmp(argv[_i]->varname, "arg")) { |
325 | 0 | arg_str = argv[_i]->arg; |
326 | 0 | char *_end; |
327 | 0 | arg = strtol(argv[_i]->arg, &_end, 10); |
328 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
329 | 0 | } |
330 | 0 | if (!strcmp(argv[_i]->varname, "uj")) { |
331 | 0 | uj = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
332 | 0 | } |
333 | 0 | #if 1 /* anything that can fail? */ |
334 | 0 | if (_fail) |
335 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
336 | 0 | argv[_i]->varname, argv[_i]->arg); |
337 | 0 | _failcnt += _fail; |
338 | 0 | #endif |
339 | 0 | } |
340 | 0 | #if 1 /* anything that can fail? */ |
341 | 0 | if (_failcnt) |
342 | 0 | return CMD_WARNING; |
343 | 0 | #endif |
344 | 0 | #endif |
345 | | |
346 | 0 | return show_ipv6_prefix_list_magic(self, vty, argc, argv, prefix_list, dseq, arg, arg_str, uj); |
347 | 0 | } |
348 | | |
349 | | /* show_ipv6_prefix_list_prefix => "show ipv6 prefix-list WORD X:X::X:X/M$prefix [longer$dl|first-match$dfm]" */ |
350 | | DEFUN_CMD_FUNC_DECL(show_ipv6_prefix_list_prefix) |
351 | | #define funcdecl_show_ipv6_prefix_list_prefix static int show_ipv6_prefix_list_prefix_magic(\ |
352 | | const struct cmd_element *self __attribute__ ((unused)),\ |
353 | | struct vty *vty __attribute__ ((unused)),\ |
354 | | int argc __attribute__ ((unused)),\ |
355 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
356 | | const char * prefix_list,\ |
357 | | const struct prefix_ipv6 * prefix,\ |
358 | | const char * prefix_str __attribute__ ((unused)),\ |
359 | | const char * dl,\ |
360 | | const char * dfm) |
361 | | funcdecl_show_ipv6_prefix_list_prefix; |
362 | | DEFUN_CMD_FUNC_TEXT(show_ipv6_prefix_list_prefix) |
363 | 0 | { |
364 | 0 | #if 4 /* anything to parse? */ |
365 | 0 | int _i; |
366 | 0 | #if 1 /* anything that can fail? */ |
367 | 0 | unsigned _fail = 0, _failcnt = 0; |
368 | 0 | #endif |
369 | 0 | const char *prefix_list = NULL; |
370 | 0 | struct prefix_ipv6 prefix = { }; |
371 | 0 | const char *prefix_str = NULL; |
372 | 0 | const char *dl = NULL; |
373 | 0 | const char *dfm = NULL; |
374 | |
|
375 | 0 | for (_i = 0; _i < argc; _i++) { |
376 | 0 | if (!argv[_i]->varname) |
377 | 0 | continue; |
378 | 0 | #if 1 /* anything that can fail? */ |
379 | 0 | _fail = 0; |
380 | 0 | #endif |
381 | |
|
382 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
383 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
384 | 0 | } |
385 | 0 | if (!strcmp(argv[_i]->varname, "prefix")) { |
386 | 0 | prefix_str = argv[_i]->arg; |
387 | 0 | _fail = !str2prefix_ipv6(argv[_i]->arg, &prefix); |
388 | 0 | } |
389 | 0 | if (!strcmp(argv[_i]->varname, "dl")) { |
390 | 0 | dl = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
391 | 0 | } |
392 | 0 | if (!strcmp(argv[_i]->varname, "dfm")) { |
393 | 0 | dfm = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
394 | 0 | } |
395 | 0 | #if 1 /* anything that can fail? */ |
396 | 0 | if (_fail) |
397 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
398 | 0 | argv[_i]->varname, argv[_i]->arg); |
399 | 0 | _failcnt += _fail; |
400 | 0 | #endif |
401 | 0 | } |
402 | 0 | #if 1 /* anything that can fail? */ |
403 | 0 | if (_failcnt) |
404 | 0 | return CMD_WARNING; |
405 | 0 | #endif |
406 | 0 | #endif |
407 | 0 | if (!prefix_list) { |
408 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "prefix_list"); |
409 | 0 | return CMD_WARNING; |
410 | 0 | } |
411 | 0 | if (!prefix_str) { |
412 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "prefix_str"); |
413 | 0 | return CMD_WARNING; |
414 | 0 | } |
415 | | |
416 | 0 | return show_ipv6_prefix_list_prefix_magic(self, vty, argc, argv, prefix_list, &prefix, prefix_str, dl, dfm); |
417 | 0 | } |
418 | | |
419 | | /* show_ipv6_prefix_list_summary => "show ipv6 prefix-list summary [WORD$prefix-list] [json$uj]" */ |
420 | | DEFUN_CMD_FUNC_DECL(show_ipv6_prefix_list_summary) |
421 | | #define funcdecl_show_ipv6_prefix_list_summary static int show_ipv6_prefix_list_summary_magic(\ |
422 | | const struct cmd_element *self __attribute__ ((unused)),\ |
423 | | struct vty *vty __attribute__ ((unused)),\ |
424 | | int argc __attribute__ ((unused)),\ |
425 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
426 | | const char * prefix_list,\ |
427 | | const char * uj) |
428 | | funcdecl_show_ipv6_prefix_list_summary; |
429 | | DEFUN_CMD_FUNC_TEXT(show_ipv6_prefix_list_summary) |
430 | 0 | { |
431 | 0 | #if 2 /* anything to parse? */ |
432 | 0 | int _i; |
433 | | #if 0 /* anything that can fail? */ |
434 | | unsigned _fail = 0, _failcnt = 0; |
435 | | #endif |
436 | 0 | const char *prefix_list = NULL; |
437 | 0 | const char *uj = NULL; |
438 | |
|
439 | 0 | for (_i = 0; _i < argc; _i++) { |
440 | 0 | if (!argv[_i]->varname) |
441 | 0 | continue; |
442 | | #if 0 /* anything that can fail? */ |
443 | | _fail = 0; |
444 | | #endif |
445 | | |
446 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
447 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
448 | 0 | } |
449 | 0 | if (!strcmp(argv[_i]->varname, "uj")) { |
450 | 0 | uj = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
451 | 0 | } |
452 | | #if 0 /* anything that can fail? */ |
453 | | if (_fail) |
454 | | vty_out (vty, "%% invalid input for %s: %s\n", |
455 | | argv[_i]->varname, argv[_i]->arg); |
456 | | _failcnt += _fail; |
457 | | #endif |
458 | 0 | } |
459 | | #if 0 /* anything that can fail? */ |
460 | | if (_failcnt) |
461 | | return CMD_WARNING; |
462 | | #endif |
463 | 0 | #endif |
464 | |
|
465 | 0 | return show_ipv6_prefix_list_summary_magic(self, vty, argc, argv, prefix_list, uj); |
466 | 0 | } |
467 | | |
468 | | /* show_ipv6_prefix_list_detail => "show ipv6 prefix-list detail [WORD$prefix-list] [json$uj]" */ |
469 | | DEFUN_CMD_FUNC_DECL(show_ipv6_prefix_list_detail) |
470 | | #define funcdecl_show_ipv6_prefix_list_detail static int show_ipv6_prefix_list_detail_magic(\ |
471 | | const struct cmd_element *self __attribute__ ((unused)),\ |
472 | | struct vty *vty __attribute__ ((unused)),\ |
473 | | int argc __attribute__ ((unused)),\ |
474 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
475 | | const char * prefix_list,\ |
476 | | const char * uj) |
477 | | funcdecl_show_ipv6_prefix_list_detail; |
478 | | DEFUN_CMD_FUNC_TEXT(show_ipv6_prefix_list_detail) |
479 | 0 | { |
480 | 0 | #if 2 /* anything to parse? */ |
481 | 0 | int _i; |
482 | | #if 0 /* anything that can fail? */ |
483 | | unsigned _fail = 0, _failcnt = 0; |
484 | | #endif |
485 | 0 | const char *prefix_list = NULL; |
486 | 0 | const char *uj = NULL; |
487 | |
|
488 | 0 | for (_i = 0; _i < argc; _i++) { |
489 | 0 | if (!argv[_i]->varname) |
490 | 0 | continue; |
491 | | #if 0 /* anything that can fail? */ |
492 | | _fail = 0; |
493 | | #endif |
494 | | |
495 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
496 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
497 | 0 | } |
498 | 0 | if (!strcmp(argv[_i]->varname, "uj")) { |
499 | 0 | uj = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
500 | 0 | } |
501 | | #if 0 /* anything that can fail? */ |
502 | | if (_fail) |
503 | | vty_out (vty, "%% invalid input for %s: %s\n", |
504 | | argv[_i]->varname, argv[_i]->arg); |
505 | | _failcnt += _fail; |
506 | | #endif |
507 | 0 | } |
508 | | #if 0 /* anything that can fail? */ |
509 | | if (_failcnt) |
510 | | return CMD_WARNING; |
511 | | #endif |
512 | 0 | #endif |
513 | |
|
514 | 0 | return show_ipv6_prefix_list_detail_magic(self, vty, argc, argv, prefix_list, uj); |
515 | 0 | } |
516 | | |
517 | | /* clear_ipv6_prefix_list => "clear ipv6 prefix-list [WORD [X:X::X:X/M$prefix]]" */ |
518 | | DEFUN_CMD_FUNC_DECL(clear_ipv6_prefix_list) |
519 | | #define funcdecl_clear_ipv6_prefix_list static int clear_ipv6_prefix_list_magic(\ |
520 | | const struct cmd_element *self __attribute__ ((unused)),\ |
521 | | struct vty *vty __attribute__ ((unused)),\ |
522 | | int argc __attribute__ ((unused)),\ |
523 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
524 | | const char * prefix_list,\ |
525 | | const struct prefix_ipv6 * prefix,\ |
526 | | const char * prefix_str __attribute__ ((unused))) |
527 | | funcdecl_clear_ipv6_prefix_list; |
528 | | DEFUN_CMD_FUNC_TEXT(clear_ipv6_prefix_list) |
529 | 0 | { |
530 | 0 | #if 2 /* anything to parse? */ |
531 | 0 | int _i; |
532 | 0 | #if 1 /* anything that can fail? */ |
533 | 0 | unsigned _fail = 0, _failcnt = 0; |
534 | 0 | #endif |
535 | 0 | const char *prefix_list = NULL; |
536 | 0 | struct prefix_ipv6 prefix = { }; |
537 | 0 | const char *prefix_str = NULL; |
538 | |
|
539 | 0 | for (_i = 0; _i < argc; _i++) { |
540 | 0 | if (!argv[_i]->varname) |
541 | 0 | continue; |
542 | 0 | #if 1 /* anything that can fail? */ |
543 | 0 | _fail = 0; |
544 | 0 | #endif |
545 | |
|
546 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
547 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
548 | 0 | } |
549 | 0 | if (!strcmp(argv[_i]->varname, "prefix")) { |
550 | 0 | prefix_str = argv[_i]->arg; |
551 | 0 | _fail = !str2prefix_ipv6(argv[_i]->arg, &prefix); |
552 | 0 | } |
553 | 0 | #if 1 /* anything that can fail? */ |
554 | 0 | if (_fail) |
555 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
556 | 0 | argv[_i]->varname, argv[_i]->arg); |
557 | 0 | _failcnt += _fail; |
558 | 0 | #endif |
559 | 0 | } |
560 | 0 | #if 1 /* anything that can fail? */ |
561 | 0 | if (_failcnt) |
562 | 0 | return CMD_WARNING; |
563 | 0 | #endif |
564 | 0 | #endif |
565 | | |
566 | 0 | return clear_ipv6_prefix_list_magic(self, vty, argc, argv, prefix_list, &prefix, prefix_str); |
567 | 0 | } |
568 | | |
569 | | /* debug_prefix_list_match => "debug prefix-list WORD$prefix-list match <A.B.C.D/M|X:X::X:X/M> [address-mode$addr_mode]" */ |
570 | | DEFUN_CMD_FUNC_DECL(debug_prefix_list_match) |
571 | | #define funcdecl_debug_prefix_list_match static int debug_prefix_list_match_magic(\ |
572 | | const struct cmd_element *self __attribute__ ((unused)),\ |
573 | | struct vty *vty __attribute__ ((unused)),\ |
574 | | int argc __attribute__ ((unused)),\ |
575 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
576 | | const char * prefix_list,\ |
577 | | const struct prefix * match,\ |
578 | | const char * match_str __attribute__ ((unused)),\ |
579 | | const char * addr_mode) |
580 | | funcdecl_debug_prefix_list_match; |
581 | | DEFUN_CMD_FUNC_TEXT(debug_prefix_list_match) |
582 | 0 | { |
583 | 0 | #if 3 /* anything to parse? */ |
584 | 0 | int _i; |
585 | 0 | #if 1 /* anything that can fail? */ |
586 | 0 | unsigned _fail = 0, _failcnt = 0; |
587 | 0 | #endif |
588 | 0 | const char *prefix_list = NULL; |
589 | 0 | struct prefix match = { }; |
590 | 0 | const char *match_str = NULL; |
591 | 0 | const char *addr_mode = NULL; |
592 | |
|
593 | 0 | for (_i = 0; _i < argc; _i++) { |
594 | 0 | if (!argv[_i]->varname) |
595 | 0 | continue; |
596 | 0 | #if 1 /* anything that can fail? */ |
597 | 0 | _fail = 0; |
598 | 0 | #endif |
599 | |
|
600 | 0 | if (!strcmp(argv[_i]->varname, "prefix_list")) { |
601 | 0 | prefix_list = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
602 | 0 | } |
603 | 0 | if (!strcmp(argv[_i]->varname, "match")) { |
604 | 0 | match_str = argv[_i]->arg; |
605 | 0 | _fail = !str2prefix(argv[_i]->arg, &match); |
606 | 0 | } |
607 | 0 | if (!strcmp(argv[_i]->varname, "addr_mode")) { |
608 | 0 | addr_mode = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
609 | 0 | } |
610 | 0 | #if 1 /* anything that can fail? */ |
611 | 0 | if (_fail) |
612 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
613 | 0 | argv[_i]->varname, argv[_i]->arg); |
614 | 0 | _failcnt += _fail; |
615 | 0 | #endif |
616 | 0 | } |
617 | 0 | #if 1 /* anything that can fail? */ |
618 | 0 | if (_failcnt) |
619 | 0 | return CMD_WARNING; |
620 | 0 | #endif |
621 | 0 | #endif |
622 | 0 | if (!prefix_list) { |
623 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "prefix_list"); |
624 | 0 | return CMD_WARNING; |
625 | 0 | } |
626 | 0 | if (!match_str) { |
627 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "match_str"); |
628 | 0 | return CMD_WARNING; |
629 | 0 | } |
630 | | |
631 | 0 | return debug_prefix_list_match_magic(self, vty, argc, argv, prefix_list, &match, match_str, addr_mode); |
632 | 0 | } |
633 | | |