TAO_AV_Core Class Reference

This class encapsulates access to the TAO AV Core's resources and its state. More...

#include <AV_Core.h>

Collaboration diagram for TAO_AV_Core:

Collaboration graph
[legend]
List of all members.

Public Types

 TAO_AV_ENDPOINT_A
 TAO_AV_ENDPOINT_B
 TAO_AV_NOPROTOCOL = -1
 TAO_AV_TCP = 0
 TAO_AV_UDP = 1
 TAO_AV_AAL5 = 2
 TAO_AV_AAL3_4 = 3
 TAO_AV_AAL1 = 4
 TAO_AV_RTP_UDP = 5
 TAO_AV_RTP_AAL5 = 6
 TAO_AV_IPX = 7
 TAO_AV_SFP_UDP = 8
 TAO_AV_UDP_MCAST = 9
 TAO_AV_RTP_UDP_MCAST = 10
 TAO_AV_SFP_UDP_MCAST = 11
 TAO_AV_QOS_UDP = 12
 TAO_AV_USERDEFINED_UDP = 13
 TAO_AV_USERDEFINED_UDP_MCAST = 14
 TAO_AV_SCTP_SEQ = 15
 TAO_AV_DATA = 1
 TAO_AV_CONTROL = 2
 TAO_AV_BOTH = 3
enum  EndPoint { TAO_AV_ENDPOINT_A, TAO_AV_ENDPOINT_B }
enum  Protocol {
  TAO_AV_NOPROTOCOL = -1, TAO_AV_TCP = 0, TAO_AV_UDP = 1, TAO_AV_AAL5 = 2,
  TAO_AV_AAL3_4 = 3, TAO_AV_AAL1 = 4, TAO_AV_RTP_UDP = 5, TAO_AV_RTP_AAL5 = 6,
  TAO_AV_IPX = 7, TAO_AV_SFP_UDP = 8, TAO_AV_UDP_MCAST = 9, TAO_AV_RTP_UDP_MCAST = 10,
  TAO_AV_SFP_UDP_MCAST = 11, TAO_AV_QOS_UDP = 12, TAO_AV_USERDEFINED_UDP = 13, TAO_AV_USERDEFINED_UDP_MCAST = 14,
  TAO_AV_SCTP_SEQ = 15
}
enum  Flow_Component { TAO_AV_DATA = 1, TAO_AV_CONTROL = 2, TAO_AV_BOTH = 3 }

Public Member Functions

 TAO_AV_Core (void)
 Default constructor.
 ~TAO_AV_Core (void)
 Destructor.
int init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
int run (void)
int stop_run (void)
int init_forward_flows (TAO_Base_StreamEndPoint *endpoint, TAO_AV_FlowSpecSet &flow_spec_set, EndPoint direction, AVStreams::flowSpec &flow_spec)
int init_reverse_flows (TAO_Base_StreamEndPoint *endpoint, TAO_AV_FlowSpecSet &forward_flow_spec_set, TAO_AV_FlowSpecSet &reverse_flow_spec_set, EndPoint direction)
int init_transport_factories (void)
int init_flow_protocol_factories (void)
int load_default_transport_factories (void)
int load_default_flow_protocol_factories (void)
TAO_AV_Acceptorget_acceptor (const char *flowname)
 = Get the acceptor registry
TAO_AV_Connectorget_connector (const char *flowname)
int remove_acceptor (const char *flowname)
int remove_connector (const char *flowname)
TAO_AV_Connector_Registryconnector_registry (void)
TAO_FlowSpec_Entryget_flow_spec_entry (TAO_AV_FlowSpecSet &flow_spec_set, const char *flowname)
TAO_AV_Acceptor_Registryacceptor_registry (void)
TAO_AV_Flow_Protocol_Factoryget_flow_protocol_factory (const char *flow_protocol)
 = Set/get the <ACE_Reactor>.
TAO_AV_Transport_Factoryget_transport_factory (const char *transport_protocol)
TAO_AV_Flow_ProtocolFactorySetflow_protocol_factories (void)
TAO_AV_TransportFactorySettransport_factories (void)
void reactor (ACE_Reactor *r)
ACE_Reactorreactor (void)
CORBA::ORB_ptr orb (void)
void orb (CORBA::ORB_ptr orb_)
PortableServer::POA_ptr poa (void)
void poa (PortableServer::POA_ptr poa_)

Static Public Member Functions

static int deactivate_servant (PortableServer::Servant servant)
static char * get_flowname (const char *flow_spec_entry_str)
static ACE_CString get_control_flowname (const char *flowname)

Protected Attributes

TAO_AV_Connector_Registryconnector_registry_
TAO_AV_Acceptor_Registryacceptor_registry_
TAO_AV_TransportFactorySet transport_factories_
 Pointer to the list of transports loaded into this AV_Core instance.
TAO_AV_Flow_ProtocolFactorySet flow_protocol_factories_
 Pointer to the list of flow protocol loaded into this AV_Core instance.
ACE_Reactorreactor_
CORBA::ORB_var orb_
PortableServer::POA_var poa_
CORBA::Boolean stop_run_

Detailed Description

This class encapsulates access to the TAO AV Core's resources and its state.

Definition at line 58 of file AV_Core.h.


Member Enumeration Documentation

enum TAO_AV_Core::EndPoint

Enumerator:
TAO_AV_ENDPOINT_A 
TAO_AV_ENDPOINT_B 

Definition at line 61 of file AV_Core.h.

enum TAO_AV_Core::Flow_Component

Enumerator:
TAO_AV_DATA 
TAO_AV_CONTROL 
TAO_AV_BOTH 

Definition at line 84 of file AV_Core.h.

00085   {
00086     TAO_AV_DATA = 1,
00087     TAO_AV_CONTROL = 2,
00088     TAO_AV_BOTH = 3
00089   };

enum TAO_AV_Core::Protocol

Enumerator:
TAO_AV_NOPROTOCOL 
TAO_AV_TCP 
TAO_AV_UDP 
TAO_AV_AAL5 
TAO_AV_AAL3_4 
TAO_AV_AAL1 
TAO_AV_RTP_UDP 
TAO_AV_RTP_AAL5 
TAO_AV_IPX 
TAO_AV_SFP_UDP 
TAO_AV_UDP_MCAST 
TAO_AV_RTP_UDP_MCAST 
TAO_AV_SFP_UDP_MCAST 
TAO_AV_QOS_UDP 
TAO_AV_USERDEFINED_UDP 
TAO_AV_USERDEFINED_UDP_MCAST 
TAO_AV_SCTP_SEQ 

Definition at line 63 of file AV_Core.h.

00064   {
00065     TAO_AV_NOPROTOCOL = -1,
00066     TAO_AV_TCP        =  0,
00067     TAO_AV_UDP        =  1,
00068     TAO_AV_AAL5       =  2,
00069     TAO_AV_AAL3_4     =  3,
00070     TAO_AV_AAL1       =  4,
00071     TAO_AV_RTP_UDP    =  5,
00072     TAO_AV_RTP_AAL5   =  6,
00073     TAO_AV_IPX        =  7,
00074     TAO_AV_SFP_UDP    =  8,
00075     TAO_AV_UDP_MCAST  =  9,
00076     TAO_AV_RTP_UDP_MCAST = 10,
00077     TAO_AV_SFP_UDP_MCAST = 11,
00078     TAO_AV_QOS_UDP       = 12,
00079     TAO_AV_USERDEFINED_UDP = 13,
00080     TAO_AV_USERDEFINED_UDP_MCAST = 14,
00081     TAO_AV_SCTP_SEQ =  15
00082   };


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_AV_Core::TAO_AV_Core ( void   ) 

