FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
mactime.api
Go to the documentation of this file.
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 = "2.0.0";
20 
21 import "vnet/ethernet/ethernet_types.api";
22 import "vnet/interface_types.api";
23 
24 /** @brief api to enable or disable the time-based src mac filter on
25  an interface
26 */
27 
28 autoreply define mactime_enable_disable
29 {
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]";
35 };
36 
37 /** @brief a time range structure
38  * times are in double-precision fp seconds since 1/1/1970,
39  * which was a Thursday.
40  */
41 typedef time_range
42 {
43  f64 start; /**< start of the time range */
44  f64 end; /**< end of the time range */
45 };
46 
47 /** @brief configure per src-mac time ranges
48  *
49  * Usage:
50  * to create a static allow entry:
51  * set mac_address, device_name, is_add=1, and allow=1.
52  *
53  * to create a static drop entry:
54  * set mac_address, device_name, is_add=1, and drop=1.
55  *
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
61  *
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/
65  *
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
69  *
70  * to delete a per src-mac entry (of any kind)
71  * set mac_address, is_add=0
72  * note: deletes all ranges.
73  *
74  * See mactime_test.c:api_mactime_add_del_range(...) for
75  * a working example.
76  */
77 
78 autoreply define mactime_add_del_range
79 {
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";
94 };
95 
96 /** @brief a time range, in fp seconds since Sunday midnight
97  */
98 
99 typedef mactime_time_range
100 {
101  f64 start;
102  f64 end;
103 };
104 
105 /** @brief dump mactime table
106  *
107  * Request a mactime client pool dump
108  * Sequence:
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
113  */
114 
115 define mactime_dump
116 {
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 */
120 };
121 
122 /** @brief mactime table entry details
123  */
124 
125 define mactime_details
126 {
129  vl_api_mac_address_t mac_address;
133  string device_name[64];
135  vl_api_mactime_time_range_t ranges[nranges];
136 };
137 
138 /** @brief dump mactime table reply
139  * Includes the vpp table epoch, needed to optimize API traffic
140  */
141 define mactime_dump_reply
142 {
146 };
147 
148 /*
149  * Local Variables:
150  * eval: (c-set-style "gnu")
151  * End:
152  */
vl_api_mactime_add_del_range_t::is_add
bool is_add
add=1, del=0
Definition: mactime.api:82
vl_api_mactime_add_del_range_t::device_name
string device_name[64]
device name
Definition: mactime.api:89
vl_api_mactime_add_del_range_t::no_udp_10001
bool no_udp_10001
drop udp to port 10001
Definition: mactime.api:86
vl_api_mactime_details_t
mactime table entry details
Definition: mactime.api:125
vl_api_mactime_dump_t::client_index
u32 client_index
client index, from api_main
Definition: mactime.api:117
vl_api_mactime_dump_t
dump mactime table
Definition: mactime.api:115
vl_api_mactime_dump_t::my_table_epoch
u32 my_table_epoch
to suppress dump if no changes
Definition: mactime.api:119
vl_api_mactime_details_t::data_quota
u64 data_quota
Definition: mactime.api:130
vl_api_mactime_details_t::flags
u32 flags
Definition: mactime.api:132
vl_api_mactime_add_del_range_t::data_quota
u64 data_quota
max bytes this device
Definition: mactime.api:87
vl_api_mactime_enable_disable_t::enable_disable
bool enable_disable
enable=1, disable=0
Definition: mactime.api:32
mactime_enable_disable
int mactime_enable_disable(mactime_main_t *mm, u32 sw_if_index, int enable_disable)
Action function shared between message handler and debug CLI.
Definition: mactime.c:67
vl_api_mactime_add_del_range_t::drop
bool drop
drop flag
Definition: mactime.api:83
vl_api_mactime_add_del_range_t::allow
bool allow
allow flag
Definition: mactime.api:84
vl_api_mactime_details_t::data_used_in_range
u64 data_used_in_range
Definition: mactime.api:131
version
option version
Definition: mactime.api:19
vl_api_mactime_enable_disable_t::client_index
u32 client_index
client index, from api_main
Definition: mactime.api:30
vl_api_mactime_enable_disable_t::vat_help
option vat_help
Definition: mactime.api:34
time_range
typedef time_range
a time range structure times are in double-precision fp seconds since 1/1/1970, which was a Thursday.
Definition: mactime.api:42
i32
signed int i32
Definition: types.h:77
vl_api_mactime_dump_reply_t::table_epoch
u32 table_epoch
Definition: mactime.api:145
vl_api_mactime_add_del_range_t::client_index
u32 client_index
client index, from api_main
Definition: mactime.api:80
vl_api_mactime_enable_disable_t::context
u32 context
application context
Definition: mactime.api:31
vl_api_mactime_dump_t::context
u32 context
application context
Definition: mactime.api:118
count
u8 count
Definition: dhcp.api:208
vl_api_mactime_enable_disable_t
api to enable or disable the time-based src mac filter on an interface
Definition: mactime.api:28
vl_api_mactime_details_t::nranges
u32 nranges
Definition: mactime.api:134
end
f64 end
end of the time range
Definition: mactime.api:44
vl_api_mactime_add_del_range_t::allow_quota
u8 allow_quota
allow subject to quota
Definition: mactime.api:85
vl_api_mactime_enable_disable_t::sw_if_index
vl_api_interface_index_t sw_if_index
the interface handle
Definition: mactime.api:33
vl_api_mactime_details_t::pool_index
u32 pool_index
Definition: mactime.api:128
vl_api_mactime_add_del_range_t
configure per src-mac time ranges
Definition: mactime.api:78
f64
double f64
Definition: types.h:142
vl_api_mactime_dump_reply_t::context
u32 context
Definition: mactime.api:143
mactime_time_range
typedef mactime_time_range
a time range, in fp seconds since Sunday midnight
Definition: mactime.api:100
vl_api_mactime_add_del_range_t::count
u32 count
number of time ranges to follow
Definition: mactime.api:90
vl_api_mactime_details_t::context
u32 context
Definition: mactime.api:127
vl_api_mactime_details_t::ranges
vl_api_mactime_time_range_t ranges[nranges]
Definition: mactime.api:135
vl_api_mactime_details_t::mac_address
vl_api_mac_address_t mac_address
Definition: mactime.api:129
vl_api_mactime_add_del_range_t::ranges
vl_api_time_range_t ranges[count]
time ranges, in seconds since Sunday began
Definition: mactime.api:92
u64
unsigned long u64
Definition: types.h:89
vl_api_mactime_details_t::device_name
string device_name[64]
Definition: mactime.api:133
u32
unsigned int u32
Definition: types.h:88
vl_api_mactime_add_del_range_t::context
u32 context
application context
Definition: mactime.api:81
vl_api_mactime_add_del_range_t::mac_address
vl_api_mac_address_t mac_address
src mac address
Definition: mactime.api:88
u8
unsigned char u8
Definition: types.h:56
vl_api_mactime_dump_reply_t::retval
i32 retval
Definition: mactime.api:144
vl_api_mactime_add_del_range_t::vat_help
option vat_help
Definition: mactime.api:93
vl_api_mactime_dump_reply_t
dump mactime table reply Includes the vpp table epoch, needed to optimize API traffic
Definition: mactime.api:141