Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fixes for 'make UNATTENDED=yes CC=clang CXX=clang verify'
[vpp.git]
/
src
/
vpp-api
/
vom
/
l3_binding.cpp
diff --git
a/src/vpp-api/vom/l3_binding.cpp
b/src/vpp-api/vom/l3_binding.cpp
index
8bc7c7c
..
13bc1ff
100644
(file)
--- a/
src/vpp-api/vom/l3_binding.cpp
+++ b/
src/vpp-api/vom/l3_binding.cpp
@@
-15,9
+15,10
@@
#include "vom/l3_binding.hpp"
#include "vom/l3_binding_cmds.hpp"
#include "vom/l3_binding.hpp"
#include "vom/l3_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace VOM {
-singular_db<l3_binding::key_t
ype_t
, l3_binding> l3_binding::m_db;
+singular_db<l3_binding::key_t, l3_binding> l3_binding::m_db;
l3_binding::event_handler l3_binding::m_evh;
l3_binding::event_handler l3_binding::m_evh;
@@
-27,14
+28,14
@@
l3_binding::event_handler l3_binding::m_evh;
l3_binding::l3_binding(const interface& itf, const route::prefix_t& pfx)
: m_itf(itf.singular())
, m_pfx(pfx)
l3_binding::l3_binding(const interface& itf, const route::prefix_t& pfx)
: m_itf(itf.singular())
, m_pfx(pfx)
- , m_binding(true)
+ , m_binding(true
, rc_t::NOOP
)
{
}
l3_binding::l3_binding(const l3_binding& o)
: m_itf(o.m_itf)
, m_pfx(o.m_pfx)
{
}
l3_binding::l3_binding(const l3_binding& o)
: m_itf(o.m_itf)
, m_pfx(o.m_pfx)
- , m_binding(
true
)
+ , m_binding(
o.m_binding
)
{
}
{
}
@@
-43,7
+44,19
@@
l3_binding::~l3_binding()
sweep();
// not in the DB anymore.
sweep();
// not in the DB anymore.
- m_db.release(make_pair(m_itf->key(), m_pfx), this);
+ m_db.release(key(), this);
+}
+
+bool
+l3_binding::operator==(const l3_binding& l) const
+{
+ return ((m_pfx == l.m_pfx) && (*m_itf == *l.m_itf));
+}
+
+const l3_binding::key_t
+l3_binding::key() const
+{
+ return (make_pair(m_itf->key(), m_pfx));
}
void
}
void
@@
-71,11
+84,29
@@
l3_binding::prefix() const
return (m_pfx);
}
return (m_pfx);
}
+const interface&
+l3_binding::itf() const
+{
+ return (*m_itf);
+}
+
+l3_binding::const_iterator_t
+l3_binding::cbegin()
+{
+ return m_db.begin();
+}
+
+l3_binding::const_iterator_t
+l3_binding::cend()
+{
+ return m_db.end();
+}
+
std::string
l3_binding::to_string() const
{
std::ostringstream s;
std::string
l3_binding::to_string() const
{
std::ostringstream s;
- s << "L3-
confi
g:[" << m_itf->to_string() << " prefix:" << m_pfx.to_string()
+ s << "L3-
bindin
g:[" << m_itf->to_string() << " prefix:" << m_pfx.to_string()
<< " " << m_binding.to_string() << "]";
return (s.str());
<< " " << m_binding.to_string() << "]";
return (s.str());
@@
-85,8
+116,10
@@
void
l3_binding::update(const l3_binding& desired)
{
/*
l3_binding::update(const l3_binding& desired)
{
/*
- * the desired state is always that the interface should be created
- */
+ * no updates for the binding. chaning the interface or the prefix is a change
+ * to the
+ * key, hence a new object
+ */
if (!m_binding) {
HW::enqueue(
new l3_binding_cmds::bind_cmd(m_binding, m_itf->handle(), m_pfx));
if (!m_binding) {
HW::enqueue(
new l3_binding_cmds::bind_cmd(m_binding, m_itf->handle(), m_pfx));
@@
-96,7
+129,13
@@
l3_binding::update(const l3_binding& desired)
std::shared_ptr<l3_binding>
l3_binding::find_or_add(const l3_binding& temp)
{
std::shared_ptr<l3_binding>
l3_binding::find_or_add(const l3_binding& temp)
{
- return (m_db.find_or_add(make_pair(temp.m_itf->key(), temp.m_pfx), temp));
+ return (m_db.find_or_add(temp.key(), temp));
+}
+
+std::shared_ptr<l3_binding>
+l3_binding::find(const key_t& k)
+{
+ return (m_db.find(k));
}
std::shared_ptr<l3_binding>
}
std::shared_ptr<l3_binding>
@@
-108,11
+147,11
@@
l3_binding::singular() const
void
l3_binding::dump(std::ostream& os)
{
void
l3_binding::dump(std::ostream& os)
{
-
m_db.dump(
os);
+
db_dump(m_db,
os);
}
std::ostream&
}
std::ostream&
-operator<<(std::ostream& os, const l3_binding::key_t
ype_t
& key)
+operator<<(std::ostream& os, const l3_binding::key_t& key)
{
os << "[" << key.first << ", " << key.second << "]";
{
os << "[" << key.first << ", " << key.second << "]";
@@
-129,13
+168,13
@@
l3_binding::find(const interface& i)
*/
std::deque<std::shared_ptr<l3_binding>> l3s;
*/
std::deque<std::shared_ptr<l3_binding>> l3s;
- auto it = m_db.
c
begin();
+ auto it = m_db.begin();
- while (it != m_db.
c
end()) {
+ while (it != m_db.end()) {
/*
/*
- * The key in the DB is a pair of the interface's name and prefix.
- * If the keys match, save the L3-config
- */
+
* The key in the DB is a pair of the interface's name and prefix.
+
* If the keys match, save the L3-config
+
*/
auto key = it->first;
if (i.key() == key.first) {
auto key = it->first;
if (i.key() == key.first) {
@@
-164,8
+203,8
@@
void
l3_binding::event_handler::handle_populate(const client_db::key_t& key)
{
/**
l3_binding::event_handler::handle_populate(const client_db::key_t& key)
{
/**
- * This is done while populating the interfaces
- */
+
* This is done while populating the interfaces
+
*/
}
dependency_t
}
dependency_t
@@
-177,7
+216,7
@@
l3_binding::event_handler::order() const
void
l3_binding::event_handler::show(std::ostream& os)
{
void
l3_binding::event_handler::show(std::ostream& os)
{
-
m_db.dump(
os);
+
db_dump(m_db,
os);
}
}
}
}