2 * oddbuf.c - awkward chained buffer geometry test tool
4 * Copyright (c) 2019 by Cisco and/or its affiliates.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include <vlibapi/api.h>
19 #include <vlibmemory/api.h>
20 #include <vppinfra/error.h>
23 uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
25 /* Declare message IDs */
26 #include <oddbuf/oddbuf.api_enum.h>
27 #include <oddbuf/oddbuf.api_types.h>
31 /* API message ID base */
36 oddbuf_test_main_t oddbuf_test_main;
38 #define __plugin_msg_base oddbuf_test_main.msg_id_base
39 #include <vlibapi/vat_helper_macros.h>
42 api_oddbuf_enable_disable (vat_main_t * vam)
44 unformat_input_t *i = vam->input;
45 int enable_disable = 1;
47 vl_api_oddbuf_enable_disable_t *mp;
50 /* Parse args required to build the message */
51 while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
53 if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
55 else if (unformat (i, "sw_if_index %d", &sw_if_index))
57 else if (unformat (i, "disable"))
63 if (sw_if_index == ~0)
65 errmsg ("missing interface name / explicit sw_if_index number \n");
69 /* Construct the API message */
70 M (ODDBUF_ENABLE_DISABLE, mp);
71 mp->sw_if_index = ntohl (sw_if_index);
72 mp->enable_disable = enable_disable;
77 /* Wait for a reply... */
82 #include <oddbuf/oddbuf.api_test.c>
85 * fd.io coding-style-patch-verification: ON
88 * eval: (c-set-style "gnu")