TAO_RTEvent  2.4.0
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
TAO_ECG_Mcast_EH Class Reference

Event Handler for Mcast messages. NOT THREAD-SAFE. More...

#include <ECG_Mcast_EH.h>

Inheritance diagram for TAO_ECG_Mcast_EH:
Inheritance graph
[legend]
Collaboration diagram for TAO_ECG_Mcast_EH:
Collaboration graph
[legend]

Classes

class  Observer
 Observes changes in the EC consumer subscriptions and notifies TAO_ECG_Mcast_EH when there are changes. More...
 
class  Observer_Disconnect_Command
 Disconnects Observer from the Event Channel. More...
 
struct  Subscription
 

Public Member Functions

virtual int handle_input (ACE_HANDLE fd)
 
 TAO_ECG_Mcast_EH (TAO_ECG_Dgram_Handler *recv, const ACE_TCHAR *net_if=0, CORBA::ULong buf_sz=0)
 Initialization and termination methods. More...
 
virtual ~TAO_ECG_Mcast_EH (void)
 Destructor. More...
 
void open (RtecEventChannelAdmin::EventChannel_ptr ec)
 
virtual int shutdown (void)
 TAO_ECG_Handler_Shutdown method. More...
 
- Public Member Functions inherited from ACE_Event_Handler
virtual ~ACE_Event_Handler (void)
 
virtual ACE_HANDLE get_handle (void) const
 
virtual void set_handle (ACE_HANDLE)
 
virtual int priority (void) const
 
virtual void priority (int priority)
 
virtual int handle_output (ACE_HANDLE fd=ACE_INVALID_HANDLE)
 
virtual int handle_exception (ACE_HANDLE fd=ACE_INVALID_HANDLE)
 
virtual int handle_timeout (const ACE_Time_Value &current_time, const void *act=0)
 
virtual int handle_exit (ACE_Process *)
 
virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask)
 
virtual int handle_signal (int signum, siginfo_t *=0, ucontext_t *=0)
 
virtual int resume_handler (void)
 
virtual int handle_qos (ACE_HANDLE=ACE_INVALID_HANDLE)
 
virtual int handle_group_qos (ACE_HANDLE=ACE_INVALID_HANDLE)
 
virtual void reactor (ACE_Reactor *reactor)
 
virtual ACE_Reactorreactor (void) const
 
virtual ACE_Reactor_Timer_Interfacereactor_timer_interface (void) const
 
virtual Reference_Count add_reference (void)
 
virtual Reference_Count remove_reference (void)
 
Reference_Counting_Policyreference_counting_policy (void)
 
- Public Member Functions inherited from TAO_ECG_Handler_Shutdown
virtual ~TAO_ECG_Handler_Shutdown (void)
 

Private Types

typedef ACE_Unbounded_Set< ACE_INET_AddrAddress_Set
 
typedef ACE_Array_Base< SubscriptionSubscriptions
 

Private Member Functions

void update_consumer (const RtecEventChannelAdmin::ConsumerQOS &sub)
 
void compute_required_subscriptions (const RtecEventChannelAdmin::ConsumerQOS &sub, Address_Set &multicast_addresses)
 
int delete_unwanted_subscriptions (Address_Set &multicast_addresses)
 
void add_new_subscriptions (Address_Set &multicast_addresses)
 

Private Attributes

ACE_TCHARnet_if_
 The NIC used to subscribe for multicast traffic. More...
 
Subscriptions subscriptions_
 List of multicast addresses we subscribe to and dgrams we use. More...
 
TAO_ECG_Dgram_Handlerreceiver_
 We callback to this object when a message arrives. More...
 
CORBA::ULong recvbuf_size_
 SOCKbuf size. More...
 
PortableServer::Servant_var< Observerobserver_
 
TAO_EC_Auto_Command< Observer_Disconnect_Commandauto_observer_disconnect_
 

Friends

class Observer
 Make update_consumer () accessible to Observer. More...
 

Additional Inherited Members

- Public Types inherited from ACE_Event_Handler
typedef long Reference_Count
 
- Static Public Member Functions inherited from ACE_Event_Handler
static ACE_THR_FUNC_RETURN read_adapter (void *event_handler)
 
static int register_stdin_handler (ACE_Event_Handler *eh, ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr, int flags=THR_DETACHED)
 
static int remove_stdin_handler (ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr)
 
- Public Attributes inherited from ACE_Event_Handler
 LO_PRIORITY
 
 HI_PRIORITY
 
 NULL_MASK
 
 READ_MASK
 
 WRITE_MASK
 
 EXCEPT_MASK
 
 ACCEPT_MASK
 
 CONNECT_MASK
 
 TIMER_MASK
 
 QOS_MASK
 
 GROUP_QOS_MASK
 
 SIGNAL_MASK
 
 ALL_EVENTS_MASK
 
 RWE_MASK
 
 DONT_CALL
 
 ACE_EVENT_HANDLER_NOT_RESUMED
 
 ACE_REACTOR_RESUMES_HANDLER
 
 ACE_APPLICATION_RESUMES_HANDLER
 
- Protected Types inherited from ACE_Event_Handler
typedef ACE_Atomic_Op< ACE_SYNCH_MUTEX, Reference_CountAtomic_Reference_Count
 
