16 #ifndef __VOM_ACL_LIST_H__ 17 #define __VOM_ACL_LIST_H__ 36 template <
typename RULE>
89 m_db.release(m_key,
this);
95 std::shared_ptr<list>
singular()
const {
return find_or_add(*
this); }
100 static void dump(std::ostream& os) { m_db.dump(os); }
107 std::ostringstream s;
108 s <<
"acl-list:[" << m_key <<
" " << m_hdl.
to_string() <<
" rules:[";
110 for (
auto rule : m_rules) {
111 s << rule.to_string() <<
" ";
122 void insert(
const RULE& rule) { m_rules.insert(rule); }
127 void remove(
const RULE& rule) { m_rules.erase(rule); }
136 return (m_hdl_db[handle].lock());
139 static std::shared_ptr<list>
find(
const key_t&
key)
141 return (m_db.find(key));
151 const key_t&
key()
const {
return m_key; }
153 const rules_t&
rules()
const {
return m_rules; }
175 virtual ~event_handler() =
default;
185 void handle_replay() { m_db.replay(); }
190 void show(std::ostream& os) { m_db.dump(os); }
201 static event_handler m_evh;
206 void update(
const list& obj);
216 static std::shared_ptr<list> find_or_add(
const list& temp)
218 return (m_db.find_or_add(temp.m_key, temp));
249 static std::map<const handle_t, std::weak_ptr<list>> m_hdl_db;
275 template <
typename RULE>
281 template <
typename RULE>
284 template <
typename RULE>
const rules_t & rules() const
static void dump(std::ostream &os)
Dump all ACLs into the stream provided.
void insert(const RULE &rule)
Insert priority sorted a rule into the list.
std::string to_string() const
convert to string format for debug purposes
static void add(const handle_t &handle, std::shared_ptr< list > sp)
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
An ACL list comprises a set of match actions rules to be applied to packets.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
static std::shared_ptr< list > find(const handle_t &handle)
std::string to_string() const
convert to string format for debug purposes
T & data()
Return the data read/written.
std::string key_t
The KEY can be used to uniquely identify the ACL.
std::shared_ptr< list > singular() const
Return the 'sigular instance' of the ACL that matches this object.
A Database to store the unique 'singular' instances of a single object type.
list(const key_t &key)
Construct a new object matching the desried state.
static std::shared_ptr< list > find(const key_t &key)
Class definition for listeners to OM events.
inspect command handler Handler
A type declaration of an interface handle in VPP.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
The interface to writing objects into VPP OM.
list< l3_rule > l3_list
Typedef the L3 ACL type.
A base class for all object_base in the VPP object_base-Model.
list(const list &o)
Copy Constructor.
The VPP Object Model (VOM) library.
std::multiset< RULE > rules_t
The rule container type.
list(const key_t &key, const rules_t &rules)
const handle_t & handle() const
Return the VPP assign handle.
list(const handle_t &hdl, const key_t &key)
list< l2_rule > l2_list
Typedef the L2 ACL type.
const key_t & key() const
static bool register_listener(listener *listener)
Register a listener of events.
bool operator==(const list &l) const
Comparison operator - for UT.