A bit of buffer metadata reshuffling to accommodate flow_id
[vpp.git] / src / vpp-api / vom / interface_cmds.hpp
index 4178be3..7a0040d 100644 (file)
@@ -27,6 +27,7 @@
 #include <vapi/interface.api.vapi.hpp>
 #include <vapi/stats.api.vapi.hpp>
 #include <vapi/tap.api.vapi.hpp>
+#include <vapi/vhost_user.api.vapi.hpp>
 #include <vapi/vpe.api.vapi.hpp>
 
 namespace VOM {
@@ -109,6 +110,30 @@ public:
   std::string to_string() const;
 };
 
+/**
+ * A functor class that creates an interface
+ */
+class vhost_create_cmd
+  : public interface::create_cmd<vapi::Create_vhost_user_if>
+{
+public:
+  vhost_create_cmd(HW::item<handle_t>& item,
+                   const std::string& name,
+                   const std::string& tag);
+
+  /**
+   * Issue the command to VPP/HW
+   */
+  rc_t issue(connection& con);
+  /**
+   * convert to string format for debug purposes
+   */
+  std::string to_string() const;
+
+private:
+  const std::string m_tag;
+};
+
 /**
  * A command class to delete loopback interfaces in VPP
  */
@@ -174,6 +199,25 @@ public:
   std::string to_string() const;
 };
 
+/**
+ * A functor class that deletes a Vhost interface
+ */
+class vhost_delete_cmd
+  : public interface::delete_cmd<vapi::Delete_vhost_user_if>
+{
+public:
+  vhost_delete_cmd(HW::item<handle_t>& item, const std::string& name);
+
+  /**
+   * Issue the command to VPP/HW
+   */
+  rc_t issue(connection& con);
+  /**
+   * convert to string format for debug purposes
+   */
+  std::string to_string() const;
+};
+
 /**
  * A command class to set tag on interfaces
  */
@@ -288,7 +332,7 @@ private:
 };
 
 /**
- * A command class that binds an interface to an L3 table
+ * A command class that changes the MAC address on an interface
  */
 class set_mac_cmd : public rpc_cmd<HW::item<l2_address_t>,
                                    rc_t,
@@ -323,6 +367,50 @@ private:
   const HW::item<handle_t>& m_hdl;
 };
 
+/**
+ * A command class that enables detailed stats collection on an interface
+ */
+class collect_detail_stats_change_cmd
+  : public rpc_cmd<HW::item<interface::stats_type_t>,
+                   rc_t,
+                   vapi::Collect_detailed_interface_stats>
+{
+public:
+  /**
+   * Constructor taking the HW::item to update
+   * and the handle of the interface
+   */
+  collect_detail_stats_change_cmd(HW::item<interface::stats_type_t>& item,
+                                  const handle_t& h,
+                                  bool enable);
+
+  /**
+   * Issue the command to VPP/HW
+   */
+  rc_t issue(connection& con);
+
+  /**
+   * convert to string format for debug purposes
+   */
+  std::string to_string() const;
+
+  /**
+   * Comparison operator - only used for UT
+   */
+  bool operator==(const collect_detail_stats_change_cmd& i) const;
+
+private:
+  /**
+   * the handle of the interface to update
+   */
+  const handle_t& m_hdl;
+
+  /**
+   * enable or disable the detailed stats collection
+   */
+  bool m_enable;
+};
+
 /**
  * A command class represents our desire to recieve interface events
  */
@@ -364,21 +452,21 @@ private:
   /**
    * The listeners to notify when data/events arrive
    */
-  interface::interface::event_listener& m_listener;
+  interface::event_listener& m_listener;
 };
 
 /**
  * A command class represents our desire to recieve interface stats
  */
-class stats_cmd : public event_cmd<vapi::Want_per_interface_combined_stats,
-                                   vapi::Vnet_per_interface_combined_counters>
+class stats_enable_cmd
+  : public event_cmd<vapi::Want_per_interface_combined_stats,
+                     vapi::Vnet_per_interface_combined_counters>
 {
 public:
   /**
    * Constructor taking the listner to notify
    */
-  stats_cmd(interface::stat_listener& el,
-            const std::vector<handle_t>& interfaces);
+  stats_enable_cmd(interface::stat_listener& el, const handle_t& handle);
 
   /**
    * Issue the command to VPP/HW
@@ -395,10 +483,20 @@ public:
    */
   std::string to_string() const;
 
+  /**
+   * (re)set status
+   */
+  void set(const rc_t& rc);
+
+  /**
+   * get listener
+   */
+  interface::stat_listener& listener() const;
+
   /**
    * Comparison operator - only used for UT
    */
-  bool operator==(const stats_cmd& i) const;
+  bool operator==(const stats_enable_cmd& i) const;
 
   /**
    * Called when it's time to poke the listeners
@@ -409,9 +507,49 @@ private:
   /**
    * The listeners to notify when data/stats arrive
    */
-  interface::interface::stat_listener& m_listener;
+  interface::stat_listener& m_listener;
 
-  std::vector<handle_t> m_swifindex;
+  /**
+   * The interface on which we are enabling states
+   */
+  const handle_t& m_swifindex;
+};
+
+/**
+ * A command class represents our desire to recieve interface stats
+ */
+class stats_disable_cmd
+  : public rpc_cmd<HW::item<bool>,
+                   rc_t,
+                   vapi::Want_per_interface_combined_stats>
+{
+public:
+  /**
+   * Constructor taking the listner to notify
+   */
+  stats_disable_cmd(const handle_t& handle);
+
+  /**
+   * Issue the command to VPP/HW
+   */
+  rc_t issue(connection& con);
+
+  /**
+   * convert to string format for debug purposes
+   */
+  std::string to_string() const;
+
+  /**
+   * Comparison operator - only used for UT
+   */
+  bool operator==(const stats_disable_cmd& i) const;
+
+private:
+  HW::item<bool> m_res;
+  /**
+   * The interface on which we are disabling states
+   */
+  handle_t m_swifindex;
 };
 
 /**
@@ -439,6 +577,32 @@ public:
    */
   bool operator==(const dump_cmd& i) const;
 };
+
+/**
+ * A cmd class that Dumps all the Vpp Interfaces
+ */
+class vhost_dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_vhost_user_dump>
+{
+public:
+  /**
+   * Default Constructor
+   */
+  vhost_dump_cmd();
+
+  /**
+   * Issue the command to VPP/HW
+   */
+  rc_t issue(connection& con);
+  /**
+   * convert to string format for debug purposes
+   */
+  std::string to_string() const;
+
+  /**
+   * Comparison operator - only used for UT
+   */
+  bool operator==(const vhost_dump_cmd& i) const;
+};
 };
 };
 /*