mc_tables Class Reference
Parse ipv4 and ipv6 kernel tables to usable data structures.
#include "mc_tables.hpp"
Public Member Functions | |
vector< struct igmp_dev > | get_igmp_table_all () |
vector< string > | get_igmp_table_all_interfaces () |
struct igmp_dev | get_igmp_table_dev (string if_name) |
struct igmp_dev | get_igmp_table_empty_dev () |
addr_storage | get_joined_group (string &ifName, unsigned int index) |
unsigned int | get_joined_groups_count (string &ifName) |
struct mr_cache & | get_route (unsigned int index) |
unsigned int | get_routes_count () |
struct snmp6 | get_snmp6 (string if_name) |
vector< string > | get_snmp6_all_interfaces () |
struct snmp6 | get_snmp6_empty_struct () |
struct mr_vif & | get_vif (unsigned int index) |
unsigned int | get_vifs_count () |
void | init_tables (int addrFamily) |
mc_tables () | |
void | print_all_igmp_table () |
void | print_all_joined_groups () |
void | print_all_route_infos () |
void | print_all_snmp6_infos () |
void | print_all_vif_infos () |
void | print_igmp_table_dev (const struct igmp_dev *s) |
void | print_route_info (struct mr_cache &t) |
void | print_snmp6_infos (const struct snmp6 *s) |
void | print_vif_info (struct mr_vif &t) |
bool | refresh_igmp_table () |
bool | refresh_joined_groups () |
bool | refresh_routes () |
bool | refresh_snmp6 () |
bool | refresh_vifs () |
Static Public Member Functions | |
static void | test_igmp_table () |
static void | test_joined_groups (int addrFamily) |
static void | test_mr_cache (int addrFamily) |
static void | test_snmp6 () |
static void | test_vifs (int addrFamily) |
static void | trim (char *str, unsigned int size) |
Constructor & Destructor Documentation
mc_tables::mc_tables | ( | ) |
Create mc_tables.
Member Function Documentation
vector< struct igmp_dev > mc_tables::get_igmp_table_all | ( | ) |
Get the whole igmp table.
References HC_LOG_TRACE.
vector< string > mc_tables::get_igmp_table_all_interfaces | ( | ) |
- Returns:
- Get all available interfaces seen in the igmp table.
References HC_LOG_TRACE, and igmp_dev::if_name.
struct igmp_dev mc_tables::get_igmp_table_dev | ( | string | if_name | ) | [read] |
Get igmp infos for a specific interface.
- Parameters:
-
if_name interface name for the interface
- Returns:
- Return the structure igmp_dev or on error an empty_igmp_dev structure.
References HC_LOG_TRACE, and igmp_dev::if_name.
struct igmp_dev mc_tables::get_igmp_table_empty_dev | ( | ) | [read] |
Get an empty igmp device structure.
References igmp_dev::g_count, igmp_dev::if_name, igmp_dev::index, and igmp_dev::querier_version.
addr_storage mc_tables::get_joined_group | ( | string & | ifName, | |
unsigned int | index | |||
) |
Get a multicastgroup address for a specificinterface.
- Parameters:
-
ifName name of the interface index number of the joined group for this interface
References HC_LOG_TRACE.
Referenced by test_joined_groups().
unsigned int mc_tables::get_joined_groups_count | ( | string & | ifName | ) |
Get the number of joined groups for a specificnetwork interface.
- Parameters:
-
ifName name of the interface
References HC_LOG_TRACE.
Referenced by test_joined_groups().
struct mr_cache & mc_tables::get_route | ( | unsigned int | index | ) | [read] |
Get a mutlciast struct mr_cache.
- Parameters:
-
index number of the multicast forwarding route in the Linux kernel table
References HC_LOG_TRACE.
Referenced by check_source::is_src_unused().
unsigned int mc_tables::get_routes_count | ( | ) |
Get the number of configured multicastforwarding routes.
References HC_LOG_TRACE.
Referenced by check_source::is_src_unused().
struct snmp6 mc_tables::get_snmp6 | ( | string | if_name | ) | [read] |
Get snmp6 infos for a specific interface.
- Parameters:
-
if_name name of the interface
- Returns:
- Return the snmp6 infos or if the interface name not found an empty struct.
References HC_LOG_TRACE.
vector< string > mc_tables::get_snmp6_all_interfaces | ( | ) |
Get all available interfaces watched by snmp6.
References HC_LOG_TRACE.
struct snmp6 mc_tables::get_snmp6_empty_struct | ( | ) | [read] |
struct mr_vif & mc_tables::get_vif | ( | unsigned int | index | ) | [read] |
Get a virtual interface and there properties.
- Parameters:
-
index number of the virtual interface in the Linux kernel table
References HC_LOG_TRACE.
unsigned int mc_tables::get_vifs_count | ( | ) |
Get the number of configured virtual interfaces.
References HC_LOG_TRACE.
void mc_tables::init_tables | ( | int | addrFamily | ) |
Set the address family.
Referenced by check_source::init(), test_igmp_table(), test_joined_groups(), test_mr_cache(), test_snmp6(), and test_vifs().
void mc_tables::print_all_igmp_table | ( | ) |
Print the whole igmp table.
References HC_LOG_TRACE, and print_igmp_table_dev().
Referenced by test_igmp_table().
void mc_tables::print_all_joined_groups | ( | ) |
Print all available devices and their joined groups.
References HC_LOG_TRACE.
void mc_tables::print_all_route_infos | ( | ) |
Print all multicast route infos.
References HC_LOG_TRACE, and print_route_info().
Referenced by test_mr_cache().
void mc_tables::print_all_snmp6_infos | ( | ) |
Print all snmp6 infos.
References HC_LOG_TRACE, and print_snmp6_infos().
Referenced by test_snmp6().
void mc_tables::print_all_vif_infos | ( | ) |
Print all virtual interface infos.
References HC_LOG_TRACE, and print_vif_info().
Referenced by test_vifs().
void mc_tables::print_igmp_table_dev | ( | const struct igmp_dev * | s | ) |
Print igmp infos for a specific interface.
- Parameters:
-
igmp_dev device raw of the igmp table
References igmp_dev::g_count, igmp_group::group, igmp_dev::groups, HC_LOG_ERROR, HC_LOG_TRACE, igmp_dev::if_name, igmp_dev::index, igmp_dev::querier_version, igmp_group::reporter, igmp_group::timer, igmp_group::timer_run, and igmp_group::users.
Referenced by print_all_igmp_table().
void mc_tables::print_route_info | ( | struct mr_cache & | t | ) |
Print a multicast forwarding route.
- Parameters:
-
mr_cache multicast forwarding route
References mr_cache::bytes, mr_cache::group, HC_LOG_TRACE, mr_cache::i_if, mr_cache::o_if, mr_cache::origin, mr_cache::pkts, and mr_cache::wrong.
Referenced by print_all_route_infos().
void mc_tables::print_snmp6_infos | ( | const struct snmp6 * | s | ) |
Print snmp6 infos for a specificinterface.
References HC_LOG_ERROR, HC_LOG_TRACE, SNMP6_value::Icmp6InGroupMembQueries, SNMP6_value::Icmp6InGroupMembResponses, SNMP6_value::Icmp6InMLDv2Reports, SNMP6_value::Icmp6OutGroupMembQueries, SNMP6_value::Icmp6OutGroupMembResponses, and SNMP6_value::Icmp6OutMLDv2Reports.
Referenced by print_all_snmp6_infos().
void mc_tables::print_vif_info | ( | struct mr_vif & | t | ) |
Print the properties of a virtual interface.
- Parameters:
-
mr_vif virtual interface struct
References mr_vif::bytesIn, mr_vif::bytesOut, mr_vif::flags, mr_vif::ifname, mr_vif::lcl_addr, mr_vif::lcl_index, mr_vif::pktsIn, mr_vif::pktsOut, mr_vif::remote, and mr_vif::vifi.
Referenced by print_all_vif_infos().
bool mc_tables::refresh_igmp_table | ( | ) |
Refresh the igmp table.
- Returns:
- Return true on success.
References igmp_dev::g_count, igmp_group::group, igmp_dev::groups, HC_LOG_ERROR, HC_LOG_TRACE, igmp_dev::if_name, igmp_dev::index, JOINED_GROUP_PATH_V4, MAX_N_LINE_LENGTH, igmp_dev::querier_version, igmp_group::reporter, igmp_group::timer, igmp_group::timer_run, and igmp_group::users.
Referenced by test_igmp_table().
bool mc_tables::refresh_joined_groups | ( | ) |
Refresh all devices and their joined groups.
- Returns:
- Return true on success.
References HC_LOG_ERROR, HC_LOG_TRACE, JOINED_GROUP_PATH_V4, JOINED_GROUP_PATH_V6, and MAX_N_LINE_LENGTH.
Referenced by test_joined_groups().
bool mc_tables::refresh_routes | ( | ) |
Refresh the multicast forwarding routes.
- Returns:
- Return true on success.
References mr_cache::addr_family, mr_cache::bytes, mr_cache::group, HC_LOG_ERROR, HC_LOG_TRACE, mr_cache::i_if, MAX_N_LINE_LENGTH, MR_CACHE_PATH_V4, MR_CACHE_PATH_V6, mr_cache::o_if, mr_cache::origin, mr_cache::pkts, trim(), and mr_cache::wrong.
Referenced by check_source::check(), check_source::init(), and test_mr_cache().
bool mc_tables::refresh_snmp6 | ( | ) |
Refresh the snmp6 table.
- Returns:
- Return true on success.
References get_snmp6_empty_struct(), HC_LOG_ERROR, HC_LOG_TRACE, MAX_N_LINE_LENGTH, and SNMP6_PATH.
Referenced by test_snmp6().
bool mc_tables::refresh_vifs | ( | ) |
Refresh the virtual interfaces.
References mr_vif::addr_family, mr_vif::bytesIn, mr_vif::bytesOut, mr_vif::flags, HC_LOG_ERROR, HC_LOG_TRACE, mr_vif::ifname, mr_vif::lcl_addr, mr_vif::lcl_index, MAX_N_LINE_LENGTH, mr_vif::pktsIn, mr_vif::pktsOut, mr_vif::remote, VIF_PATH_V4, VIF_PATH_V6, and mr_vif::vifi.
Referenced by test_vifs().
void mc_tables::test_igmp_table | ( | ) | [static] |
Test the igmp table.
References HC_LOG_TRACE, init_tables(), print_all_igmp_table(), and refresh_igmp_table().
void mc_tables::test_joined_groups | ( | int | addrFamily | ) | [static] |
Test joined groups for an ip version (AF_INET or AF_INET6).
References get_joined_group(), get_joined_groups_count(), HC_LOG_TRACE, init_tables(), and refresh_joined_groups().
Referenced by test_mctables().
void mc_tables::test_mr_cache | ( | int | addrFamily | ) | [static] |
Test the multicast routing cache for an ip version (AF_INET or AF_INET6).
References HC_LOG_TRACE, init_tables(), print_all_route_infos(), and refresh_routes().
Referenced by test_mctables().
void mc_tables::test_snmp6 | ( | ) | [static] |
Test the snmp6 table for an ip version (AF_INET or AF_INET6).
References HC_LOG_TRACE, init_tables(), print_all_snmp6_infos(), and refresh_snmp6().
void mc_tables::test_vifs | ( | int | addrFamily | ) | [static] |
Test virtual interfaces for an ip version (AF_INET or AF_INET6).
References HC_LOG_TRACE, init_tables(), print_all_vif_infos(), and refresh_vifs().
Referenced by test_mctables().
void mc_tables::trim | ( | char * | str, | |
unsigned int | size | |||
) | [static] |
Remove spaces beforeand behind a string.
- Parameters:
-
str string to trim size size of the string
Referenced by refresh_routes().