- Protected Member Functions inherited from ACE_Event_Handler
 ACE_Event_Handler (ACE_Reactor *=0, int priority=ACE_Event_Handler::LO_PRIORITY)
 
- Protected Attributes inherited from ACE_Event_Handler
Atomic_Reference_Count reference_count_
 

Detailed Description

Event Handler for Mcast messages. NOT THREAD-SAFE.

This object acts as an Observer to Event Channel. It subscribes to multicast groups that carry events matching the EC's subscriptions. This object then receives callbacks from the Reactor when data is available on the mcast sockets and alerts TAO_ECG_Dgram_Handler, which reads the data, transforms it into event and pushes to the Event Channel.

Member Typedef Documentation

Constructor & Destructor Documentation

TAO_ECG_Mcast_EH::TAO_ECG_Mcast_EH ( TAO_ECG_Dgram_Handler recv,
const ACE_TCHAR net_if = 0,
CORBA::ULong  buf_sz = 0 
)

Initialization and termination methods.

Constructor. Messages received by this EH will be forwarded to the recv. net_if can be used to specify NIC where multicast messages are expected. would be used to alter the default buffer size.

See comments for receiver_ data member on why raw pointer is used for the recv argument.

TAO_ECG_Mcast_EH::~TAO_ECG_Mcast_EH ( void  )
virtual

Destructor.

Member Function Documentation

void TAO_ECG_Mcast_EH::add_new_subscriptions ( Address_Set multicast_addresses)
private

Subscribe to all multicast addresses in /a multicast_addresses - we are not subscribed to them yet, but need to be.

Parameters
multicast_addressesList of multicast addresses to which we need to subscribe to in order to be receiving all event types in the current consumer subscriptions.
void TAO_ECG_Mcast_EH::compute_required_subscriptions ( const RtecEventChannelAdmin::ConsumerQOS sub,
Address_Set multicast_addresses 
)
private

Helpers for updating multicast subscriptions based on changes in consumer subscriptions. Compute the list of multicast addresses that we need to be subscribed to, in order to receive the events described in the ConsumerQOS parameter.

Parameters
subThe list of event types that our event channel consumers are interested in.
multicast_addressesThis method populates this list with multicast addresses that we need to be subscribed to in order to receive event types specified in /a sub.
Exceptions
CORBA::SystemExceptionThis method needs to perform several CORBA invocations, and it propagates any exceptions back to the caller.
int TAO_ECG_Mcast_EH::delete_unwanted_subscriptions ( Address_Set multicast_addresses)
private

Unsubscribe from any multicast addresses we are currently subscribed to that are not in the multicast_addresses list. Also remove from /a multicast_addresses any addresses to which we are already subscribed.

Parameters
multicast_addressesList of multicast addresses we need to be subscribed to in order receive all event types in the current consumer subscriptions.
int TAO_ECG_Mcast_EH::handle_input ( ACE_HANDLE  fd)
virtual

Reactor callback. Notify receiver_ that a dgram corresponding to fd is ready for reading.

Reimplemented from ACE_Event_Handler.

void TAO_ECG_Mcast_EH::open ( RtecEventChannelAdmin::EventChannel_ptr  ec)

Register for changes in the EC subscription list. When the subscription list becomes non-empty we join the proper multicast groups (using Dgram_Handler to translate between event types and mcast groups) and the class registers itself with the reactor.

To insure proper resource clean up, if open () is successful, the user MUST call shutdown () when handler is no longer needed (and its reactor still exists).

int TAO_ECG_Mcast_EH::shutdown ( void  )
virtual

TAO_ECG_Handler_Shutdown method.

Remove ourselves from the event channel, unsubscribe from the multicast groups, close the sockets and deregister from the reactor.

Implements TAO_ECG_Handler_Shutdown.

void TAO_ECG_Mcast_EH::update_consumer ( const RtecEventChannelAdmin::ConsumerQOS sub)
private

The Observer method. Subscribe/unsubscribe to multicast groups according to changes in consumer subscriptions.

Friends And Related Function Documentation

friend class Observer
friend

Make update_consumer () accessible to Observer.

Member Data Documentation

TAO_EC_Auto_Command<Observer_Disconnect_Command> TAO_ECG_Mcast_EH::auto_observer_disconnect_
private

Manages connection of our observer to the Event Channel. ORDER DEPENDENCY: this member should be declared AFTER <observer_>.

ACE_TCHAR* TAO_ECG_Mcast_EH::net_if_
private

The NIC used to subscribe for multicast traffic.

PortableServer::Servant_var<Observer> TAO_ECG_Mcast_EH::observer_
private

Event Channel Observer. Detects changes in EC consumer subscriptions. ORDER DEPENDENCY: this member should be declared before <auto_observer_disconnect_>.

TAO_ECG_Dgram_Handler* TAO_ECG_Mcast_EH::receiver_
private

We callback to this object when a message arrives.

CORBA::ULong TAO_ECG_Mcast_EH::recvbuf_size_
private

SOCKbuf size.

Subscriptions TAO_ECG_Mcast_EH::subscriptions_
private

List of multicast addresses we subscribe to and dgrams we use.


The documentation for this class was generated from the following files: