25 l2_list::event_handler::event_handler()
41 std::shared_ptr<list_cmds::l2_dump_cmd> cmd =
42 std::make_shared<list_cmds::l2_dump_cmd>();
47 for (
auto& record : *cmd) {
48 auto& payload = record.get_payload();
50 const handle_t hdl(payload.acl_index);
51 l2_list acl(hdl, std::string(reinterpret_cast<const char*>(payload.tag)));
53 for (
unsigned int ii = 0; ii < payload.count; ii++) {
54 const route::prefix_t pfx(payload.r[ii].is_ipv6,
55 payload.r[ii].src_ip_addr,
56 payload.r[ii].src_ip_prefix_len);
58 { payload.r[ii].src_mac }, { payload.r[ii].src_mac_mask });
81 l3_list::event_handler::event_handler()
97 std::shared_ptr<list_cmds::l3_dump_cmd> cmd =
98 std::make_shared<list_cmds::l3_dump_cmd>();
103 for (
auto& record : *cmd) {
104 auto& payload = record.get_payload();
106 const handle_t hdl(payload.acl_index);
107 l3_list acl(hdl, std::string(reinterpret_cast<const char*>(payload.tag)));
109 for (
unsigned int ii = 0; ii < payload.count; ii++) {
110 const route::prefix_t src(payload.r[ii].is_ipv6,
111 payload.r[ii].src_ip_addr,
112 payload.r[ii].src_ip_prefix_len);
113 const route::prefix_t dst(payload.r[ii].is_ipv6,
114 payload.r[ii].dst_ip_addr,
115 payload.r[ii].dst_ip_prefix_len);
118 rule.set_proto(payload.r[ii].proto);
119 rule.set_src_from_port(payload.r[ii].srcport_or_icmptype_first);
120 rule.set_src_to_port(payload.r[ii].srcport_or_icmptype_last);
121 rule.set_dst_from_port(payload.r[ii].dstport_or_icmpcode_first);
122 rule.set_dst_to_port(payload.r[ii].dstport_or_icmpcode_last);
123 rule.set_tcp_flags_mask(payload.r[ii].tcp_flags_mask);
124 rule.set_tcp_flags_value(payload.r[ii].tcp_flags_value);
148 l3_list::update(
const l3_list& obj)
153 if (
rc_t::OK != m_hdl.
rc() || obj.m_rules != m_rules) {
161 m_rules = obj.m_rules;
165 l2_list::update(
const l2_list& obj)
170 if (
rc_t::OK != m_hdl.
rc() || obj.m_rules != m_rules) {
178 m_rules = obj.m_rules;
207 l3_list::replay(
void)
216 l2_list::replay(
void)
static const action_t & from_int(uint8_t i)
Get the enum type from a VPP integer value.
update_cmd< l3_rule, vapi::Acl_add_replace > l3_update_cmd
Typedef the L3 ACL commands.
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.
static const log_level_t DEBUG
T & data()
Return the data read/written.
rc_t rc() const
Get the HW return code.
delete_cmd< l3_rule, vapi::Acl_del > l3_delete_cmd
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
static const rc_t OK
The HW write was successfull.
static void enqueue(cmd *f)
Enqueue A command for execution.
list< l3_rule > l3_list
Typedef the L3 ACL type.
The VPP Object Model (VOM) library.
delete_cmd< l2_rule, vapi::Macip_acl_del > l2_delete_cmd
update_cmd< l2_rule, vapi::Macip_acl_add > l2_update_cmd
Typedef the L2 ACL commands.
void reset()
reset the value of the handle to ~0
list< l2_rule > l2_list
Typedef the L2 ACL type.
static bool register_listener(listener *listener)
Register a listener of events.