Default constructor.

Definition at line 33 of file AV_Core.cpp.

References ACE_NEW.

00034   :connector_registry_ (0),
00035    acceptor_registry_ (0)
00036 {
00037   ACE_NEW (this->connector_registry_,
00038            TAO_AV_Connector_Registry
00039            );
00040   ACE_NEW (this->acceptor_registry_,
00041            TAO_AV_Acceptor_Registry
00042            );
00043 }

TAO_AV_Core::~TAO_AV_Core ( void   ) 

Destructor.

Definition at line 45 of file AV_Core.cpp.

References acceptor_registry_, ACE_Unbounded_Set_Ex< T, C >::begin(), connector_registry_, flow_protocol_factories_, and transport_factories_.

00046 {
00047   delete this->connector_registry_;
00048   delete this->acceptor_registry_;
00049 
00050   TAO_AV_TransportFactorySetItor transport_iter =
00051       this->transport_factories_.begin();
00052 
00053   while (transport_iter != this->transport_factories_.end())
00054     {
00055       if ((*transport_iter)->factory()->ref_count != 1)
00056         {
00057           delete (*transport_iter)->factory();
00058         }
00059       delete (*transport_iter);
00060       transport_iter++;
00061     }
00062 
00063   TAO_AV_Flow_ProtocolFactorySetItor flow_iter =
00064       this->flow_protocol_factories_.begin();
00065 
00066   while (flow_iter != this->flow_protocol_factories_.end())
00067     {
00068       if ((*flow_iter)->factory()->ref_count != 1)
00069         {
00070           delete (*flow_iter)->factory();
00071         }
00072       delete (*flow_iter);
00073 
00074       flow_iter++;
00075     }
00076 }


Member Function Documentation

TAO_AV_Acceptor_Registry * TAO_AV_Core::acceptor_registry ( void   ) 

Definition at line 109 of file AV_Core.cpp.

References acceptor_registry_.

00110 {
00111   return this->acceptor_registry_;
00112 }

TAO_AV_Connector_Registry * TAO_AV_Core::connector_registry ( void   ) 

Definition at line 103 of file AV_Core.cpp.

References connector_registry_.

00104 {
00105   return this->connector_registry_;
00106 }

int TAO_AV_Core::deactivate_servant ( PortableServer::Servant  servant  )  [static]

Definition at line 1099 of file AV_Core.cpp.

References TAO_ServantBase::_default_POA(), CORBA::Exception::_tao_print_exception(), and poa().

Referenced by TAO_FDev< T_Producer, T_Consumer >::destroy(), TAO_FlowEndPoint::destroy(), TAO_FlowConnection::destroy(), TAO_MMDevice::destroy(), TAO_StreamEndPoint::destroy(), and TAO_StreamCtrl::destroy().

01100 {
01101   // Because of reference counting, the POA will automatically delete
01102   // the servant when all pending requests on this servant are
01103   // complete.
01104 
01105   try
01106     {
01107       PortableServer::POA_var poa = servant->_default_POA ();
01108 
01109       PortableServer::ObjectId_var id = poa->servant_to_id (servant);
01110 
01111       poa->deactivate_object (id.in ());
01112     }
01113   catch (const CORBA::Exception& ex)
01114     {
01115       ex._tao_print_exception ("deactivate_servant");
01116       return -1;
01117     }
01118   return 0;
01119 }

TAO_AV_Flow_ProtocolFactorySet * TAO_AV_Core::flow_protocol_factories ( void   ) 

Definition at line 121 of file AV_Core.cpp.

References flow_protocol_factories_.

00122 {
00123   return &this->flow_protocol_factories_;
00124 }

TAO_AV_Acceptor * TAO_AV_Core::get_acceptor ( const char *  flowname  ) 

= Get the acceptor registry

Definition at line 562 of file AV_Core.cpp.

References CORBA::Exception::_tao_print_exception(), acceptor_registry_, TAO_AV_Acceptor_Registry::begin(), TAO_AV_Acceptor_Registry::end(), and ACE_OS::strcmp().

00563 {
00564 
00565   try
00566     {
00567 
00568       TAO_AV_AcceptorSetItor acceptor =  this->acceptor_registry_->begin ();
00569 
00570       TAO_AV_AcceptorSetItor end =
00571         this->acceptor_registry_->end ();
00572 
00573       for (;acceptor != end; ++acceptor)
00574         {
00575           if (ACE_OS::strcmp ((*acceptor)->flowname (),flowname) == 0)
00576             return *acceptor;
00577         }
00578     }
00579   catch (const CORBA::Exception& ex)
00580     {
00581       ex._tao_print_exception ("TAO_AV_Core::get_acceptor");
00582     }
00583   return 0;
00584 }

TAO_AV_Connector * TAO_AV_Core::get_connector ( const char *  flowname  ) 

Definition at line 615 of file AV_Core.cpp.

References TAO_AV_Connector_Registry::begin(), connector_registry_, TAO_AV_Connector_Registry::end(), and ACE_OS::strcmp().

00616 {
00617   TAO_AV_ConnectorSetItor connector =
00618     this->connector_registry_->begin ();
00619   TAO_AV_ConnectorSetItor end =
00620     this->connector_registry_->end ();
00621 
00622   for (;connector != end; ++connector)
00623     {
00624       if (ACE_OS::strcmp ((*connector)->flowname (),flowname) == 0)
00625         return *connector;
00626     }
00627   return 0;
00628 }

ACE_CString TAO_AV_Core::get_control_flowname ( const char *  flowname  )  [static]

Definition at line 1136 of file AV_Core.cpp.

Referenced by TAO_AV_UDP_Connector::connect(), TAO_AV_TCP_Connector::connect(), TAO_StreamEndPoint::destroy(), TAO_AV_UDP_Acceptor::open(), TAO_AV_TCP_Acceptor::open(), TAO_AV_UDP_Acceptor::open_default(), and TAO_AV_TCP_Acceptor::open_default().

01137 {
01138   ACE_CString control_flowname;
01139   control_flowname = "c_";
01140   control_flowname = control_flowname + flowname;
01141 
01142   return flowname;
01143 }

TAO_AV_Flow_Protocol_Factory * TAO_AV_Core::get_flow_protocol_factory ( const char *  flow_protocol  ) 

= Set/get the <ACE_Reactor>.

Definition at line 650 of file AV_Core.cpp.

References ACE_Unbounded_Set_Ex< T, C >::end(), and flow_protocol_factories_.

Referenced by TAO_AV_Acceptor_Registry::open(), TAO_AV_Connector_Registry::open(), and TAO_AV_Acceptor_Registry::open_default().

00651 {
00652   if (flow_protocol == 0)
00653     return 0;
00654 
00655   for (TAO_AV_Flow_ProtocolFactorySetItor control_flow_factory =
00656          this->flow_protocol_factories_.begin ();
00657        control_flow_factory !=
00658          this->flow_protocol_factories_.end ();
00659        ++control_flow_factory)
00660     {
00661       if ((*control_flow_factory)->factory ()->match_protocol (flow_protocol))
00662         {
00663           return (*control_flow_factory)->factory ();
00664         }
00665     }
00666 
00667   // Not found.
00668   return 0;
00669 }

TAO_FlowSpec_Entry * TAO_AV_Core::get_flow_spec_entry ( TAO_AV_FlowSpecSet flow_spec_set,
const char *  flowname 
)

Definition at line 546 of file AV_Core.cpp.

References ACE_Unbounded_Set_Ex< T, C >::begin(), ACE_Unbounded_Set_Ex< T, C >::end(), and ACE_OS::strcmp().

Referenced by init_reverse_flows().

00548 {
00549   TAO_AV_FlowSpecSetItor end = flow_spec_set.end ();
00550   TAO_AV_FlowSpecSetItor begin = flow_spec_set.begin ();
00551   for (;
00552        begin != end;
00553        ++begin)
00554     {
00555       if (ACE_OS::strcmp ((*begin)->flowname (),flowname) == 0)
00556         return (*begin);
00557     }
00558   return 0;
00559 }

char * TAO_AV_Core::get_flowname ( const char *  flow_spec_entry_str  )  [static]

Definition at line 1123 of file AV_Core.cpp.

References ACE_String_Base< CHAR >::c_str(), ACE_String_Base< CHAR >::find(), ACE_String_Base_Const::npos, CORBA::string_dup(), and ACE_String_Base< CHAR >::substring().

Referenced by TAO_Basic_StreamCtrl::destroy(), TAO_Basic_StreamCtrl::start(), and TAO_Basic_StreamCtrl::stop().

01124 {
01125   ACE_CString flow_spec_entry (flow_spec_entry_str);
01126   ACE_CString::size_type slash_pos = flow_spec_entry.find ('\\');
01127   ACE_CString flow_name;
01128   if (slash_pos != flow_spec_entry.npos)
01129     flow_name = flow_spec_entry.substring (0, slash_pos);
01130   else
01131     flow_name = flow_spec_entry_str;
01132   return CORBA::string_dup (flow_name.c_str ());
01133 }

TAO_AV_Transport_Factory * TAO_AV_Core::get_transport_factory ( const char *  transport_protocol  ) 

Definition at line 672 of file AV_Core.cpp.

References ACE_Unbounded_Set_Ex< T, C >::end(), and transport_factories_.

Referenced by TAO_AV_Acceptor_Registry::open(), TAO_AV_Connector_Registry::open(), and TAO_AV_Acceptor_Registry::open_default().

00673 {
00674   if (transport_protocol == 0)
00675     return 0;
00676 
00677   for (TAO_AV_TransportFactorySetItor transport_factory =
00678          this->transport_factories_.begin ();
00679        transport_factory != this->transport_factories_.end ();
00680        ++transport_factory)
00681     {
00682       if ((*transport_factory)->factory ()->match_protocol (transport_protocol))
00683         {
00684           return (*transport_factory)->factory ();
00685         }
00686     }
00687 
00688   // Not found.
00689   return 0;
00690 }

int TAO_AV_Core::init ( CORBA::ORB_ptr  orb,
PortableServer::POA_ptr  poa 
)

Definition at line 156 of file AV_Core.cpp.

References CORBA::ORB::_duplicate(), ACE_DEBUG, init_flow_protocol_factories(), init_transport_factories(), LM_DEBUG, orb(), orb_, poa_, reactor(), and TAO_debug_level.

00158 {
00159   if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Core::init "));
00160   this->orb_ = CORBA::ORB::_duplicate (orb);
00161   this->poa_ = PortableServer::POA::_duplicate (poa);
00162   this->reactor (this->orb_->orb_core ()->reactor ());
00163   this->init_transport_factories ();
00164   this->init_flow_protocol_factories ();
00165   return 0;
00166 }

int TAO_AV_Core::init_flow_protocol_factories ( void   ) 

Definition at line 1050 of file AV_Core.cpp.

References ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), ACE_Unbounded_Set_Ex< T, C >::begin(), ACE_Unbounded_Set_Ex< T, C >::end(), flow_protocol_factories_, LM_DEBUG, LM_ERROR, load_default_flow_protocol_factories(), and TAO_debug_level.

Referenced by init().

01051 {
01052   TAO_AV_Flow_ProtocolFactorySetItor end = this->flow_protocol_factories_.end ();
01053   TAO_AV_Flow_ProtocolFactorySetItor factory = this->flow_protocol_factories_.begin ();
01054 
01055   if (factory == end)
01056     {
01057       ACE_DEBUG ((LM_DEBUG,
01058                   "Loading default flow protocol factories\n"));
01059 
01060       this->load_default_flow_protocol_factories ();
01061     }
01062   else
01063     {
01064       for (; factory != end; factory++)
01065         {
01066           const ACE_CString &name = (*factory)->name ();
01067           if (TAO_debug_level > 0)
01068             ACE_DEBUG ((LM_DEBUG,
01069                         "%s \n",
01070                         name.c_str ()));
01071 
01072           (*factory)->factory (
01073                                ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (name.c_str ()));
01074           if ((*factory)->factory () == 0)
01075             {
01076               ACE_ERROR_RETURN ((LM_ERROR,
01077                                  ACE_TEXT ("TAO (%P|%t) Unable to load ")
01078                                  ACE_TEXT ("protocol <%s>, %p\n"),
01079                                  name.c_str (), ""),
01080                                 -1);
01081             }
01082 
01083           (*factory)->factory ()->ref_count = 1;
01084 
01085           if (TAO_debug_level > 0)
01086             {
01087               ACE_DEBUG ((LM_DEBUG,
01088                           ACE_TEXT ("TAO (%P|%t) Loaded protocol <%s>\n"),
01089                           name.c_str ()));
01090             }
01091         }
01092     }
01093 
01094   return 0;
01095 }

int TAO_AV_Core::init_forward_flows ( TAO_Base_StreamEndPoint endpoint,
TAO_AV_FlowSpecSet flow_spec_set,
EndPoint  direction,
AVStreams::flowSpec flow_spec 
)

Definition at line 169 of file AV_Core.cpp.

References acceptor_registry_, ACE_DEBUG, ACE_ERROR_RETURN, ACE_Unbounded_Set_Ex< T, C >::begin(), connect(), connector_registry_, ACE_Unbounded_Set_Ex< T, C >::end(), ACE_Unbounded_Set_Ex< T, C >::find(), ACE_Unbounded_Set_Ex< T, C >::insert(), LM_DEBUG, LM_ERROR, TAO_AV_Acceptor_Registry::open(), TAO_AV_Connector_Registry::open(), ACE_Event_Handler::reactor(), ACE_Event_Handler::READ_MASK, ACE_Unbounded_Set_Ex< T, C >::size(), TAO_FlowSpec_Entry::TAO_AV_CONSUMER, TAO_FlowSpec_Entry::TAO_AV_DIR_IN, TAO_FlowSpec_Entry::TAO_AV_DIR_OUT, TAO_AV_ENDPOINT_A, TAO_AV_ENDPOINT_B, TAO_FlowSpec_Entry::TAO_AV_PRODUCER, and TAO_debug_level.

