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

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 .

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

int deactivate_servant (PortableServer::Servant servant)
char * get_flowname (const char *flow_spec_entry_str)
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
 

Enumeration values:
TAO_AV_ENDPOINT_A 
TAO_AV_ENDPOINT_B 

Definition at line 61 of file AV_Core.h.

enum TAO_AV_Core::Flow_Component
 

Enumeration values:
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
 

Enumeration values:
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 ACE_Unbounded_Set< T >::begin(), ACE_Unbounded_Set< T >::end(), flow_protocol_factories_, TAO_AV_Flow_ProtocolFactorySetItor, TAO_AV_TransportFactorySetItor, 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.

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.

00104 {
00105   return this->connector_registry_;
00106 }

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

Definition at line 1123 of file AV_Core.cpp.

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

01124 {
01125   // Because of reference counting, the POA will automatically delete
01126   // the servant when all pending requests on this servant are
01127   // complete.
01128 
01129   try
01130     {
01131       PortableServer::POA_var poa = servant->_default_POA ();
01132 
01133       PortableServer::ObjectId_var id = poa->servant_to_id (servant);
01134 
01135       poa->deactivate_object (id.in ());
01136     }
01137   catch (const CORBA::Exception& ex)
01138     {
01139       ex._tao_print_exception ("deactivate_servant");
01140       return -1;
01141     }
01142   return 0;
01143 }

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 586 of file AV_Core.cpp.

References TAO_AV_Acceptor_Registry::begin(), TAO_AV_Acceptor_Registry::end(), ACE_OS::strcmp(), and TAO_AV_AcceptorSetItor.

Referenced by init_reverse_flows().

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

TAO_AV_Connector * TAO_AV_Core::get_connector const char *  flowname  ) 
 

Definition at line 639 of file AV_Core.cpp.

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

00640 {
00641   TAO_AV_ConnectorSetItor connector =
00642     this->connector_registry_->begin ();
00643   TAO_AV_ConnectorSetItor end =
00644     this->connector_registry_->end ();
00645 
00646   for (;connector != end; ++connector)
00647     {
00648       if (ACE_OS::strcmp ((*connector)->flowname (),flowname) == 0)
00649         return *connector;
00650     }
00651   return 0;
00652 }

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

Definition at line 1160 of file AV_Core.cpp.

References ACE_CString.

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

01161 {
01162   ACE_CString control_flowname;
01163   control_flowname = "c_";
01164   control_flowname = control_flowname + flowname;
01165 
01166   return flowname;
01167 }

TAO_AV_Flow_Protocol_Factory * TAO_AV_Core::get_flow_protocol_factory const char *  flow_protocol  ) 
 

= Set/get the .

Definition at line 674 of file AV_Core.cpp.

References ACE_Unbounded_Set< T >::begin(), ACE_Unbounded_Set< T >::end(), flow_protocol_factories_, and TAO_AV_Flow_ProtocolFactorySetItor.

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

00675 {
00676   if (flow_protocol == 0)
00677     return 0;
00678 
00679   for (TAO_AV_Flow_ProtocolFactorySetItor control_flow_factory =
00680          this->flow_protocol_factories_.begin ();
00681        control_flow_factory !=
00682          this->flow_protocol_factories_.end ();
00683        ++control_flow_factory)
00684     {
00685       if ((*control_flow_factory)->factory ()->match_protocol (flow_protocol))
00686         {
00687           return (*control_flow_factory)->factory ();
00688         }
00689     }
00690 
00691   // Not found.
00692   return 0;
00693 }

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

Definition at line 570 of file AV_Core.cpp.

References ACE_Unbounded_Set< T >::begin(), ACE_Unbounded_Set< T >::end(), ACE_OS::strcmp(), TAO_AV_FlowSpecSet, and TAO_AV_FlowSpecSetItor.

Referenced by init_reverse_flows().

00572 {
00573   TAO_AV_FlowSpecSetItor end = flow_spec_set.end ();
00574   TAO_AV_FlowSpecSetItor begin = flow_spec_set.begin ();
00575   for (;
00576        begin != end;
00577        ++begin)
00578     {
00579       if (ACE_OS::strcmp ((*begin)->flowname (),flowname) == 0)
00580         return (*begin);
00581     }
00582   return 0;
00583 }

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

Definition at line 1147 of file AV_Core.cpp.

References ACE_CString, and CORBA::string_dup().

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

