MCProxy

receiver Class Reference
[Receiver]

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
mroute_socketm_mrt_sock
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.

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

Delete an registerd interface.

Parameters:
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.

Parameters:
vif virutal interface index
Returns:
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.

Parameters:
if_index interface index
Returns:
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.

Parameters:
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
Returns:
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.

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