21 singular_db<igmp_listen::key_t, igmp_listen> igmp_listen::m_db;
29 const boost::asio::ip::address_v4& gaddr,
31 : m_igmp_bind(igmp_bind.singular())
34 , m_listen(true,
rc_t::NOOP)
39 const boost::asio::ip::address_v4& gaddr)
43 , m_listen(true,
rc_t::NOOP)
48 : m_igmp_bind(o.m_igmp_bind)
50 , m_saddrs(o.m_saddrs)
51 , m_listen(o.m_listen)
60 m_db.release(
key(),
this);
66 return ((m_gaddr == l.m_gaddr) && (*m_igmp_bind == *l.m_igmp_bind) &&
67 (m_saddrs == l.m_saddrs));
73 return (make_pair(m_igmp_bind->itf()->key(), m_gaddr));
81 m_listen, m_igmp_bind->itf()->handle(), m_gaddr));
91 m_listen, m_igmp_bind->itf()->handle(), m_gaddr, m_saddrs));
98 auto addr = m_saddrs.cbegin();
100 std::ostringstream s;
101 s <<
"igmp-listen:[" << m_igmp_bind->to_string() <<
" group:" << m_gaddr
103 while (
addr != m_saddrs.cend()) {
107 s <<
" ] " << m_listen.
to_string() <<
"]";
121 m_listen, m_igmp_bind->itf()->handle(), m_gaddr, m_saddrs));
125 std::shared_ptr<igmp_listen>
128 return (m_db.find_or_add(temp.
key(), temp));
131 std::shared_ptr<igmp_listen>
134 return (m_db.find(k));
137 std::shared_ptr<igmp_listen>
140 return find_or_add(*
this);
156 igmp_listen::event_handler::handle_replay()
170 igmp_listen::event_handler::order()
const
std::shared_ptr< igmp_listen > singular() const
Return the 'singular instance' of the IGMP that matches this object.
A representation of igmp configuration on an interface.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
static rc_t write()
Write/Execute all commands hitherto enqueued.
Error codes that VPP will return during a HW write.
const key_t key() const
Get the object's key.
A representation of IGMP binding on an interface.
std::string to_string() const
convert to string format for debug purposes
igmp_listen(const igmp_binding &igmp_bind, const boost::asio::ip::address_v4 &gaddr, const src_addrs_t &saddrs)
Construct a new object matching the desried state.
A functor class that binds the igmp group to the interface.
static void dump(std::ostream &os)
Dump all igmp_listens into the stream provided.
bool operator==(const igmp_listen &l) const
Comparison operator.
A cmd class that Unbinds igmp group from an interface.
std::set< boost::asio::ip::address_v4 > src_addrs_t
void event_handler(void *tls_async)
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
static void enqueue(cmd *f)
Enqueue A command for execution.
The VPP Object Model (VOM) library.
static std::shared_ptr< igmp_listen > find(const key_t &k)
Find a listen from its key.
static bool register_listener(listener *listener)
Register a listener of events.
~igmp_listen()
Destructor.
std::pair< interface::key_t, boost::asio::ip::address > key_t
The key type for igmp_listens.
std::string to_string() const
convert to string format for debug purposes