lc_index =
acl_plugin_get_lookup_context_index (am->interface_acl_user_id,
sw_if_index, is_input);
- ASSERT (lc_index >= 0);
(*pinout_lc_index_by_sw_if_index)[sw_if_index] = lc_index;
}
acl_plugin_set_acl_vec_for_context (lc_index, vec_acl_list_index);
{
ip6_ioam_analyser_main_t *am = &ioam_analyser_main;
- ASSERT (option < ARRAY_LEN (am->analyse_hbh_handler));
+ ASSERT ((u32) option < ARRAY_LEN (am->analyse_hbh_handler));
/* Already registered */
if (am->analyse_hbh_handler[option])
{
ip6_ioam_analyser_main_t *am = &ioam_analyser_main;
- ASSERT (option < ARRAY_LEN (am->analyse_hbh_handler));
+ ASSERT ((u32) option < ARRAY_LEN (am->analyse_hbh_handler));
/* Not registered */
if (!am->analyse_hbh_handler[option])
{
vxlan_gpe_ioam_main_t *hm = &vxlan_gpe_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->add_options));
+ ASSERT ((u32) option < ARRAY_LEN (hm->add_options));
/* Already registered */
if (hm->add_options[option])
{
vxlan_gpe_ioam_main_t *hm = &vxlan_gpe_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->add_options));
+ ASSERT ((u32) option < ARRAY_LEN (hm->add_options));
/* Not registered */
if (!hm->add_options[option])
{
vxlan_gpe_ioam_main_t *im = &vxlan_gpe_ioam_main;
- ASSERT (option < ARRAY_LEN (im->options));
+ ASSERT ((u32) option < ARRAY_LEN (im->options));
/* Already registered */
if (im->options[option])
{
vxlan_gpe_ioam_main_t *hm = &vxlan_gpe_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->options));
+ ASSERT ((u32) option < ARRAY_LEN (hm->options));
/* Not registered */
if (!hm->options[option])
proto = DPO_PROTO_IP6;
}
- if(lb_vip_is_gre4(vip))
+ if (lb_vip_is_gre4(vip))
dpo_type = lbm->dpo_gre4_type;
else if (lb_vip_is_gre6(vip))
dpo_type = lbm->dpo_gre6_type;
lb_vip_t *vip = &lbm->vips[as->vip_index];
dpo_type_t dpo_type = 0;
- if(lb_vip_is_gre4(vip))
+ if (lb_vip_is_gre4(vip))
dpo_type = lbm->dpo_gre4_type;
else if (lb_vip_is_gre6(vip))
dpo_type = lbm->dpo_gre6_type;
|| (vip)->type == LB_VIP_TYPE_IP4_GRE4)
#define lb_vip_is_gre6(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE6 \
|| (vip)->type == LB_VIP_TYPE_IP4_GRE6)
-#define lb_vip_is_l3dsr(vip) ((vip)->type == LB_VIP_TYPE_IP4_L3DSR)
+#define lb_vip_is_l3dsr(vip) (vip)->type == LB_VIP_TYPE_IP4_L3DSR
#define lb_encap_is_ip4(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE4 \
|| (vip)->type == LB_VIP_TYPE_IP4_GRE4 \
sock_test_socket_t *ctrl = &scm->ctrl_socket;
sock_test_t rv = SOCK_TEST_TYPE_NONE;
- if (!strcmp (SOCK_TEST_TOKEN_EXIT, ctrl->txbuf))
+ if (!strncmp (SOCK_TEST_TOKEN_EXIT, ctrl->txbuf,
+ strlen (SOCK_TEST_TOKEN_EXIT)))
rv = SOCK_TEST_TYPE_EXIT;
- else if (!strcmp (SOCK_TEST_TOKEN_HELP, ctrl->txbuf))
+ else if (!strncmp (SOCK_TEST_TOKEN_HELP, ctrl->txbuf,
+ strlen (SOCK_TEST_TOKEN_HELP)))
dump_help ();
- else if (!strcmp (SOCK_TEST_TOKEN_SHOW_CFG, ctrl->txbuf))
+ else if (!strncmp (SOCK_TEST_TOKEN_SHOW_CFG, ctrl->txbuf,
+ strlen (SOCK_TEST_TOKEN_SHOW_CFG)))
scm->dump_cfg = 1;
- else if (!strcmp (SOCK_TEST_TOKEN_VERBOSE, ctrl->txbuf))
+ else if (!strncmp (SOCK_TEST_TOKEN_VERBOSE, ctrl->txbuf,
+ strlen (SOCK_TEST_TOKEN_VERBOSE)))
cfg_verbose_toggle ();
else if (!strncmp (SOCK_TEST_TOKEN_TXBUF_SIZE, ctrl->txbuf,
if (scan_dirs)
{
if (e->d_type == DT_DIR
- && (!strcmp (e->d_name, ".") || !strcmp (e->d_name, "..")))
+ && (!strncmp (e->d_name, ".", 1) ||
+ !strncmp (e->d_name, "..", 2)))
continue;
}
else
res = 0;
bier_entry_contribute_forwarding(bei, &dpo);
- BIER_TEST_I((DPO_LOAD_BALANCE == dpo.dpoi_type),
- "Entry links to %U",
- format_dpo_type, dpo.dpoi_type);
+ res = BIER_TEST_I((DPO_LOAD_BALANCE == dpo.dpoi_type),
+ "Entry links to %U",
+ format_dpo_type, dpo.dpoi_type);
if (!res)
{
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
- next_index = node->cached_next_index;
+ next_index = INTERFACE_RX_DPO_INPUT;
while (n_left_from > 0)
{
tr1 = vlib_add_trace (vm, node, b1, sizeof (*tr1));
tr1->sw_if_index = ido1->ido_sw_if_index;
}
-
- vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next,
- n_left_to_next, bi0, bi1,
- INTERFACE_RX_DPO_INPUT,
- INTERFACE_RX_DPO_INPUT);
}
while (n_left_from > 0 && n_left_to_next > 0)
tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
tr->sw_if_index = ido0->ido_sw_if_index;
}
-
- vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next,
- n_left_to_next, bi0,
- INTERFACE_RX_DPO_INPUT);
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
ethernet_main_t *
ethernet_get_main (vlib_main_t * vm)
{
- vlib_call_init_function (vm, ethernet_init);
return ðernet_main;
}
}
break;
case FT_LB_ADJ:
- FIB_TEST_I(((DPO_ADJACENCY == dpo->dpoi_type) ||
- (DPO_ADJACENCY_INCOMPLETE == dpo->dpoi_type)),
- "bucket %d stacks on %U",
- bucket,
- format_dpo_type, dpo->dpoi_type);
+ res = FIB_TEST_I(((DPO_ADJACENCY == dpo->dpoi_type) ||
+ (DPO_ADJACENCY_INCOMPLETE == dpo->dpoi_type)),
+ "bucket %d stacks on %U",
+ bucket,
+ format_dpo_type, dpo->dpoi_type);
FIB_TEST_LB((exp->adj.adj == dpo->dpoi_index),
"bucket %d stacks on adj %d",
bucket,
{
const mpls_disp_dpo_t *mdd;
- FIB_TEST_I((DPO_MPLS_DISPOSITION_PIPE == dpo->dpoi_type),
+ res = FIB_TEST_I((DPO_MPLS_DISPOSITION_PIPE == dpo->dpoi_type),
"bucket %d stacks on %U",
bucket,
format_dpo_type, dpo->dpoi_type);
dpo = &mdd->mdd_dpo;
- FIB_TEST_I(((DPO_ADJACENCY == dpo->dpoi_type) ||
- (DPO_ADJACENCY_INCOMPLETE == dpo->dpoi_type)),
- "bucket %d stacks on %U",
- bucket,
- format_dpo_type, dpo->dpoi_type);
+ res = FIB_TEST_I(((DPO_ADJACENCY == dpo->dpoi_type) ||
+ (DPO_ADJACENCY_INCOMPLETE == dpo->dpoi_type)),
+ "bucket %d stacks on %U",
+ bucket,
+ format_dpo_type, dpo->dpoi_type);
FIB_TEST_LB((exp->adj.adj == dpo->dpoi_index),
"bucket %d stacks on adj %d",
bucket,
break;
}
case FT_LB_INTF:
- FIB_TEST_I((DPO_INTERFACE_RX == dpo->dpoi_type),
- "bucket %d stacks on %U",
- bucket,
- format_dpo_type, dpo->dpoi_type);
+ res = FIB_TEST_I((DPO_INTERFACE_RX == dpo->dpoi_type),
+ "bucket %d stacks on %U",
+ bucket,
+ format_dpo_type, dpo->dpoi_type);
FIB_TEST_LB((exp->adj.adj == dpo->dpoi_index),
"bucket %d stacks on adj %d",
bucket,
exp->adj.adj);
break;
case FT_LB_L2:
- FIB_TEST_I((DPO_DVR == dpo->dpoi_type),
- "bucket %d stacks on %U",
- bucket,
- format_dpo_type, dpo->dpoi_type);
+ res = FIB_TEST_I((DPO_DVR == dpo->dpoi_type),
+ "bucket %d stacks on %U",
+ bucket,
+ format_dpo_type, dpo->dpoi_type);
FIB_TEST_LB((exp->adj.adj == dpo->dpoi_index),
"bucket %d stacks on adj %d",
bucket,
exp->adj.adj);
break;
case FT_LB_O_LB:
- FIB_TEST_I((DPO_LOAD_BALANCE == dpo->dpoi_type),
- "bucket %d stacks on %U",
- bucket,
- format_dpo_type, dpo->dpoi_type);
+ res = FIB_TEST_I((DPO_LOAD_BALANCE == dpo->dpoi_type),
+ "bucket %d stacks on %U",
+ bucket,
+ format_dpo_type, dpo->dpoi_type);
FIB_TEST_LB((exp->lb.lb == dpo->dpoi_index),
"bucket %d stacks on lb %d not %d",
bucket,
typedef enum
{
- GRE_ENCAP_NEXT_DROP,
GRE_ENCAP_NEXT_L2_MIDCHAIN,
GRE_ENCAP_N_NEXT,
} gre_encap_next_t;
-#define NEXT_IDX (GRE_ENCAP_NEXT_L2_MIDCHAIN)
-
/**
* @brief TX function. Only called for L2 payload including TEB or ERSPAN.
* L3 traffic uses the adj-midchains.
n_left_from = frame->n_vectors;
/* Speculatively send the first buffer to the last disposition we used */
- next_index = node->cached_next_index;
+ next_index = GRE_ENCAP_NEXT_L2_MIDCHAIN;
while (n_left_from > 0)
{
tr1->dst = gt1->tunnel_dst.fp_addr;
tr1->length = vlib_buffer_length_in_chain (vm, b1);
}
-
- vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, bi1, NEXT_IDX, NEXT_IDX);
}
while (n_left_from > 0 && n_left_to_next > 0)
tr->dst = gt0->tunnel_dst.fp_addr;
tr->length = vlib_buffer_length_in_chain (vm, b0);
}
-
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, NEXT_IDX);
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
.error_strings = gre_error_strings,
.n_next_nodes = GRE_ENCAP_N_NEXT,
.next_nodes = {
- [GRE_ENCAP_NEXT_DROP] = "error-drop",
[GRE_ENCAP_NEXT_L2_MIDCHAIN] = "adj-l2-midchain",
},
};
VLIB_INIT_FUNCTION (gre_init);
-gre_main_t *
-gre_get_main (vlib_main_t * vm)
-{
- vlib_call_init_function (vm, gre_init);
- return &gre_main;
-}
-
-
/*
* fd.io coding-style-patch-verification: ON
*
VLIB_INIT_FUNCTION (hdlc_init);
-hdlc_main_t *
-hdlc_get_main (vlib_main_t * vm)
-{
- vlib_call_init_function (vm, hdlc_init);
- return &hdlc_main;
-}
-
-
/*
* fd.io coding-style-patch-verification: ON
*
{
if (ip4_fib_mtrie_leaf_is_non_empty (p, i))
{
- FORMAT_PLY (s, p, i, base_address,
- p->dst_address_bits_base + 8, indent);
+ s = FORMAT_PLY (s, p, i, base_address,
+ p->dst_address_bits_base + 8, indent);
}
}
if (p->dst_address_bits_of_leaves[slot] > 0)
{
- FORMAT_PLY (s, p, slot, base_address, 16, 2);
+ s = FORMAT_PLY (s, p, slot, base_address, 16, 2);
}
}
}
ip6_main_t *im = &ip6_main;
ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main;
- ASSERT (option < ARRAY_LEN (hm->options));
+ ASSERT ((u32) option < ARRAY_LEN (hm->options));
/* Already registered */
if (hm->options[option])
ip6_main_t *im = &ip6_main;
ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main;
- ASSERT (option < ARRAY_LEN (hm->options));
+ ASSERT ((u32) option < ARRAY_LEN (hm->options));
/* Not registered */
if (!hm->options[option])
{
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->add_options));
+ ASSERT ((u32) option < ARRAY_LEN (hm->add_options));
/* Already registered */
if (hm->add_options[option])
{
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->add_options));
+ ASSERT ((u32) option < ARRAY_LEN (hm->add_options));
/* Not registered */
if (!hm->add_options[option])
{
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->config_handler));
+ ASSERT ((u32) option < ARRAY_LEN (hm->config_handler));
/* Already registered */
if (hm->config_handler[option])
{
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->config_handler));
+ ASSERT ((u32) option < ARRAY_LEN (hm->config_handler));
/* Not registered */
if (!hm->config_handler[option])
{
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->flow_handler));
+ ASSERT ((u32) option < ARRAY_LEN (hm->flow_handler));
/* Already registered */
if (hm->flow_handler[option])
{
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->flow_handler));
+ ASSERT ((u32) option < ARRAY_LEN (hm->flow_handler));
/* Not registered */
if (!hm->flow_handler[option])
{
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->pop_options));
+ ASSERT ((u32) option < ARRAY_LEN (hm->pop_options));
/* Already registered */
if (hm->pop_options[option])
{
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ASSERT (option < ARRAY_LEN (hm->pop_options));
+ ASSERT ((u32) option < ARRAY_LEN (hm->pop_options));
/* Not registered */
if (!hm->pop_options[option])
clib_error_t *error = 0;
/* Make sure the IPIP tunnel subsystem is initialised */
- vlib_call_init_function (vm, ipip_init);
+ error = vlib_call_init_function (vm, ipip_init);
sixrd_adj_delegate_type =
adj_delegate_register_new_type (&sixrd_adj_delegate_vft);
VLIB_INIT_FUNCTION (ipsec_gre_init);
-ipsec_gre_main_t *
-ipsec_gre_get_main (vlib_main_t * vm)
-{
- vlib_call_init_function (vm, ipsec_gre_init);
- return &ipsec_gre_main;
-}
-
/*
* fd.io coding-style-patch-verification: ON
*
VLIB_INIT_FUNCTION (ppp_init);
-ppp_main_t *
-ppp_get_main (vlib_main_t * vm)
-{
- vlib_call_init_function (vm, ppp_init);
- return &ppp_main;
-}
-
-
/*
* fd.io coding-style-patch-verification: ON
*
#include "vom/object_base.hpp"
#include "vom/om.hpp"
#include "vom/singular_db.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace ACL {
/**
* Show the object in the Singular DB
*/
- void show(std::ostream& os) { m_db.dump(os); }
+ void show(std::ostream& os) { db_dump(m_db, os); }
/**
* Get the sortable Id of the listener
#include "vom/acl_ethertype.hpp"
#include "vom/acl_ethertype_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace ACL {
void
acl_ethertype::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
acl_ethertype::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
};
};
#include "vom/acl_list.hpp"
#include "vom/acl_list_cmds.hpp"
#include "vom/logger.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace ACL {
}
}
+template <>
+void
+l2_list::event_handler::show(std::ostream& os)
+{
+ db_dump(m_db, os);
+}
+
template <>
l3_list::event_handler::event_handler()
{
}
}
+template <>
+void
+l3_list::event_handler::show(std::ostream& os)
+{
+ db_dump(m_db, os);
+}
+
template <>
void
l3_list::update(const l3_list& obj)
/**
* Show the object in the Singular DB
*/
- void show(std::ostream& os) { m_db.dump(os); }
+ void show(std::ostream& os);
/**
* Get the sortable Id of the listener
#include "vom/arp_proxy_binding.hpp"
#include "vom/arp_proxy_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
void
arp_proxy_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
arp_proxy_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
/*
#include "vom/arp_proxy_config.hpp"
#include "vom/arp_proxy_config_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<arp_proxy_config::key_t, arp_proxy_config> arp_proxy_config::m_db;
void
arp_proxy_config::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
arp_proxy_config::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
#include "vom/bond_group_binding.hpp"
#include "vom/bond_group_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
void
bond_group_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
bond_group_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
/*
#include "vom/bridge_domain_cmds.hpp"
#include "vom/interface.hpp"
#include "vom/l2_binding.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
void
bridge_domain::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
bridge_domain::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/bridge_domain_arp_entry.hpp"
#include "vom/bridge_domain_arp_entry_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
void
bridge_domain_arp_entry::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
bridge_domain_arp_entry::event_handler::event_handler()
void
bridge_domain_arp_entry::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
#include "vom/bridge_domain_entry.hpp"
#include "vom/bridge_domain_entry_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<bridge_domain_entry::key_t, bridge_domain_entry>
void
bridge_domain_entry::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
bridge_domain_entry::event_handler::event_handler()
void
bridge_domain_entry::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
#include "vom/dhcp_config.hpp"
#include "vom/dhcp_config_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
void
dhcp_config::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
dhcp_config::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
payload.is_add = 1;
payload.pid = getpid();
payload.want_dhcp_event = 1;
+ payload.set_broadcast_flag = m_set_broadcast_flag;
memset(payload.hostname, 0, sizeof(payload.hostname));
memcpy(payload.hostname, m_hostname.c_str(),
#include "vom/gbp_contract.hpp"
#include "vom/gbp_contract_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
void
gbp_contract::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
gbp_contract::event_handler::event_handler()
void
gbp_contract::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
#include "vom/gbp_endpoint.hpp"
#include "vom/gbp_endpoint_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
void
gbp_endpoint::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
gbp_endpoint::event_handler::event_handler()
void
gbp_endpoint::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
} // namespace VOM
#ifndef __VOM_GBP_ENDPOINT_H__
#define __VOM_GBP_ENDPOINT_H__
+#include <ostream>
+
#include "vom/interface.hpp"
#include "vom/singular_db.hpp"
#include "vom/types.hpp"
#include "vom/l3_binding_cmds.hpp"
#include "vom/logger.hpp"
#include "vom/prefix.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
interface::const_iterator_t
interface::cbegin()
{
- return m_db.cbegin();
+ return m_db.begin();
}
interface::const_iterator_t
interface::cend()
{
- return m_db.cend();
+ return m_db.end();
}
void
void
interface::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
interface::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
} // namespace VOM
#include "vom/interface_span.hpp"
#include "vom/interface_span_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
void
interface_span::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
interface_span::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
const interface_span::state_t interface_span::state_t::DISABLED(0, "disable");
#include "vom/ip_unnumbered.hpp"
#include "vom/ip_unnumbered_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
void
ip_unnumbered::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
ip_unnumbered::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/l2_binding.hpp"
#include "vom/l2_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
void
l2_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
l2_binding::event_handler::event_handler()
void
l2_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/l2_emulation.hpp"
#include "vom/l2_emulation_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
void
l2_emulation::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
l2_emulation::event_handler::event_handler()
void
l2_emulation::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/l3_binding.hpp"
#include "vom/l3_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<l3_binding::key_t, l3_binding> l3_binding::m_db;
l3_binding::const_iterator_t
l3_binding::cbegin()
{
- return m_db.cbegin();
+ return m_db.begin();
}
l3_binding::const_iterator_t
l3_binding::cend()
{
- return m_db.cend();
+ return m_db.end();
}
std::string
void
l3_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
*/
std::deque<std::shared_ptr<l3_binding>> l3s;
- auto it = m_db.cbegin();
+ auto it = m_db.begin();
- while (it != m_db.cend()) {
+ while (it != m_db.end()) {
/*
* The key in the DB is a pair of the interface's name and prefix.
* If the keys match, save the L3-config
void
l3_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/lldp_binding.hpp"
#include "vom/lldp_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
void
lldp_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
lldp_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/lldp_global.hpp"
#include "vom/lldp_global_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
/**
void
lldp_global::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
lldp_global::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/nat_binding.hpp"
#include "vom/cmd.hpp"
#include "vom/nat_binding_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<const nat_binding::key_t, nat_binding> nat_binding::m_db;
void
nat_binding::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
void
nat_binding::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/nat_static.hpp"
#include "vom/nat_static_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<nat_static::key_t, nat_static> nat_static::m_db;
void
nat_static::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
nat_static::event_handler::event_handler()
void
nat_static::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/neighbour.hpp"
#include "vom/neighbour_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
singular_db<neighbour::key_t, neighbour> neighbour::m_db;
void
neighbour::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
void
neighbour::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}
#include "vom/route.hpp"
#include "vom/route_cmds.hpp"
-#include "vom/singular_db.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace route {
void
ip_route::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
ip_route::event_handler::event_handler()
void
ip_route::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
std::ostream&
#include "vom/route_domain.hpp"
#include "vom/cmd.hpp"
#include "vom/route_domain_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
void
route_domain::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
void
route_domain::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
}; // namespace VOPM
#ifndef __VOM_INST_DB_H__
#define __VOM_INST_DB_H__
+#include <map>
#include <memory>
#include <ostream>
/**
* Get iterator to the beginning of the DB
*/
- const_iterator cbegin() { return m_map.cbegin(); }
+ const_iterator begin() const { return m_map.cbegin(); }
/**
* Get iterator to the beginning of the DB
*/
- const_iterator cend() { return m_map.cend(); }
+ const_iterator end() const { return m_map.cend(); }
/**
* Find or add the object to the store.
*/
void add(const KEY& key, std::shared_ptr<OBJ> sp) { m_map[key] = sp; }
- /**
- * Print each of the object in the DB into the stream provided
- */
- void dump(std::ostream& os)
- {
- for (auto entry : m_map) {
- os << "key: " << entry.first << std::endl;
- os << " " << entry.second.lock()->to_string() << std::endl;
- }
- }
-
/**
* Populate VPP from current state, on VPP restart
*/
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_INST_DB_FUNCS_H__
+#define __VOM_INST_DB_FUNCS_H__
+
+#include <ostream>
+
+#include "singular_db.hpp"
+
+/**
+ * A set of helper function to iterate over objects in the DB.
+ * These functions are delcared not as DB member functions so that
+ * the template instatiation of the DB does not require the definitions
+ * of the functions used to be declared.
+ */
+namespace VOM {
+/**
+ * Print each of the objects in the DB into the stream provided
+ */
+template <typename DB>
+void
+db_dump(const DB& db, std::ostream& os)
+{
+ for (const auto entry : db) {
+ os << "key: " << entry.first << std::endl;
+ os << " " << entry.second.lock()->to_string() << std::endl;
+ }
+}
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
#include "vom/vxlan_tunnel.hpp"
#include "vom/logger.hpp"
+#include "vom/singular_db_funcs.hpp"
#include "vom/vxlan_tunnel_cmds.hpp"
namespace VOM {
void
vxlan_tunnel::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
argc--;
argv++;
- if (argc > 1 && strcmp (argv[0], "-s") == 0)
+ if (argc > 1 && strncmp (argv[0], "-s", 2) == 0)
{
s->config = argv[1];
argc -= 2;