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 = "1.2.1";
21 /** @brief api to enable or disable the time-based src mac filter on
25 autoreply define mactime_enable_disable
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]";
34 /** @brief a time range structure
35 * times are in double-precision fp seconds since 1/1/1970,
36 * which was a Thursday.
40 f64 start; /**< start of the time range */
41 f64 end; /**< end of the time range */
44 /** @brief configure per src-mac time ranges
47 * to create a static allow entry:
48 * set mac_address, device_name, is_add=1, and allow=1.
50 * to create a static drop entry:
51 * set mac_address, device_name, is_add=1, and drop=1.
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
59 * to create a (time-range-based) dynamic allow entry with quota:
60 * Outside of stated time ranges, such entries revert to allow with no quota.
61 * previous setup, s/allow=1/allow_quota=1/
63 * to create a (time-range-based) dynamic drop entry:
64 * Same procedure to create a dynamic allow entry,
65 * set drop=1 instead of allow=1
67 * to delete a per src-mac entry (of any kind)
68 * set mac_address, is_add=0
69 * note: deletes all ranges.
71 * See mactime_test.c:api_mactime_add_del_range(...) for
75 autoreply define mactime_add_del_range
77 u32 client_index; /**< client index, from api_main */
78 u32 context; /**< application context */
79 u8 is_add; /**< add=1, del=0 */
80 u8 drop; /**< drop flag */
81 u8 allow; /**< allow flag */
82 u8 allow_quota; /**< allow subject to quota */
83 u8 no_udp_10001; /**< drop udp to port 10001 */
84 u64 data_quota; /**< max bytes this device */
85 u8 mac_address[6]; /**< src mac address */
86 u8 device_name[64]; /**< device name */
87 u32 count; /**< number of time ranges to follow */
88 /** time ranges, in seconds since Sunday began */
89 vl_api_time_range_t ranges[count];
90 option vat_help = "name <devname> mac <mac-addr> allow drop allow-range Mon - Fri 9:00 - 17:00";
93 /** @brief a time range, in fp seconds since Sunday midnight
96 typedef mactime_time_range
102 /** @brief dump mactime table
104 * Request a mactime client pool dump
106 * client send vl_api_mactime_dump to vpp
107 * vpp replies with zero or more vl_api_mactime_entry_t's
108 * vpp replies with a vl_api_mactime_dump_reply_t
109 * @param my_table_epoch dump table only if update needed, 0 => full dump
114 u32 client_index; /**< client index, from api_main */
115 u32 context; /**< application context */
116 u32 my_table_epoch; /**< to suppress dump if no changes */
119 /** @brief mactime table entry details
122 define mactime_details
128 u64 data_used_in_range;
132 vl_api_mactime_time_range_t ranges[nranges];
135 /** @brief dump mactime table reply
136 * Includes the vpp table epoch, needed to optimize API traffic
138 define mactime_dump_reply
147 * eval: (c-set-style "gnu")