mactime: remove api boilerplate
[vpp.git] / src / plugins / mactime / mactime.api
1 /*
2  * Copyright (c) 2018 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
16 /** \file
17     This file defines vpp mactime control-plane API messages
18 */
19 option version = "1.1.1";
20
21 /** \brief api to enable or disable the time-based src mac filter on
22     an interface
23 */
24
25 autoreply define mactime_enable_disable
26 {
27   u32 client_index;             /**< client index, from api_main */
28   u32 context;                  /**< application context */
29   u8 enable_disable;            /**< enable=1, disable=0 */
30   u32 sw_if_index;              /**< the interface handle  */
31   option vat_help = "<intfc> [disable]";
32 };
33
34 /** \brief a time range structure
35  * times are in double-precision fp seconds since 1/1/1970,
36  * which was a Thursday.
37  */
38 typedef time_range
39 {
40   f64 start;                    /**< start of the time range  */
41   f64 end;                      /**< end of the time range */
42 };
43
44 /** \brief configure per src-mac time ranges
45  *
46  * Usage:
47  *  to create a static allow entry:
48  *   set mac_address, device_name, is_add=1, and allow=1.
49  *
50  *  to create a static drop entry:
51  *   set mac_address, device_name, is_add=1, and drop=1.
52  *
53  *  to create a (time-range-based) dynamic allow entry:
54  *   set mac_address, device_name, is_add=1, set allow=1.
55  *   set count = number of ranges
56  *   set each range start/end in seconds since Sunday began
57  *   As in: start/end >= 0.0 && start/end < 7.0 *86400.0
58  *
59  *  to create a (time-range-based) dynamic drop entry:
60  *   Same procedure to create a dynamic allow entry,
61  *   set drop=1 instead of allow=1
62  *
63  *  to delete a per src-mac entry (of any kind)
64  *   set mac_address, is_add=0
65  *   note: deletes all ranges.
66  *
67  * See mactime_test.c:api_mactime_add_del_range(...) for
68  * a working example.
69  */
70
71 autoreply define mactime_add_del_range
72 {
73   u32 client_index;             /**< client index, from api_main */
74   u32 context;                  /**< application context */
75   u8 is_add;                    /**< add=1, del=0  */
76   u8 drop;                      /**< drop flag */
77   u8 allow;                     /**< allow flag */
78   u8 allow_quota;               /**< allow subject to quota */
79   u8 no_udp_10001;              /**< drop udp to port 10001 */
80   u64 data_quota;               /**< max bytes this device */
81   u8 mac_address[6];            /**< src mac address */
82   u8 device_name[64];           /**< device name */
83   u32 count;                    /**< number of time ranges to follow */
84   /** time ranges, in seconds since Sunday began */
85   vl_api_time_range_t ranges[count];
86   option vat_help = "name <devname> mac <mac-addr> allow drop allow-range Mon - Fri 9:00 - 17:00";
87 };
88
89 /*
90  * Local Variables:
91  * eval: (c-set-style "gnu")
92  * End:
93  */