MCProxy

mc_tables Class Reference

Parse ipv4 and ipv6 kernel tables to usable data structures.

#include "mc_tables.hpp"

List of all members.

Public Member Functions

vector< struct igmp_devget_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_cacheget_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_vifget_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]

Get an empty snmp6 structure.

References HC_LOG_TRACE.

Referenced by refresh_snmp6().

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  ) 
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  ) 
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  ) 
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_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 (  ) 
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().

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().