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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 This file defines vpp mactime control-plane API messages
19 option version = "2.0.0";
21 import "vnet/ethernet/ethernet_types.api";
22 import "vnet/interface_types.api";
24 /** @brief api to enable or disable the time-based src mac filter on
28 autoreply define mactime_enable_disable
30 u32 client_index; /**< client index, from api_main */
31 u32 context; /**< application context */
32 bool enable_disable; /**< enable=1, disable=0 */
33 vl_api_interface_index_t sw_if_index; /**< the interface handle */
34 option vat_help = "<intfc> [disable]";
37 /** @brief a time range structure
38 * times are in double-precision fp seconds since 1/1/1970,
39 * which was a Thursday.
43 f64 start; /**< start of the time range */
44 f64 end; /**< end of the time range */
47 /** @brief configure per src-mac time ranges
50 * to create a static allow entry:
51 * set mac_address, device_name, is_add=1, and allow=1.
53 * to create a static drop entry:
54 * set mac_address, device_name, is_add=1, and drop=1.
56 * to create a (time-range-based) dynamic allow entry:
57 * set mac_address, device_name, is_add=1, set allow=1.
58 * set count = number of ranges
59 * set each range start/end in seconds since Sunday began
60 * As in: start/end >= 0.0 && start/end < 7.0 *86400.0
62 * to create a (time-range-based) dynamic allow entry with quota:
63 * Outside of stated time ranges, such entries revert to allow with no quota.
64 * previous setup, s/allow=1/allow_quota=1/
66 * to create a (time-range-based) dynamic drop entry:
67 * Same procedure to create a dynamic allow entry,
68 * set drop=1 instead of allow=1
70 * to delete a per src-mac entry (of any kind)
71 * set mac_address, is_add=0
72 * note: deletes all ranges.
74 * See mactime_test.c:api_mactime_add_del_range(...) for
78 autoreply define mactime_add_del_range
80 u32 client_index; /**< client index, from api_main */
81 u32 context; /**< application context */
82 bool is_add; /**< add=1, del=0 */
83 bool drop; /**< drop flag */
84 bool allow; /**< allow flag */
85 u8 allow_quota; /**< allow subject to quota */
86 bool no_udp_10001; /**< drop udp to port 10001 */
87 u64 data_quota; /**< max bytes this device */
88 vl_api_mac_address_t mac_address; /**< src mac address */
89 string device_name[64]; /**< device name */
90 u32 count; /**< number of time ranges to follow */
91 /** time ranges, in seconds since Sunday began */
92 vl_api_time_range_t ranges[count];
93 option vat_help = "name <devname> mac <mac-addr> allow drop allow-range Mon - Fri 9:00 - 17:00";
96 /** @brief a time range, in fp seconds since Sunday midnight
99 typedef mactime_time_range
105 /** @brief dump mactime table
107 * Request a mactime client pool dump
109 * client send vl_api_mactime_dump to vpp
110 * vpp replies with zero or more vl_api_mactime_entry_t's
111 * vpp replies with a vl_api_mactime_dump_reply_t
112 * @param my_table_epoch dump table only if update needed, 0 => full dump
117 u32 client_index; /**< client index, from api_main */
118 u32 context; /**< application context */
119 u32 my_table_epoch; /**< to suppress dump if no changes */
122 /** @brief mactime table entry details
125 define mactime_details
129 vl_api_mac_address_t mac_address;
131 u64 data_used_in_range;
133 string device_name[64];
135 vl_api_mactime_time_range_t ranges[nranges];
138 /** @brief dump mactime table reply
139 * Includes the vpp table epoch, needed to optimize API traffic
141 define mactime_dump_reply
150 * eval: (c-set-style "gnu")