00173 {
00174   if (TAO_debug_level > 0)
00175     ACE_DEBUG ((LM_DEBUG,
00176                 "TAO_AV_Core::init_forward_flows\n"));
00177 
00178   TAO_AV_FlowSpecSet address_flow_set;
00179   TAO_AV_FlowSpecSet flow_set;
00180   TAO_AV_FlowSpecSetItor end = flow_spec_set.end ();
00181   for (TAO_AV_FlowSpecSetItor start = flow_spec_set.begin ();
00182        start != end; ++start)
00183     {
00184       TAO_FlowSpec_Entry *entry = (*start);
00185       switch (direction)
00186         {
00187         case TAO_AV_Core::TAO_AV_ENDPOINT_B:
00188           {
00189             switch (entry->direction ())
00190               {
00191               case TAO_FlowSpec_Entry::TAO_AV_DIR_IN:
00192                 {
00193                   entry->role (TAO_FlowSpec_Entry::TAO_AV_CONSUMER);
00194                   break;
00195                 }
00196               case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
00197                 {
00198                   entry->role (TAO_FlowSpec_Entry::TAO_AV_PRODUCER);
00199                   break;
00200                 }
00201               }
00202             break;
00203           }
00204         case TAO_AV_Core::TAO_AV_ENDPOINT_A:
00205           {
00206             switch (entry->direction ())
00207               {
00208               case TAO_FlowSpec_Entry::TAO_AV_DIR_IN:
00209                 entry->role (TAO_FlowSpec_Entry::TAO_AV_PRODUCER);
00210                 break;
00211               case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
00212                 entry->role (TAO_FlowSpec_Entry::TAO_AV_CONSUMER);
00213                 break;
00214               }
00215             break;
00216           }
00217         default:
00218           break;
00219         }
00220       ACE_Addr *address = entry->address ();
00221       if (address != 0)
00222         {
00223           if (TAO_debug_level > 0)
00224             ACE_DEBUG ((LM_DEBUG,
00225                         "address given for flow %s\n",
00226                         entry->flowname ()));
00227 
00228           address_flow_set.insert (entry);
00229         }
00230       else
00231         flow_set.insert (entry);
00232     } //End of For Loop
00233 
00234 
00235   int result = -1;
00236   switch (direction)
00237     {
00238     case TAO_AV_Core::TAO_AV_ENDPOINT_A:
00239       if (address_flow_set.size () > 0)
00240         {
00241           result = this->acceptor_registry_->open (endpoint,
00242                                                    this,
00243                                                    address_flow_set);
00244           if (result < 0)
00245             ACE_ERROR_RETURN ((LM_ERROR,
00246                                "TAO_AV_Core::init_forward_flows::acceptor_registry::open failed\n"),
00247                               -1);
00248           TAO_AV_FlowSpecSetItor end = address_flow_set.end ();
00249           for (TAO_AV_FlowSpecSetItor start = address_flow_set.begin ();
00250                start != end; ++start)
00251             {
00252               TAO_FlowSpec_Entry *entry = (*start);
00253               switch (entry->direction ())
00254                 {
00255                 case TAO_FlowSpec_Entry::TAO_AV_DIR_IN:
00256                   {
00257                     if (entry->handler () != 0)
00258                       {
00259                         //Yamuna:PLEASE CHECK THIS LATER
00260 #if defined ACE_HAS_RAPI || defined (ACE_HAS_WINSOCK2_GQOS)
00261                         // For IN flows on the A side we should remove the handlers from the reactor.
00262                         ACE_Event_Handler *event_handler = entry->handler ()->event_handler ();
00263 
00264             if (event_handler->reactor () != 0)
00265               {
00266                 result = event_handler->reactor ()->remove_handler (event_handler,
00267                                         ACE_Event_Handler::READ_MASK);
00268 
00269                 if (result < 0)
00270                   if (TAO_debug_level > 0)
00271                 ACE_DEBUG ((LM_DEBUG,
00272                         "TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
00273               }
00274 #endif //ACE_HAS_RAPI || ACE_HAS_WINSOCK2_GQOS
00275                       }
00276                   }
00277                 default:
00278                   break;
00279                 }
00280               // Now if the address_set has been changed due to the addition of a control entry we should
00281               // add that to the flow_spec_set also.
00282               if (flow_spec_set.find (entry) < 0)
00283                 {
00284                   // entry doesn't exist so add it.
00285                   flow_spec_set.insert (entry);
00286                   //                   size_t len = flow_spec.length ();
00287                   //                   flow_spec.length (len+1);
00288                   //                   flow_spec [len] = entry->entry_to_string ();
00289                 }
00290             }
00291         }
00292       break;
00293     case TAO_AV_Core::TAO_AV_ENDPOINT_B:
00294       {
00295         if (address_flow_set.size () > 0)
00296           {
00297             ACE_DEBUG ((LM_DEBUG,
00298                         "(%N,%l) This connector registry is called\n"));
00299 
00300             result = this->connector_registry_->open (endpoint,
00301                                                       this,
00302                                                       address_flow_set);
00303             if (result == -1)
00304               ACE_ERROR_RETURN ((LM_ERROR,"TAO_AV_Core::init_Forward_flows: connector_registry open failed\n"),-1);
00305             TAO_AV_FlowSpecSetItor end = address_flow_set.end ();
00306             for (TAO_AV_FlowSpecSetItor start = address_flow_set.begin ();
00307                  start != end; ++start)
00308               {
00309                 TAO_FlowSpec_Entry *entry = (*start);
00310                 switch (entry->direction ())
00311                   {
00312                   case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
00313                     {
00314               if (entry->handler () != 0)
00315             {
00316               // @@Naga: This wont be called in the case of Full Profile.
00317               // For IN flows on the A side we should remove the handlers from the reactor.
00318               ACE_Event_Handler *event_handler = entry->handler ()->event_handler ();
00319               result = event_handler->reactor ()->remove_handler (event_handler,
00320                                           ACE_Event_Handler::READ_MASK);
00321               if (result < 0)
00322                 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
00323             }
00324                     }
00325                   default:
00326                     break;
00327                   }
00328         // Now if the address_set has been changed due to the addition of a control entry we should
00329         // add that to the flow_spec_set also.
00330         if (flow_spec_set.find (entry) < 0)
00331           {
00332             // entry doesn't exist so add it.
00333             flow_spec_set.insert (entry);
00334           }
00335               }
00336           }
00337         if (flow_set.size () > 0)
00338           {
00339             // If any of the flow spec entries have a valid peer address,
00340             // we need to set it as the forwarding address.  According to
00341             // Yamuna Krishnamurthy, this "happens when no address is
00342             // specified for the A endpoint."
00343         TAO_AV_FlowSpecSetItor end = flow_set.end ();
00344         TAO_AV_FlowSpecSetItor start = flow_set.begin ();
00345             for (; start != end; ++start)
00346               {
00347         TAO_FlowSpec_Entry *entry = *start;
00348         if (entry->get_peer_addr () != 0)
00349           {
00350             entry->address (entry->get_peer_addr (), false);
00351           }
00352           }
00353 
00354             result = this->acceptor_registry_->open (endpoint,
00355                                                      this,
00356                                                      flow_set);
00357             if (result == -1)
00358               ACE_ERROR_RETURN ((LM_ERROR,"TAO_AV_Core::init_Forward_flows: Acceptor_registry open failed\n"),-1);
00359             end = address_flow_set.end ();
00360         start = address_flow_set.begin ();
00361             for (; start != end; ++start)
00362               {
00363                 TAO_FlowSpec_Entry *entry = (*start);
00364                 switch (entry->direction ())
00365                   {
00366                   case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
00367                     {
00368               if (entry->handler () != 0)
00369             {
00370               // For IN flows on the A side we should remove the handlers from the reactor.
00371               ACE_Event_Handler *event_handler = entry->handler ()->event_handler ();
00372               result = event_handler->reactor ()->remove_handler (event_handler,
00373                                           ACE_Event_Handler::READ_MASK);
00374               if (result < 0)
00375                 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
00376             }
00377                     }
00378                   default:
00379                     break;
00380                   }
00381         // Now if the address_set has been changed due to the addition of a control entry we should
00382         // add that to the flow_spec_set also.
00383         if (flow_spec_set.find (entry) < 0)
00384           {
00385             // entry doesn't exist so add it.
00386             flow_spec_set.insert (entry);
00387           }
00388               }
00389           }
00390 
00391         AVStreams::flowSpec new_flowspec (static_cast<CORBA::ULong> (flow_spec_set.size ()));
00392         int i=0;
00393         TAO_AV_FlowSpecSetItor connect_end = address_flow_set.end ();
00394         TAO_AV_FlowSpecSetItor connect = address_flow_set.begin ();
00395         for (;connect != connect_end;  ++connect)
00396           {
00397             ACE_Addr *local_addr;
00398             ACE_Addr *local_control_addr;
00399             local_addr = (*connect)->get_local_addr ();
00400             local_control_addr = (*connect)->get_local_control_addr ();
00401             if (local_addr != 0)
00402               {
00403                 TAO_Reverse_FlowSpec_Entry entry ((*connect)->flowname (),
00404                                                   (*connect)->direction_str (),
00405                                                   (*connect)->format (),
00406                                                   (*connect)->flow_protocol_str (),
00407                                                   (*connect)->carrier_protocol_str (),
00408                                                   local_addr,
00409                                                   local_control_addr);
00410         /*
00411           ACE_Addr *addr;
00412           if ((addr = (*connect)->get_peer_addr ()) != 0)
00413           {
00414           entry.set_peer_addr (addr);
00415           };
00416         */
00417                 int len = new_flowspec.length ();
00418                 if (i == len)
00419                   new_flowspec.length (len+1);
00420                 new_flowspec [i++] = entry.entry_to_string ();
00421                 if (TAO_debug_level > 0)
00422                   ACE_DEBUG ((LM_DEBUG, "reverse Flow Spec Is %s\n", entry.entry_to_string ()));
00423               }
00424           }
00425         connect_end = flow_set.end ();
00426         for (connect = flow_set.begin ();
00427              connect != connect_end;  ++connect)
00428           {
00429             ACE_Addr *local_addr;
00430             ACE_Addr *local_control_addr;
00431             local_addr = (*connect)->get_local_addr ();
00432             local_control_addr = (*connect)->get_local_control_addr ();
00433             if (local_addr != 0)
00434               {
00435                 TAO_Reverse_FlowSpec_Entry entry ((*connect)->flowname (),
00436                                                   (*connect)->direction_str (),
00437                                                   (*connect)->format (),
00438                                                   (*connect)->flow_protocol_str (),
00439                                                   (*connect)->carrier_protocol_str (),
00440                                                   local_addr,
00441                                                   local_control_addr);
00442 
00443                 int len = new_flowspec.length ();
00444                 if (i == len)
00445                   new_flowspec.length (len+1);
00446                 new_flowspec [i++] = entry.entry_to_string ();
00447               }
00448           }
00449         // Change the reverse flow spec to be sent.
00450         //        int index = flow_spec.length () + 1;
00451         int index = new_flowspec.length ();
00452         flow_spec.length (index);
00453         for (i = 0; i < index; i++)
00454           {
00455             flow_spec [i] = new_flowspec [i];
00456           }
00457       }
00458       break;
00459     default:
00460       break;
00461     }
00462   return 0;
00463 }

int TAO_AV_Core::init_reverse_flows ( TAO_Base_StreamEndPoint endpoint,
TAO_AV_FlowSpecSet forward_flow_spec_set,
TAO_AV_FlowSpecSet reverse_flow_spec_set,
EndPoint  direction 
)

Definition at line 466 of file AV_Core.cpp.

References ACE_DEBUG, ACE_ERROR_RETURN, ACE_Unbounded_Set_Ex< T, C >::begin(), connector_registry_, ACE_Unbounded_Set_Ex< T, C >::end(), get_flow_spec_entry(), ACE_Unbounded_Set_Ex< T, C >::insert(), LM_DEBUG, LM_ERROR, TAO_AV_Connector_Registry::open(), TAO_FlowSpec_Entry::set_peer_addr(), TAO_FlowSpec_Entry::TAO_AV_CONSUMER, TAO_FlowSpec_Entry::TAO_AV_DIR_IN, TAO_FlowSpec_Entry::TAO_AV_DIR_OUT, TAO_AV_ENDPOINT_A, TAO_AV_ENDPOINT_B, TAO_FlowSpec_Entry::TAO_AV_PRODUCER, and TAO_debug_level.

00470 {
00471   if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"(%P|%t)TAO_AV_Core::init_reverse_flows\n"));
00472   TAO_AV_FlowSpecSet acceptor_flow_set;
00473   TAO_AV_FlowSpecSet connector_flow_set;
00474   TAO_AV_FlowSpecSetItor end = reverse_flow_spec_set.end ();
00475   TAO_AV_FlowSpecSetItor start = reverse_flow_spec_set.begin ();
00476   for (;start != end; ++start)
00477     {
00478       TAO_FlowSpec_Entry *entry = (*start);
00479       ACE_Addr *address = entry->address ();
00480       switch (direction)
00481         {
00482         case TAO_AV_Core::TAO_AV_ENDPOINT_B:
00483           {
00484             switch (entry->direction ())
00485               {
00486               case TAO_FlowSpec_Entry::TAO_AV_DIR_IN:
00487                 entry->role (TAO_FlowSpec_Entry::TAO_AV_CONSUMER);
00488                 break;
00489               case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
00490                 entry->role (TAO_FlowSpec_Entry::TAO_AV_PRODUCER);
00491                 break;
00492               }
00493             break;
00494           }
00495         case TAO_AV_Core::TAO_AV_ENDPOINT_A:
00496           {
00497             switch (entry->direction ())
00498               {
00499               case TAO_FlowSpec_Entry::TAO_AV_DIR_IN:
00500                 entry->role (TAO_FlowSpec_Entry::TAO_AV_PRODUCER);
00501                 break;
00502               case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
00503                 entry->role (TAO_FlowSpec_Entry::TAO_AV_CONSUMER);
00504                 break;
00505               }
00506             break;
00507           }
00508         default: break;
00509         }
00510 
00511       if (address != 0)
00512         {
00513           if (this->get_acceptor (entry->flowname ())!= 0)
00514             {
00515               ACE_Addr *address = entry->address ();
00516               TAO_FlowSpec_Entry *forward_entry =
00517                 this->get_flow_spec_entry (forward_flow_spec_set,
00518                                            entry->flowname ());
00519               if (forward_entry != 0)
00520                 forward_entry->set_peer_addr (address);
00521             }
00522           else
00523             connector_flow_set.insert (entry);
00524         }
00525     }
00526   int result = -1;
00527   switch (direction)
00528     {
00529 
00530     case TAO_AV_Core::TAO_AV_ENDPOINT_A:
00531       {
00532         result = this->connector_registry_->open (endpoint,
00533                                                   this,
00534                                                   connector_flow_set);
00535       }
00536         break;
00537     default:
00538       break;
00539     }
00540   if (result == -1)
00541     ACE_ERROR_RETURN ((LM_ERROR,"acceptor_registry::open"),-1);
00542   return 0;
00543 }

