|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
28 singular_db<l3_list::key_t, l3_list> l3_list::m_db;
33 std::map<handle_t, std::weak_ptr<l3_list>> l3_list::m_hdl_db;
68 m_db.release(m_key,
this);
71 std::shared_ptr<l3_list>
74 return find_or_add(*
this);
93 s <<
"acl-list:[" << m_key <<
" " << m_hdl.
to_string() <<
" rules:[";
95 for (
auto rule : m_rules) {
96 s << rule.to_string() <<
" ";
107 m_rules.insert(rule);
122 std::shared_ptr<l3_list>
125 return (m_hdl_db[
handle].lock());
128 std::shared_ptr<l3_list>
131 return (m_db.find(
key));
134 std::shared_ptr<l3_list>
135 l3_list::find_or_add(
const l3_list& temp)
137 return (m_db.find_or_add(temp.
key(), temp));
141 l3_list::handle_i()
const
143 return (m_hdl.
data());
149 std::shared_ptr<l3_list> sp =
find(
key);
152 m_hdl_db[
item.data()] = sp;
159 m_hdl_db.erase(
item.data());
186 std::shared_ptr<list_cmds::l3_dump_cmd>
cmd =
187 std::make_shared<list_cmds::l3_dump_cmd>();
192 for (
auto& record : *
cmd) {
193 auto& payload = record.get_payload();
195 const handle_t hdl(payload.acl_index);
198 for (
unsigned int ii = 0; ii < payload.count; ii++) {
203 rule.set_proto(payload.r[ii].proto);
204 rule.set_src_from_port(payload.r[ii].srcport_or_icmptype_first);
205 rule.set_src_to_port(payload.r[ii].srcport_or_icmptype_last);
206 rule.set_dst_from_port(payload.r[ii].dstport_or_icmpcode_first);
207 rule.set_dst_to_port(payload.r[ii].dstport_or_icmpcode_last);
208 rule.set_tcp_flags_mask(payload.r[ii].tcp_flags_mask);
209 rule.set_tcp_flags_value(payload.r[ii].tcp_flags_value);
231 l3_list::event_handler::order()
const
237 l3_list::event_handler::handle_replay()
243 l3_list::update(
const l3_list& obj)
248 if (
rc_t::OK != m_hdl.
rc() || obj.m_rules != m_rules) {
256 m_rules = obj.m_rules;
275 l3_list::replay(
void)
const handle_t & handle() const
Return the VPP assign handle.
std::multiset< l3_rule > rules_t
The rule container type.
static rc_t write()
Write/Execute all commands hitherto enqueued.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
std::shared_ptr< l3_list > singular() const
Return the 'sigular instance' of the ACL that matches this object.
The VPP Object Model (VOM) library.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
const static rc_t OK
The HW write was successfull.
bool operator==(const l3_list &l) const
Comparison operator - for UT.
void reset()
reset the value of the handle to ~0
void insert(const l3_rule &rule)
Insert priority sorted a rule into the list.
const rules_t & rules() const
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
static std::shared_ptr< l3_list > find(const handle_t &handle)
static bool register_listener(listener *listener)
Register a listener of events.
static void add(const key_t &key, const HW::item< handle_t > &item)
An ACL rule is the building block of an ACL.
const typedef std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
A type declaration of an interface handle in VPP.
static void enqueue(cmd *f)
Enqueue A command for execution.
std::string key_t
The KEY can be used to uniquely identify the ACL.
delete_cmd< l3_list, vapi::Acl_del > l3_delete_cmd
static void dump(std::ostream &os)
Dump all ACLs into the stream provided.
std::string to_string() const
convert to string format for debug purposes
l3_list(const key_t &key)
Construct a new object matching the desried state.
const static log_level_t DEBUG
const key_t & key() const
std::string to_string() const
convert to string format for debug purposes
An L3 ACL list comprises a set of match actions rules to be applied to packets.
rc_t rc() const
Get the HW return code.
T & data()
Return the data read/written.
void remove(const l3_rule &rule)
Remove a rule from the list.
vl_api_gbp_rule_t rules[n_rules]
void event_handler(void *tls_async)
A representation of a method call to VPP.
update_cmd< l3_list, vapi::Acl_add_replace > l3_update_cmd
Typedef the L3 ACL commands.
static const action_t & from_int(uint8_t i)
Get the enum type from a VPP integer value.
const neighbour::flags_t from_api(vapi_enum_ip_neighbor_flags f)