16 #ifndef __VOM_ACL_LIST_H__ 17 #define __VOM_ACL_LIST_H__ 36 template <
typename RULE>
90 m_db.release(m_key,
this);
96 std::shared_ptr<list>
singular()
const {
return find_or_add(*
this); }
101 static void dump(std::ostream& os) { m_db.dump(os); }
108 std::ostringstream s;
109 s <<
"acl-list:[" << m_key <<
" " << m_hdl.
to_string() <<
" rules:[";
111 for (
auto rule : m_rules) {
112 s << rule.to_string() <<
" ";
123 void insert(
const RULE& rule) { m_rules.insert(rule); }
128 void remove(
const RULE& rule) { m_rules.erase(rule); }
137 return (m_hdl_db[handle].lock());
140 static std::shared_ptr<list>
find(
const key_t&
key)
142 return (m_db.find(key));
147 std::shared_ptr<list> sp =
find(key);
150 m_hdl_db[item.
data()] = sp;
156 m_hdl_db.erase(item.data());
159 const key_t&
key()
const {
return m_key; }
161 const rules_t&
rules()
const {
return m_rules; }
190 void handle_replay() { m_db.replay(); }
195 void show(std::ostream& os);
211 void update(
const list& obj);
221 static std::shared_ptr<list> find_or_add(
const list& temp)
223 return (m_db.find_or_add(temp.
key(), temp));
229 const handle_t& handle_i()
const {
return (m_hdl.
data()); }
259 static std::map<handle_t, std::weak_ptr<list>> m_hdl_db;
285 template <
typename RULE>
291 template <
typename RULE>
294 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
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 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.
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 ...
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)
static void add(const key_t &key, const HW::item< handle_t > &item)
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
bool operator==(const list &l) const
Comparison operator - for UT.