aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/mactime/mactime.api
blob: edad2c48362f756f0587602737789202399f7c96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
 * Copyright (c) 2018 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/** \file
    This file defines vpp mactime control-plane API messages
*/
option version = "1.1.1";

/** \brief api to enable or disable the time-based src mac filter on
    an interface
*/

autoreply define mactime_enable_disable
{
  u32 client_index;             /**< client index, from api_main */
  u32 context;                  /**< application context */
  u8 enable_disable;            /**< enable=1, disable=0 */
  u32 sw_if_index;              /**< the interface handle  */
  option vat_help = "<intfc> [disable]";
};

/** \brief a time range structure
 * times are in double-precision fp seconds since 1/1/1970,
 * which was a Thursday.
 */
typedef time_range
{
  f64 start;                    /**< start of the time range  */
  f64 end;                      /**< end of the time range */
};

/** \brief configure per src-mac time ranges
 *
 * Usage:
 *  to create a static allow entry:
 *   set mac_address, device_name, is_add=1, and allow=1.
 *
 *  to create a static drop entry:
 *   set mac_address, device_name, is_add=1, and drop=1.
 *
 *  to create a (time-range-based) dynamic allow entry:
 *   set mac_address, device_name, is_add=1, set allow=1.
 *   set count = number of ranges
 *   set each range start/end in seconds since Sunday began
 *   As in: start/end >= 0.0 && start/end < 7.0 *86400.0
 *
 *  to create a (time-range-based) dynamic drop entry:
 *   Same procedure to create a dynamic allow entry,
 *   set drop=1 instead of allow=1
 *
 *  to delete a per src-mac entry (of any kind)
 *   set mac_address, is_add=0
 *   note: deletes all ranges.
 *
 * See mactime_test.c:api_mactime_add_del_range(...) for
 * a working example.
 */

autoreply define mactime_add_del_range
{
  u32 client_index;             /**< client index, from api_main */
  u32 context;                  /**< application context */
  u8 is_add;                    /**< add=1, del=0  */
  u8 drop;                      /**< drop flag */
  u8 allow;                     /**< allow flag */
  u8 allow_quota;               /**< allow subject to quota */
  u8 no_udp_10001;              /**< drop udp to port 10001 */
  u64 data_quota;		/**< max bytes this device */
  u8 mac_address[6];            /**< src mac address */
  u8 device_name[64];           /**< device name */
  u32 count;                    /**< number of time ranges to follow */
  /** time ranges, in seconds since Sunday began */
  vl_api_time_range_t ranges[count];
  option vat_help = "name <devname> mac <mac-addr> allow drop allow-range Mon - Fri 9:00 - 17:00";
};

/*
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */