X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp-api%2Fvom%2Fl3_binding.hpp;h=0177e56ea2b0b760961e94f0853686af778e053a;hb=bc27d1be24815e1371dcce3bff2d3075a532acba;hp=d94ff696b234bcc9c7ffdf2acb4ae3398c40d2ef;hpb=9ef1c0adbf9399c55deeede3cf629dd4e8c20304;p=vpp.git diff --git a/src/vpp-api/vom/l3_binding.hpp b/src/vpp-api/vom/l3_binding.hpp index d94ff696b23..0177e56ea2b 100644 --- a/src/vpp-api/vom/l3_binding.hpp +++ b/src/vpp-api/vom/l3_binding.hpp @@ -30,6 +30,11 @@ namespace VOM { class l3_binding : public object_base { public: + /** + * The key type for l3_bindings + */ + typedef std::pair key_t; + /** * Construct a new object matching the desried state */ @@ -45,6 +50,24 @@ public: */ ~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::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 @@ -57,24 +80,29 @@ public: 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 key_type_t; + static std::deque> find(const interface& i); /** - * Find an singular instance in the DB for the interface passed + * Find a binding from its key */ - static std::deque> find(const interface& i); + static std::shared_ptr find(const key_t& k); private: /** @@ -130,7 +158,7 @@ private: /** e* It's the singular_db class that calls replay() */ - friend class singular_db; + friend class singular_db; /** * Sweep/reap the object if still stale @@ -142,6 +170,8 @@ private: */ 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 @@ -152,7 +182,7 @@ private: /** * 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 @@ -164,13 +194,13 @@ private: * A map of all L3 configs keyed against a combination of the interface * and subnet's keys. */ - static singular_db m_db; + static singular_db 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); }; /*