Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | #include <vlib/vlib.h> |
| 16 | #include <vlib/unix/unix.h> |
| 17 | #include <math.h> |
| 18 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 19 | int |
| 20 | main (int argc, char *argv[]) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 21 | { |
| 22 | return vlib_unix_main (argc, argv); |
| 23 | } |
| 24 | |
| 25 | static clib_error_t * |
| 26 | main_stub_init (vlib_main_t * vm) |
| 27 | { |
Dave Barach | f8d5068 | 2019-05-14 18:01:44 -0400 | [diff] [blame] | 28 | clib_error_t *error = 0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 29 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 30 | return error; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 31 | } |
| 32 | |
Dave Barach | f8d5068 | 2019-05-14 18:01:44 -0400 | [diff] [blame] | 33 | VLIB_INIT_FUNCTION (main_stub_init) = |
| 34 | { |
| 35 | .runs_after = VLIB_INITS("unix_physmem_init", "unix_cli_init"), |
| 36 | }; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 37 | |
| 38 | #if 0 |
| 39 | /* Node test code. */ |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 40 | typedef struct |
| 41 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 42 | int scalar; |
| 43 | int vector[0]; |
| 44 | } my_frame_t; |
| 45 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 46 | static u8 * |
| 47 | format_my_node_frame (u8 * s, va_list * va) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 48 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 49 | vlib_frame_t *f = va_arg (*va, vlib_frame_t *); |
Damjan Marion | a3d5986 | 2018-11-10 10:23:00 +0100 | [diff] [blame] | 50 | my_frame_t *g = vlib_frame_scalar_args (f); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 51 | int i; |
| 52 | |
| 53 | s = format (s, "scalar %d, vector { ", g->scalar); |
| 54 | for (i = 0; i < f->n_vectors; i++) |
| 55 | s = format (s, "%d, ", g->vector[i]); |
| 56 | s = format (s, " }"); |
| 57 | |
| 58 | return s; |
| 59 | } |
| 60 | |
| 61 | static uword |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 62 | my_func (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 63 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 64 | vlib_node_t *node; |
| 65 | my_frame_t *y; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 66 | u32 i, n_left = 0; |
| 67 | static int serial; |
| 68 | int verbose; |
| 69 | |
| 70 | node = vlib_get_node (vm, rt->node_index); |
| 71 | |
| 72 | verbose = 0; |
| 73 | |
| 74 | if (verbose && f) |
| 75 | vlib_cli_output (vm, "%v: call frame %p %U", node->name, |
| 76 | f, format_my_node_frame, f); |
| 77 | |
| 78 | if (rt->n_next_nodes > 0) |
| 79 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 80 | vlib_frame_t *next = vlib_get_next_frame (vm, rt, /* next index */ 0); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 81 | n_left = VLIB_FRAME_SIZE - next->n_vectors; |
Damjan Marion | a3d5986 | 2018-11-10 10:23:00 +0100 | [diff] [blame] | 82 | y = vlib_frame_scalar_args (next); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 83 | y->scalar = serial++; |
| 84 | } |
| 85 | else |
| 86 | y = 0; |
| 87 | |
| 88 | for (i = 0; i < 5; i++) |
| 89 | { |
| 90 | if (y) |
| 91 | { |
| 92 | ASSERT (n_left > 0); |
| 93 | n_left--; |
| 94 | y->vector[i] = y->scalar + i; |
| 95 | } |
| 96 | } |
| 97 | if (y) |
| 98 | vlib_put_next_frame (vm, rt, /* next index */ 0, n_left); |
| 99 | |
| 100 | if (verbose) |
| 101 | vlib_cli_output (vm, "%v: return frame %p", node->name, f); |
| 102 | |
| 103 | return i; |
| 104 | } |
| 105 | |
| 106 | VLIB_REGISTER_NODE (my_node1,static) = { |
| 107 | .function = my_func, |
| 108 | .type = VLIB_NODE_TYPE_INPUT, |
| 109 | .name = "my-node1", |
| 110 | .scalar_size = sizeof (my_frame_t), |
| 111 | .vector_size = STRUCT_SIZE_OF (my_frame_t, vector[0]), |
| 112 | .n_next_nodes = 1, |
| 113 | .next_nodes = { |
| 114 | [0] = "my-node2", |
| 115 | }, |
| 116 | }; |
| 117 | |
| 118 | VLIB_REGISTER_NODE (my_node2,static) = { |
| 119 | .function = my_func, |
| 120 | .name = "my-node2", |
| 121 | .scalar_size = sizeof (my_frame_t), |
| 122 | .vector_size = STRUCT_SIZE_OF (my_frame_t, vector[0]), |
| 123 | }; |
| 124 | |
| 125 | #endif |
| 126 | |
| 127 | #if 0 |
| 128 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 129 | typedef enum |
| 130 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 131 | MY_EVENT_TYPE1, |
| 132 | MY_EVENT_TYPE2, |
| 133 | } my_process_completion_type_t; |
| 134 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 135 | typedef struct |
| 136 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 137 | int a; |
| 138 | f64 b; |
| 139 | } my_process_event_data_t; |
| 140 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 141 | static u8 * |
| 142 | format_my_process_event_data (u8 * s, va_list * va) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 143 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 144 | my_process_event_data_t *d = va_arg (*va, my_process_event_data_t *); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 145 | return format (s, "{ a %d b %.6f}", d->a, d->b); |
| 146 | } |
| 147 | |
| 148 | static uword |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 149 | my_proc (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 150 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 151 | vlib_node_t *node; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 152 | u32 i; |
| 153 | |
| 154 | node = vlib_get_node (vm, rt->node_index); |
| 155 | |
| 156 | vlib_cli_output (vm, "%v: call frame %p", node->name, f); |
| 157 | |
| 158 | for (i = 0; i < 5; i++) |
| 159 | { |
| 160 | vlib_cli_output (vm, "%v: %d", node->name, i); |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 161 | vlib_process_suspend (vm, 1e0 /* secs */ ); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | vlib_cli_output (vm, "%v: return frame %p", node->name, f); |
| 165 | |
| 166 | if (0) |
| 167 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 168 | uword n_events_seen, type, *data = 0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 169 | |
| 170 | for (n_events_seen = 0; n_events_seen < 2;) |
| 171 | { |
| 172 | vlib_process_wait_for_event (vm); |
| 173 | type = vlib_process_get_events (vm, &data); |
| 174 | n_events_seen += vec_len (data); |
| 175 | vlib_cli_output (vm, "%U %v: completion #%d type %d data 0x%wx", |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 176 | format_time_interval, "h:m:s:u", |
| 177 | vlib_time_now (vm), node->name, i, type, data[0]); |
Damjan Marion | 8bea589 | 2022-04-04 22:40:45 +0200 | [diff] [blame] | 178 | vec_set_len (data, 0); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | vec_free (data); |
| 182 | } |
| 183 | else |
| 184 | { |
| 185 | uword n_events_seen, i, type; |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 186 | my_process_event_data_t *data; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 187 | for (n_events_seen = 0; n_events_seen < 2;) |
| 188 | { |
| 189 | vlib_process_wait_for_event (vm); |
| 190 | data = vlib_process_get_event_data (vm, &type); |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 191 | vec_foreach_index (i, data) |
| 192 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 193 | vlib_cli_output (vm, "%U event type %d data %U", |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 194 | format_time_interval, "h:m:s:u", |
| 195 | vlib_time_now (vm), type, |
| 196 | format_my_process_event_data, data); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 197 | } |
| 198 | n_events_seen += vec_len (data); |
| 199 | vlib_process_put_event_data (vm, data); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | return i; |
| 204 | } |
| 205 | |
| 206 | VLIB_REGISTER_NODE (my_proc_node,static) = { |
| 207 | .function = my_proc, |
| 208 | .type = VLIB_NODE_TYPE_PROCESS, |
| 209 | .name = "my-proc", |
| 210 | }; |
| 211 | |
| 212 | static uword |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 213 | my_proc_input (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 214 | { |
| 215 | static int i; |
| 216 | |
| 217 | if (i++ < 2) |
| 218 | { |
| 219 | if (0) |
| 220 | vlib_process_signal_event (vm, my_proc_node.index, |
| 221 | i == 1 ? MY_EVENT_TYPE1 : MY_EVENT_TYPE2, |
| 222 | 0x12340000 + i); |
| 223 | else |
| 224 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 225 | my_process_event_data_t *d; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 226 | f64 dt = 5; |
| 227 | d = vlib_process_signal_event_at_time (vm, |
| 228 | i * dt, |
| 229 | my_proc_node.index, |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 230 | i == |
| 231 | 1 ? MY_EVENT_TYPE1 : |
| 232 | MY_EVENT_TYPE2, |
| 233 | 1 /* elts */ , |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 234 | sizeof (d[0])); |
| 235 | d->a = i; |
| 236 | d->b = vlib_time_now (vm); |
| 237 | } |
| 238 | } |
| 239 | else |
| 240 | vlib_node_set_state (vm, rt->node_index, VLIB_NODE_STATE_DISABLED); |
| 241 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 242 | return 0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | VLIB_REGISTER_NODE (my_proc_input_node,static) = { |
| 246 | .function = my_proc_input, |
| 247 | .type = VLIB_NODE_TYPE_INPUT, |
| 248 | .name = "my-proc-input", |
| 249 | }; |
| 250 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 251 | static uword |
| 252 | _unformat_farith (unformat_input_t * i, va_list * args) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 253 | { |
| 254 | u32 prec = va_arg (*args, u32); |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 255 | f64 *result = va_arg (*args, f64 *); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 256 | f64 tmp[2]; |
| 257 | |
| 258 | /* Binary operations in from lowest to highest precedence. */ |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 259 | char *binops[] = { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 260 | "+%U", "-%U", "/%U", "*%U", "^%U", |
| 261 | }; |
| 262 | |
| 263 | if (prec <= ARRAY_LEN (binops) - 1 |
| 264 | && unformat_user (i, _unformat_farith, prec + 1, &tmp[0])) |
| 265 | { |
| 266 | int p; |
| 267 | for (p = prec; p < ARRAY_LEN (binops); p++) |
| 268 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 269 | if (unformat (i, binops[p], _unformat_farith, prec + 0, &tmp[1])) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 270 | { |
| 271 | switch (binops[p][0]) |
| 272 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 273 | case '+': |
| 274 | result[0] = tmp[0] + tmp[1]; |
| 275 | break; |
| 276 | case '-': |
| 277 | result[0] = tmp[0] - tmp[1]; |
| 278 | break; |
| 279 | case '/': |
| 280 | result[0] = tmp[0] / tmp[1]; |
| 281 | break; |
| 282 | case '*': |
| 283 | result[0] = tmp[0] * tmp[1]; |
| 284 | break; |
| 285 | case '^': |
| 286 | result[0] = pow (tmp[0], tmp[1]); |
| 287 | break; |
| 288 | default: |
| 289 | abort (); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 290 | } |
| 291 | return 1; |
| 292 | } |
| 293 | } |
| 294 | result[0] = tmp[0]; |
| 295 | return 1; |
| 296 | } |
| 297 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 298 | else if (unformat (i, "-%U", _unformat_farith, prec + 0, &tmp[0])) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 299 | { |
| 300 | result[0] = -tmp[0]; |
| 301 | return 1; |
| 302 | } |
| 303 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 304 | else if (unformat (i, "(%U)", _unformat_farith, 0, &tmp[0])) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 305 | { |
| 306 | result[0] = tmp[0]; |
| 307 | return 1; |
| 308 | } |
| 309 | |
| 310 | else if (unformat (i, "%f", result)) |
| 311 | return 1; |
| 312 | |
| 313 | else |
| 314 | return 0; |
| 315 | } |
| 316 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 317 | static uword |
| 318 | unformat_farith (unformat_input_t * i, va_list * args) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 319 | { |
| 320 | CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 321 | f64 *result = va_arg (*args, f64 *); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 322 | return unformat_user (i, _unformat_farith, 0, result); |
| 323 | } |
| 324 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 325 | static uword |
| 326 | unformat_integer (unformat_input_t * i, va_list * args) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 327 | { |
| 328 | CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 329 | u32 *data = va_arg (*args, u32 *); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 330 | return unformat (i, "%d", data); |
| 331 | } |
| 332 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 333 | static VLIB_CLI_PARSE_RULE (my_parse_rule1) = |
| 334 | { |
| 335 | .name = "decimal_integer",.short_help = |
| 336 | "a decimal integer",.unformat_function = unformat_integer,.data_size = |
| 337 | sizeof (u32),}; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 338 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 339 | static VLIB_CLI_PARSE_RULE (my_parse_rule2) = |
| 340 | { |
| 341 | .name = "float_expression",.short_help = |
| 342 | "floating point expression",.unformat_function = |
| 343 | unformat_farith,.data_size = sizeof (f64),}; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 344 | |
| 345 | static clib_error_t * |
| 346 | bar_command (vlib_main_t * vm, |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 347 | unformat_input_t * input, vlib_cli_command_t * cmd) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 348 | { |
| 349 | switch (cmd->function_arg) |
| 350 | { |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 351 | case 2: |
| 352 | { |
| 353 | u32 *d, *e; |
| 354 | d = vlib_cli_get_parse_rule_result (vm, 0); |
| 355 | e = vlib_cli_get_parse_rule_result (vm, 1); |
| 356 | vlib_cli_output (vm, "bar2 %d %d", d[0], e[0]); |
| 357 | break; |
| 358 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 359 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 360 | case 1: |
| 361 | { |
| 362 | u32 *d = vlib_cli_get_parse_rule_result (vm, 0); |
| 363 | vlib_cli_output (vm, "bar1 %d", d[0]); |
| 364 | break; |
| 365 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 366 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 367 | case 3: |
| 368 | { |
| 369 | f64 *d = vlib_cli_get_parse_rule_result (vm, 0); |
| 370 | vlib_cli_output (vm, "expr %.6f", d[0]); |
| 371 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 372 | } |
| 373 | |
| 374 | return 0; |
| 375 | } |
| 376 | |
| 377 | VLIB_CLI_COMMAND (bar_command2, static) = { |
| 378 | .path = "bar %decimal_integer", |
| 379 | .short_help = "bar1 command", |
| 380 | .function = bar_command, |
| 381 | .function_arg = 1, |
| 382 | }; |
| 383 | VLIB_CLI_COMMAND (bar_command1, static) = { |
| 384 | .path = "bar %decimal_integer %decimal_integer", |
| 385 | .short_help = "bar2 command", |
| 386 | .function = bar_command, |
| 387 | .function_arg = 2, |
| 388 | }; |
| 389 | VLIB_CLI_COMMAND (bar_command3, static) = { |
| 390 | .path = "zap %float_expression", |
| 391 | .short_help = "bar3 command", |
| 392 | .function = bar_command, |
| 393 | .function_arg = 3, |
| 394 | }; |
| 395 | |
| 396 | #endif |
| 397 | |
Dave Barach | 9b8ffd9 | 2016-07-08 08:13:45 -0400 | [diff] [blame] | 398 | /* |
| 399 | * fd.io coding-style-patch-verification: ON |
| 400 | * |
| 401 | * Local Variables: |
| 402 | * eval: (c-set-style "gnu") |
| 403 | * End: |
| 404 | */ |