FD.io VPP  v18.07-rc0-415-g6c78436
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 = "1.0.0";
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 };
32 
33 /** \brief a time range structure
34  * times are in double-precision fp seconds since 1/1/1970,
35  * which was a Thursday.
36  */
37 typeonly define time_range
38 {
39  f64 start; /**< start of the time range */
40  f64 end; /**< end of the time range */
41 };
42 
43 /** \brief configure per src-mac time ranges
44  *
45  * Usage:
46  * to create a static allow entry:
47  * set mac_address, device_name, is_add=1, and allow=1.
48  *
49  * to create a static drop entry:
50  * set mac_address, device_name, is_add=1, and drop=1.
51  *
52  * to create a (time-range-based) dynamic allow entry:
53  * set mac_address, device_name, is_add=1, set allow=1.
54  * set count = number of ranges
55  * set each range start/end in seconds since Sunday began
56  * As in: start/end >= 0.0 && start/end < 7.0 *86400.0
57  *
58  * to create a (time-range-based) dynamic drop entry:
59  * Same procedure to create a dynamic allow entry,
60  * set drop=1 instead of allow=1
61  *
62  * to delete a per src-mac entry (of any kind)
63  * set mac_address, is_add=0
64  * note: deletes all ranges.
65  *
66  * See mactime_test.c:api_mactime_add_del_range(...) for
67  * a working example.
68  */
69 
70 autoreply define mactime_add_del_range
71 {
72  u32 client_index; /**< client index, from api_main */
73  u32 context; /**< application context */
74  u8 is_add; /**< add=1, del=0 */
75  u8 drop; /**< drop flag */
76  u8 allow; /**< allow flag */
77  u8 mac_address[6]; /**< src mac address */
78  u8 device_name[64]; /**< device name */
79  u32 count; /**< number of time ranges to follow */
80  /** time ranges, in seconds since Sunday began */
82 };
83 
84 /*
85  * Local Variables:
86  * eval: (c-set-style "gnu")
87  * End:
88  */
a time range structure times are in double-precision fp seconds since 1/1/1970, which was a Thursday...
Definition: mactime.api:37
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:86
f64 end
end of the time range
Definition: mactime.api:40
u32 client_index
client index, from api_main
Definition: mactime.api:27
unsigned char u8
Definition: types.h:56
double f64
Definition: types.h:142
u32 count
number of time ranges to follow
Definition: mactime.api:79
unsigned int u32
Definition: types.h:88
u32 client_index
client index, from api_main
Definition: mactime.api:72
u32 context
application context
Definition: mactime.api:73
option version
Definition: mactime.api:19
f64 start
start of the time range
Definition: mactime.api:39
size_t count
Definition: vapi.c:42
u32 context
application context
Definition: mactime.api:28
u32 sw_if_index
the interface handle
Definition: mactime.api:30
u8 enable_disable
enable=1, disable=0
Definition: mactime.api:29