For DHCP client configuration control the setting of the broadcast flag in the
[vpp.git] / src / vpp-api / vom / dhcp_config.hpp
index f64a3c8..8ea608d 100644 (file)
@@ -33,17 +33,25 @@ class events_cmd;
 class dhcp_config : public object_base
 {
 public:
+  /**
+   * typedef for the DHCP config key type
+   */
+  typedef interface::key_t key_t;
+
   /**
    * Construct a new object matching the desried state
    */
-  dhcp_config(const interface& itf, const std::string& hostname);
+  dhcp_config(const interface& itf,
+              const std::string& hostname,
+              bool set_broadcast_flag = true);
 
   /**
    * Construct a new object matching the desried state
    */
   dhcp_config(const interface& itf,
               const std::string& hostname,
-              const l2_address_t& client_id);
+              const l2_address_t& client_id,
+              bool set_broadcast_flag = true);
 
   /**
    * Copy Constructor
@@ -55,6 +63,16 @@ public:
    */
   ~dhcp_config();
 
+  /**
+   * Comparison operator - for UT
+   */
+  bool operator==(const dhcp_config& d) const;
+
+  /**
+   * Return the object's key
+   */
+  const key_t& key() const;
+
   /**
    * Return the 'singular' of the DHCP config that matches this object
    */
@@ -71,8 +89,13 @@ public:
   static void dump(std::ostream& os);
 
   /**
-   * A class that listens to DHCP Events
+   * Find a DHCP config from its key
    */
+  static std::shared_ptr<dhcp_config> find(const key_t& k);
+
+  /**
+ * A class that listens to DHCP Events
+ */
   class event_listener
   {
   public:
@@ -153,7 +176,7 @@ private:
   /**
    * It's the singular_db class that calls replay()
    */
-  friend class singular_db<interface::key_type, dhcp_config>;
+  friend class singular_db<key_t, dhcp_config>;
 
   /**
    * Sweep/reap the object if still stale
@@ -182,6 +205,11 @@ private:
    */
   const l2_address_t m_client_id;
 
+  /**
+   * Flag to control the setting the of DHCP discover's broadcast flag
+   */
+  const bool m_set_broadcast_flag;
+
   /**
    * HW configuration for the binding. The bool representing the
    * do/don't bind.
@@ -191,7 +219,7 @@ private:
   /**
    * A map of all Dhcp configs keyed against the interface.
    */
-  static singular_db<interface::key_type, dhcp_config> m_db;
+  static singular_db<key_t, dhcp_config> m_db;
 };
 };