FD.io VPP  v20.01-48-g3e0dafb74
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  */
u8 count
Definition: dhcp.api:208
u64 data_quota
max bytes this device
Definition: mactime.api:87
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:65
unsigned long u64
Definition: types.h:89
u32 client_index
client index, from api_main
Definition: mactime.api:30
unsigned char u8
Definition: types.h:56
double f64
Definition: types.h:142
u32 count
number of time ranges to follow
Definition: mactime.api:90
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
u32 context
application context
Definition: mactime.api:118
unsigned int u32
Definition: types.h:88
vl_api_interface_index_t sw_if_index
the interface handle
Definition: mactime.api:33
u32 client_index
client index, from api_main
Definition: mactime.api:117
u32 client_index
client index, from api_main
Definition: mactime.api:80
vl_api_mac_address_t mac_address
Definition: mactime.api:129
u32 my_table_epoch
to suppress dump if no changes
Definition: mactime.api:119
u32 context
application context
Definition: mactime.api:81
typedef mactime_time_range
a time range, in fp seconds since Sunday midnight
Definition: mactime.api:100
option version
Definition: mactime.api:19
signed int i32
Definition: types.h:77
bool enable_disable
enable=1, disable=0
Definition: mactime.api:32
u32 context
application context
Definition: mactime.api:31
vl_api_mac_address_t mac_address
src mac address
Definition: mactime.api:88
f64 end
end of the time range
Definition: mactime.api:44
bool is_add
add=1, del=0
Definition: mactime.api:82
bool no_udp_10001
drop udp to port 10001
Definition: mactime.api:86
u8 allow_quota
allow subject to quota
Definition: mactime.api:85