int TAO_AV_Core::init_transport_factories ( void   ) 

Definition at line 812 of file AV_Core.cpp.

References ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), ACE_Unbounded_Set_Ex< T, C >::begin(), ACE_Unbounded_Set_Ex< T, C >::end(), LM_DEBUG, LM_ERROR, load_default_transport_factories(), TAO_debug_level, and transport_factories_.

Referenced by init().

00813 {
00814   TAO_AV_TransportFactorySetItor end = this->transport_factories_.end ();
00815   TAO_AV_TransportFactorySetItor factory = this->transport_factories_.begin ();
00816 
00817 
00818   if (factory == end)
00819     {
00820       if (TAO_debug_level > 0)
00821         ACE_DEBUG ((LM_DEBUG,
00822                     "Loading default transport protocols\n"));
00823       this->load_default_transport_factories ();
00824     }
00825   else
00826     {
00827       for (; factory != end; factory++)
00828         {
00829           const ACE_CString &name = (*factory)->name ();
00830           if (TAO_debug_level > 0)
00831             ACE_DEBUG ((LM_DEBUG,
00832                         "%s \n",
00833                         name.c_str ()));
00834 
00835           (*factory)->factory (
00836                                ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (name.c_str ()));
00837           if ((*factory)->factory () == 0)
00838             {
00839               ACE_ERROR_RETURN ((LM_ERROR,
00840                                  ACE_TEXT ("TAO (%P|%t) Unable to load ")
00841                                  ACE_TEXT ("protocol <%s>, %p\n"),
00842                                  name.c_str (), ""),
00843                                 -1);
00844             }
00845           (*factory)->factory ()->ref_count = 1;
00846 
00847           if (TAO_debug_level > 0)
00848             {
00849               ACE_DEBUG ((LM_DEBUG,
00850                           ACE_TEXT ("TAO (%P|%t) Loaded protocol <%s>\n"),
00851                           name.c_str ()));
00852             }
00853         }
00854     }
00855 
00856   return 0;
00857 }