01148 {
01149   ACE_CString flow_spec_entry (flow_spec_entry_str);
01150   ACE_CString::size_type slash_pos = flow_spec_entry.find ('\\');
01151   ACE_CString flow_name;
01152   if (slash_pos != flow_spec_entry.npos)
01153     flow_name = flow_spec_entry.substring (0, slash_pos);
01154   else
01155     flow_name = flow_spec_entry_str;
01156   return CORBA::string_dup (flow_name.c_str ());
01157 }

TAO_AV_Transport_Factory * TAO_AV_Core::get_transport_factory const char *  transport_protocol  ) 
 

Definition at line 696 of file AV_Core.cpp.

References ACE_Unbounded_Set< T >::begin(), ACE_Unbounded_Set< T >::end(), TAO_AV_TransportFactorySetItor, and transport_factories_.

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

00697 {
00698   if (transport_protocol == 0)
00699     return 0;
00700 
00701   for (TAO_AV_TransportFactorySetItor transport_factory =
00702          this->transport_factories_.begin ();
00703        transport_factory != this->transport_factories_.end ();
00704        ++transport_factory)
00705     {
00706       if ((*transport_factory)->factory ()->match_protocol (transport_protocol))
00707         {
00708           return (*transport_factory)->factory ();
00709         }
00710     }
00711 
00712   // Not found.
00713   return 0;
00714 }

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, 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 1074 of file AV_Core.cpp.

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

Referenced by init().

01075 {
01076   TAO_AV_Flow_ProtocolFactorySetItor end = this->flow_protocol_factories_.end ();
01077   TAO_AV_Flow_ProtocolFactorySetItor factory = this->flow_protocol_factories_.begin ();
01078 
01079   if (factory == end)
01080     {
01081       ACE_DEBUG ((LM_DEBUG,
01082                   "Loading default flow protocol factories\n"));
01083 
01084       this->load_default_flow_protocol_factories ();
01085     }
01086   else
01087     {
01088       for (; factory != end; factory++)
01089         {
01090           const ACE_CString &name = (*factory)->name ();
01091           if (TAO_debug_level > 0)
01092             ACE_DEBUG ((LM_DEBUG,
01093                         "%s \n",
01094                         name.c_str ()));
01095 
01096           (*factory)->factory (
01097                                ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (name.c_str ()));
01098           if ((*factory)->factory () == 0)
01099             {
01100               ACE_ERROR_RETURN ((LM_ERROR,
01101                                  ACE_TEXT ("TAO (%P|%t) Unable to load ")
01102                                  ACE_TEXT ("protocol <%s>, %p\n"),
01103                                  name.c_str (), ""),
01104                                 -1);
01105             }
01106 
01107           (*factory)->factory ()->ref_count = 1;
01108 
01109           if (TAO_debug_level > 0)
01110             {
01111               ACE_DEBUG ((LM_DEBUG,
01112                           ACE_TEXT ("TAO (%P|%t) Loaded protocol <%s>\n"),
01113                           name.c_str ()));
01114             }
01115         }
01116     }
01117 
01118   return 0;
01119 }

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 ACE_CString, ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, TAO_FlowSpec_Entry::address(), ACE_Unbounded_Set< T >::begin(), TAO_FlowSpec_Entry::carrier_protocol_str(), TAO_FlowSpec_Entry::control_address(), TAO_FlowSpec_Entry::direction(), ACE_Unbounded_Set< T >::end(), TAO_Reverse_FlowSpec_Entry::entry_to_string(), TAO_AV_Flow_Handler::event_handler(), ACE_Unbounded_Set< T >::find(), TAO_FlowSpec_Entry::flow_protocol_str(), TAO_FlowSpec_Entry::flowname(), AVStreams::flowSpec, TAO_FlowSpec_Entry::format(), TAO_FlowSpec_Entry::get_peer_addr(), TAO_FlowSpec_Entry::handler(), ACE_Unbounded_Set< T >::insert(), LM_DEBUG, LM_ERROR, TAO_AV_Connector_Registry::open(), TAO_AV_Acceptor_Registry::open(), ACE_Event_Handler::reactor(), ACE_Unbounded_Set< T >::reset(), TAO_FlowSpec_Entry::role(), ACE_Unbounded_Set< T >::size(), TAO_AV_ENDPOINT_A, TAO_AV_ENDPOINT_B, TAO_AV_FlowSpecSet, TAO_AV_FlowSpecSetItor, 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             TAO_AV_FlowSpecSet tmp_flow_set (flow_set);
00340             flow_set.reset ();
00341             TAO_AV_FlowSpecSetItor end = tmp_flow_set.end ();
00342             TAO_AV_FlowSpecSetItor start = tmp_flow_set.begin ();
00343             for (; start != end; ++start)
00344               {
00345                 TAO_FlowSpec_Entry *entry = *start;
00346                 TAO_FlowSpec_Entry *new_entry;
00347                 ACE_CString dir;
00348                 if (entry->direction () == 0)
00349                   dir += "IN";
00350                 else if (entry->direction () == 1)
00351                   dir += "OUT";
00352                 if (entry->get_peer_addr () != 0)
00353                   {
00354                     ACE_NEW_RETURN (new_entry,
00355                                     TAO_Forward_FlowSpec_Entry (entry->flowname (),
00356                                                                 dir.c_str (),
00357                                                                 entry->format (),
00358                                                                 entry->flow_protocol_str (),
00359                                                                 entry->carrier_protocol_str (),
00360                                                                 entry->get_peer_addr (),
00361                                                                 entry->control_address ()),
00362                                     -1);
00363                   }
00364                 else
00365                   {
00366                     ACE_NEW_RETURN (new_entry,
00367                                     TAO_Forward_FlowSpec_Entry (entry->flowname (),
00368                                                                 dir.c_str (),
00369                                                                 entry->format (),
00370                                                                 entry->flow_protocol_str (),
00371                                                                 entry->carrier_protocol_str (),
00372                                                                 entry->address (),
00373                                                                 entry->control_address ()),
00374                                     -1);
00375                   }
00376                 flow_set.insert (new_entry);
00377               }
00378             result = this->acceptor_registry_->open (endpoint,
00379                                                      this,
00380                                                      flow_set);
00381             if (result == -1)
00382               ACE_ERROR_RETURN ((LM_ERROR,"TAO_AV_Core::init_Forward_flows: Acceptor_registry open failed\n"),-1);
00383             end = address_flow_set.end ();
00384             start = address_flow_set.begin ();
00385             for (; start != end; ++start)
00386               {
00387                 TAO_FlowSpec_Entry *entry = (*start);
00388                 switch (entry->direction ())
00389                   {
00390                   case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
00391                     {
00392                       if (entry->handler () != 0)
00393                         {
00394                           // For IN flows on the A side we should remove the handlers from the reactor.
00395                           ACE_Event_Handler *event_handler = entry->handler ()->event_handler ();
00396                           result = event_handler->reactor ()->remove_handler (event_handler,
00397                                                                               ACE_Event_Handler::READ_MASK);
00398                           if (result < 0)
00399                             if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Core::init_forward_flows: remove_handler failed\n"));
00400                         }
00401                     }
00402                   default:
00403                     break;
00404                   }
00405                 // Now if the address_set has been changed due to the addition of a control entry we should
00406                 // add that to the flow_spec_set also.
00407                 if (flow_spec_set.find (entry) < 0)
00408                   {
00409                     // entry doesn't exist so add it.
00410                     flow_spec_set.insert (entry);
00411                   }
00412               }
00413           }
00414 
00415         AVStreams::flowSpec new_flowspec (static_cast<CORBA::ULong> (flow_spec_set.size ()));
00416         int i=0;
00417         TAO_AV_FlowSpecSetItor connect_end = address_flow_set.end ();
00418         TAO_AV_FlowSpecSetItor connect = address_flow_set.begin ();
00419         for (;connect != connect_end;  ++connect)
00420           {
00421             ACE_Addr *local_addr;
00422             ACE_Addr *local_control_addr;
00423             local_addr = (*connect)->get_local_addr ();
00424             local_control_addr = (*connect)->get_local_control_addr ();
00425             if (local_addr != 0)
00426               {
00427                 TAO_Reverse_FlowSpec_Entry entry ((*connect)->flowname (),
00428                                                   (*connect)->direction_str (),
00429                                                   (*connect)->format (),
00430                                                   (*connect)->flow_protocol_str (),
00431                                                   (*connect)->carrier_protocol_str (),
00432                                                   local_addr,
00433                                                   local_control_addr);
00434                 /*
00435                   ACE_Addr *addr;
00436                   if ((addr = (*connect)->get_peer_addr ()) != 0)
00437                   {
00438                   entry.set_peer_addr (addr);
00439                   };
00440                 */
00441                 int len = new_flowspec.length ();
00442                 if (i == len)
00443                   new_flowspec.length (len+1);
00444                 new_flowspec [i++] = entry.entry_to_string ();
00445                 if (TAO_debug_level > 0)
00446                   ACE_DEBUG ((LM_DEBUG, "reverse Flow Spec Is %s\n", entry.entry_to_string ()));
00447               }
00448           }
00449         connect_end = flow_set.end ();
00450         for (connect = flow_set.begin ();
00451              connect != connect_end;  ++connect)
00452           {
00453             ACE_Addr *local_addr;
00454             ACE_Addr *local_control_addr;
00455             local_addr = (*connect)->get_local_addr ();
00456             local_control_addr = (*connect)->get_local_control_addr ();
00457             if (local_addr != 0)
00458               {
00459                 TAO_Reverse_FlowSpec_Entry entry ((*connect)->flowname (),
00460                                                   (*connect)->direction_str (),
00461                                                   (*connect)->format (),
00462                                                   (*connect)->flow_protocol_str (),
00463                                                   (*connect)->carrier_protocol_str (),
00464                                                   local_addr,
00465                                                   local_control_addr);
00466 
00467                 int len = new_flowspec.length ();
00468                 if (i == len)
00469                   new_flowspec.length (len+1);
00470                 new_flowspec [i++] = entry.entry_to_string ();
00471               }
00472           }
00473         // Change the reverse flow spec to be sent.
00474         //        int index = flow_spec.length () + 1;
00475         int index = new_flowspec.length ();
00476         flow_spec.length (index);
00477         for (i = 0; i < index; i++)
00478           {
00479             flow_spec [i] = new_flowspec [i];
00480           }
00481       }
00482       break;
00483     default:
00484       break;
00485     }
00486   return 0;
00487 }

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 490 of file AV_Core.cpp.

References ACE_DEBUG, ACE_ERROR_RETURN, TAO_FlowSpec_Entry::address(), ACE_Unbounded_Set< T >::begin(), TAO_FlowSpec_Entry::direction(), ACE_Unbounded_Set< T >::end(), TAO_FlowSpec_Entry::flowname(), get_acceptor(), get_flow_spec_entry(), ACE_Unbounded_Set< T >::insert(), LM_DEBUG, LM_ERROR, TAO_AV_Connector_Registry::open(), TAO_FlowSpec_Entry::role(), TAO_FlowSpec_Entry::set_peer_addr(), TAO_AV_ENDPOINT_A, TAO_AV_ENDPOINT_B, TAO_AV_FlowSpecSet, TAO_AV_FlowSpecSetItor, and TAO_debug_level.

00494 {
00495   if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"(%P|%t)TAO_AV_Core::init_reverse_flows\n"));
00496   TAO_AV_FlowSpecSet acceptor_flow_set;
00497   TAO_AV_FlowSpecSet connector_flow_set;
00498   TAO_AV_FlowSpecSetItor end = reverse_flow_spec_set.end ();
00499   TAO_AV_FlowSpecSetItor start = reverse_flow_spec_set.begin ();
00500   for (;start != end; ++start)
00501     {
00502       TAO_FlowSpec_Entry *entry = (*start);
00503       ACE_Addr *address = entry->address ();
00504       switch (direction)
00505         {
00506         case TAO_AV_Core::TAO_AV_ENDPOINT_B:
00507           {
00508             switch (entry->direction ())
00509               {
00510               case TAO_FlowSpec_Entry::TAO_AV_DIR_IN:
00511                 entry->role (TAO_FlowSpec_Entry::TAO_AV_CONSUMER);
00512                 break;
00513               case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
00514                 entry->role (TAO_FlowSpec_Entry::TAO_AV_PRODUCER);
00515                 break;
00516               }
00517             break;
00518           }
00519         case TAO_AV_Core::TAO_AV_ENDPOINT_A:
00520           {
00521             switch (entry->direction ())
00522               {
00523               case TAO_FlowSpec_Entry::TAO_AV_DIR_IN:
00524                 entry->role (TAO_FlowSpec_Entry::TAO_AV_PRODUCER);
00525                 break;
00526               case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
00527                 entry->role (TAO_FlowSpec_Entry::TAO_AV_CONSUMER);
00528                 break;
00529               }
00530             break;
00531           }
00532         default: break;
00533         }
00534 
00535       if (address != 0)
00536         {
00537           if (this->get_acceptor (entry->flowname ())!= 0)
00538             {
00539               ACE_Addr *address = entry->address ();
00540               TAO_FlowSpec_Entry *forward_entry =
00541                 this->get_flow_spec_entry (forward_flow_spec_set,
00542                                            entry->flowname ());
00543               if (forward_entry != 0)
00544                 forward_entry->set_peer_addr (address);
00545             }
00546           else
00547             connector_flow_set.insert (entry);
00548         }
00549     }
00550   int result = -1;
00551   switch (direction)
00552     {
00553 
00554     case TAO_AV_Core::TAO_AV_ENDPOINT_A:
00555       {
00556         result = this->connector_registry_->open (endpoint,
00557                                                   this,
00558                                                   connector_flow_set);
00559       }
00560         break;
00561     default:
00562       break;
00563     }
00564   if (result == -1)
00565     ACE_ERROR_RETURN ((LM_ERROR,"acceptor_registry::open"),-1);
00566   return 0;
00567 }

int TAO_AV_Core::init_transport_factories void   ) 
 

Definition at line 836 of file AV_Core.cpp.

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

Referenced by init().

00837 {
00838   TAO_AV_TransportFactorySetItor end = this->transport_factories_.end ();
00839   TAO_AV_TransportFactorySetItor factory = this->transport_factories_.begin ();
00840 
00841 
00842   if (factory == end)
00843     {
00844       if (TAO_debug_level > 0)
00845         ACE_DEBUG ((LM_DEBUG,
00846                     "Loading default transport protocols\n"));
00847       this->load_default_transport_factories ();
00848     }
00849   else
00850     {
00851       for (; factory != end; factory++)
00852         {
00853           const ACE_CString &name = (*factory)->name ();
00854           if (TAO_debug_level > 0)
00855             ACE_DEBUG ((LM_DEBUG,
00856                         "%s \n",
00857                         name.c_str ()));
00858 
00859           (*factory)->factory (
00860                                ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (name.c_str ()));
00861           if ((*factory)->factory () == 0)
00862             {
00863               ACE_ERROR_RETURN ((LM_ERROR,
00864                                  ACE_TEXT ("TAO (%P|%t) Unable to load ")
00865                                  ACE_TEXT ("protocol <%s>, %p\n"),
00866                                  name.c_str (), ""),
00867                                 -1);
00868             }
00869           (*factory)->factory ()->ref_count = 1;
00870 
00871           if (TAO_debug_level > 0)
00872             {
00873               ACE_DEBUG ((LM_DEBUG,
00874                           ACE_TEXT ("TAO (%P|%t) Loaded protocol <%s>\n"),
00875                           name.c_str ()));
00876             }
00877         }
00878     }
00879 
00880   return 0;
00881 }

int TAO_AV_Core::load_default_flow_protocol_factories void   ) 
 

Definition at line 884 of file AV_Core.cpp.

References ACE_ERROR, ACE_NEW_RETURN, TAO_AV_Flow_Protocol_Item::factory(), flow_protocol_factories_, ACE_Unbounded_Set< T >::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().

00885 {
00886   const char *udp_flow = "UDP_Flow_Factory";
00887   const char *tcp_flow = "TCP_Flow_Factory";
00888   const char *rtp_flow = "RTP_Flow_Factory";
00889   const char *rtcp_flow = "RTCP_Flow_Factory";
00890   const char *sfp_flow = "SFP_Flow_Factory";
00891 
00892   TAO_AV_Flow_Protocol_Factory *udp_flow_factory = 0;
00893   TAO_AV_Flow_Protocol_Item *udp_item = 0;
00894 
00895   udp_flow_factory =
00896     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (udp_flow);
00897   if (udp_flow_factory == 0)
00898     {
00899       if (TAO_debug_level)
00900         ACE_ERROR ((LM_WARNING,
00901                     "(%P|%t) WARNING - No %s found in Service Repository."
00902                     "  Using default instance.\n",
00903                     "UDP Flow Factory"));
00904 
00905       ACE_NEW_RETURN (udp_flow_factory,
00906                       TAO_AV_UDP_Flow_Factory,
00907                       -1);
00908     }
00909   else udp_flow_factory->ref_count = 1;
00910 
00911   ACE_NEW_RETURN (udp_item, TAO_AV_Flow_Protocol_Item ("UDP_Flow_Factory"), -1);
00912   udp_item->factory (udp_flow_factory);
00913 
00914   this->flow_protocol_factories_.insert (udp_item);
00915 
00916 #if defined (ACE_HAS_RAPI) || defined (ACE_HAS_WINSOCK2_GQOS)
00917 
00918   const char *udp_qos_flow = "UDP_QoS_Flow_Factory";
00919   TAO_AV_Flow_Protocol_Factory *udp_qos_flow_factory = 0;
00920   TAO_AV_Flow_Protocol_Item *udp_qos_flow_item = 0;
00921 
00922   udp_qos_flow_factory =
00923     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (udp_qos_flow);
00924   if (udp_qos_flow_factory == 0)
00925     {
00926       if (TAO_debug_level)
00927         ACE_ERROR ((LM_WARNING,
00928                     "(%P|%t) WARNING - No %s found in Service Repository."
00929                     "  Using default instance.\n",
00930                     "UDP QoS Flow Factory"));
00931 
00932       ACE_NEW_RETURN (udp_qos_flow_factory,
00933                       TAO_AV_UDP_QoS_Flow_Factory,
00934                       -1);
00935     }
00936   else udp_qos_flow_factory->ref_count = 1;
00937 
00938   ACE_NEW_RETURN (udp_qos_flow_item, TAO_AV_Flow_Protocol_Item ("UDP_QoS_Flow_Factory"), -1);
00939   udp_qos_flow_item->factory (udp_qos_flow_factory);
00940 
00941   this->flow_protocol_factories_.insert (udp_qos_flow_item);
00942 
00943 #endif /* defined (ACE_HAS_RAPI) || defined (ACE_HAS_WINSOCK2_GQOS) */
00944 
00945 #if defined ACE_HAS_SCTP
00946 
00947   const char *sctp_seq_flow = "SCTP_SEQ_Flow_Factory";
00948   TAO_AV_Flow_Protocol_Factory *sctp_seq_flow_factory = 0;
00949   TAO_AV_Flow_Protocol_Item *sctp_seq_flow_item = 0;
00950 
00951   sctp_seq_flow_factory =
00952     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (sctp_seq_flow);
00953   if (sctp_seq_flow_factory == 0)
00954     {
00955       if (TAO_debug_level)
00956         ACE_ERROR ((LM_WARNING,
00957                     "(%P|%t) WARNING - No %s found in Service Repository."
00958                     "  Using default instance.\n",
00959                     "SCTP SEQ Flow Factory"));
00960 
00961       ACE_NEW_RETURN (sctp_seq_flow_factory,
00962                       TAO_AV_SCTP_SEQ_Flow_Factory,
00963                       -1);
00964     }
00965   else sctp_seq_flow_factory->ref_count = 1;
00966 
00967   ACE_NEW_RETURN (sctp_seq_flow_item, TAO_AV_Flow_Protocol_Item ("SCTP_SEQ_Flow_Factory"), -1);
00968   sctp_seq_flow_item->factory (sctp_seq_flow_factory);
00969 
00970   this->flow_protocol_factories_.insert (sctp_seq_flow_item);
00971 
00972 #endif /* ACE_HAS_SCTP */
00973 
00974   TAO_AV_Flow_Protocol_Factory *tcp_flow_factory = 0;
00975   TAO_AV_Flow_Protocol_Item *tcp_item = 0;
00976 
00977   tcp_flow_factory =
00978     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (tcp_flow);
00979   if (tcp_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                     "TCP Flow Factory"));
00986 
00987       ACE_NEW_RETURN (tcp_flow_factory,
00988                       TAO_AV_TCP_Flow_Factory,
00989                       -1);
00990     }
00991   else tcp_flow_factory->ref_count = 1;
00992 
00993   ACE_NEW_RETURN (tcp_item, TAO_AV_Flow_Protocol_Item ("TCP_Flow_Factory"), -1);
00994   tcp_item->factory (tcp_flow_factory);
00995 
00996   this->flow_protocol_factories_.insert (tcp_item);
00997 
00998   TAO_AV_Flow_Protocol_Factory *rtp_flow_factory = 0;
00999   TAO_AV_Flow_Protocol_Item *rtp_item = 0;
01000 
01001   rtp_flow_factory =
01002     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (rtp_flow);
01003   if (rtp_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                     "RTP Flow Factory"));
01010 
01011       ACE_NEW_RETURN (rtp_flow_factory,
01012                       TAO_AV_RTP_Flow_Factory,
01013                       -1);
01014     }
01015   else rtp_flow_factory->ref_count = 1;
01016 
01017   ACE_NEW_RETURN (rtp_item, TAO_AV_Flow_Protocol_Item ("RTP_Flow_Factory"), -1);
01018   rtp_item->factory (rtp_flow_factory);
01019 
01020   this->flow_protocol_factories_.insert (rtp_item);
01021 
01022   TAO_AV_Flow_Protocol_Factory *rtcp_flow_factory = 0;
01023   TAO_AV_Flow_Protocol_Item *rtcp_item = 0;
01024 
01025   rtcp_flow_factory =
01026     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (rtcp_flow);
01027   if (rtcp_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                     "RTCP Flow Factory"));
01034 
01035       ACE_NEW_RETURN (rtcp_flow_factory,
01036                       TAO_AV_RTCP_Flow_Factory,
01037                       -1);
01038     }
01039   else rtcp_flow_factory->ref_count = 1;
01040 
01041   ACE_NEW_RETURN (rtcp_item, TAO_AV_Flow_Protocol_Item ("RTCP_Flow_Factory"), -1);
01042   rtcp_item->factory (rtcp_flow_factory);
01043 
01044   this->flow_protocol_factories_.insert (rtcp_item);
01045 
01046   TAO_AV_Flow_Protocol_Factory *sfp_flow_factory = 0;
01047   TAO_AV_Flow_Protocol_Item *sfp_item = 0;
01048 
01049   sfp_flow_factory =
01050     ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (sfp_flow);
01051   if (sfp_flow_factory == 0)
01052     {
01053       if (TAO_debug_level)
01054         ACE_ERROR ((LM_WARNING,
01055                     "(%P|%t) WARNING - No %s found in Service Repository."
01056                     "  Using default instance.\n",
01057                     "SFP Flow Factory"));
01058 
01059       ACE_NEW_RETURN (sfp_flow_factory,
01060                       TAO_AV_SFP_Factory,
01061                       -1);
01062     }
01063   else sfp_flow_factory->ref_count = 1;
01064 
01065   ACE_NEW_RETURN (sfp_item, TAO_AV_Flow_Protocol_Item ("SFP_Flow_Factory"), -1);
01066   sfp_item->factory (sfp_flow_factory);
01067 
01068   this->flow_protocol_factories_.insert (sfp_item);
01069 
01070   return 0;
01071 }

int TAO_AV_Core::load_default_transport_factories void   ) 
 

Definition at line 717 of file AV_Core.cpp.

References ACE_ERROR, ACE_NEW_RETURN, TAO_AV_Transport_Item::factory(), ACE_Unbounded_Set< T >::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().

00718 {
00719   const char *udp_factory_str = "UDP_Factory";
00720   const char *tcp_factory_str = "TCP_Factory";
00721 
00722   TAO_AV_Transport_Factory *udp_factory = 0;
00723   TAO_AV_Transport_Item *udp_item = 0;
00724 
00725   udp_factory =
00726     ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (udp_factory_str);
00727   if (udp_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                     "UDP Factory"));
00734 
00735       ACE_NEW_RETURN (udp_factory,
00736                       TAO_AV_UDP_Factory,
00737                       -1);
00738     }
00739   else udp_factory->ref_count = 1;
00740 
00741   ACE_NEW_RETURN (udp_item, TAO_AV_Transport_Item ("UDP_Factory"), -1);
00742   udp_item->factory (udp_factory);
00743 
00744   this->transport_factories_.insert (udp_item);
00745 
00746   TAO_AV_Transport_Factory *tcp_factory = 0;
00747   TAO_AV_Transport_Item *tcp_item = 0;
00748 
00749   tcp_factory =
00750     ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (tcp_factory_str);
00751   if (tcp_factory == 0)
00752     {
00753       if (TAO_debug_level)
00754         ACE_ERROR ((LM_WARNING,
00755                     "(%P|%t) WARNING - No %s found in Service Repository."
00756                     "  Using default instance.\n",
00757                     "TCP Factory"));
00758 
00759       ACE_NEW_RETURN (tcp_factory,
00760                       TAO_AV_TCP_Factory,
00761                           -1);
00762     }
00763   else tcp_factory->ref_count = 1;
00764 
00765   ACE_NEW_RETURN (tcp_item, TAO_AV_Transport_Item ("TCP_Factory"), -1);
00766   tcp_item->factory (tcp_factory);
00767 
00768   this->transport_factories_.insert (tcp_item);
00769 
00770 #if defined (ACE_HAS_RAPI) || defined (ACE_HAS_WINSOCK2_GQOS)
00771   const char *udp_qos_factory_str = "UDP_QoS_Factory";
00772 
00773   TAO_AV_Transport_Factory *udp_qos_factory = 0;
00774   TAO_AV_Transport_Item *udp_qos_item = 0;
00775 
00776   udp_qos_factory =
00777         ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (udp_qos_factory_str);
00778   if (udp_qos_factory == 0)
00779     {
00780       if (TAO_debug_level)
00781         ACE_ERROR ((LM_WARNING,
00782                     "(%P|%t) WARNING - No %s found in Service Repository."
00783                     "  Using default instance.\n",
00784                     "UDP QoS Factory"));
00785 
00786           ACE_NEW_RETURN (udp_qos_factory,
00787                           TAO_AV_UDP_QoS_Factory,
00788                           -1);
00789     }
00790   else udp_qos_factory->ref_count = 1;
00791 
00792   ACE_NEW_RETURN (udp_qos_item,
00793                   TAO_AV_Transport_Item ("UDP_QoS_Factory"),
00794                   -1);
00795 
00796   udp_qos_item->factory (udp_qos_factory);
00797 
00798   this->transport_factories_.insert (udp_qos_item);
00799 #endif /* ACE_HAS_RAPI || ACE_HAS_WINSOCK2_GQOS */
00800 
00801 #if defined ACE_HAS_SCTP
00802   const char *sctp_seq_factory_str = "SCTP_SEQ_Factory";
00803 
00804   TAO_AV_Transport_Factory *sctp_seq_factory = 0;
00805   TAO_AV_Transport_Item *sctp_seq_item = 0;
00806 
00807   sctp_seq_factory =
00808         ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (sctp_seq_factory_str);
00809   if (sctp_seq_factory == 0)
00810     {
00811       if (TAO_debug_level)
00812         ACE_ERROR ((LM_WARNING,
00813                     "(%P|%t) WARNING - No %s found in Service Repository."
00814                     "  Using default instance.\n",
00815                     "SCTP SEQ Factory"));
00816 
00817       ACE_NEW_RETURN (sctp_seq_factory,
00818                       TAO_AV_SCTP_SEQ_Factory,
00819                       -1);
00820     }
00821   else sctp_seq_factory->ref_count = 1;
00822 
00823   ACE_NEW_RETURN (sctp_seq_item,
00824                   TAO_AV_Transport_Item ("SCTP_SEQ_Factory"),
00825                   -1);
00826 
00827   sctp_seq_item->factory (sctp_seq_factory);
00828 
00829   this->transport_factories_.insert (sctp_seq_item);
00830 #endif /* ACE_HAS_SCTP */
00831 
00832   return 0;
00833 }

void TAO_AV_Core::orb CORBA::ORB_ptr  orb_  ) 
 

Definition at line 85 of file AV_Core.cpp.

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

CORBA::ORB_ptr TAO_AV_Core::orb void   ) 
 

Definition at line 79 of file AV_Core.cpp.

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.

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

PortableServer::POA_ptr TAO_AV_Core::poa void   ) 
 

Definition at line 91 of file AV_Core.cpp.

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

ACE_Reactor * TAO_AV_Core::reactor void   ) 
 

Definition at line 149 of file AV_Core.cpp.

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.

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

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

int TAO_AV_Core::remove_acceptor const char *  flowname  ) 
 

Definition at line 611 of file AV_Core.cpp.

References TAO_AV_Acceptor_Registry::begin(), TAO_AV_Acceptor_Registry::close(), TAO_AV_Acceptor_Registry::end(), ACE_OS::strcmp(), and TAO_AV_AcceptorSetItor.

00612 {
00613 
00614   try
00615     {
00616 
00617       TAO_AV_AcceptorSetItor acceptor =  this->acceptor_registry_->begin ();
00618 
00619       TAO_AV_AcceptorSetItor end =
00620         this->acceptor_registry_->end ();
00621 
00622       for (;acceptor != end; ++acceptor)
00623         {
00624           if (ACE_OS::strcmp ((*acceptor)->flowname (),flowname) == 0)
00625             {
00626               this->acceptor_registry_->close (*acceptor);
00627               return 0;
00628             }
00629         }
00630     }
00631   catch (const CORBA::Exception& ex)
00632     {
00633       ex._tao_print_exception ("TAO_AV_Core::get_acceptor");
00634     }
00635   return -1;
00636 }

int TAO_AV_Core::remove_connector const char *  flowname  ) 
 

Definition at line 655 of file AV_Core.cpp.

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

00656 {
00657   TAO_AV_ConnectorSetItor connector =
00658     this->connector_registry_->begin ();
00659   TAO_AV_ConnectorSetItor end =
00660     this->connector_registry_->end ();
00661 
00662   for (;connector != end; ++connector)
00663     {
00664       if (ACE_OS::strcmp ((*connector)->flowname (),flowname) == 0)
00665         {
00666           this->connector_registry_->close (*connector);
00667           return 0;
00668         }
00669     }
00670   return -1;
00671 }

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.

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.

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.

PortableServer::POA_var TAO_AV_Core::poa_ [protected]
 

Definition at line 159 of file AV_Core.h.

ACE_Reactor* TAO_AV_Core::reactor_ [protected]
 

Definition at line 157 of file AV_Core.h.

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 Sun Jan 27 16:06:38 2008 for TAO_AV by doxygen 1.3.6