LCOV - code coverage report
Current view: top level - plugins/oddbuf - oddbuf_test.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 0 19 0.0 %
Date: 2023-07-05 22:20:52 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /*
       2             :  * oddbuf.c - awkward chained buffer geometry test tool
       3             :  *
       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:
       8             :  *
       9             :  *     http://www.apache.org/licenses/LICENSE-2.0
      10             :  *
      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.
      16             :  */
      17             : #include <vat/vat.h>
      18             : #include <vlibapi/api.h>
      19             : #include <vlibmemory/api.h>
      20             : #include <vppinfra/error.h>
      21             : #include <stdbool.h>
      22             : 
      23             : uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
      24             : 
      25             : /* Declare message IDs */
      26             : #include <oddbuf/oddbuf.api_enum.h>
      27             : #include <oddbuf/oddbuf.api_types.h>
      28             : 
      29             : typedef struct
      30             : {
      31             :   /* API message ID base */
      32             :   u16 msg_id_base;
      33             :   vat_main_t *vat_main;
      34             : } oddbuf_test_main_t;
      35             : 
      36             : oddbuf_test_main_t oddbuf_test_main;
      37             : 
      38             : #define __plugin_msg_base oddbuf_test_main.msg_id_base
      39             : #include <vlibapi/vat_helper_macros.h>
      40             : 
      41             : static int
      42           0 : api_oddbuf_enable_disable (vat_main_t * vam)
      43             : {
      44           0 :   unformat_input_t *i = vam->input;
      45           0 :   int enable_disable = 1;
      46           0 :   u32 sw_if_index = ~0;
      47             :   vl_api_oddbuf_enable_disable_t *mp;
      48             :   int ret;
      49             : 
      50             :   /* Parse args required to build the message */
      51           0 :   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
      52             :     {
      53           0 :       if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
      54             :         ;
      55           0 :       else if (unformat (i, "sw_if_index %d", &sw_if_index))
      56             :         ;
      57           0 :       else if (unformat (i, "disable"))
      58           0 :         enable_disable = 0;
      59             :       else
      60           0 :         break;
      61             :     }
      62             : 
      63           0 :   if (sw_if_index == ~0)
      64             :     {
      65           0 :       errmsg ("missing interface name / explicit sw_if_index number \n");
      66           0 :       return -99;
      67             :     }
      68             : 
      69             :   /* Construct the API message */
      70           0 :   M (ODDBUF_ENABLE_DISABLE, mp);
      71           0 :   mp->sw_if_index = ntohl (sw_if_index);
      72           0 :   mp->enable_disable = enable_disable;
      73             : 
      74             :   /* send it... */
      75           0 :   S (mp);
      76             : 
      77             :   /* Wait for a reply... */
      78           0 :   W (ret);
      79           0 :   return ret;
      80             : }
      81             : 
      82             : #include <oddbuf/oddbuf.api_test.c>
      83             : 
      84             : /*
      85             :  * fd.io coding-style-patch-verification: ON
      86             :  *
      87             :  * Local Variables:
      88             :  * eval: (c-set-style "gnu")
      89             :  * End:
      90             :  */

Generated by: LCOV version 1.14