TAO_AV_Flow_Handler Class Reference

#include <Transport.h>

Inheritance diagram for TAO_AV_Flow_Handler:

Inheritance graph
[legend]
Collaboration diagram for TAO_AV_Flow_Handler:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_AV_Flow_Handler (void)
 Constructor.

virtual ~TAO_AV_Flow_Handler (void)
virtual int start (TAO_FlowSpec_Entry::Role role)
 Start/stop the flow handler.

virtual int stop (TAO_FlowSpec_Entry::Role role)
virtual int schedule_timer (void)
 Schedule timer. Uses the get_timeout method on the callback.

virtual int cancel_timer (void)
TAO_AV_Transporttransport (void)
 get the transport.

TAO_AV_Protocol_Objectprotocol_object (void)
 set/get protocol_object.

void protocol_object (TAO_AV_Protocol_Object *protocol_object)
void callback (TAO_AV_Callback *callback)
 set the callback.

virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg=0)
 Handle timeout. called from reactor.

virtual int set_remote_address (ACE_Addr *address)
 set the remote address.

virtual ACE_Event_Handlerevent_handler (void)=0
 get the underlying event handler. To be overridden by the derived clases.

virtual int change_qos (AVStreams::QoS)

Protected Attributes

TAO_AV_Transporttransport_
TAO_AV_Callbackcallback_
TAO_AV_Protocol_Objectprotocol_object_
long timer_id_
ACE_Reactorreactor_
void * timeout_arg_

Constructor & Destructor Documentation

TAO_AV_Flow_Handler::TAO_AV_Flow_Handler void   ) 
 

Constructor.

Definition at line 488 of file Transport.cpp.

00489   :transport_ (0),
00490    callback_ (0),
00491    protocol_object_ (0),
00492    timer_id_ (-1)
00493 {
00494 }

TAO_AV_Flow_Handler::~TAO_AV_Flow_Handler void   )  [virtual]
 

Definition at line 496 of file Transport.cpp.

References cancel_timer().

00497 {
00498   // cancel the timer (if there is one)
00499   this->cancel_timer();
00500 }


Member Function Documentation

void TAO_AV_Flow_Handler::callback TAO_AV_Callback callback  ) 
 

set the callback.

Definition at line 626 of file Transport.cpp.

Referenced by TAO_AV_Callback::open().

00627 {
00628   this->callback_ = callback;
00629 }

int TAO_AV_Flow_Handler::cancel_timer void   )  [virtual]
 

Definition at line 549 of file Transport.cpp.

References ACE_Singleton< TYPE, ACE_LOCK >::instance().

Referenced by ~TAO_AV_Flow_Handler().

00550 {
00551   if (this->timer_id_ != -1)
00552   return TAO_AV_CORE::instance()->reactor ()->cancel_timer (this->timer_id_);
00553   else
00554     return 0;
00555 }

int TAO_AV_Flow_Handler::change_qos AVStreams::QoS   )  [virtual]
 

Reimplemented in TAO_AV_UDP_Flow_Handler.

Definition at line 602 of file Transport.cpp.

00603 {
00604   return 0;
00605 }

virtual ACE_Event_Handler* TAO_AV_Flow_Handler::event_handler void   )  [pure virtual]
 

get the underlying event handler. To be overridden by the derived clases.

Implemented in TAO_AV_UDP_MCast_Flow_Handler, TAO_AV_TCP_Flow_Handler, and TAO_AV_UDP_Flow_Handler.

Referenced by TAO_AV_UDP_Connector::activate_svc_handler(), TAO_AV_UDP_Acceptor::activate_svc_handler(), handle_timeout(), TAO_AV_Core::init_forward_flows(), schedule_timer(), and stop().

int TAO_AV_Flow_Handler::handle_timeout const ACE_Time_Value tv,
const void *  arg = 0
[virtual]
 

Handle timeout. called from reactor.

Reimplemented in TAO_AV_UDP_MCast_Flow_Handler, TAO_AV_TCP_Flow_Handler, and TAO_AV_UDP_Flow_Handler.

Definition at line 578 of file Transport.cpp.

References event_handler(), TAO_AV_Callback::get_timeout(), TAO_AV_Callback::handle_timeout(), and ACE_Event_Handler::reactor().

Referenced by TAO_AV_UDP_Flow_Handler::handle_timeout(), TAO_AV_TCP_Flow_Handler::handle_timeout(), and TAO_AV_UDP_MCast_Flow_Handler::handle_timeout().

00580 {
00581   int result = this->callback_->handle_timeout (this->timeout_arg_);
00582   if (result < 0)
00583     return result;
00584   ACE_Event_Handler *event_handler = this->event_handler ();
00585   ACE_Time_Value *timeout = 0;
00586 
00587   this->callback_->get_timeout (timeout,  this->timeout_arg_);
00588   if (timeout == 0)
00589     return 0;
00590 
00591   this->timer_id_ =  event_handler->reactor ()->schedule_timer (event_handler,
00592                                                                 0,
00593                                                                 *timeout);
00594 
00595   if (this->timer_id_ < 0)
00596     return -1;
00597 
00598   return 0;
00599 }

