receiver Class Reference

Abstract basic receiver class.

#include "receiver.hpp"

List of all members.

Public Member Functions

void del_interface (int if_index, int vif)
virtual bool init (int addr_family, int version, mroute_socket *mrt_sock)
bool is_running ()
void join ()
 receiver ()
void registrate_interface (int if_index, int vif, proxy_instance *p)
void start ()
void stop ()
 ~receiver ()

Protected Member Functions

virtual void analyse_packet (struct msghdr *msg, int info_size)=0
virtual int get_ctrl_min_size ()=0
int get_if_index (int vif)
virtual int get_iov_min_size ()=0
proxy_instanceget_proxy_instance (int if_index)

Protected Attributes

int m_addr_family
if_prop m_if_property
if_poxy_instance_map m_if_proxy_map
int m_version

Constructor & Destructor Documentation

receiver::receiver (  ) 

Create a receiver.

References HC_LOG_TRACE.

receiver::~receiver (  ) 

Release all resources.

References HC_LOG_TRACE.

Member Function Documentation

virtual void receiver::analyse_packet ( struct msghdr *  msg,
int  info_size 
) [protected, pure virtual]

Analyze the received packet and send a message to the relevant proxy instance.

msg received message
info_size received information size
void receiver::del_interface ( int  if_index,
int  vif 

Delete an registerd interface.

if_index interface index of the interface
vif virtual interface index of the interface

References HC_LOG_TRACE, and m_if_proxy_map.

virtual int receiver::get_ctrl_min_size (  )  [protected, pure virtual]

Get the size for the control buffer for recvmsg().

int receiver::get_if_index ( int  vif  )  [protected]

Get the interface index to a virtual interface index. Search in a private map vif_map.

vif virutal interface index
interface index or 0 if not found

References HC_LOG_TRACE.

virtual int receiver::get_iov_min_size (  )  [protected, pure virtual]

Get the size for the iov vector for recvmsg().

proxy_instance * receiver::get_proxy_instance ( int  if_index  )  [protected]

Get the proxy instance pointer to the interface index. Search in m_if_proxy_map.

if_index interface index
pointer of the proxy instance or NULL if not found

References HC_LOG_TRACE, and m_if_proxy_map.

bool receiver::init ( int  addr_family,
int  version,
mroute_socket mrt_sock 
) [virtual]

Initialize the receiver.

addr_family used IP version (AF_INET or AF_INET6)
version used group membership version
mrt_sock need the multicast routing socket with set mrt-flag
Return true on success.

Reimplemented in mld_receiver.

References HC_LOG_TRACE, m_addr_family, m_mrt_sock, m_version, RECEIVER_RECV_TIMEOUT, and mc_socket::set_receive_timeout().

Referenced by proxy::init().

bool receiver::is_running (  ) 

Check whether the receiver is running.

void receiver::join (  ) 

Blocked until receiver stopped.

References HC_LOG_TRACE.

Referenced by proxy::end().

void receiver::registrate_interface ( int  if_index,
int  vif,
proxy_instance p 

Register an interface at the receiver.

if_index interface index of the registered interface
vif virtual interface indxe of the inteface
proxy_instance* who register the interface

References HC_LOG_TRACE, and m_if_proxy_map.

void receiver::start (  ) 

Start the receiver.

References HC_LOG_TRACE.

Referenced by proxy::init().

void receiver::stop (  ) 

Stop the receiver, but dont wait for stopped.

References HC_LOG_TRACE.

Referenced by proxy::end().

Member Data Documentation

int receiver::m_addr_family [protected]

Used IP version (AF_INET or AF_INET6).

Referenced by init().

Collect interface properties. Used to generate multicast messages.

Save the interface index with the incidental Proxy Instance.

Referenced by del_interface(), get_proxy_instance(), and registrate_interface().

Abstracted multicast socket to receive multicast messages.

Referenced by init(), and mld_receiver::init().

int receiver::m_version [protected]

Used group membership version.

Referenced by init().