TAO_RTEvent
2.1.8
|
Event Handler for Mcast messages. NOT THREAD-SAFE. More...
#include <ECG_Mcast_EH.h>
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... | |
![]() | |
virtual | ~TAO_ECG_Handler_Shutdown (void) |
Private Types | |
typedef ACE_Unbounded_Set < ACE_INET_Addr > | Address_Set |
typedef ACE_Array_Base < Subscription > | Subscriptions |
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_TCHAR * | net_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_Handler * | receiver_ |
We callback to this object when a message arrives. More... | |
CORBA::ULong | recvbuf_size_ |
SOCKbuf size. More... | |
PortableServer::Servant_var < Observer > | observer_ |
TAO_EC_Auto_Command < Observer_Disconnect_Command > | auto_observer_disconnect_ |
Friends | |
class | Observer |
Make update_consumer () accessible to Observer. More... | |
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.
|
private |
|
private |
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.
|
virtual |
Destructor.
|
private |
Subscribe to all multicast addresses in /a multicast_addresses - we are not subscribed to them yet, but need to be.
multicast_addresses | List of multicast addresses to which we need to subscribe to in order to be receiving all event types in the current consumer subscriptions. |
|
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.
sub | The list of event types that our event channel consumers are interested in. |
multicast_addresses | This method populates this list with multicast addresses that we need to be subscribed to in order to receive event types specified in /a sub. |
CORBA::SystemException | This method needs to perform several CORBA invocations, and it propagates any exceptions back to the caller. |
|
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.
multicast_addresses | List of multicast addresses we need to be subscribed to in order receive all event types in the current consumer subscriptions. |
|
virtual |
Reactor callback. Notify receiver_ that a dgram corresponding to fd is ready for reading.
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).
|
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.
|
private |
The Observer method. Subscribe/unsubscribe to multicast groups according to changes in consumer subscriptions.
|
private |
Manages connection of our observer to the Event Channel. ORDER DEPENDENCY: this member should be declared AFTER <observer_>.
|
private |
The NIC used to subscribe for multicast traffic.
|
private |
Event Channel Observer. Detects changes in EC consumer subscriptions. ORDER DEPENDENCY: this member should be declared before <auto_observer_disconnect_>.
|
private |
We callback to this object when a message arrives.
|
private |
SOCKbuf size.
|
private |
List of multicast addresses we subscribe to and dgrams we use.