AVStreams_i.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   AVStreams_i.h
00006  *
00007  *  AVStreams_i.h,v 5.60 2006/03/14 06:14:24 jtc Exp
00008  *
00009  *  @author Sumedh Mungee <sumedh@cs.wustl.edu>
00010  *  @author Nagarajan Surendran <naga@cs.wustl.edu>
00011  */
00012 //=============================================================================
00013 
00014 #ifndef AVSTREAMS_I_H
00015 #define AVSTREAMS_I_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "orbsvcs/AV/AV_Core.h"
00019 
00020 #include "orbsvcs/AV/AV_export.h"
00021 #include "orbsvcs/CosPropertyS.h"
00022 #include "orbsvcs/AVStreamsS.h"
00023 #include "orbsvcs/Property/CosPropertyService_i.h"
00024 #include "orbsvcs/CosNamingC.h"
00025 #include "orbsvcs/AV/AV_Core.h"
00026 #include "orbsvcs/AV/Endpoint_Strategy.h"
00027 #include "orbsvcs/Null_MediaCtrlS.h"
00028 #include "orbsvcs/AV/FlowSpec_Entry.h"
00029 
00030 #include "ace/OS.h"
00031 #include "ace/SOCK_Dgram_Mcast.h"
00032 #include "ace/ATM_Addr.h"
00033 #include "ace/Containers_T.h"
00034 #include "ace/Process.h"
00035 #include "ace/SOCK_CODgram.h"
00036 #include "ace/SOCK_Connector.h"
00037 #include "ace/Connector.h"
00038 #include "ace/Acceptor.h"
00039 #include "ace/SOCK_Stream.h"
00040 #include "ace/Svc_Handler.h"
00041 #include "ace/SOCK_Acceptor.h"
00042 
00043 #define FLOWSPEC_MAX 5
00044 // for the Hash_Map helper classes.
00045 
00046 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00047 
00048 typedef ACE_Hash_Map_Manager <ACE_CString,AVStreams::FlowEndPoint_var,ACE_Null_Mutex>  FlowEndPoint_Map;
00049 typedef ACE_Hash_Map_Entry <ACE_CString,AVStreams::FlowEndPoint_var> FlowEndPoint_Map_Entry;
00050 typedef ACE_Hash_Map_Iterator <ACE_CString,AVStreams::FlowEndPoint_var,ACE_Null_Mutex>  FlowEndPoint_Map_Iterator;
00051 
00052 typedef ACE_Hash_Map_Manager <ACE_CString,TAO_AV_Flow_Handler*,ACE_Null_Mutex>  Flow_Handler_Map;
00053 typedef ACE_Hash_Map_Entry <ACE_CString,TAO_AV_Flow_Handler*> Flow_Handler_Map_Entry;
00054 typedef ACE_Hash_Map_Iterator <ACE_CString,TAO_AV_Flow_Handler*,ACE_Null_Mutex>  Flow_Handler_Map_Iterator;
00055 
00056 
00057 
00058 class TAO_AV_Export AV_Null_MediaCtrl
00059   : public virtual POA_Null_MediaCtrl
00060 {
00061 public:
00062   AV_Null_MediaCtrl (void);
00063 
00064 protected:
00065 
00066   virtual ~AV_Null_MediaCtrl (void);
00067 
00068 };
00069 
00070 /**
00071  * @class TAO_Basic_StreamCtrl
00072  * @brief Base class for StreamCtrl, implements basic stream start
00073  *        and stop functionality.
00074  */
00075 class TAO_AV_Export TAO_Basic_StreamCtrl
00076   : public virtual POA_AVStreams::Basic_StreamCtrl,
00077     public virtual TAO_PropertySet
00078 {
00079 
00080 public:
00081   /// Default Constructor
00082   TAO_Basic_StreamCtrl (void);
00083 
00084   /// Stop the transfer of data of the stream
00085   /// Empty the_spec means apply operation to all flows
00086   virtual void stop (const AVStreams::flowSpec &the_spec
00087                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00088     ACE_THROW_SPEC ((CORBA::SystemException,
00089                      AVStreams::noSuchFlow));
00090 
00091   /// Start the transfer of data in the stream.
00092   /// Empty the_spec means apply operation to all flows
00093   virtual void start (const AVStreams::flowSpec &the_spec
00094                       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00095     ACE_THROW_SPEC ((CORBA::SystemException,
00096                      AVStreams::noSuchFlow));
00097 
00098   /**
00099    * Tears down the stream. This will close the connection, and delete
00100    * the streamendpoint and vdev associated with this stream
00101    * Empty the_spec means apply operation to all flows
00102    */
00103   virtual void destroy (const AVStreams::flowSpec &the_spec
00104                         ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00105     ACE_THROW_SPEC ((CORBA::SystemException,
00106                      AVStreams::noSuchFlow));
00107 
00108   /// Changes the QoS associated with the stream
00109   /// Empty the_spec means apply operation to all flows
00110   virtual CORBA::Boolean modify_QoS (AVStreams::streamQoS &new_qos,
00111                                      const AVStreams::flowSpec &the_spec
00112                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00113     ACE_THROW_SPEC ((CORBA::SystemException,
00114                      AVStreams::noSuchFlow,
00115                      AVStreams::QoSRequestFailed));
00116 
00117   /// Used by StreamEndPoint and VDev to inform StreamCtrl of events.
00118   /// E.g., loss of flow, reestablishment of flow, etc..
00119   virtual void push_event (const struct CosPropertyService::Property & the_event
00120                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00121     ACE_THROW_SPEC ((CORBA::SystemException));
00122 
00123   /// Used to control the flow protocol parameters.
00124   virtual void set_FPStatus (const AVStreams::flowSpec &the_spec,
00125                              const char *fp_name,
00126                              const CORBA::Any &fp_settings
00127                              ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00128     ACE_THROW_SPEC ((CORBA::SystemException,
00129                      AVStreams::noSuchFlow,
00130                      AVStreams::FPError));
00131 
00132   /// Not implemented in the light profile, will raise the notsupported
00133   /// exception
00134   virtual CORBA::Object_ptr get_flow_connection (const char *flow_name
00135                                                  ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00136     ACE_THROW_SPEC ((CORBA::SystemException,
00137                      AVStreams::noSuchFlow,
00138                      AVStreams::notSupported));
00139 
00140   /// Not implemented in the light profile, will raise the notsupported
00141   /// exception
00142   virtual void set_flow_connection (const char *flow_name,
00143                                     CORBA::Object_ptr flow_connection
00144                                     ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00145     ACE_THROW_SPEC ((CORBA::SystemException,
00146                      AVStreams::noSuchFlow,
00147                      AVStreams::notSupported));
00148 
00149 protected:
00150 
00151   /// Destructor.
00152   virtual ~TAO_Basic_StreamCtrl (void);
00153 
00154 
00155   /// The Virtual Devices for this stream
00156   AVStreams::VDev_var vdev_a_;
00157   AVStreams::VDev_var vdev_b_;
00158 
00159   /// The Endpoints for this stream
00160   AVStreams::StreamEndPoint_A_var sep_a_;
00161   AVStreams::StreamEndPoint_B_var sep_b_;
00162 
00163   /// Hash table for the flow names and its corresponding flowconnection object reference.
00164   typedef ACE_Hash_Map_Manager <ACE_CString,AVStreams::FlowConnection_var,ACE_Null_Mutex> FlowConnection_Map;
00165   typedef ACE_Hash_Map_Iterator <ACE_CString,AVStreams::FlowConnection_var,ACE_Null_Mutex> FlowConnection_Map_Iterator;
00166   typedef ACE_Hash_Map_Entry <ACE_CString,AVStreams::FlowConnection_var> FlowConnection_Map_Entry;
00167   FlowConnection_Map flow_connection_map_;
00168   AVStreams::FlowConnection_seq flowConnections_;
00169 
00170   ///sequence of flow names.
00171   u_int flow_count_;
00172   AVStreams::flowSpec flows_;
00173 };
00174 
00175 class TAO_AV_Export TAO_Negotiator
00176   : public POA_AVStreams::Negotiator
00177 {
00178 public:
00179   virtual CORBA::Boolean negotiate (AVStreams::Negotiator_ptr remote_negotiator,
00180                                     const AVStreams::streamQoS &qos_spec
00181                                     ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00182     ACE_THROW_SPEC ((CORBA::SystemException));
00183 };
00184 
00185 class TAO_MCastConfigIf;
00186 
00187 class TAO_AV_Export MMDevice_Map_Hash_Key
00188 {
00189 public:
00190   /// default constructor.
00191   MMDevice_Map_Hash_Key (void);
00192 
00193   /// constructor.
00194   MMDevice_Map_Hash_Key (AVStreams::MMDevice_ptr mmdevice);
00195 
00196   /// copy constructor.
00197   MMDevice_Map_Hash_Key (const MMDevice_Map_Hash_Key&);
00198 
00199   /// destructor.
00200   ~MMDevice_Map_Hash_Key (void);
00201 
00202   /// operator== needed by  ACE_Hash_Map_Manager.
00203   bool operator == (const MMDevice_Map_Hash_Key &hash_key) const;
00204 
00205   /// operator== needed by  ACE_Hash_Map_Manager.
00206   friend bool operator < (const MMDevice_Map_Hash_Key &left,
00207                           const MMDevice_Map_Hash_Key &right);
00208 
00209   /// hash function for this mmdevice.
00210   u_long hash (void) const;
00211 
00212   static const int hash_maximum_;
00213 protected:
00214   AVStreams::MMDevice_ptr mmdevice_;
00215 };
00216 
00217 /**
00218  * @class TAO_StreamCtrl
00219  * @brief Implementation the A/V StreamCtrl class. this class
00220  *        is used to control the stream. It should be subclassed
00221  *        by applications that want to provide more control features.
00222  */
00223 class TAO_AV_Export TAO_StreamCtrl
00224   : public virtual POA_AVStreams::StreamCtrl,
00225     public virtual TAO_Basic_StreamCtrl
00226 {
00227 
00228 public:
00229 
00230   /// Default Constructor
00231   TAO_StreamCtrl (void);
00232 
00233   /// virtual destructor.
00234   virtual ~TAO_StreamCtrl (void);
00235 
00236   /// Stop the transfer of data of the stream
00237   /// Empty the_spec means apply operation to all flows
00238   virtual void stop (const AVStreams::flowSpec &the_spec
00239                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00240     ACE_THROW_SPEC ((CORBA::SystemException,
00241                      AVStreams::noSuchFlow));
00242 
00243   /// Start the transfer of data in the stream.
00244   /// Empty the_spec means apply operation to all flows
00245   virtual void start (const AVStreams::flowSpec &the_spec
00246                       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00247     ACE_THROW_SPEC ((CORBA::SystemException,
00248                      AVStreams::noSuchFlow));
00249 
00250   /**
00251    * Tears down the stream. This will close the connection, and delete
00252    * the streamendpoint and vdev associated with this stream
00253    * Empty the_spec means apply operation to all flows
00254    */
00255   virtual void destroy (const AVStreams::flowSpec &the_spec
00256                         ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00257     ACE_THROW_SPEC ((CORBA::SystemException,
00258                      AVStreams::noSuchFlow));
00259 
00260   /**
00261    * Establish a stream between a_party and b_party,
00262    * with qos the_qos, and for the flows in the_flows
00263    * if the_flows is empty, bind all the flows
00264    * Causes a connection to be established between the StreamEndpoints.
00265    * Returns success/failure
00266    */
00267   virtual CORBA::Boolean bind_devs (AVStreams::MMDevice_ptr a_party,
00268                                     AVStreams::MMDevice_ptr b_party,
00269                                     AVStreams::streamQoS& the_qos,
00270                                     const AVStreams::flowSpec& the_flows
00271                                     ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00272     ACE_THROW_SPEC ((CORBA::SystemException,
00273                      AVStreams::streamOpFailed,
00274                      AVStreams::noSuchFlow,
00275                      AVStreams::QoSRequestFailed));
00276 
00277   /**
00278    * Establish a connection between two streamendpoints. This can
00279    * be used if the streamendpoints have been created independent of
00280    * a MMDevice
00281    */
00282   virtual CORBA::Boolean bind (AVStreams::StreamEndPoint_A_ptr a_party,
00283                                AVStreams::StreamEndPoint_B_ptr b_party,
00284                                AVStreams::streamQoS &the_qos,
00285                                const AVStreams::flowSpec &the_flows
00286                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00287   ACE_THROW_SPEC ((CORBA::SystemException,
00288                    AVStreams::streamOpFailed,
00289                    AVStreams::noSuchFlow,
00290                    AVStreams::QoSRequestFailed));
00291 
00292   virtual void unbind_dev (AVStreams::MMDevice_ptr dev,
00293                            const AVStreams::flowSpec & the_spec
00294                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00295     ACE_THROW_SPEC ((CORBA::SystemException,
00296                      AVStreams::streamOpFailed,
00297                      AVStreams::noSuchFlow));
00298 
00299   /// Unbind the_ep from the stream. Empty the_spec means apply to all flows.
00300   virtual void unbind_party (AVStreams::StreamEndPoint_ptr the_ep,
00301                              const AVStreams::flowSpec &the_spec
00302                              ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00303     ACE_THROW_SPEC ((CORBA::SystemException,
00304                      AVStreams::streamOpFailed,
00305                      AVStreams::noSuchFlow));
00306 
00307   /// unbind the stream. Same effect as Basic_StreamCtrl::destroy ()
00308   virtual void unbind (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00309     ACE_THROW_SPEC ((CORBA::SystemException,
00310                      AVStreams::streamOpFailed));
00311 
00312   virtual AVStreams::VDev_ptr get_related_vdev (AVStreams::MMDevice_ptr adev,
00313                                                 AVStreams::StreamEndPoint_out sep
00314                                                 ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00315     ACE_THROW_SPEC ((CORBA::SystemException,
00316                      AVStreams::streamOpFailed));
00317 
00318   /// Changes the QoS associated with the stream
00319   /// Empty the_spec means apply operation to all flows
00320   virtual CORBA::Boolean modify_QoS (AVStreams::streamQoS &new_qos,
00321                                      const AVStreams::flowSpec &the_spec
00322                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00323     ACE_THROW_SPEC ((CORBA::SystemException,
00324                      AVStreams::noSuchFlow,
00325                      AVStreams::QoSRequestFailed));
00326 
00327 protected:
00328 
00329   struct MMDevice_Map_Entry
00330   {
00331     AVStreams::StreamEndPoint_var sep_;
00332     AVStreams::VDev_var vdev_;
00333     AVStreams::flowSpec flowspec_;
00334     AVStreams::streamQoS qos_;
00335   };
00336 
00337   typedef ACE_Hash_Map_Manager <MMDevice_Map_Hash_Key,MMDevice_Map_Entry,ACE_Null_Mutex> MMDevice_Map;
00338   typedef ACE_Hash_Map_Iterator <MMDevice_Map_Hash_Key,MMDevice_Map_Entry,ACE_Null_Mutex> MMDevice_Map_Iterator;
00339 
00340   MMDevice_Map mmdevice_a_map_;
00341   MMDevice_Map mmdevice_b_map_;
00342   TAO_MCastConfigIf *mcastconfigif_;
00343   AVStreams::MCastConfigIf_var mcastconfigif_ptr_;
00344   AVStreams::StreamCtrl_var streamctrl_;
00345   CORBA::ULong source_id_;
00346 };
00347 
00348 class TAO_AV_Export TAO_MCastConfigIf
00349   : public virtual POA_AVStreams::MCastConfigIf,
00350     public virtual TAO_PropertySet
00351 {
00352 public:
00353 
00354   enum Peer_Interface {VDEV = 0, FLOWENDPOINT=1};
00355   struct Peer_Info
00356   {
00357     AVStreams::VDev_var peer_;
00358     AVStreams::FlowEndPoint_var fep_;
00359     AVStreams::streamQoS qos_;
00360     AVStreams::flowSpec flow_spec_;
00361     Peer_Interface interface_;
00362   };
00363 
00364   /// Default constructor.
00365   TAO_MCastConfigIf (void);
00366 
00367   /// Dtor
00368   ~TAO_MCastConfigIf (void);
00369 
00370   virtual CORBA::Boolean set_peer (CORBA::Object_ptr peer,
00371                                    AVStreams::streamQoS & the_qos,
00372                                    const AVStreams::flowSpec & the_spec
00373                                    ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00374     ACE_THROW_SPEC ((CORBA::SystemException,
00375                      AVStreams::QoSRequestFailed,
00376                      AVStreams::streamOpFailed));
00377 
00378   virtual void configure (const CosPropertyService::Property & a_configuration
00379                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00380   ACE_THROW_SPEC ((CORBA::SystemException));
00381 
00382   virtual void set_initial_configuration (const CosPropertyService::Properties & initial
00383                                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00384     ACE_THROW_SPEC ((CORBA::SystemException));
00385 
00386   virtual void set_format (const char * flowName,
00387                            const char * format_name
00388                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00389     ACE_THROW_SPEC ((CORBA::SystemException,
00390                      AVStreams::notSupported));
00391 
00392   virtual void set_dev_params (const char * flowName,
00393                                const CosPropertyService::Properties & new_params
00394                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00395 
00396     ACE_THROW_SPEC ((CORBA::SystemException,
00397                      AVStreams::PropertyException,
00398                      AVStreams::streamOpFailed));
00399 
00400 protected:
00401   /// checks whether the flowname is  in the flow_spec.
00402   int in_flowSpec (const AVStreams::flowSpec& flow_spec, const char *flow_name);
00403 
00404   /// Multicast socket.
00405   ACE_SOCK_Dgram_Mcast sock_mcast_;
00406 
00407   /// Initial configuration to be distributed to all B parties when they join.
00408   CosPropertyService::Properties initial_configuration_;
00409 
00410   ACE_DLList<Peer_Info> peer_list_;
00411   ACE_DLList_Iterator<Peer_Info> peer_list_iterator_;
00412 };
00413 
00414 /**
00415  * @class TAO_AV_QoS
00416  * @brief Class for getting and setting the QoS characteristics of
00417  *        an AV Stream.
00418  */
00419 class TAO_AV_Export TAO_AV_QoS
00420 {
00421 public:
00422   /// constructor.
00423   TAO_AV_QoS (void);
00424 
00425   /// constructor taking a stream qos parameter.
00426   TAO_AV_QoS (AVStreams::streamQoS &stream_qos);
00427 
00428   /// sets the maps with the QoS paramter.
00429   int set (AVStreams::streamQoS &stream_qos);
00430 
00431   /// gets the flow_qos.
00432   int get_flow_qos (const char *flowname,AVStreams::QoS &flow_qos);
00433 
00434   /// converts the application level QoS to Network-level QoS.
00435   int convert (AVStreams::streamQoS &network_qos);
00436 
00437 
00438 protected:
00439   /// Stream Qos.
00440   AVStreams::streamQoS stream_qos_;
00441 
00442   ACE_Hash_Map_Manager<ACE_CString,AVStreams::QoS,ACE_Null_Mutex> qos_map_;
00443 };
00444 
00445 
00446 // Forward declarations.
00447 class TAO_AV_TCP_Flow_Handler;
00448 class TAO_AV_UDP_Flow_Handler;
00449 class TAO_AV_UDP_MCast_Flow_Handler;
00450 class TAO_AV_Protocol_Object;
00451 class TAO_AV_Callback;
00452 class TAO_AV_SourceManager;
00453 class TAO_AV_Source;
00454 class TAO_AV_RTP_State;
00455 class TAO_AV_Flow_Handler;
00456 
00457 /**
00458  * @class TAO_Base_StreamEndPoint
00459  *
00460  * Base class for the A/V StreamEndPoint class. this class
00461  * is used to control the stream. It should be subclassed
00462  * by applications that want to provide more control features.
00463  */
00464 class TAO_AV_Export TAO_Base_StreamEndPoint
00465   :public virtual TAO_PropertySet
00466 {
00467 
00468   // @@Naga: Rename this class to TAO_Base_EndPoint since both stream and flowendpoints derive from it.
00469 public:
00470   TAO_Base_StreamEndPoint (void);
00471   virtual ~TAO_Base_StreamEndPoint (void);
00472 
00473   /// called when streamendpoint is instantiated
00474   virtual int handle_open (void);
00475 
00476   /// called when streamendpoint is being destructed
00477   virtual int handle_close (void);
00478 
00479   /// Application needs to define this
00480   virtual int handle_stop (const AVStreams::flowSpec &the_spec
00481                             ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00482 
00483   /// Application needs to define this
00484   virtual int handle_start (const AVStreams::flowSpec &the_spec
00485                              ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00486 
00487   /// Application needs to define this
00488   virtual int handle_destroy (const AVStreams::flowSpec &the_spec
00489                                ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00490 
00491   /// Application needs to define this
00492   virtual CORBA::Boolean handle_preconnect (AVStreams::flowSpec &the_spec);
00493 
00494   /// Application needs to define this
00495   virtual CORBA::Boolean handle_postconnect (AVStreams::flowSpec &the_spec);
00496 
00497   /// Application needs to define this
00498   virtual CORBA::Boolean handle_connection_requested (AVStreams::flowSpec &the_spec
00499                                                       ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00500 
00501   virtual int get_callback (const char *flowname,
00502                             TAO_AV_Callback *&callback);
00503 
00504   virtual int get_control_callback (const char *flowname,
00505                                     TAO_AV_Callback *&callback);
00506 
00507   virtual int set_protocol_object (const char *flowname,
00508                                    TAO_AV_Protocol_Object *object);
00509 
00510   virtual void set_flow_handler (const char *flowname,
00511                                  TAO_AV_Flow_Handler *handler);
00512 
00513   virtual void set_control_flow_handler (const char *flowname,
00514                                          TAO_AV_Flow_Handler *handler);
00515 
00516   TAO_AV_QoS &qos (void);
00517 
00518   void protocol_object_set (void);
00519   int is_protocol_object_set (void);
00520 
00521 protected:
00522 
00523   TAO_AV_QoS qos_;
00524   Flow_Handler_Map flow_handler_map_;
00525   Flow_Handler_Map control_flow_handler_map_;
00526   int protocol_object_set_;
00527 };
00528 
00529 // Forward declarations.
00530 class TAO_AV_Acceptor;
00531 class TAO_AV_Connector;
00532 class TAO_Forward_FlowSpec_Entry;
00533 class TAO_Reverse_FlowSpec_Entry;
00534 
00535 /**
00536  * @class TAO_StreamEndPoint
00537  * @brief The Stream EndPoint. Used to implement one endpoint of a stream
00538  *        that implements the transport layer.
00539  */
00540 class TAO_AV_Export TAO_StreamEndPoint
00541   : public virtual POA_AVStreams::StreamEndPoint,
00542     public virtual TAO_Base_StreamEndPoint
00543 {
00544 
00545 public:
00546   /// Constructor
00547   TAO_StreamEndPoint (void);
00548 
00549    /// Stop the stream. Empty the_spec means, for all the flows
00550   virtual void stop (const AVStreams::flowSpec &the_spec
00551                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00552     ACE_THROW_SPEC ((CORBA::SystemException,
00553                      AVStreams::noSuchFlow));
00554 
00555   /// Start the stream, Empty the_spec means, for all the flows
00556   virtual void start (const AVStreams::flowSpec &the_spec
00557                       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00558     ACE_THROW_SPEC ((CORBA::SystemException,
00559                      AVStreams::noSuchFlow));
00560 
00561   /// Destroy the stream, Empty the_spec means, for all the flows
00562   virtual void destroy (const AVStreams::flowSpec &the_spec
00563                         ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00564     ACE_THROW_SPEC ((CORBA::SystemException,
00565                      AVStreams::noSuchFlow));
00566 
00567   /// Called by StreamCtrl. responder is the peer to connect to
00568   virtual CORBA::Boolean connect (AVStreams::StreamEndPoint_ptr responder,
00569                                   AVStreams::streamQoS& qos_spec,
00570                                   const AVStreams::flowSpec& the_spec
00571                                   ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00572     ACE_THROW_SPEC ((CORBA::SystemException,
00573                      AVStreams::noSuchFlow,
00574                      AVStreams::QoSRequestFailed,
00575                      AVStreams::streamOpFailed));
00576 
00577   /// Called by the peer StreamEndPoint. The flow_spec indicates the
00578   /// flows (which contain transport addresses etc.)
00579   virtual CORBA::Boolean request_connection (AVStreams::StreamEndPoint_ptr initiator,
00580                                              CORBA::Boolean is_mcast,
00581                                              AVStreams::streamQoS &qos,
00582                                              AVStreams::flowSpec &the_spec
00583                                              ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00584     ACE_THROW_SPEC ((CORBA::SystemException,
00585                      AVStreams::streamOpDenied,
00586                      AVStreams::noSuchFlow,
00587                      AVStreams::QoSRequestFailed,
00588                      AVStreams::FPError));
00589 
00590   /// Change the transport qos on a stream
00591   virtual CORBA::Boolean modify_QoS (AVStreams::streamQoS &new_qos,
00592                                      const AVStreams::flowSpec &the_flows
00593                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00594     ACE_THROW_SPEC ((CORBA::SystemException,
00595                      AVStreams::noSuchFlow,
00596                      AVStreams::QoSRequestFailed));
00597 
00598   virtual int change_qos (AVStreams::streamQoS &new_qos,
00599                           const AVStreams::flowSpec &the_flows
00600                           ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00601 
00602   /// Used to restrict the set of protocols
00603   virtual CORBA::Boolean set_protocol_restriction (const AVStreams::protocolSpec &the_pspec
00604                                                    ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00605     ACE_THROW_SPEC ((CORBA::SystemException));
00606 
00607   /// disconnect the flows
00608   virtual void disconnect (const AVStreams::flowSpec &the_spec
00609                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00610     ACE_THROW_SPEC ((CORBA::SystemException,
00611                      AVStreams::noSuchFlow,
00612                      AVStreams::streamOpFailed));
00613 
00614   /// Used to control the flow
00615   virtual void set_FPStatus (const AVStreams::flowSpec &the_spec,
00616                              const char *fp_name,
00617                              const CORBA::Any &fp_settings
00618                              ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00619     ACE_THROW_SPEC ((CORBA::SystemException,
00620                      AVStreams::noSuchFlow,
00621                      AVStreams::FPError));
00622 
00623   /// Not implemented in the light profile, throws notsupported
00624   virtual CORBA::Object_ptr get_fep (const char *flow_name
00625                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00626     ACE_THROW_SPEC ((CORBA::SystemException,
00627                      AVStreams::notSupported,
00628                      AVStreams::noSuchFlow));
00629 
00630   /// Not implemented in the light profile, throws notsupported
00631   virtual char * add_fep (CORBA::Object_ptr the_fep
00632                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00633     ACE_THROW_SPEC ((CORBA::SystemException,
00634                      AVStreams::notSupported,
00635                      AVStreams::streamOpFailed));
00636 
00637   /// Not implemented in the light profile, throws notsupported
00638   virtual void remove_fep (const char *fep_name
00639                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00640     ACE_THROW_SPEC ((CORBA::SystemException,
00641                      AVStreams::notSupported,
00642                      AVStreams::streamOpFailed));
00643 
00644   /// Used to "attach" a negotiator to the endpoint
00645   virtual void set_negotiator (AVStreams::Negotiator_ptr new_negotiator
00646                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00647     ACE_THROW_SPEC ((CORBA::SystemException));
00648 
00649   /// Used for public key encryption.
00650   virtual void set_key (const char *flow_name,
00651                         const AVStreams::key & the_key
00652                         ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00653     ACE_THROW_SPEC ((CORBA::SystemException));
00654 
00655   /// Used to set a unique id for packets sent by this streamendpoint
00656   virtual void set_source_id (CORBA::Long source_id
00657                               ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00658     ACE_THROW_SPEC ((CORBA::SystemException));
00659 
00660   /// Destructor
00661   virtual ~TAO_StreamEndPoint (void);
00662 
00663   CORBA::Boolean multiconnect (AVStreams::streamQoS &the_qos,
00664                                AVStreams::flowSpec &the_spec
00665                                ACE_ENV_ARG_DECL);
00666 
00667 protected:
00668   /// Helper methods to implement add_fep()
00669   char* add_fep_i (AVStreams::FlowEndPoint_ptr fep
00670                    ACE_ENV_ARG_DECL)
00671     ACE_THROW_SPEC ((CORBA::SystemException,
00672                      AVStreams::notSupported,
00673                      AVStreams::streamOpFailed));
00674   char* add_fep_i_add_property (AVStreams::FlowEndPoint_ptr fep
00675                                 ACE_ENV_ARG_DECL)
00676     ACE_THROW_SPEC ((CORBA::SystemException,
00677                      AVStreams::notSupported,
00678                      AVStreams::streamOpFailed));
00679 
00680   /// translate from application level to network level qos.
00681   int translate_qos (const AVStreams::streamQoS& application_qos,
00682                      AVStreams::streamQoS& network_qos);
00683 
00684   /// Count of the number of flows in this streamendpoint, used to
00685   /// generate unique names for the flows.
00686   u_int flow_count_;
00687 
00688   /// current flow number used for system generation of flow names.
00689   u_int flow_num_;
00690 
00691   /// hash table for the flownames and its corresponding flowEndpoint reference.
00692   FlowEndPoint_Map fep_map_;
00693 
00694   /// sequence of supported flow names.
00695   AVStreams::flowSpec flows_;
00696 
00697   /// source id used for multicast.
00698   CORBA::Long source_id_;
00699 
00700   /// our local negotiator for QoS.
00701   AVStreams::Negotiator_var negotiator_;
00702 
00703   /// Our available list of protocols.
00704   AVStreams::protocolSpec protocols_;
00705 
00706   /// Chosen protocol for this streamendpoint based on availableprotocols property.
00707   CORBA::String_var protocol_;
00708 
00709   /// Key used for encryption.
00710   AVStreams::key key_;
00711 
00712 ///   TAO_Forward_FlowSpec_Entry forward_entries_ [FLOWSPEC_MAX];
00713 ///   TAO_Reverse_FlowSpec_Entry reverse_entries_ [FLOWSPEC_MAX];
00714   u_short mcast_port_;
00715   ACE_CString mcast_addr_;
00716   ACE_Hash_Map_Manager <ACE_CString, TAO_FlowSpec_Entry*,ACE_Null_Mutex> mcast_entry_map_;
00717   TAO_AV_FlowSpecSet forward_flow_spec_set;
00718   TAO_AV_FlowSpecSet reverse_flow_spec_set;
00719   AVStreams::StreamEndPoint_var peer_sep_;
00720   AVStreams::SFPStatus *sfp_status_;
00721   AVStreams::StreamCtrl_var streamctrl_;
00722 };
00723 
00724 /**
00725  * @class TAO_StreamEndPoint_A
00726  * @brief  The "A" side of a streamendpoint
00727  */
00728 class TAO_AV_Export TAO_StreamEndPoint_A :
00729   public virtual POA_AVStreams::StreamEndPoint_A,
00730   public virtual TAO_StreamEndPoint
00731 {
00732 
00733 public:
00734   /// Constructor
00735   TAO_StreamEndPoint_A (void);
00736 
00737   /// Used for ATM-style multicast
00738   virtual CORBA::Boolean multiconnect (AVStreams::streamQoS &the_qos,
00739                                        AVStreams::flowSpec &the_spec
00740                                        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00741     ACE_THROW_SPEC ((CORBA::SystemException,
00742                      AVStreams::noSuchFlow,
00743                      AVStreams::QoSRequestFailed,
00744                      AVStreams::streamOpFailed));
00745 
00746   /// Used for ATM-style multicast
00747   virtual CORBA::Boolean connect_leaf (AVStreams::StreamEndPoint_B_ptr the_ep,
00748                                        AVStreams::streamQoS &the_qos,
00749                                        const AVStreams::flowSpec &the_flows
00750                                        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00751     ACE_THROW_SPEC ((CORBA::SystemException,
00752                      AVStreams::streamOpFailed,
00753                      AVStreams::noSuchFlow,
00754                      AVStreams::QoSRequestFailed,
00755                      AVStreams::notSupported));
00756 
00757   /// Used to remove a multicast leaf
00758   virtual void disconnect_leaf (AVStreams::StreamEndPoint_B_ptr the_ep,
00759                                 const AVStreams::flowSpec &theSpec
00760                                 ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00761     ACE_THROW_SPEC ((CORBA::SystemException,
00762                      AVStreams::streamOpFailed,
00763                      AVStreams::noSuchFlow,
00764                      AVStreams::notSupported));
00765 
00766   /// Destructor
00767   virtual ~TAO_StreamEndPoint_A (void);
00768 
00769 };
00770 
00771 // For backward compatibility.
00772 #define TAO_Client_StreamEndPoint TAO_StreamEndPoint_A
00773 #define TAO_Server_StreamEndPoint TAO_StreamEndPoint_B
00774 
00775 /**
00776  * @class TAO_StreamEndPoint_B
00777  * @brief The "B" side of a streamendpoint
00778  */
00779 class TAO_AV_Export TAO_StreamEndPoint_B :
00780   public virtual POA_AVStreams::StreamEndPoint_B,
00781   public virtual TAO_StreamEndPoint
00782 {
00783   // = DESCRIPTION
00784   //     The "B" side of a streamendpoint
00785 public:
00786   /// Constructor
00787   TAO_StreamEndPoint_B (void);
00788 
00789   /// Used for internet-style multicast
00790   virtual CORBA::Boolean multiconnect (AVStreams::streamQoS &the_qos,
00791                                        AVStreams::flowSpec &the_spec
00792                                        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00793     ACE_THROW_SPEC ((CORBA::SystemException,
00794                      AVStreams::streamOpFailed,
00795                      AVStreams::noSuchFlow,
00796                      AVStreams::QoSRequestFailed,
00797                      AVStreams::FPError));
00798 
00799   /// Destructor
00800   virtual ~TAO_StreamEndPoint_B (void);
00801 };
00802 
00803 /**
00804  * @class TAO_VDev
00805  * @brief Implements the VDev interface. One of these is created per
00806  *        connection, and represents device-specific parameters.
00807  */
00808 class TAO_AV_Export TAO_VDev
00809   :public virtual TAO_PropertySet,
00810    public virtual POA_AVStreams::VDev
00811 {
00812 
00813 public:
00814   /// Default Constructor
00815   TAO_VDev (void);
00816 
00817   /// Called to tell the vdev who the streamctrl, peer vdev is
00818   virtual CORBA::Boolean set_peer (AVStreams::StreamCtrl_ptr the_ctrl,
00819                                    AVStreams::VDev_ptr the_peer_dev,
00820                                    AVStreams::streamQoS &the_qos,
00821                                    const AVStreams::flowSpec &the_spec
00822                                    ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00823     ACE_THROW_SPEC ((CORBA::SystemException,
00824                      AVStreams::noSuchFlow,
00825                      AVStreams::QoSRequestFailed,
00826                      AVStreams::streamOpFailed));
00827 
00828   /// Used to set the streamctrl and multicast device
00829   virtual CORBA::Boolean set_Mcast_peer (AVStreams::StreamCtrl_ptr the_ctrl,
00830                                          AVStreams::MCastConfigIf_ptr a_mcastconfigif,
00831                                          AVStreams::streamQoS &the_qos,
00832                                          const AVStreams::flowSpec &the_spec
00833                                          ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00834     ACE_THROW_SPEC ((CORBA::SystemException,
00835                      AVStreams::noSuchFlow,
00836                      AVStreams::QoSRequestFailed,
00837                      AVStreams::streamOpFailed));
00838 
00839   /// Called by the peer VDev to configure the device (catch all)
00840   virtual void configure (const CosPropertyService::Property &the_config_mesg
00841                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00842     ACE_THROW_SPEC ((CORBA::SystemException,
00843                      AVStreams::PropertyException,
00844                      AVStreams::streamOpFailed));
00845 
00846   /// Used to set a format on a flowname
00847   virtual void set_format (const char *flowName,
00848                            const char *format_name
00849                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00850     ACE_THROW_SPEC ((CORBA::SystemException,
00851                      AVStreams::notSupported));
00852 
00853   /// Used to set device parameters
00854   virtual void set_dev_params (const char *flowName,
00855                                const CosPropertyService::Properties &new_params
00856                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00857     ACE_THROW_SPEC ((CORBA::SystemException,
00858                      AVStreams::PropertyException,
00859                      AVStreams::streamOpFailed));
00860 
00861   /// Called to change QoS of the device
00862   virtual CORBA::Boolean modify_QoS (AVStreams::streamQoS &the_qos,
00863                                      const AVStreams::flowSpec &the_spec
00864                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00865     ACE_THROW_SPEC ((CORBA::SystemException,
00866                      AVStreams::noSuchFlow,
00867                      AVStreams::QoSRequestFailed));
00868 
00869 protected:
00870   /// Destructor for a servant should be protected or private.
00871   /// Use _remove_ref() to delete this servant.
00872   virtual ~TAO_VDev (void);
00873 
00874   /// hook called after set_peer is done to set the media ctrl of the peer vdev.
00875   virtual CORBA::Boolean set_media_ctrl (CORBA::Object_ptr media_ctrl
00876                                          ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00877 
00878   /// My stream controller
00879   AVStreams::StreamCtrl_var streamctrl_;
00880 
00881   /// My peer
00882   AVStreams::VDev_var peer_;
00883 
00884   /// The multicast VDev peer.
00885   AVStreams::MCastConfigIf_var mcast_peer_;
00886 };
00887 
00888 class TAO_AV_Endpoint_Strategy;
00889 
00890 /**
00891  * @class TAO_MMDevice
00892  * @brief Implements a factory to create Endpoints and VDevs
00893  */
00894 class TAO_AV_Export TAO_MMDevice
00895   :public virtual POA_AVStreams::MMDevice,
00896    public virtual TAO_PropertySet
00897 {
00898 
00899 public:
00900 
00901   /// Constructor
00902   enum MMDevice_Type {MMDEVICE_A = 0,MMDEVICE_B = 1};
00903   TAO_MMDevice (TAO_AV_Endpoint_Strategy *endpoint_strategy_);
00904 
00905   virtual AVStreams::StreamEndPoint_ptr create_A_B (MMDevice_Type type,
00906                                                     AVStreams::StreamCtrl_ptr the_requester,
00907                                                      AVStreams::VDev_out the_vdev,
00908                                                      AVStreams::streamQoS &the_qos,
00909                                                      CORBA::Boolean_out met_qos,
00910                                                      char *&named_vdev,
00911                                                      const AVStreams::flowSpec &the_spec
00912                                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00913 
00914   /// Can be used to request the MMDevice to create a new StreamCtrl,
00915   /// and call bind_devs on it
00916   virtual AVStreams::StreamCtrl_ptr  bind (AVStreams::MMDevice_ptr peer_device,
00917                                            AVStreams::streamQoS &the_qos,
00918                                            CORBA::Boolean_out is_met,
00919                                            const AVStreams::flowSpec &the_spec
00920                                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00921     ACE_THROW_SPEC ((CORBA::SystemException,
00922                      AVStreams::streamOpFailed,
00923                      AVStreams::noSuchFlow,
00924                      AVStreams::QoSRequestFailed));
00925 
00926   /// Multicast bind
00927   virtual AVStreams::StreamCtrl_ptr  bind_mcast (AVStreams::MMDevice_ptr first_peer,
00928                                                  AVStreams::streamQoS &the_qos,
00929                                                  CORBA::Boolean_out is_met,
00930                                                  const AVStreams::flowSpec &the_spec
00931                                                  ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00932     ACE_THROW_SPEC ((CORBA::SystemException,
00933                      AVStreams::streamOpFailed,
00934                      AVStreams::noSuchFlow,
00935                      AVStreams::QoSRequestFailed));
00936 
00937   /// Called by StreamCtrl to create a "A" type streamandpoint and vdev
00938   virtual AVStreams::StreamEndPoint_A_ptr  create_A (AVStreams::StreamCtrl_ptr the_requester,
00939                                                      AVStreams::VDev_out the_vdev,
00940                                                      AVStreams::streamQoS &the_qos,
00941                                                      CORBA::Boolean_out met_qos,
00942                                                      char *&named_vdev,
00943                                                      const AVStreams::flowSpec &the_spec
00944                                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00945     ACE_THROW_SPEC ((CORBA::SystemException,
00946                      AVStreams::streamOpFailed,
00947                      AVStreams::streamOpDenied,
00948                      AVStreams::notSupported,
00949                      AVStreams::QoSRequestFailed,
00950                      AVStreams::noSuchFlow));
00951 
00952   /// Called by StreamCtrl to create a "B" type streamandpoint and vdev
00953   virtual AVStreams::StreamEndPoint_B_ptr  create_B (AVStreams::StreamCtrl_ptr the_requester,
00954                                                      AVStreams::VDev_out the_vdev,
00955                                                      AVStreams::streamQoS &the_qos,
00956                                                      CORBA::Boolean_out met_qos,
00957                                                      char *&named_vdev,
00958                                                      const AVStreams::flowSpec &the_spec
00959                                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00960     ACE_THROW_SPEC ((CORBA::SystemException,
00961                      AVStreams::streamOpFailed,
00962                      AVStreams::streamOpDenied,
00963                      AVStreams::notSupported,
00964                      AVStreams::QoSRequestFailed,
00965                      AVStreams::noSuchFlow));
00966 
00967   /// Remove the StreamEndPoint and the related vdev
00968   virtual void destroy (AVStreams::StreamEndPoint_ptr the_ep,
00969                         const char *vdev_name
00970                         ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00971     ACE_THROW_SPEC ((CORBA::SystemException,
00972                      AVStreams::notSupported));
00973 
00974   /// Not supported in the light profile, raises notsupported
00975   virtual char * add_fdev (CORBA::Object_ptr the_fdev
00976                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00977     ACE_THROW_SPEC ((CORBA::SystemException,
00978                      AVStreams::notSupported,
00979                      AVStreams::streamOpFailed));
00980 
00981   /// Not supported in the light profile, raises notsupported
00982   virtual CORBA::Object_ptr get_fdev (const char *flow_name
00983                                       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00984     ACE_THROW_SPEC ((CORBA::SystemException,
00985                      AVStreams::notSupported,
00986                      AVStreams::noSuchFlow));
00987 
00988   /// Not supported in the light profile, raises notsupported
00989   virtual void remove_fdev (const char *flow_name
00990                             ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00991     ACE_THROW_SPEC ((CORBA::SystemException,
00992                      AVStreams::notSupported,
00993                      AVStreams::noSuchFlow,
00994                      AVStreams::streamOpFailed));
00995 
00996   /// Destructor
00997   virtual ~TAO_MMDevice (void);
00998 
00999 protected:
01000   /// Helper method to implement add_fdev()
01001   char* add_fdev_i (AVStreams::FDev_ptr fdev
01002                     ACE_ENV_ARG_DECL)
01003       ACE_THROW_SPEC ((CORBA::SystemException,
01004                    AVStreams::notSupported,
01005                    AVStreams::streamOpFailed));
01006 
01007 protected:
01008 
01009   TAO_AV_Endpoint_Strategy *endpoint_strategy_;
01010 
01011   /// Count of the number of flows in this MMDevice , used to
01012   /// generate unique names for the flows.
01013   u_int flow_count_;
01014 
01015   /// current flow number used for system generation of flow names.
01016   u_int flow_num_;
01017 
01018   typedef ACE_Hash_Map_Manager <ACE_CString,AVStreams::FDev_var,ACE_Null_Mutex> FDev_Map;
01019   typedef ACE_Hash_Map_Iterator <ACE_CString,AVStreams::FDev_var,ACE_Null_Mutex> FDev_Map_Iterator;
01020   typedef ACE_Hash_Map_Entry <ACE_CString,AVStreams::FDev_var> FDev_Map_Entry;
01021 
01022   /// hash table for the flownames and its corresponding flowEndpoint
01023   /// reference.
01024   FDev_Map fdev_map_;
01025 
01026   /// sequence of supported flow names.
01027   AVStreams::flowSpec flows_;
01028 
01029   TAO_StreamCtrl *stream_ctrl_;
01030 };
01031 
01032 class TAO_FlowConsumer;
01033 class TAO_FlowProducer;
01034 
01035 /**
01036  * @class TAO_FlowConnection
01037  * @brief This class currently supports only one producer and one
01038  *        consumer per flow.
01039  */
01040 class TAO_AV_Export TAO_FlowConnection
01041  : public virtual POA_AVStreams::FlowConnection,
01042    public virtual TAO_PropertySet
01043 {
01044 
01045 public:
01046   /// default constructor.
01047   TAO_FlowConnection (void);
01048 
01049   /// stop this flow.
01050   virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01051     ACE_THROW_SPEC ((CORBA::SystemException));
01052 
01053   /// start this flow.
01054   virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01055     ACE_THROW_SPEC ((CORBA::SystemException));
01056 
01057   /// destroy this flow.
01058   virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01059     ACE_THROW_SPEC ((CORBA::SystemException));
01060 
01061   /// modify the QoS for this flow.
01062   virtual CORBA::Boolean modify_QoS (AVStreams::QoS & new_qos
01063                                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01064     ACE_THROW_SPEC ((CORBA::SystemException,
01065                      AVStreams::QoSRequestFailed));
01066 
01067   /// use the specified flow protocol for this flow.
01068   virtual CORBA::Boolean use_flow_protocol (const char * fp_name,
01069                                             const CORBA::Any & fp_settings
01070                                             ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01071     ACE_THROW_SPEC ((CORBA::SystemException,
01072                      AVStreams::FPError,
01073                      AVStreams::notSupported));
01074 
01075   /// pushes an event , to be handled by the application.
01076   virtual void push_event (const AVStreams::streamEvent & the_event
01077                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01078     ACE_THROW_SPEC ((CORBA::SystemException));
01079 
01080 
01081   /// connect 2 Flow Devices.
01082   virtual CORBA::Boolean connect_devs (AVStreams::FDev_ptr a_party,
01083                                        AVStreams::FDev_ptr b_party,
01084                                        AVStreams::QoS & the_qos
01085                                        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01086     ACE_THROW_SPEC ((CORBA::SystemException,
01087                      AVStreams::streamOpFailed,
01088                      AVStreams::streamOpDenied,
01089                      AVStreams::QoSRequestFailed));
01090 
01091   /// Connect a flow producer and consumer under this flow connection.
01092   virtual CORBA::Boolean connect (AVStreams::FlowProducer_ptr flow_producer,
01093                                   AVStreams::FlowConsumer_ptr flow_consumer,
01094                                   AVStreams::QoS & the_qos
01095                                   ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01096     ACE_THROW_SPEC ((CORBA::SystemException,
01097                      AVStreams::formatMismatch,
01098                      AVStreams::FEPMismatch,
01099                      AVStreams::alreadyConnected));
01100 
01101   /// disconnect this flow connection.
01102   virtual CORBA::Boolean disconnect (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01103     ACE_THROW_SPEC ((CORBA::SystemException));
01104 
01105   /// adds the producer to this flow connection.
01106   virtual CORBA::Boolean add_producer (AVStreams::FlowProducer_ptr flow_producer,
01107                                        AVStreams::QoS & the_qos
01108                                        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01109     ACE_THROW_SPEC ((CORBA::SystemException,
01110                      AVStreams::alreadyConnected,
01111                      AVStreams::notSupported));
01112 
01113   /// adds a consumer to this flow connection.
01114   virtual CORBA::Boolean add_consumer (AVStreams::FlowConsumer_ptr flow_consumer,
01115                                        AVStreams::QoS & the_qos
01116                                        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01117     ACE_THROW_SPEC ((CORBA::SystemException,
01118                      AVStreams::alreadyConnected));
01119 
01120   /// drops a flow endpoint from the flow.
01121   virtual CORBA::Boolean drop (AVStreams::FlowEndPoint_ptr target
01122                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01123     ACE_THROW_SPEC ((CORBA::SystemException,
01124                      AVStreams::notConnected));
01125 
01126   int set_mcast_addr (ACE_CString addr,u_short port);
01127   void set_protocol (const char *protocol);
01128 protected:
01129   typedef ACE_Unbounded_Set<AVStreams::FlowProducer_ptr> FlowProducer_Set;
01130   typedef ACE_Unbounded_Set_Iterator<AVStreams::FlowProducer_ptr> FlowProducer_SetItor;
01131   typedef ACE_Unbounded_Set<AVStreams::FlowConsumer_ptr> FlowConsumer_Set;
01132   typedef ACE_Unbounded_Set_Iterator<AVStreams::FlowConsumer_ptr> FlowConsumer_SetItor;
01133 
01134   /// The multicast address returned by the producer.
01135   FlowProducer_Set flow_producer_set_;
01136   FlowConsumer_Set flow_consumer_set_;
01137   CORBA::String_var fp_name_;
01138   CORBA::Any fp_settings_;
01139   CORBA::String_var producer_address_;
01140 
01141   /// IP Multicasting is used.
01142   int ip_multicast_;
01143   TAO_MCastConfigIf *mcastconfigif_i_;
01144   AVStreams::MCastConfigIf_var mcastconfigif_;
01145   u_short mcast_port_;
01146   ACE_CString mcast_addr_;
01147   CORBA::String_var protocol_;
01148 };
01149 
01150 /**
01151  * @class TAO_FlowEndPoint
01152  * @brief This class is used per flow e.g video flow and an audio flow
01153  *        to encapsulate the transport details.
01154  */
01155 class TAO_AV_Export TAO_FlowEndPoint :
01156   public virtual POA_AVStreams::FlowEndPoint,
01157   public virtual TAO_Base_StreamEndPoint
01158 {
01159 
01160 public:
01161 
01162   ///default constructor.
01163   TAO_FlowEndPoint (void);
01164 
01165   TAO_FlowEndPoint (const char *flowname,
01166                     AVStreams::protocolSpec &protocols,
01167                     const char *format);
01168 
01169   int open (const char *flowname,
01170             AVStreams::protocolSpec &protocols,
01171             const char *format);
01172 
01173   int set_flowname (const char *flowname);
01174 
01175   virtual void set_flow_handler (const char *flowname,
01176                                  TAO_AV_Flow_Handler *handler);
01177 
01178   virtual int set_protocol_object (const char *flowname,
01179                                    TAO_AV_Protocol_Object *object);
01180 
01181   /// lock the flow endpoint for a particular flow.
01182   virtual CORBA::Boolean lock (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01183     ACE_THROW_SPEC ((CORBA::SystemException));
01184 
01185   /// unlock the flow endpoint for subsequent use.
01186   virtual void unlock (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01187     ACE_THROW_SPEC ((CORBA::SystemException));
01188 
01189 
01190   /// destroy this flow.
01191   virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01192     ACE_THROW_SPEC ((CORBA::SystemException));
01193 
01194   /// get method for the related streamendpoint under which this
01195   /// flowendpoint is.
01196   virtual AVStreams::StreamEndPoint_ptr related_sep(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01197     ACE_THROW_SPEC ((CORBA::SystemException));
01198 
01199   /// set method for the related streamendpoint under which this
01200   /// flowendpoint is.
01201   virtual void related_sep (AVStreams::StreamEndPoint_ptr related_sep
01202                             ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01203     ACE_THROW_SPEC ((CORBA::SystemException));
01204 
01205   virtual AVStreams::FlowConnection_ptr related_flow_connection(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01206     ACE_THROW_SPEC ((CORBA::SystemException));
01207 
01208   // accessor for the related flow connection attribute.
01209 
01210   /// set method for the related flow connection attribute.
01211   virtual void related_flow_connection (AVStreams::FlowConnection_ptr related_flow_connection
01212                                         ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01213     ACE_THROW_SPEC ((CORBA::SystemException));
01214 
01215   /// returns the other flowendpoint to which this is connected.
01216   virtual AVStreams::FlowEndPoint_ptr get_connected_fep (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01217     ACE_THROW_SPEC ((CORBA::SystemException,
01218                      AVStreams::notConnected,
01219                      AVStreams::notSupported));
01220 
01221   //// use the specified flow protocol.
01222   virtual CORBA::Boolean use_flow_protocol (const char * fp_name,
01223                                             const CORBA::Any & fp_settings
01224                                             ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01225     ACE_THROW_SPEC ((CORBA::SystemException,
01226                      AVStreams::FPError,
01227                      AVStreams::notSupported));
01228 
01229   /// sets the data format.
01230   virtual void set_format (const char * format
01231                            ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01232     ACE_THROW_SPEC ((CORBA::SystemException,
01233                      AVStreams::notSupported));
01234 
01235   /// sets the device parameters.
01236   virtual void set_dev_params (const CosPropertyService::Properties & new_settings
01237                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01238     ACE_THROW_SPEC ((CORBA::SystemException,
01239                      AVStreams::PropertyException,
01240                      AVStreams::streamOpFailed));
01241 
01242   /// sets the list of protocols to be used.
01243   virtual void set_protocol_restriction (const AVStreams::protocolSpec & the_spec
01244                                          ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01245     ACE_THROW_SPEC ((CORBA::SystemException,
01246                      AVStreams::notSupported));
01247 
01248   /// checks whether the passed flowendpoint is compatible with this.
01249   virtual CORBA::Boolean is_fep_compatible (AVStreams::FlowEndPoint_ptr fep
01250                                             ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01251     ACE_THROW_SPEC ((CORBA::SystemException,
01252                      AVStreams::formatMismatch,
01253                      AVStreams::deviceQosMismatch));
01254 
01255   /// sets the peer flowendpoint.
01256   virtual CORBA::Boolean set_peer (AVStreams::FlowConnection_ptr the_fc,
01257                                    AVStreams::FlowEndPoint_ptr the_peer_fep,
01258                                    AVStreams::QoS & the_qos
01259                                    ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01260     ACE_THROW_SPEC ((CORBA::SystemException,
01261                      AVStreams::QoSRequestFailed,
01262                      AVStreams::streamOpFailed));
01263 
01264   /// sets the multicast peer flowendpoint, not implemented.
01265   virtual CORBA::Boolean set_Mcast_peer (AVStreams::FlowConnection_ptr the_fc,
01266                                          AVStreams::MCastConfigIf_ptr a_mcastconfigif,
01267                                          AVStreams::QoS & the_qos
01268                                          ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01269     ACE_THROW_SPEC ((CORBA::SystemException,
01270                      AVStreams::QoSRequestFailed));
01271 
01272 
01273   /**
01274    * This should be implemented in both the FlowProducer and consumer and hence is
01275    * pure virtual since we need to know the role of the flowendpoint to create appropriate
01276    * protocol objects. eg. in SFP to create Producer Object/ Consumer Object.
01277    */
01278   virtual CORBA::Boolean connect_to_peer (AVStreams::QoS & the_qos,
01279                                           const char * address,
01280                                           const char * use_flow_protocol
01281                                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01282     ACE_THROW_SPEC ((CORBA::SystemException,
01283                      AVStreams::failedToConnect,
01284                      AVStreams::FPError,
01285                      AVStreams::QoSRequestFailed)) = 0;
01286 
01287   /// connect to the peer endpoint.
01288   virtual CORBA::Boolean connect_to_peer_i (TAO_FlowSpec_Entry::Role role,
01289                                             AVStreams::QoS & the_qos,
01290                                             const char * address,
01291                                             const char * use_flow_protocol
01292                                             ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01293     ACE_THROW_SPEC ((CORBA::SystemException,
01294                      AVStreams::failedToConnect,
01295                      AVStreams::FPError,
01296                      AVStreams::QoSRequestFailed));
01297 
01298   /**
01299    * This should be implemented in both the FlowProducer and consumer and hence is
01300    * pure virtual since we need to know the role of the flowendpoint to create appropriate
01301    * protocol objects. eg. in SFP to create Producer Object/ Consumer Object.
01302    */
01303   virtual char * go_to_listen (AVStreams::QoS & the_qos,
01304                                CORBA::Boolean is_mcast,
01305                                AVStreams::FlowEndPoint_ptr peer,
01306                                char *& flowProtocol
01307                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01308     ACE_THROW_SPEC ((CORBA::SystemException,
01309                      AVStreams::failedToListen,
01310                      AVStreams::FPError,
01311                      AVStreams::QoSRequestFailed)) = 0;
01312 
01313   /// listen request from the peer.
01314   virtual char * go_to_listen_i (TAO_FlowSpec_Entry::Role role,
01315                                  AVStreams::QoS & the_qos,
01316                                  CORBA::Boolean is_mcast,
01317                                  AVStreams::FlowEndPoint_ptr peer,
01318                                  char *& flowProtocol
01319                                  ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01320     ACE_THROW_SPEC ((CORBA::SystemException,
01321                      AVStreams::failedToListen,
01322                      AVStreams::FPError,
01323                      AVStreams::QoSRequestFailed));
01324 
01325 
01326 protected:
01327   /// The related streamendpoint.
01328   AVStreams::StreamEndPoint_var related_sep_;
01329 
01330   /// The related flow connection reference
01331   AVStreams::FlowConnection_var related_flow_connection_;
01332 
01333   /// The peer flowendpoint reference.
01334   AVStreams::FlowEndPoint_var peer_fep_;
01335 
01336   /// Available protocols for this flowendpoint.
01337   AVStreams::protocolSpec protocols_;
01338 
01339   /// Address information for the protocols.
01340   AVStreams::protocolSpec protocol_addresses_;
01341 
01342   /// The multicast peer endpoint.
01343   AVStreams::MCastConfigIf_var mcast_peer_;
01344 
01345   /// Lock.
01346   CORBA::Boolean lock_;
01347 
01348   CORBA::String_var format_;
01349   CORBA::String_var flowname_;
01350   CosPropertyService::Properties dev_params_;
01351   TAO_AV_FlowSpecSet flow_spec_set_;
01352   CORBA::String_var reverse_channel_;
01353 };
01354 
01355 class TAO_AV_Export TAO_FlowProducer:
01356   public virtual POA_AVStreams::FlowProducer,
01357   public virtual TAO_FlowEndPoint
01358 {
01359 public:
01360   /// default constructor
01361   TAO_FlowProducer (void);
01362 
01363   TAO_FlowProducer (const char *flowname,
01364                     AVStreams::protocolSpec protocols,
01365                     const char *format);
01366 
01367   /**
01368    * get the reverse channel, to be used for feedback for protocols like UDP.
01369    * @@Naga: In the spec this is defined in the TAO_FlowProducer but it seems more reasonable for this
01370    * to be in a FlowEndPoint since any of the flowendpoints can be made to listen. So in the case of
01371    * UDP if the producer is listening and the consumer connects (logically) then the producer needs to
01372    * know the reverse channel on its peer fep to send data to.
01373    */
01374   virtual char * get_rev_channel (const char * pcol_name
01375                                   ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01376     ACE_THROW_SPEC ((CORBA::SystemException));
01377 
01378   /// stop this flow, to be overridden by the application.
01379   virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01380     ACE_THROW_SPEC ((CORBA::SystemException));
01381 
01382   /// start this flow, to be overridden by the application.
01383   virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01384     ACE_THROW_SPEC ((CORBA::SystemException));
01385 
01386   virtual char * go_to_listen (AVStreams::QoS & the_qos,
01387                                CORBA::Boolean is_mcast,
01388                                AVStreams::FlowEndPoint_ptr peer,
01389                                char *& flowProtocol
01390                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01391     ACE_THROW_SPEC ((CORBA::SystemException,
01392                      AVStreams::failedToListen,
01393                      AVStreams::FPError,
01394                      AVStreams::QoSRequestFailed));
01395 
01396   virtual CORBA::Boolean connect_to_peer (AVStreams::QoS & the_qos,
01397                                           const char * address,
01398                                           const char * use_flow_protocol
01399                                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01400     ACE_THROW_SPEC ((CORBA::SystemException,
01401                      AVStreams::failedToConnect,
01402                      AVStreams::FPError,
01403                      AVStreams::QoSRequestFailed));
01404 
01405   /// connect to the multicast address, not implemented.
01406   virtual char * connect_mcast (AVStreams::QoS & the_qos,
01407                                 CORBA::Boolean_out is_met,
01408                                 const char * address,
01409                                 const char * use_flow_protocol
01410                                 ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01411     ACE_THROW_SPEC ((CORBA::SystemException,
01412                      AVStreams::failedToConnect,
01413                      AVStreams::notSupported,
01414                      AVStreams::FPError,
01415                      AVStreams::QoSRequestFailed));
01416 
01417 
01418 
01419   /// sets the public key  to be used for encryption of the data.
01420   virtual void set_key (const AVStreams::key & the_key
01421                         ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01422     ACE_THROW_SPEC ((CORBA::SystemException));
01423 
01424   /// sets the source id of this flow producer so that it can be used
01425   /// to distinguish this producer from others in the multicast case.
01426   virtual void set_source_id (CORBA::Long source_id
01427                               ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01428     ACE_THROW_SPEC ((CORBA::SystemException));
01429 
01430 protected:
01431   /// source id of this producer.
01432   CORBA::Long source_id_;
01433   CORBA::String_var peer_address_;
01434 };
01435 
01436 class TAO_AV_Export TAO_FlowConsumer :
01437   public virtual POA_AVStreams::FlowConsumer,
01438   public virtual TAO_FlowEndPoint
01439 {
01440 public:
01441   /// default constructor.
01442   TAO_FlowConsumer (void);
01443 
01444   TAO_FlowConsumer (const char *flowname,
01445                     AVStreams::protocolSpec protocols,
01446                     const char *format);
01447 
01448   /// stop this flow, to be overridden by the application.
01449   virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01450     ACE_THROW_SPEC ((CORBA::SystemException));
01451 
01452   /// start this flow, to be overridden by the application.
01453   virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
01454     ACE_THROW_SPEC ((CORBA::SystemException));
01455 
01456   virtual char * go_to_listen (AVStreams::QoS & the_qos,
01457                                CORBA::Boolean is_mcast,
01458                                AVStreams::FlowEndPoint_ptr peer,
01459                                char *& flowProtocol
01460                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01461     ACE_THROW_SPEC ((CORBA::SystemException,
01462                      AVStreams::failedToListen,
01463                      AVStreams::FPError,
01464                      AVStreams::QoSRequestFailed));
01465 
01466   virtual CORBA::Boolean connect_to_peer (AVStreams::QoS & the_qos,
01467                                           const char * address,
01468                                           const char * use_flow_protocol
01469                                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01470     ACE_THROW_SPEC ((CORBA::SystemException,
01471                      AVStreams::failedToConnect,
01472                      AVStreams::FPError,
01473                      AVStreams::QoSRequestFailed));
01474 };
01475 
01476 /**
01477  * @class TAO_MediaControl
01478  * @brief Abstract Mediacontrol class.
01479  *        The following are to be handled by the specialized media control
01480  *        for the specific media like camera, speaker.
01481  */
01482 class TAO_AV_Export TAO_MediaControl
01483   :public virtual POA_AVStreams::MediaControl
01484 {
01485 
01486 public:
01487   /// default constructor
01488   TAO_MediaControl (void);
01489 
01490   virtual AVStreams::Position get_media_position (AVStreams::PositionOrigin an_origin,
01491                                                   AVStreams::PositionKey a_key
01492                                                   ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01493     ACE_THROW_SPEC ((CORBA::SystemException,
01494                      AVStreams::MediaControl::PostionKeyNotSupported)) =0;
01495 
01496   virtual void set_media_position (const AVStreams::Position & a_position
01497                                    ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01498     ACE_THROW_SPEC ((CORBA::SystemException,
01499                      AVStreams::MediaControl::PostionKeyNotSupported,
01500                      AVStreams::InvalidPosition)) =0;
01501 
01502   virtual void start (const AVStreams::Position & a_position
01503                       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01504     ACE_THROW_SPEC ((CORBA::SystemException,
01505                      AVStreams::InvalidPosition)) =0;
01506 
01507   virtual void pause (const AVStreams::Position & a_position
01508                       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01509     ACE_THROW_SPEC ((CORBA::SystemException,
01510                      AVStreams::InvalidPosition)) =0;
01511 
01512   virtual void resume (const AVStreams::Position & a_position
01513                        ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01514     ACE_THROW_SPEC ((CORBA::SystemException,
01515                      AVStreams::InvalidPosition)) =0;
01516 
01517   virtual void stop (const AVStreams::Position & a_position
01518                      ACE_ENV_ARG_DECL_WITH_DEFAULTS)
01519     ACE_THROW_SPEC ((CORBA::SystemException,
01520                      AVStreams::InvalidPosition)) =0;
01521 
01522 };
01523 
01524 TAO_END_VERSIONED_NAMESPACE_DECL
01525 
01526 #include "orbsvcs/AV/Transport.h"
01527 
01528 #if defined (__ACE_INLINE__)
01529 #include "tao/debug.h"
01530 #include "orbsvcs/AV/AVStreams_i.i"
01531 #endif /* __ACE_INLINE__ */
01532 
01533 #include "orbsvcs/AV/Flows_T.h"
01534 
01535 #include /**/ "ace/post.h"
01536 #endif /* AVSTREAMS_I_H */

Generated on Thu Nov 9 13:44:41 2006 for TAO_AV by doxygen 1.3.6