void TAO_AV_Flow_Handler::protocol_object TAO_AV_Protocol_Object protocol_object  ) 
 

Definition at line 614 of file Transport.cpp.

00615 {
00616   this->protocol_object_ = protocol_object;
00617 }

TAO_AV_Protocol_Object * TAO_AV_Flow_Handler::protocol_object void   ) 
 

set/get protocol_object.

Definition at line 620 of file Transport.cpp.

Referenced by TAO_AV_UDP_Connector::connect(), TAO_AV_TCP_Acceptor::make_svc_handler(), TAO_AV_TCP_Connector::make_svc_handler(), and TAO_AV_UDP_Acceptor::open_i().

00621 {
00622   return this->protocol_object_;
00623 }

int TAO_AV_Flow_Handler::schedule_timer void   )  [virtual]
 

Schedule timer. Uses the get_timeout method on the callback.

Definition at line 527 of file Transport.cpp.

References event_handler(), TAO_AV_Callback::get_timeout(), and ACE_Singleton< TYPE, ACE_LOCK >::instance().

Referenced by TAO_AV_UDP_Connector::activate_svc_handler(), TAO_AV_UDP_Acceptor::activate_svc_handler(), TAO_AV_Callback::schedule_timer(), and start().

00528 {
00529   ACE_Event_Handler *event_handler = this->event_handler ();
00530   ACE_Time_Value *tv = 0;
00531 
00532   this->callback_->get_timeout (tv, this->timeout_arg_);
00533   if (tv == 0)
00534     return 0;
00535 
00536   this->timer_id_ =
00537       TAO_AV_CORE::instance()->reactor ()->schedule_timer (event_handler,
00538                                                            0,
00539                                                            *tv);
00540 
00541   if (this->timer_id_ < 0)
00542     return -1;
00543 
00544   return 0;
00545 }

int TAO_AV_Flow_Handler::set_remote_address ACE_Addr address  )  [virtual]
 

set the remote address.

Reimplemented in TAO_AV_UDP_Flow_Handler.

Definition at line 503 of file Transport.cpp.

Referenced by TAO_AV_UDP_Connector::connect(), and TAO_FlowSpec_Entry::set_peer_addr().

00504 {
00505   return 0;
00506 }

int TAO_AV_Flow_Handler::start TAO_FlowSpec_Entry::Role  role  )  [virtual]
 

Start/stop the flow handler.

Definition at line 509 of file Transport.cpp.

References TAO_AV_Callback::handle_start(), and schedule_timer().

00510 {
00511   this->callback_->handle_start ();
00512   switch (role)
00513     {
00514       // only for producer we register for the timeout.
00515     case TAO_FlowSpec_Entry::TAO_AV_PRODUCER:
00516       {
00517         this->schedule_timer ();
00518       }
00519       break;
00520     default:
00521       break;
00522     }
00523   return 0;
00524 }

int TAO_AV_Flow_Handler::stop TAO_FlowSpec_Entry::Role  role  )  [virtual]
 

Definition at line 559 of file Transport.cpp.

References ACE_DEBUG, event_handler(), TAO_AV_Callback::handle_stop(), LM_DEBUG, ACE_Event_Handler::reactor(), and TAO_debug_level.

00560 {
00561   this->callback_->handle_stop ();
00562   switch (role)
00563     {
00564     case TAO_FlowSpec_Entry::TAO_AV_PRODUCER:
00565       {
00566         int result =  this->event_handler ()->reactor ()->cancel_timer (this->timer_id_);
00567         if (result <  0)
00568           if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Flow_Handler::stop:cancel_timer failed\n"));
00569       }
00570       break;
00571     default:
00572       break;
00573     }
00574   return 0;
00575 }

TAO_AV_Transport * TAO_AV_Flow_Handler::transport void   ) 
 

get the transport.

Reimplemented in TAO_AV_TCP_Flow_Handler, and TAO_AV_UDP_Flow_Handler.

Definition at line 608 of file Transport.cpp.

Referenced by TAO_AV_UDP_Connector::connect(), and TAO_AV_UDP_Acceptor::open_i().

00609 {
00610   return this->transport_;
00611 }


Member Data Documentation

TAO_AV_Callback* TAO_AV_Flow_Handler::callback_ [protected]
 

Definition at line 148 of file Transport.h.

TAO_AV_Protocol_Object* TAO_AV_Flow_Handler::protocol_object_ [protected]
 

Definition at line 149 of file Transport.h.

ACE_Reactor* TAO_AV_Flow_Handler::reactor_ [protected]
 

Definition at line 151 of file Transport.h.

void* TAO_AV_Flow_Handler::timeout_arg_ [protected]
 

Definition at line 152 of file Transport.h.

long TAO_AV_Flow_Handler::timer_id_ [protected]
 

Definition at line 150 of file Transport.h.

TAO_AV_Transport* TAO_AV_Flow_Handler::transport_ [protected]
 

Definition at line 147 of file Transport.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:47:08 2006 for TAO_AV by doxygen 1.3.6