Line | Count | Source |
1 | | /* interface => "interface IFNAME [vrf NAME$vrf_name]" */ |
2 | | DEFUN_CMD_FUNC_DECL(interface) |
3 | | #define funcdecl_interface static int interface_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 * ifname,\ |
9 | | const char * vrf_name) |
10 | | funcdecl_interface; |
11 | | DEFUN_CMD_FUNC_TEXT(interface) |
12 | 0 | { |
13 | 0 | #if 2 /* anything to parse? */ |
14 | 0 | int _i; |
15 | | #if 0 /* anything that can fail? */ |
16 | | unsigned _fail = 0, _failcnt = 0; |
17 | | #endif |
18 | 0 | const char *ifname = NULL; |
19 | 0 | const char *vrf_name = NULL; |
20 | |
|
21 | 0 | for (_i = 0; _i < argc; _i++) { |
22 | 0 | if (!argv[_i]->varname) |
23 | 0 | continue; |
24 | | #if 0 /* anything that can fail? */ |
25 | | _fail = 0; |
26 | | #endif |
27 | | |
28 | 0 | if (!strcmp(argv[_i]->varname, "ifname")) { |
29 | 0 | ifname = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
30 | 0 | } |
31 | 0 | if (!strcmp(argv[_i]->varname, "vrf_name")) { |
32 | 0 | vrf_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
33 | 0 | } |
34 | | #if 0 /* anything that can fail? */ |
35 | | if (_fail) |
36 | | vty_out (vty, "%% invalid input for %s: %s\n", |
37 | | argv[_i]->varname, argv[_i]->arg); |
38 | | _failcnt += _fail; |
39 | | #endif |
40 | 0 | } |
41 | | #if 0 /* anything that can fail? */ |
42 | | if (_failcnt) |
43 | | return CMD_WARNING; |
44 | | #endif |
45 | 0 | #endif |
46 | 0 | if (!ifname) { |
47 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "ifname"); |
48 | 0 | return CMD_WARNING; |
49 | 0 | } |
50 | | |
51 | 0 | return interface_magic(self, vty, argc, argv, ifname, vrf_name); |
52 | 0 | } |
53 | | |
54 | | /* no_interface => "no interface IFNAME [vrf NAME$vrf_name]" */ |
55 | | DEFUN_CMD_FUNC_DECL(no_interface) |
56 | | #define funcdecl_no_interface static int no_interface_magic(\ |
57 | | const struct cmd_element *self __attribute__ ((unused)),\ |
58 | | struct vty *vty __attribute__ ((unused)),\ |
59 | | int argc __attribute__ ((unused)),\ |
60 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
61 | | const char * ifname,\ |
62 | | const char * vrf_name) |
63 | | funcdecl_no_interface; |
64 | | DEFUN_CMD_FUNC_TEXT(no_interface) |
65 | 0 | { |
66 | 0 | #if 2 /* anything to parse? */ |
67 | 0 | int _i; |
68 | | #if 0 /* anything that can fail? */ |
69 | | unsigned _fail = 0, _failcnt = 0; |
70 | | #endif |
71 | 0 | const char *ifname = NULL; |
72 | 0 | const char *vrf_name = NULL; |
73 | |
|
74 | 0 | for (_i = 0; _i < argc; _i++) { |
75 | 0 | if (!argv[_i]->varname) |
76 | 0 | continue; |
77 | | #if 0 /* anything that can fail? */ |
78 | | _fail = 0; |
79 | | #endif |
80 | | |
81 | 0 | if (!strcmp(argv[_i]->varname, "ifname")) { |
82 | 0 | ifname = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
83 | 0 | } |
84 | 0 | if (!strcmp(argv[_i]->varname, "vrf_name")) { |
85 | 0 | vrf_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
86 | 0 | } |
87 | | #if 0 /* anything that can fail? */ |
88 | | if (_fail) |
89 | | vty_out (vty, "%% invalid input for %s: %s\n", |
90 | | argv[_i]->varname, argv[_i]->arg); |
91 | | _failcnt += _fail; |
92 | | #endif |
93 | 0 | } |
94 | | #if 0 /* anything that can fail? */ |
95 | | if (_failcnt) |
96 | | return CMD_WARNING; |
97 | | #endif |
98 | 0 | #endif |
99 | 0 | if (!ifname) { |
100 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "ifname"); |
101 | 0 | return CMD_WARNING; |
102 | 0 | } |
103 | | |
104 | 0 | return no_interface_magic(self, vty, argc, argv, ifname, vrf_name); |
105 | 0 | } |
106 | | |
107 | | /* interface_desc => "description LINE..." */ |
108 | | DEFUN_CMD_FUNC_DECL(interface_desc) |
109 | | #define funcdecl_interface_desc static int interface_desc_magic(\ |
110 | | const struct cmd_element *self __attribute__ ((unused)),\ |
111 | | struct vty *vty __attribute__ ((unused)),\ |
112 | | int argc __attribute__ ((unused)),\ |
113 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
114 | | const char * line) |
115 | | funcdecl_interface_desc; |
116 | | DEFUN_CMD_FUNC_TEXT(interface_desc) |
117 | 0 | { |
118 | 0 | #if 1 /* anything to parse? */ |
119 | 0 | int _i; |
120 | | #if 0 /* anything that can fail? */ |
121 | | unsigned _fail = 0, _failcnt = 0; |
122 | | #endif |
123 | 0 | const char *line = NULL; |
124 | |
|
125 | 0 | for (_i = 0; _i < argc; _i++) { |
126 | 0 | if (!argv[_i]->varname) |
127 | 0 | continue; |
128 | | #if 0 /* anything that can fail? */ |
129 | | _fail = 0; |
130 | | #endif |
131 | | |
132 | 0 | if (!strcmp(argv[_i]->varname, "line")) { |
133 | 0 | line = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
134 | 0 | } |
135 | | #if 0 /* anything that can fail? */ |
136 | | if (_fail) |
137 | | vty_out (vty, "%% invalid input for %s: %s\n", |
138 | | argv[_i]->varname, argv[_i]->arg); |
139 | | _failcnt += _fail; |
140 | | #endif |
141 | 0 | } |
142 | | #if 0 /* anything that can fail? */ |
143 | | if (_failcnt) |
144 | | return CMD_WARNING; |
145 | | #endif |
146 | 0 | #endif |
147 | 0 | if (!line) { |
148 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "line"); |
149 | 0 | return CMD_WARNING; |
150 | 0 | } |
151 | | |
152 | 0 | return interface_desc_magic(self, vty, argc, argv, line); |
153 | 0 | } |
154 | | |
155 | | /* no_interface_desc => "no description" */ |
156 | | DEFUN_CMD_FUNC_DECL(no_interface_desc) |
157 | | #define funcdecl_no_interface_desc static int no_interface_desc_magic(\ |
158 | | const struct cmd_element *self __attribute__ ((unused)),\ |
159 | | struct vty *vty __attribute__ ((unused)),\ |
160 | | int argc __attribute__ ((unused)),\ |
161 | | struct cmd_token *argv[] __attribute__ ((unused))) |
162 | | funcdecl_no_interface_desc; |
163 | | DEFUN_CMD_FUNC_TEXT(no_interface_desc) |
164 | 0 | { |
165 | | #if 0 /* anything to parse? */ |
166 | | int _i; |
167 | | #if 0 /* anything that can fail? */ |
168 | | unsigned _fail = 0, _failcnt = 0; |
169 | | #endif |
170 | | |
171 | | for (_i = 0; _i < argc; _i++) { |
172 | | if (!argv[_i]->varname) |
173 | | continue; |
174 | | #if 0 /* anything that can fail? */ |
175 | | _fail = 0; |
176 | | #endif |
177 | | |
178 | | #if 0 /* anything that can fail? */ |
179 | | if (_fail) |
180 | | vty_out (vty, "%% invalid input for %s: %s\n", |
181 | | argv[_i]->varname, argv[_i]->arg); |
182 | | _failcnt += _fail; |
183 | | #endif |
184 | | } |
185 | | #if 0 /* anything that can fail? */ |
186 | | if (_failcnt) |
187 | | return CMD_WARNING; |
188 | | #endif |
189 | | #endif |
190 | |
|
191 | 0 | return no_interface_desc_magic(self, vty, argc, argv); |
192 | 0 | } |
193 | | |