int TAO_AV_Core::load_default_flow_protocol_factories ( void   ) 

Definition at line 860 of file AV_Core.cpp.

References ACE_ERROR, ACE_NEW_RETURN, TAO_AV_Flow_Protocol_Item::factory(), flow_protocol_factories_, ACE_Unbounded_Set_Ex< T, C >::insert(), ACE_Dynamic_Service< TYPE >::instance(), LM_WARNING, TAO_AV_Flow_Protocol_Factory::ref_count, and TAO_debug_level.

Referenced by init_flow_protocol_factories().

00861 {
00862   const char *udp_flow = "UDP_Flow_Factory";
00863   const char *tcp_flow = "TCP_Flow_Factory";
00864   const char *rtp_flow = "RTP_Flow_Factory";
00865   const char *rtcp_flow = "RTCP_Flow_Factory";
00866   const char *sfp_flow = "SFP_Flow_Factory";
00867 
00868   TAO_AV_Flow_Protocol_Factory *udp_flow_factory = 0;
00869   TAO_AV_Flow_Protocol_Item *udp_item = 0;
00870 
00871   udp_flow_factory =
00872     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (udp_flow);
00873   if (udp_flow_factory == 0)
00874     {
00875       if (TAO_debug_level)
00876         ACE_ERROR ((LM_WARNING,
00877                     "(%P|%t) WARNING - No %s found in Service Repository."
00878                     "  Using default instance.\n",
00879                     "UDP Flow Factory"));
00880 
00881       ACE_NEW_RETURN (udp_flow_factory,
00882                       TAO_AV_UDP_Flow_Factory,
00883                       -1);
00884     }
00885   else udp_flow_factory->ref_count = 1;
00886 
00887   ACE_NEW_RETURN (udp_item, TAO_AV_Flow_Protocol_Item ("UDP_Flow_Factory"), -1);
00888   udp_item->factory (udp_flow_factory);
00889 
00890   this->flow_protocol_factories_.insert (udp_item);
00891 
00892 #if defined (ACE_HAS_RAPI) || defined (ACE_HAS_WINSOCK2_GQOS)
00893 
00894   const char *udp_qos_flow = "UDP_QoS_Flow_Factory";
00895   TAO_AV_Flow_Protocol_Factory *udp_qos_flow_factory = 0;
00896   TAO_AV_Flow_Protocol_Item *udp_qos_flow_item = 0;
00897 
00898   udp_qos_flow_factory =
00899     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (udp_qos_flow);
00900   if (udp_qos_flow_factory == 0)
00901     {
00902       if (TAO_debug_level)
00903         ACE_ERROR ((LM_WARNING,
00904                     "(%P|%t) WARNING - No %s found in Service Repository."
00905                     "  Using default instance.\n",
00906                     "UDP QoS Flow Factory"));
00907 
00908       ACE_NEW_RETURN (udp_qos_flow_factory,
00909                       TAO_AV_UDP_QoS_Flow_Factory,
00910                       -1);
00911     }
00912   else udp_qos_flow_factory->ref_count = 1;
00913 
00914   ACE_NEW_RETURN (udp_qos_flow_item, TAO_AV_Flow_Protocol_Item ("UDP_QoS_Flow_Factory"), -1);
00915   udp_qos_flow_item->factory (udp_qos_flow_factory);
00916 
00917   this->flow_protocol_factories_.insert (udp_qos_flow_item);
00918 
00919 #endif /* defined (ACE_HAS_RAPI) || defined (ACE_HAS_WINSOCK2_GQOS) */
00920 
00921 #if defined ACE_HAS_SCTP
00922 
00923   const char *sctp_seq_flow = "SCTP_SEQ_Flow_Factory";
00924   TAO_AV_Flow_Protocol_Factory *sctp_seq_flow_factory = 0;
00925   TAO_AV_Flow_Protocol_Item *sctp_seq_flow_item = 0;
00926 
00927   sctp_seq_flow_factory =
00928     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (sctp_seq_flow);
00929   if (sctp_seq_flow_factory == 0)
00930     {
00931       if (TAO_debug_level)
00932         ACE_ERROR ((LM_WARNING,
00933                     "(%P|%t) WARNING - No %s found in Service Repository."
00934                     "  Using default instance.\n",
00935                     "SCTP SEQ Flow Factory"));
00936 
00937       ACE_NEW_RETURN (sctp_seq_flow_factory,
00938                       TAO_AV_SCTP_SEQ_Flow_Factory,
00939                       -1);
00940     }
00941   else sctp_seq_flow_factory->ref_count = 1;
00942 
00943   ACE_NEW_RETURN (sctp_seq_flow_item, TAO_AV_Flow_Protocol_Item ("SCTP_SEQ_Flow_Factory"), -1);
00944   sctp_seq_flow_item->factory (sctp_seq_flow_factory);
00945 
00946   this->flow_protocol_factories_.insert (sctp_seq_flow_item);
00947 
00948 #endif /* ACE_HAS_SCTP */
00949 
00950   TAO_AV_Flow_Protocol_Factory *tcp_flow_factory = 0;
00951   TAO_AV_Flow_Protocol_Item *tcp_item = 0;
00952 
00953   tcp_flow_factory =
00954     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (tcp_flow);
00955   if (tcp_flow_factory == 0)
00956     {
00957       if (TAO_debug_level)
00958         ACE_ERROR ((LM_WARNING,
00959                     "(%P|%t) WARNING - No %s found in Service Repository."
00960                     "  Using default instance.\n",
00961                     "TCP Flow Factory"));
00962 
00963       ACE_NEW_RETURN (tcp_flow_factory,
00964                       TAO_AV_TCP_Flow_Factory,
00965                       -1);
00966     }
00967   else tcp_flow_factory->ref_count = 1;
00968 
00969   ACE_NEW_RETURN (tcp_item, TAO_AV_Flow_Protocol_Item ("TCP_Flow_Factory"), -1);
00970   tcp_item->factory (tcp_flow_factory);
00971 
00972   this->flow_protocol_factories_.insert (tcp_item);
00973 
00974   TAO_AV_Flow_Protocol_Factory *rtp_flow_factory = 0;
00975   TAO_AV_Flow_Protocol_Item *rtp_item = 0;
00976 
00977   rtp_flow_factory =
00978     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (rtp_flow);
00979   if (rtp_flow_factory == 0)
00980     {
00981       if (TAO_debug_level)
00982         ACE_ERROR ((LM_WARNING,
00983                     "(%P|%t) WARNING - No %s found in Service Repository."
00984                     "  Using default instance.\n",
00985                     "RTP Flow Factory"));
00986 
00987       ACE_NEW_RETURN (rtp_flow_factory,
00988                       TAO_AV_RTP_Flow_Factory,
00989                       -1);
00990     }
00991   else rtp_flow_factory->ref_count = 1;
00992 
00993   ACE_NEW_RETURN (rtp_item, TAO_AV_Flow_Protocol_Item ("RTP_Flow_Factory"), -1);
00994   rtp_item->factory (rtp_flow_factory);
00995 
00996   this->flow_protocol_factories_.insert (rtp_item);
00997 
00998   TAO_AV_Flow_Protocol_Factory *rtcp_flow_factory = 0;
00999   TAO_AV_Flow_Protocol_Item *rtcp_item = 0;
01000 
01001   rtcp_flow_factory =
01002     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (rtcp_flow);
01003   if (rtcp_flow_factory == 0)
01004     {
01005       if (TAO_debug_level)
01006         ACE_ERROR ((LM_WARNING,
01007                     "(%P|%t) WARNING - No %s found in Service Repository."
01008                     "  Using default instance.\n",
01009                     "RTCP Flow Factory"));
01010 
01011       ACE_NEW_RETURN (rtcp_flow_factory,
01012                       TAO_AV_RTCP_Flow_Factory,
01013                       -1);
01014     }
01015   else rtcp_flow_factory->ref_count = 1;
01016 
01017   ACE_NEW_RETURN (rtcp_item, TAO_AV_Flow_Protocol_Item ("RTCP_Flow_Factory"), -1);
01018   rtcp_item->factory (rtcp_flow_factory);
01019 
01020   this->flow_protocol_factories_.insert (rtcp_item);
01021 
01022   TAO_AV_Flow_Protocol_Factory *sfp_flow_factory = 0;
01023   TAO_AV_Flow_Protocol_Item *sfp_item = 0;
01024 
01025   sfp_flow_factory =
01026     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (sfp_flow);
01027   if (sfp_flow_factory == 0)
01028     {
01029       if (TAO_debug_level)
01030         ACE_ERROR ((LM_WARNING,
01031                     "(%P|%t) WARNING - No %s found in Service Repository."
01032                     "  Using default instance.\n",
01033                     "SFP Flow Factory"));
01034 
01035       ACE_NEW_RETURN (sfp_flow_factory,
01036                       TAO_AV_SFP_Factory,
01037                       -1);
01038     }
01039   else sfp_flow_factory->ref_count = 1;
01040 
01041   ACE_NEW_RETURN (sfp_item, TAO_AV_Flow_Protocol_Item ("SFP_Flow_Factory"), -1);
01042   sfp_item->factory (sfp_flow_factory);
01043 
01044   this->flow_protocol_factories_.insert (sfp_item);
01045 
01046   return 0;
01047 }

int TAO_AV_Core::load_default_transport_factories ( void   ) 

Definition at line 693 of file AV_Core.cpp.

References ACE_ERROR, ACE_NEW_RETURN, TAO_AV_Transport_Item::factory(), ACE_Unbounded_Set_Ex< T, C >::insert(), ACE_Dynamic_Service< TYPE >::instance(), LM_WARNING, TAO_AV_Transport_Factory::ref_count, TAO_debug_level, and transport_factories_.

Referenced by init_transport_factories().

00694 {
00695   const char *udp_factory_str = "UDP_Factory";
00696   const char *tcp_factory_str = "TCP_Factory";
00697 
00698   TAO_AV_Transport_Factory *udp_factory = 0;
00699   TAO_AV_Transport_Item *udp_item = 0;
00700 
00701   udp_factory =
00702     ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (udp_factory_str);
00703   if (udp_factory == 0)
00704     {
00705       if (TAO_debug_level)
00706         ACE_ERROR ((LM_WARNING,
00707                     "(%P|%t) WARNING - No %s found in Service Repository."
00708                     "  Using default instance.\n",
00709                     "UDP Factory"));
00710 
00711       ACE_NEW_RETURN (udp_factory,
00712                       TAO_AV_UDP_Factory,
00713                       -1);
00714     }
00715   else udp_factory->ref_count = 1;
00716 
00717   ACE_NEW_RETURN (udp_item, TAO_AV_Transport_Item ("UDP_Factory"), -1);
00718   udp_item->factory (udp_factory);
00719 
00720   this->transport_factories_.insert (udp_item);
00721 
00722   TAO_AV_Transport_Factory *tcp_factory = 0;
00723   TAO_AV_Transport_Item *tcp_item = 0;
00724 
00725   tcp_factory =
00726     ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (tcp_factory_str);
00727   if (tcp_factory == 0)
00728     {
00729       if (TAO_debug_level)
00730         ACE_ERROR ((LM_WARNING,
00731                     "(%P|%t) WARNING - No %s found in Service Repository."
00732                     "  Using default instance.\n",
00733                     "TCP Factory"));
00734 
00735       ACE_NEW_RETURN (tcp_factory,
00736                       TAO_AV_TCP_Factory,
00737                           -1);
00738     }
00739   else tcp_factory->ref_count = 1;
00740 
00741   ACE_NEW_RETURN (tcp_item, TAO_AV_Transport_Item ("TCP_Factory"), -1);
00742   tcp_item->factory (tcp_factory);
00743 
00744   this->transport_factories_.insert (tcp_item);
00745 
00746 #if defined (ACE_HAS_RAPI) || defined (ACE_HAS_WINSOCK2_GQOS)
00747   const char *udp_qos_factory_str = "UDP_QoS_Factory";
00748 
00749   TAO_AV_Transport_Factory *udp_qos_factory = 0;
00750   TAO_AV_Transport_Item *udp_qos_item = 0;
00751 
00752   udp_qos_factory =
00753         ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (udp_qos_factory_str);
00754   if (udp_qos_factory == 0)
00755     {
00756       if (TAO_debug_level)
00757         ACE_ERROR ((LM_WARNING,
00758                     "(%P|%t) WARNING - No %s found in Service Repository."
00759                     "  Using default instance.\n",
00760                     "UDP QoS Factory"));
00761 
00762           ACE_NEW_RETURN (udp_qos_factory,
00763                           TAO_AV_UDP_QoS_Factory,
00764                           -1);
00765     }
00766   else udp_qos_factory->ref_count = 1;
00767 
00768   ACE_NEW_RETURN (udp_qos_item,
00769                   TAO_AV_Transport_Item ("UDP_QoS_Factory"),
00770                   -1);
00771 
00772   udp_qos_item->factory (udp_qos_factory);
00773 
00774   this->transport_factories_.insert (udp_qos_item);
00775 #endif /* ACE_HAS_RAPI || ACE_HAS_WINSOCK2_GQOS */
00776 
00777 #if defined ACE_HAS_SCTP
00778   const char *sctp_seq_factory_str = "SCTP_SEQ_Factory";
00779 
00780   TAO_AV_Transport_Factory *sctp_seq_factory = 0;
00781   TAO_AV_Transport_Item *sctp_seq_item = 0;
00782 
00783   sctp_seq_factory =
00784         ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (sctp_seq_factory_str);
00785   if (sctp_seq_factory == 0)
00786     {
00787       if (TAO_debug_level)
00788         ACE_ERROR ((LM_WARNING,
00789                     "(%P|%t) WARNING - No %s found in Service Repository."
00790                     "  Using default instance.\n",
00791                     "SCTP SEQ Factory"));
00792 
00793       ACE_NEW_RETURN (sctp_seq_factory,
00794               TAO_AV_SCTP_SEQ_Factory,
00795               -1);
00796     }
00797   else sctp_seq_factory->ref_count = 1;
00798 
00799   ACE_NEW_RETURN (sctp_seq_item,
00800                   TAO_AV_Transport_Item ("SCTP_SEQ_Factory"),
00801                   -1);
00802 
00803   sctp_seq_item->factory (sctp_seq_factory);
00804 
00805   this->transport_factories_.insert (sctp_seq_item);
00806 #endif /* ACE_HAS_SCTP */
00807 
00808   return 0;
00809 }

