Driver level time-based src mac filter
[vpp.git] / src / plugins / mactime / mactime.api
diff --git a/src/plugins/mactime/mactime.api b/src/plugins/mactime/mactime.api
new file mode 100644 (file)
index 0000000..7cad782
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * 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.0.0";
+
+/** \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  */
+};
+
+/** \brief a time range structure
+ * times are in double-precision fp seconds since 1/1/1970, 
+ * which was a Thursday.
+ */
+typeonly define 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 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]; 
+};
+
+/*
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */