AV_Core.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   AV_Core.h
00006  *
00007  *  $Id: AV_Core.h 79589 2007-09-06 10:32:54Z johnnyw $
00008  *
00009  *  @author Nagarajan Surendran <naga@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_AV_CORE_H
00014 #define TAO_AV_CORE_H
00015 #include /**/ "ace/pre.h"
00016 
00017 #include "orbsvcs/AV/AV_export.h"
00018 #include "orbsvcs/AVStreamsC.h"
00019 
00020 #include "tao/PortableServer/PortableServer.h"
00021 
00022 #include "ace/Singleton.h"
00023 #include "ace/Unbounded_Set.h"
00024 #include "ace/Null_Mutex.h"
00025 
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027 class ACE_Reactor;
00028 ACE_END_VERSIONED_NAMESPACE_DECL
00029 
00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 class TAO_Base_StreamEndPoint;
00033 class TAO_AV_Connector_Registry;
00034 class TAO_AV_Acceptor_Registry;
00035 class TAO_AV_Acceptor;
00036 class TAO_AV_Connector;
00037 class TAO_FlowSpec_Entry;
00038 class TAO_AV_Transport_Item;
00039 class TAO_AV_Transport_Factory;
00040 class TAO_AV_Flow_Protocol_Item;
00041 class TAO_AV_Flow_Protocol_Factory;
00042 
00043 typedef ACE_Unbounded_Set <TAO_FlowSpec_Entry*> TAO_AV_FlowSpecSet;
00044 typedef ACE_Unbounded_Set_Iterator <TAO_FlowSpec_Entry*> TAO_AV_FlowSpecSetItor;
00045 
00046 typedef ACE_Unbounded_Set<TAO_AV_Transport_Item*> TAO_AV_TransportFactorySet;
00047 typedef ACE_Unbounded_Set_Iterator<TAO_AV_Transport_Item*> TAO_AV_TransportFactorySetItor;
00048 
00049 // typedefs for containers containing the list of loaded Flow_Protocol factories.
00050 typedef ACE_Unbounded_Set<TAO_AV_Flow_Protocol_Item*> TAO_AV_Flow_ProtocolFactorySet;
00051 typedef ACE_Unbounded_Set_Iterator<TAO_AV_Flow_Protocol_Item*> TAO_AV_Flow_ProtocolFactorySetItor;
00052 
00053 /**
00054  * @class TAO_AV_Core
00055  * @brief This class encapsulates access to the TAO AV Core's resources
00056  *        and its state.
00057  */
00058 class TAO_AV_Export TAO_AV_Core
00059 {
00060 public:
00061   enum EndPoint {TAO_AV_ENDPOINT_A,TAO_AV_ENDPOINT_B};
00062 
00063   enum Protocol
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   };
00083 
00084   enum Flow_Component
00085   {
00086     TAO_AV_DATA = 1,
00087     TAO_AV_CONTROL = 2,
00088     TAO_AV_BOTH = 3
00089   };
00090 
00091   /// Default constructor.
00092   TAO_AV_Core (void);
00093 
00094   /// Destructor.
00095   ~TAO_AV_Core (void);
00096 
00097   int init (CORBA::ORB_ptr orb,
00098             PortableServer::POA_ptr poa);
00099   int run (void);
00100   int stop_run (void);
00101   int init_forward_flows (TAO_Base_StreamEndPoint *endpoint,
00102                           TAO_AV_FlowSpecSet &flow_spec_set,
00103                           EndPoint direction,
00104                           AVStreams::flowSpec &flow_spec);
00105   int init_reverse_flows (TAO_Base_StreamEndPoint *endpoint,
00106                           TAO_AV_FlowSpecSet &forward_flow_spec_set,
00107                           TAO_AV_FlowSpecSet &reverse_flow_spec_set,
00108                           EndPoint direction);
00109   int init_transport_factories (void);
00110   int init_flow_protocol_factories (void);
00111 
00112   int load_default_transport_factories (void);
00113   int load_default_flow_protocol_factories (void);
00114 
00115   /// = Get the acceptor registry
00116   TAO_AV_Acceptor *get_acceptor (const char *flowname);
00117   TAO_AV_Connector *get_connector (const char *flowname);
00118   int remove_acceptor (const char *flowname);
00119   int remove_connector (const char *flowname);
00120   TAO_AV_Connector_Registry *connector_registry (void);
00121   TAO_FlowSpec_Entry *get_flow_spec_entry (TAO_AV_FlowSpecSet &flow_spec_set,
00122                                            const char *flowname);
00123   TAO_AV_Acceptor_Registry  *acceptor_registry  (void);
00124 
00125   // = Get the protocol factories
00126   /// = Set/get the <ACE_Reactor>.
00127   TAO_AV_Flow_Protocol_Factory *get_flow_protocol_factory(const char *flow_protocol);
00128   TAO_AV_Transport_Factory *get_transport_factory(const char *transport_protocol);
00129   TAO_AV_Flow_ProtocolFactorySet *flow_protocol_factories (void);
00130   TAO_AV_TransportFactorySet *transport_factories (void);
00131   void reactor (ACE_Reactor *r);
00132   ACE_Reactor *reactor (void);
00133   CORBA::ORB_ptr orb (void);
00134   void orb (CORBA::ORB_ptr orb_);
00135   PortableServer::POA_ptr poa (void);
00136   void poa (PortableServer::POA_ptr poa_);
00137 
00138   static int deactivate_servant (PortableServer::Servant servant);
00139   static char *get_flowname (const char *flow_spec_entry_str);
00140   static ACE_CString get_control_flowname(const char *flowname);
00141 
00142 protected:
00143   /// The connector registry which all active connecters must register
00144   /// themselves with.
00145   TAO_AV_Connector_Registry *connector_registry_;
00146 
00147   /// The registry which maintains a list of acceptor factories for each
00148   /// loaded protocol.
00149   TAO_AV_Acceptor_Registry *acceptor_registry_;
00150 
00151   /// Pointer to the list of transports loaded into this AV_Core instance.
00152   TAO_AV_TransportFactorySet transport_factories_;
00153 
00154   /// Pointer to the list of flow protocol loaded into this AV_Core instance.
00155   TAO_AV_Flow_ProtocolFactorySet flow_protocol_factories_;
00156 
00157   ACE_Reactor *reactor_;
00158   CORBA::ORB_var orb_;
00159   PortableServer::POA_var poa_;
00160   CORBA::Boolean stop_run_;
00161 };
00162 
00163 TAO_AV_SINGLETON_DECLARE (ACE_Singleton, TAO_AV_Core, ACE_Null_Mutex)
00164 
00165 typedef ACE_Singleton<TAO_AV_Core, ACE_Null_Mutex> TAO_AV_CORE;
00166 
00167 TAO_END_VERSIONED_NAMESPACE_DECL
00168 
00169 #include /**/ "ace/post.h"
00170 #endif /* TAO_AV_CORE_H */

Generated on Tue Feb 2 17:47:49 2010 for TAO_AV by  doxygen 1.4.7