void TAO_AV_Core::orb ( CORBA::ORB_ptr  orb_  ) 

Definition at line 85 of file AV_Core.cpp.

References orb(), and orb_.

00086 {
00087   this->orb_ = orb;
00088 }

CORBA::ORB_ptr TAO_AV_Core::orb ( void   ) 

Definition at line 79 of file AV_Core.cpp.

References TAO_Pseudo_Var_T< T >::in(), and orb_.

Referenced by init(), and orb().

00080 {
00081   return this->orb_.in ();
00082 }

void TAO_AV_Core::poa ( PortableServer::POA_ptr  poa_  ) 

Definition at line 97 of file AV_Core.cpp.

References poa_.

00098 {
00099   this->poa_ = poa;
00100 }

PortableServer::POA_ptr TAO_AV_Core::poa ( void   ) 

Definition at line 91 of file AV_Core.cpp.

References TAO_Objref_Var_T< T >::in(), and poa_.

Referenced by deactivate_servant().

00092 {
00093   return this->poa_.in ();
00094 }

ACE_Reactor * TAO_AV_Core::reactor ( void   ) 

Definition at line 149 of file AV_Core.cpp.

References reactor_.

Referenced by init().

00150 {
00151   return this->reactor_;
00152 }

void TAO_AV_Core::reactor ( ACE_Reactor r  ) 

Definition at line 143 of file AV_Core.cpp.

References reactor_.

Referenced by TAO_AV_UDP_Connector::activate_svc_handler(), TAO_AV_UDP_Acceptor::activate_svc_handler(), TAO_AV_TCP_Acceptor::open(), TAO_AV_TCP_Connector::open(), and TAO_AV_TCP_Acceptor::open_default().

00144 {
00145   this->reactor_ = r;
00146 }

int TAO_AV_Core::remove_acceptor ( const char *  flowname  ) 

Definition at line 587 of file AV_Core.cpp.

References CORBA::Exception::_tao_print_exception(), acceptor_registry_, TAO_AV_Acceptor_Registry::begin(), TAO_AV_Acceptor_Registry::close(), TAO_AV_Acceptor_Registry::end(), and ACE_OS::strcmp().

00588 {
00589 
00590   try
00591     {
00592 
00593       TAO_AV_AcceptorSetItor acceptor =  this->acceptor_registry_->begin ();
00594 
00595       TAO_AV_AcceptorSetItor end =
00596         this->acceptor_registry_->end ();
00597 
00598       for (;acceptor != end; ++acceptor)
00599         {
00600           if (ACE_OS::strcmp ((*acceptor)->flowname (),flowname) == 0)
00601             {
00602               this->acceptor_registry_->close (*acceptor);
00603               return 0;
00604             }
00605         }
00606     }
00607   catch (const CORBA::Exception& ex)
00608     {
00609       ex._tao_print_exception ("TAO_AV_Core::get_acceptor");
00610     }
00611   return -1;
00612 }

int TAO_AV_Core::remove_connector ( const char *  flowname  ) 

Definition at line 631 of file AV_Core.cpp.

References TAO_AV_Connector_Registry::begin(), TAO_AV_Connector_Registry::close(), connector_registry_, TAO_AV_Connector_Registry::end(), and ACE_OS::strcmp().

00632 {
00633   TAO_AV_ConnectorSetItor connector =
00634     this->connector_registry_->begin ();
00635   TAO_AV_ConnectorSetItor end =
00636     this->connector_registry_->end ();
00637 
00638   for (;connector != end; ++connector)
00639     {
00640       if (ACE_OS::strcmp ((*connector)->flowname (),flowname) == 0)
00641         {
00642           this->connector_registry_->close (*connector);
00643           return 0;
00644         }
00645     }
00646   return -1;
00647 }

int TAO_AV_Core::run ( void   ) 

Definition at line 134 of file AV_Core.cpp.

References stop_run_.

00135 {
00136   this->stop_run_ = 0;
00137   while (!this->stop_run_ && this->orb_->work_pending ())
00138     this->orb_->perform_work ();
00139   return 0;
00140 }

int TAO_AV_Core::stop_run ( void   ) 

Definition at line 127 of file AV_Core.cpp.

References stop_run_.

00128 {
00129   this->stop_run_ = 1;
00130   return 0;
00131 }

TAO_AV_TransportFactorySet * TAO_AV_Core::transport_factories ( void   ) 

Definition at line 115 of file AV_Core.cpp.

References transport_factories_.

00116 {
00117   return &this->transport_factories_;
00118 }


Member Data Documentation

TAO_AV_Acceptor_Registry* TAO_AV_Core::acceptor_registry_ [protected]

The registry which maintains a list of acceptor factories for each loaded protocol.

Definition at line 149 of file AV_Core.h.

Referenced by acceptor_registry(), get_acceptor(), init_forward_flows(), remove_acceptor(), and ~TAO_AV_Core().

TAO_AV_Connector_Registry* TAO_AV_Core::connector_registry_ [protected]

The connector registry which all active connecters must register themselves with.

Definition at line 145 of file AV_Core.h.

Referenced by connector_registry(), get_connector(), init_forward_flows(), init_reverse_flows(), remove_connector(), and ~TAO_AV_Core().

TAO_AV_Flow_ProtocolFactorySet TAO_AV_Core::flow_protocol_factories_ [protected]

Pointer to the list of flow protocol loaded into this AV_Core instance.

Definition at line 155 of file AV_Core.h.

Referenced by flow_protocol_factories(), get_flow_protocol_factory(), init_flow_protocol_factories(), load_default_flow_protocol_factories(), and ~TAO_AV_Core().

CORBA::ORB_var TAO_AV_Core::orb_ [protected]

Definition at line 158 of file AV_Core.h.

Referenced by init(), and orb().

PortableServer::POA_var TAO_AV_Core::poa_ [protected]

Definition at line 159 of file AV_Core.h.

Referenced by init(), and poa().

ACE_Reactor* TAO_AV_Core::reactor_ [protected]

Definition at line 157 of file AV_Core.h.

Referenced by reactor().

CORBA::Boolean TAO_AV_Core::stop_run_ [protected]

Definition at line 160 of file AV_Core.h.

Referenced by run(), and stop_run().

TAO_AV_TransportFactorySet TAO_AV_Core::transport_factories_ [protected]

Pointer to the list of transports loaded into this AV_Core instance.

Definition at line 152 of file AV_Core.h.

Referenced by get_transport_factory(), init_transport_factories(), load_default_transport_factories(), transport_factories(), and ~TAO_AV_Core().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:48:00 2010 for TAO_AV by  doxygen 1.4.7