class l3_binding : public object_base
{
public:
+ /**
+ * The key type for l3_bindings
+ */
+ typedef std::pair<interface::key_t, route::prefix_t> key_t;
+
/**
* Construct a new object matching the desried state
*/
*/
~l3_binding();
+ /**
+ * Comparison operator
+ */
+ bool operator==(const l3_binding& l) const;
+
+ /**
+ * Get the object's key
+ */
+ const key_t key() const;
+
+ /**
+ * The iterator type
+ */
+ typedef singular_db<key_t, l3_binding>::const_iterator const_iterator_t;
+
+ static const_iterator_t cbegin();
+ static const_iterator_t cend();
+
/**
* Return the 'singular instance' of the L3-Config that matches this
* object
std::string to_string() const;
/**
- * Return the prefix associated with this L3config
+ * Return the prefix associated with this L3 binding
*/
const route::prefix_t& prefix() const;
+ /**
+ * Return the interface associated with this L3 binding
+ */
+ const interface& itf() const;
+
/**
* Dump all l3_bindings into the stream provided
*/
static void dump(std::ostream& os);
/**
- * The key type for l3_bindings
+ * Find all bindings in the DB for the interface passed
*/
- typedef std::pair<interface::key_type, route::prefix_t> key_type_t;
+ static std::deque<std::shared_ptr<l3_binding>> find(const interface& i);
/**
- * Find an singular instance in the DB for the interface passed
+ * Find a binding from its key
*/
- static std::deque<std::shared_ptr<l3_binding>> find(const interface& i);
+ static std::shared_ptr<l3_binding> find(const key_t& k);
private:
/**
/**
e* It's the singular_db class that calls replay()
*/
- friend class singular_db<key_type_t, l3_binding>;
+ friend class singular_db<key_t, l3_binding>;
/**
* Sweep/reap the object if still stale
*/
void replay(void);
+ friend class interface;
+
/**
* A reference counting pointer the interface that this L3 layer
* represents. By holding the reference here, we can guarantee that
/**
* The prefix for this L3 configuration
*/
- const route::prefix_t& m_pfx;
+ const route::prefix_t m_pfx;
/**
* HW configuration for the binding. The bool representing the
* A map of all L3 configs keyed against a combination of the interface
* and subnet's keys.
*/
- static singular_db<key_type_t, l3_binding> m_db;
+ static singular_db<key_t, l3_binding> m_db;
};
/**
* Ostream output for the key
*/
-std::ostream& operator<<(std::ostream& os, const l3_binding::key_type_t& key);
+std::ostream& operator<<(std::ostream& os, const l3_binding::key_t& key);
};
/*