TAO_StreamEndPoint Class Reference

The Stream EndPoint. Used to implement one endpoint of a stream that implements the transport layer. More...

#include <AVStreams_i.h>

Inheritance diagram for TAO_StreamEndPoint:

Inheritance graph
[legend]
Collaboration diagram for TAO_StreamEndPoint:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_StreamEndPoint (void)
 Constructor.
virtual void stop (const AVStreams::flowSpec &the_spec)
 Stop the stream. Empty the_spec means, for all the flows.
virtual void start (const AVStreams::flowSpec &the_spec)
 Start the stream, Empty the_spec means, for all the flows.
virtual void destroy (const AVStreams::flowSpec &the_spec)
 Destroy the stream, Empty the_spec means, for all the flows.
virtual CORBA::Boolean connect (AVStreams::StreamEndPoint_ptr responder, AVStreams::streamQoS &qos_spec, const AVStreams::flowSpec &the_spec)
 Called by StreamCtrl. responder is the peer to connect to.
virtual CORBA::Boolean request_connection (AVStreams::StreamEndPoint_ptr initiator, CORBA::Boolean is_mcast, AVStreams::streamQoS &qos, AVStreams::flowSpec &the_spec)
virtual CORBA::Boolean modify_QoS (AVStreams::streamQoS &new_qos, const AVStreams::flowSpec &the_flows)
 Change the transport qos on a stream.
virtual int change_qos (AVStreams::streamQoS &new_qos, const AVStreams::flowSpec &the_flows)
virtual CORBA::Boolean set_protocol_restriction (const AVStreams::protocolSpec &the_pspec)
 Used to restrict the set of protocols.
virtual void disconnect (const AVStreams::flowSpec &the_spec)
 disconnect the flows
virtual void set_FPStatus (const AVStreams::flowSpec &the_spec, const char *fp_name, const CORBA::Any &fp_settings)
 Used to control the flow.
virtual CORBA::Object_ptr get_fep (const char *flow_name)
 Not implemented in the light profile, throws notsupported.
virtual char * add_fep (CORBA::Object_ptr the_fep)
 Not implemented in the light profile, throws notsupported.
virtual void remove_fep (const char *fep_name)
 Not implemented in the light profile, throws notsupported.
virtual void set_negotiator (AVStreams::Negotiator_ptr new_negotiator)
 Used to "attach" a negotiator to the endpoint.
virtual void set_key (const char *flow_name, const AVStreams::key &the_key)
 Used for public key encryption.
virtual void set_source_id (CORBA::Long source_id)
 Used to set a unique id for packets sent by this streamendpoint.
virtual ~TAO_StreamEndPoint (void)
 Destructor.
CORBA::Boolean multiconnect (AVStreams::streamQoS &the_qos, AVStreams::flowSpec &the_spec)

Protected Member Functions

char * add_fep_i (AVStreams::FlowEndPoint_ptr fep)
 Helper methods to implement add_fep().
char * add_fep_i_add_property (AVStreams::FlowEndPoint_ptr fep)
int translate_qos (const AVStreams::streamQoS &application_qos, AVStreams::streamQoS &network_qos)
 translate from application level to network level qos.

Protected Attributes

u_int flow_count_
u_int flow_num_
 current flow number used for system generation of flow names.
FlowEndPoint_Map fep_map_
 hash table for the flownames and its corresponding flowEndpoint reference.
AVStreams::flowSpec flows_
 sequence of supported flow names.
CORBA::Long source_id_
 source id used for multicast.
AVStreams::Negotiator_var negotiator_
 our local negotiator for QoS.
AVStreams::protocolSpec protocols_
 Our available list of protocols.
CORBA::String_var protocol_
 Chosen protocol for this streamendpoint based on availableprotocols property.
AVStreams::key key_
 Key used for encryption.
u_short mcast_port_
ACE_CString mcast_addr_
ACE_Hash_Map_Manager< ACE_CString,
TAO_FlowSpec_Entry *, ACE_Null_Mutex
mcast_entry_map_
TAO_AV_FlowSpecSet forward_flow_spec_set
TAO_AV_FlowSpecSet reverse_flow_spec_set
AVStreams::StreamEndPoint_var peer_sep_
AVStreams::SFPStatussfp_status_
AVStreams::StreamCtrl_var streamctrl_

Detailed Description

The Stream EndPoint. Used to implement one endpoint of a stream that implements the transport layer.

Definition at line 456 of file AVStreams_i.h.


Constructor & Destructor Documentation

TAO_StreamEndPoint::TAO_StreamEndPoint ( void   ) 

Constructor.

Definition at line 1558 of file AVStreams_i.cpp.

References ACE_DEBUG, ACE_DEFAULT_MULTICAST_ADDR, LM_DEBUG, mcast_addr_, ACE_String_Base< CHAR >::set(), and TAO_debug_level.

01559   :flow_count_ (0),
01560    flow_num_ (0),
01561    mcast_port_ (ACE_DEFAULT_MULTICAST_PORT+1)
01562 {
01563   //is->mcast_addr_ = ACE_OS::inet_addr (ACE_DEFAULT_MULTICAST_ADDR);
01564   this->mcast_addr_.set (ACE_DEFAULT_MULTICAST_ADDR);
01565   if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::TAO_StreamEndPoint::mcast_addr = %s", this->mcast_addr_.c_str ()));
01566   //  this->handle_open ();
01567 }

TAO_StreamEndPoint::~TAO_StreamEndPoint ( void   )  [virtual]

Destructor.

Definition at line 2381 of file AVStreams_i.cpp.

References ACE_Unbounded_Set_Ex< T, C >::begin(), ACE_Unbounded_Set_Ex< T, C >::end(), forward_flow_spec_set, and reverse_flow_spec_set.

02382 {
02383   //this->handle_close ();
02384   TAO_AV_FlowSpecSetItor begin = this->forward_flow_spec_set.begin ();
02385   TAO_AV_FlowSpecSetItor end = this->forward_flow_spec_set.end ();
02386 
02387   int i=0;
02388   // @@ Naga: Will the iterator always give the entries in the order of insertion.
02389   // or is it an implementation fact of ACE containers.
02390   for ( ; begin != end; ++begin, ++i)
02391     {
02392 //       if (i >= FLOWSPEC_MAX)
02393 //         {
02394           TAO_FlowSpec_Entry *entry = *begin;
02395           delete entry;
02396           //        }
02397     }
02398   begin = this->reverse_flow_spec_set.begin ();
02399   end = this->reverse_flow_spec_set.end ();
02400   i = 0;
02401   for (; begin != end; ++begin)
02402     {
02403 //       if (i >= FLOWSPEC_MAX)
02404 //         {
02405           TAO_FlowSpec_Entry *entry = *begin;
02406           delete entry;
02407           //        }
02408     }
02409 }


Member Function Documentation

char * TAO_StreamEndPoint::add_fep ( CORBA::Object_ptr  the_fep  )  [virtual]

Not implemented in the light profile, throws notsupported.

Definition at line 2259 of file AVStreams_i.cpp.

References CORBA::Exception::_tao_print_exception(), add_fep_i(), flow_count_, flows_, and CORBA::string_dup().

02260 {
02261   AVStreams::FlowEndPoint_var fep =
02262     AVStreams::FlowEndPoint::_narrow (fep_obj);
02263 
02264   CORBA::String_var flow_name =
02265     this->add_fep_i (fep.in ());
02266 
02267   try
02268     {
02269       fep->lock ();
02270       // Add it to the sequence of flowNames supported.
02271       // put the flowname and the flowendpoint in a hashtable.
02272       ACE_CString fep_name_key (CORBA::string_dup (flow_name.in ()));
02273       if (this->fep_map_.bind (fep_name_key, AVStreams::FlowEndPoint::_duplicate (fep.in ())) != 0)
02274         {
02275           throw AVStreams::streamOpFailed ();
02276         }
02277       // increment the flow count.
02278       this->flow_count_++;
02279       this->flows_.length (this->flow_count_);
02280       this->flows_[this->flow_count_-1] = flow_name;
02281       // define/modify the "Flows" property.
02282       CORBA::Any flows_any;
02283       flows_any <<= this->flows_;
02284       this->define_property ("Flows",
02285                              flows_any);
02286     }
02287   catch (const CORBA::Exception& ex)
02288     {
02289       ex._tao_print_exception ("TAO_StreamEndPoint::add_fep");
02290       return 0;
02291     }
02292   return flow_name._retn ();
02293 }

char * TAO_StreamEndPoint::add_fep_i ( AVStreams::FlowEndPoint_ptr  fep  )  [protected]

Helper methods to implement add_fep().

Definition at line 2238 of file AVStreams_i.cpp.

References add_fep_i_add_property(), and CORBA::string_dup().

Referenced by add_fep().

02239 {
02240   CORBA::String_var flow_name;
02241   try
02242     {
02243       CORBA::Any_var flow_name_any =
02244         fep->get_property_value ("FlowName");
02245 
02246       const char *tmp;
02247       flow_name_any >>= tmp;
02248       flow_name = CORBA::string_dup (tmp);
02249     }
02250   catch (const CORBA::Exception&)
02251     {
02252       flow_name =
02253         this->add_fep_i_add_property (fep);
02254     }
02255   return flow_name._retn ();
02256 }

char * TAO_StreamEndPoint::add_fep_i_add_property ( AVStreams::FlowEndPoint_ptr  fep  )  [protected]

Definition at line 2211 of file AVStreams_i.cpp.

References CORBA::Exception::_tao_print_exception(), ACE_String_Base< CHAR >::c_str(), ACE_OS::sprintf(), and ACE_OS::strdup().

Referenced by add_fep_i().

02212 {
02213   ACE_CString flow_name;
02214 
02215   try
02216     {
02217       // exception implies the flow name is not defined and is system
02218       // generated.
02219       flow_name = "flow";
02220       char tmp[255];
02221       ACE_OS::sprintf (tmp, "%u", this->flow_num_++);
02222       flow_name += tmp;
02223 
02224       CORBA::Any flowname_any;
02225       flowname_any <<= flow_name.c_str ();
02226       fep->define_property ("Flow",
02227                             flowname_any);
02228     }
02229   catch (const CORBA::Exception& ex)
02230     {
02231       ex._tao_print_exception ("TAO_StreamEndPoint::add_fep");
02232       return 0;
02233     }
02234   return ACE_OS::strdup( flow_name.c_str () );
02235 }

int TAO_StreamEndPoint::change_qos ( AVStreams::streamQoS new_qos,
const AVStreams::flowSpec the_flows 
) [virtual]

Definition at line 2104 of file AVStreams_i.cpp.

References ACE_DEBUG, ACE_ERROR_RETURN, TAO_AV_QoS::get_flow_qos(), LM_DEBUG, LM_ERROR, TAO_Base_StreamEndPoint::qos(), and TAO_debug_level.

Referenced by modify_QoS().

02106 {
02107   if (TAO_debug_level > 0)
02108     ACE_DEBUG ((LM_DEBUG,
02109                 "TAO_StreamEndPoint::change_qos\n"));
02110 
02111   TAO_AV_QoS qos (new_qos);
02112   for (int i = 0; (unsigned) i < the_flows.length (); i++)
02113     {
02114       TAO_Forward_FlowSpec_Entry entry;
02115       entry.parse (the_flows [i]);
02116       ACE_CString flow_name_key (entry.flowname ());
02117       Flow_Handler_Map_Entry *handler_entry;
02118       if (this->flow_handler_map_.find (flow_name_key,
02119                                         handler_entry) == 0)
02120         {
02121           AVStreams::QoS flow_qos;
02122           if (qos.get_flow_qos (entry.flowname (), flow_qos) != 0)
02123             ACE_DEBUG ((LM_DEBUG,
02124                         "New QoS for the flow %s is not specified\n",
02125                         entry.flowname ()));
02126           int result;
02127           result = handler_entry->int_id_->change_qos (flow_qos);
02128           if (result != 0)
02129             ACE_ERROR_RETURN ((LM_ERROR,
02130                                "Modifying QoS Failed\n"),
02131                               -1);
02132 
02133         }
02134     }
02135   return 0;
02136 }

CORBA::Boolean TAO_StreamEndPoint::connect ( AVStreams::StreamEndPoint_ptr  responder,
AVStreams::streamQoS qos_spec,
const AVStreams::flowSpec the_spec 
) [virtual]

Called by StreamCtrl. responder is the peer to connect to.

Definition at line 1571 of file AVStreams_i.cpp.

References CORBA::Exception::_tao_print_exception(), ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, forward_flow_spec_set, TAO_Base_StreamEndPoint::handle_postconnect(), TAO_Base_StreamEndPoint::handle_preconnect(), ACE_Unbounded_Set_Ex< T, C >::insert(), ACE_Singleton< TYPE, ACE_LOCK >::instance(), CORBA::is_nil(), LM_DEBUG, LM_ERROR, negotiator_, peer_sep_, protocol_, protocols_, TAO_Base_StreamEndPoint::qos(), reverse_flow_spec_set, TAO_AV_QoS::set(), ACE_OS::strcmp(), CORBA::string_dup(), TAO_AV_Core::TAO_AV_ENDPOINT_A, TAO_debug_level, and translate_qos().

01574 {
01575   if (TAO_debug_level > 0)
01576     ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::Connect ()\n"));
01577   CORBA::Boolean retv = 0;
01578   this->peer_sep_ = AVStreams::StreamEndPoint::_duplicate (responder);
01579   try
01580     {
01581       if (!CORBA::is_nil (this->negotiator_.in ()))
01582         {
01583           ACE_DEBUG ((LM_DEBUG,
01584                       "NEGOTIATOR AVIALABLE\n"));
01585 
01586           CORBA::Any_var negotiator_any = responder->get_property_value ("Negotiator");
01587 
01588           AVStreams::Negotiator_ptr peer_negotiator;
01589           negotiator_any.in () >>= peer_negotiator;
01590           if (!CORBA::is_nil (peer_negotiator))
01591             {
01592               CORBA::Boolean result =
01593                 this->negotiator_->negotiate (peer_negotiator,
01594                                               qos);
01595               if (!result)
01596                 if (TAO_debug_level > 0)
01597                   ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::Connect (): negotiate failed\n"));
01598             }
01599         }
01600     }
01601   catch (const CORBA::Exception& ex)
01602     {
01603       ex._tao_print_exception ("TAO_StreamEndPoint::negotiate");
01604     }
01605 
01606   try
01607     {
01608       if (this->protocols_.length () > 0)
01609         {
01610           // choose protocols based on what the remote endpoint can support.
01611           CORBA::Any_var protocols_any =
01612             responder->get_property_value ("AvailableProtocols");
01613           AVStreams::protocolSpec peer_protocols;
01614           AVStreams::protocolSpec *temp_protocols;
01615           protocols_any.in () >>= temp_protocols;
01616           peer_protocols = *temp_protocols;
01617           for (u_int i=0;i<peer_protocols.length ();i++)
01618             {
01619               for (u_int j=0;j<this->protocols_.length ();j++)
01620                 if (ACE_OS::strcmp (peer_protocols [i],
01621                                     this->protocols_[j]) == 0)
01622                   {
01623                     // we'll agree upon the first protocol that matches.
01624                     this->protocol_ = CORBA::string_dup (peer_protocols [i]);
01625                     break;
01626                   }
01627             }
01628         }
01629     }
01630   catch (const CORBA::Exception&)
01631     {
01632       if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "Availableprotocols property not defined\n"));
01633     }
01634   try
01635     {
01636       AVStreams::streamQoS network_qos;
01637       if (qos.length () > 0)
01638         {
01639           if (TAO_debug_level > 0)
01640             ACE_DEBUG ((LM_DEBUG,
01641                         "QoS is Specified\n"));
01642 
01643           int result = this->translate_qos (qos,
01644                                             network_qos);
01645           if (result != 0)
01646             if (TAO_debug_level > 0)
01647               ACE_DEBUG ((LM_DEBUG,
01648                           "QoS translation failed\n"));
01649 
01650           this->qos ().set (network_qos);
01651         }
01652 
01653 
01654       AVStreams::flowSpec flow_spec (the_spec);
01655       this->handle_preconnect (flow_spec);
01656 
01657       if (TAO_debug_level > 0)
01658         ACE_DEBUG ((LM_DEBUG,
01659                     "TAO_StreamEndPoint::connect: flow_spec_length = %d\n",
01660                     flow_spec.length ()));
01661       u_int i;
01662       for (i=0;i<flow_spec.length ();i++)
01663         {
01664           TAO_Forward_FlowSpec_Entry *entry = 0;
01665           ACE_NEW_RETURN (entry,
01666                           TAO_Forward_FlowSpec_Entry,
01667                           0);
01668 
01669           if (entry->parse (flow_spec[i]) == -1)
01670             return 0;
01671 
01672           if (TAO_debug_level > 0)
01673             ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::Connect: %s\n",  entry->entry_to_string ()));
01674 
01675           this->forward_flow_spec_set.insert (entry);
01676         }
01677 
01678       int result =TAO_AV_CORE::instance ()->init_forward_flows (this,
01679                                                                 this->forward_flow_spec_set,
01680                                                                 TAO_AV_Core::TAO_AV_ENDPOINT_A,
01681                                                                 flow_spec);
01682 
01683 
01684       if (result < 0)
01685         ACE_ERROR_RETURN ((LM_ERROR, "%N:%l TAO_AV_Core::init_forward_flows failed\n"), 0);
01686 
01687 
01688       AVStreams::StreamEndPoint_var streamendpoint = this->_this ();
01689 
01690       retv = responder->request_connection (streamendpoint.in (),
01691                                             0,
01692                                             network_qos,
01693                                             flow_spec);
01694 
01695       if (TAO_debug_level > 0)
01696          ACE_DEBUG ((LM_DEBUG, "%N:%l request_connection returned %d\n", retv));
01697 
01698       if (retv == 0)
01699         return retv;
01700       for (i=0;i<flow_spec.length ();i++)
01701         {
01702           TAO_Reverse_FlowSpec_Entry *entry = 0;
01703           ACE_NEW_RETURN (entry,
01704                           TAO_Reverse_FlowSpec_Entry,
01705                           0);
01706           if (entry->parse (flow_spec[i]) == -1)
01707             ACE_ERROR_RETURN ((LM_ERROR,
01708                                "Reverse_Flow_Spec_Set::parse failed\n"),
01709                               0);
01710 
01711           if (TAO_debug_level > 0)
01712             ACE_DEBUG ((LM_DEBUG,
01713                         "TAO_StreamEndPoint::Connect: Reverse Flow Spec %s\n",
01714                         entry->entry_to_string ()));
01715 
01716           this->reverse_flow_spec_set.insert (entry);
01717         }
01718 
01719       result = TAO_AV_CORE::instance ()->init_reverse_flows (this,
01720                                                              this->forward_flow_spec_set,
01721                                                              this->reverse_flow_spec_set,
01722                                                              TAO_AV_Core::TAO_AV_ENDPOINT_A);
01723       if (result < 0)
01724         ACE_ERROR_RETURN ((LM_ERROR,
01725                            "TAO_AV_Core::init_reverse_flows failed\n"),
01726                           0);
01727 
01728       // Make the upcall to the app
01729       retv = this->handle_postconnect (flow_spec);
01730     }
01731   catch (const CORBA::Exception& ex)
01732     {
01733       ex._tao_print_exception ("TAO_StreamEndPoint::connect");
01734       return 0;
01735     }
01736   return retv;
01737 }

void TAO_StreamEndPoint::destroy ( const AVStreams::flowSpec the_spec  )  [virtual]

Destroy the stream, Empty the_spec means, for all the flows.

Definition at line 1892 of file AVStreams_i.cpp.

References ACE_DEBUG, ACE_String_Base< CHAR >::c_str(), TAO_AV_Core::deactivate_servant(), ACE_Unbounded_Set_Ex< T, C >::end(), forward_flow_spec_set, TAO_AV_Core::get_control_flowname(), PortableServer::Servant_var< T >::in(), TAO_Pseudo_Var_T< T >::in(), ACE_Singleton< TYPE, ACE_LOCK >::instance(), CORBA::is_nil(), LM_DEBUG, TAO_Pseudo_Var_T< T >::out(), reverse_flow_spec_set, ACE_OS::strcmp(), and TAO_debug_level.

01893 {
01894   CORBA::Any_var vdev_any = this->get_property_value ("Related_VDev");
01895 
01896   AVStreams::VDev_ptr vdev;
01897 
01898   vdev_any.in() >>= vdev;
01899   CORBA::Any_var mc_any = vdev->get_property_value ("Related_MediaCtrl");
01900 
01901   // The Related_MediaCtrl property was inserted as a CORBA::Object, so we
01902   // must extract it as the same type.
01903   CORBA::Object_var obj;
01904   mc_any.in() >>= CORBA::Any::to_object( obj.out() );
01905 
01906   AVStreams::MediaControl_var media_ctrl =
01907           AVStreams::MediaControl::_narrow( obj.in() );
01908 
01909   // deactivate the associated vdev and media ctrl
01910 
01911   if ( !CORBA::is_nil( vdev ) )
01912   {
01913     PortableServer::ServantBase_var vdev_servant =
01914         TAO_AV_CORE::instance()->poa()->reference_to_servant ( vdev );
01915     TAO_AV_Core::deactivate_servant (vdev_servant.in());
01916   }
01917 
01918   if ( !CORBA::is_nil ( media_ctrl.in () ) )
01919   {
01920     PortableServer::ServantBase_var mc_servant =
01921         TAO_AV_CORE::instance()->poa()->reference_to_servant (media_ctrl.in());
01922     TAO_AV_Core::deactivate_servant (mc_servant.in());
01923   }
01924 
01925   int result = TAO_AV_Core::deactivate_servant (this);
01926   if (result < 0)
01927     if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::destroy failed\n"));
01928 
01929   if (flow_spec.length () > 0)
01930     {
01931       for (u_int i=0;i<flow_spec.length ();i++)
01932         {
01933           {
01934             TAO_AV_FlowSpecSetItor end = this->forward_flow_spec_set.end ();
01935             for (TAO_AV_FlowSpecSetItor begin = this->forward_flow_spec_set.begin ();
01936                  begin != end; ++begin)
01937               {
01938                 TAO_FlowSpec_Entry *entry = *begin;
01939                 TAO_Tokenizer flow_name (flow_spec [i], '\\');
01940                 if (ACE_OS::strcmp (entry->flowname (), flow_name[0]) == 0)
01941                   {
01942                     if (entry->protocol_object ())
01943                       {
01944                         entry->protocol_object ()->destroy ();
01945                       }
01946                     break;
01947                   }
01948               }
01949           }
01950           {
01951             TAO_AV_FlowSpecSetItor end = this->reverse_flow_spec_set.end ();
01952             for (TAO_AV_FlowSpecSetItor begin = this->reverse_flow_spec_set.begin ();
01953                  begin != end; ++begin)
01954               {
01955                 TAO_FlowSpec_Entry *entry = *begin;
01956                 TAO_Tokenizer flow_name (flow_spec [i], '\\');
01957                 if (ACE_OS::strcmp (entry->flowname (), flow_name[0]) == 0)
01958                   {
01959                     if (entry->protocol_object ())
01960                       {
01961                         entry->protocol_object ()->destroy ();
01962                       }
01963                     break;
01964                   }
01965               }
01966           }
01967         }
01968     }
01969   else
01970     {
01971       {
01972         TAO_AV_FlowSpecSetItor end = this->forward_flow_spec_set.end ();
01973         for (TAO_AV_FlowSpecSetItor begin = this->forward_flow_spec_set.begin ();
01974              begin != end; ++begin)
01975           {
01976             TAO_FlowSpec_Entry *entry = *begin;
01977             if (entry->protocol_object ())
01978               {
01979                 entry->protocol_object ()->stop ();
01980 
01981                 ACE_CString control_flowname =
01982                     TAO_AV_Core::get_control_flowname (entry->flowname ());
01983                 TAO_AV_CORE::instance()->remove_acceptor(entry->flowname());
01984                 TAO_AV_CORE::instance()->remove_acceptor(control_flowname.c_str());
01985 
01986                 entry->protocol_object ()->destroy ();
01987               }
01988           }
01989       }
01990       {
01991         TAO_AV_FlowSpecSetItor end = this->reverse_flow_spec_set.end ();
01992         for (TAO_AV_FlowSpecSetItor begin = this->reverse_flow_spec_set.begin ();
01993              begin != end; ++begin)
01994           {
01995             TAO_FlowSpec_Entry *entry = *begin;
01996             if (entry->protocol_object ())
01997               {
01998                 entry->protocol_object ()->stop ();
01999 
02000                 ACE_CString control_flowname =
02001                     TAO_AV_Core::get_control_flowname (entry->flowname ());
02002                 TAO_AV_CORE::instance()->remove_connector(entry->flowname());
02003                 TAO_AV_CORE::instance()->remove_connector(control_flowname.c_str());
02004                 entry->protocol_object ()->destroy ();
02005 
02006               }
02007           }
02008       }
02009     }
02010 
02011   // Make the upcall into the app
02012   //  this->handle_destroy (the_spec);
02013   //
02014 }

void TAO_StreamEndPoint::disconnect ( const AVStreams::flowSpec the_spec  )  [virtual]

disconnect the flows

Definition at line 2181 of file AVStreams_i.cpp.

02182 {
02183   ACE_UNUSED_ARG (the_spec);
02184 }

CORBA::Object_ptr TAO_StreamEndPoint::get_fep ( const char *  flow_name  )  [virtual]

Not implemented in the light profile, throws notsupported.

Definition at line 2201 of file AVStreams_i.cpp.

02202 {
02203   ACE_CString fep_name_key (flow_name);
02204   AVStreams::FlowEndPoint_var fep_entry;
02205   if (this->fep_map_.find (fep_name_key, fep_entry) == 0)
02206     return fep_entry._retn();
02207   return 0;
02208 }

CORBA::Boolean TAO_StreamEndPoint::modify_QoS ( AVStreams::streamQoS new_qos,
const AVStreams::flowSpec the_flows 
) [virtual]

Change the transport qos on a stream.

Definition at line 2140 of file AVStreams_i.cpp.

References ACE_DEBUG, change_qos(), LM_DEBUG, and TAO_debug_level.

02142 {
02143   if (TAO_debug_level > 0)
02144   ACE_DEBUG ((LM_DEBUG,
02145               "TAO_StreamEndPoint::modify_QoS\n"));
02146 
02147   int result =  this->change_qos (new_qos, the_flows);
02148 
02149   if (result != 0)
02150     return 0;
02151 
02152   return 1;
02153 
02154 }

CORBA::Boolean TAO_StreamEndPoint::multiconnect ( AVStreams::streamQoS the_qos,
AVStreams::flowSpec the_spec 
)

Reimplemented in TAO_StreamEndPoint_A, and TAO_StreamEndPoint_B.

Definition at line 2373 of file AVStreams_i.cpp.

References ACE_DEBUG, LM_DEBUG, and TAO_debug_level.

02375 {
02376   if (TAO_debug_level > 0)
02377     ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::multiconnect\n"));
02378   return 0;
02379 }

void TAO_StreamEndPoint::remove_fep ( const char *  fep_name  )  [virtual]

Not implemented in the light profile, throws notsupported.

Definition at line 2297 of file AVStreams_i.cpp.

References CORBA::Exception::_tao_print_exception(), flows_, and ACE_OS::strcmp().

02298 {
02299   try
02300     {
02301       ACE_CString fep_name_key (flow_name);
02302       AVStreams::FlowEndPoint_var fep_entry;
02303       // Remove the fep from the hash table.
02304       if (this->fep_map_.unbind (fep_name_key, fep_entry)!= 0)
02305         throw AVStreams::streamOpFailed ();
02306       // redefine the "Flows" property
02307       AVStreams::flowSpec new_flows (this->flows_.length ());
02308       for (u_int i=0, j=0 ; i <this->flows_.length (); i++)
02309         if (ACE_OS::strcmp (flow_name, this->flows_[i]) != 0)
02310           new_flows[j++] = this->flows_[i];
02311 
02312       CORBA::Any flows;
02313       flows <<= new_flows;
02314       this->flows_ = new_flows;
02315       this->define_property ("Flows",
02316                              flows);
02317     }
02318   catch (const CORBA::Exception& ex)
02319     {
02320       ex._tao_print_exception ("TAO_StreamEndPoint::remove_fep");
02321     }
02322 }

CORBA::Boolean TAO_StreamEndPoint::request_connection ( AVStreams::StreamEndPoint_ptr  initiator,
CORBA::Boolean  is_mcast,
AVStreams::streamQoS qos,
AVStreams::flowSpec the_spec 
) [virtual]

Called by the peer StreamEndPoint. The flow_spec indicates the flows (which contain transport addresses etc.)

Definition at line 2019 of file AVStreams_i.cpp.

References CORBA::Exception::_tao_print_exception(), ACE_DEBUG, ACE_NEW_RETURN, forward_flow_spec_set, TAO_Base_StreamEndPoint::handle_connection_requested(), ACE_Unbounded_Set_Ex< T, C >::insert(), ACE_Singleton< TYPE, ACE_LOCK >::instance(), LM_DEBUG, TAO_Base_StreamEndPoint::qos(), TAO_AV_QoS::set(), CORBA::string_dup(), TAO_AV_Core::TAO_AV_ENDPOINT_B, TAO_debug_level, and translate_qos().

02024 {
02025   if (TAO_debug_level > 0)
02026     ACE_DEBUG ((LM_DEBUG,
02027                 "\n(%P|%t) TAO_StreamEndPoint::request_connection called"));
02028 
02029   int result = 0;
02030   try
02031     {
02032       AVStreams::streamQoS network_qos;
02033       if (qos.length () > 0)
02034         {
02035          if (TAO_debug_level > 0)
02036           ACE_DEBUG ((LM_DEBUG,
02037                       "QoS is Specified\n"));
02038 
02039           int result = this->translate_qos (qos, network_qos);
02040           if (result != 0)
02041             if (TAO_debug_level > 0)
02042               ACE_DEBUG ((LM_DEBUG, "QoS translation failed\n"));
02043 
02044           this->qos ().set (network_qos);
02045         }
02046 
02047       if (TAO_debug_level > 0)
02048         ACE_DEBUG ((LM_DEBUG,
02049                     "\n(%P|%t) TAO_StreamEndPoint::request_connection: "
02050                     "flowspec has length = %d and the strings are:\n",
02051                     flow_spec.length ()));
02052       CORBA::ULong i;
02053 
02054       for (i=0;i<flow_spec.length ();i++)
02055         {
02056           TAO_Forward_FlowSpec_Entry *entry = 0;
02057           ACE_NEW_RETURN (entry,
02058                           TAO_Forward_FlowSpec_Entry,
02059                           0);
02060 
02061           CORBA::String_var string_entry = CORBA::string_dup (flow_spec[i]);
02062 
02063           if(TAO_debug_level > 0)
02064              ACE_DEBUG(( LM_DEBUG,
02065                          "%N:%l Parsing flow spec: [%s]\n",
02066                          string_entry.in ()));
02067 
02068           if (entry->parse (string_entry.in ()) == -1)
02069           {
02070             if (TAO_debug_level > 0)
02071               ACE_DEBUG ((LM_DEBUG,
02072                           "%N:%l Error parsing flow_spec: [%s]\n",
02073                           string_entry.in ()));
02074             return 0;
02075           }
02076           if (TAO_debug_level > 0)
02077             ACE_DEBUG ((LM_DEBUG,
02078                         "TAO_StreamEndPoint::request_connection flow spec [%s]\n",
02079                         entry->entry_to_string ()));
02080 
02081           this->forward_flow_spec_set.insert (entry);
02082         }
02083 
02084       result = TAO_AV_CORE::instance ()->init_forward_flows (this,
02085                                                              this->forward_flow_spec_set,
02086                                                              TAO_AV_Core::TAO_AV_ENDPOINT_B,
02087                                                              flow_spec);
02088 
02089       if (result < 0)
02090         return 0;
02091 
02092       // Make the upcall to the app
02093       result = this->handle_connection_requested (flow_spec);
02094     }
02095   catch (const CORBA::Exception& ex)
02096     {
02097       ex._tao_print_exception ("TAO_StreamEndpoint::request_connection");
02098       return 0;
02099     }
02100   return result;
02101 }

void TAO_StreamEndPoint::set_FPStatus ( const AVStreams::flowSpec the_spec,
const char *  fp_name,
const CORBA::Any &  fp_settings 
) [virtual]

Used to control the flow.

Definition at line 2189 of file AVStreams_i.cpp.

References sfp_status_, and ACE_OS::strcmp().

02192 {
02193   if (ACE_OS::strcmp (fp_name, "SFP1.0") != 0)
02194     return;
02195   fp_settings >>= this->sfp_status_;
02196   // @@Naga: We should call set_FPStatus on all the protocol objects.
02197 }

void TAO_StreamEndPoint::set_key ( const char *  flow_name,
const AVStreams::key the_key 
) [virtual]

Used for public key encryption.

Definition at line 2346 of file AVStreams_i.cpp.

References CORBA::Exception::_tao_print_exception(), key_, and ACE_OS::sprintf().

02348 {
02349   try
02350     {
02351       this->key_ = the_key;
02352       CORBA::Any PublicKey;
02353       PublicKey <<= the_key;
02354       char PublicKey_property [BUFSIZ];
02355       ACE_OS::sprintf (PublicKey_property, "%s_PublicKey", flow_name);
02356       this->define_property (PublicKey_property,
02357                              PublicKey);
02358     }
02359   catch (const CORBA::Exception& ex)
02360     {
02361       ex._tao_print_exception ("TAO_StreamEndPoint::set_key");
02362     }
02363 }

void TAO_StreamEndPoint::set_negotiator ( AVStreams::Negotiator_ptr  new_negotiator  )  [virtual]

Used to "attach" a negotiator to the endpoint.

Definition at line 2326 of file AVStreams_i.cpp.

References CORBA::Exception::_tao_print_exception(), and negotiator_.

02327 {
02328   try
02329     {
02330       CORBA::Any negotiator;
02331       negotiator <<= new_negotiator;
02332       this->define_property ("Negotiator",
02333                              negotiator);
02334       this->negotiator_ = AVStreams::Negotiator::_duplicate (new_negotiator);
02335     }
02336   catch (const CORBA::Exception& ex)
02337     {
02338       ex._tao_print_exception (
02339         "TAO_StreamEndPoint::set_negotiator");
02340     }
02341 }

CORBA::Boolean TAO_StreamEndPoint::set_protocol_restriction ( const AVStreams::protocolSpec the_pspec  )  [virtual]

Used to restrict the set of protocols.

Definition at line 2159 of file AVStreams_i.cpp.

References CORBA::Exception::_tao_print_exception(), and protocols_.

02160 {
02161   try
02162     {
02163       CORBA::Any protocol_restriction_any;
02164 
02165       protocol_restriction_any <<= protocols;
02166       this->define_property ("ProtocolRestriction",
02167                              protocol_restriction_any);
02168       this->protocols_ = protocols;
02169     }
02170   catch (const CORBA::Exception& ex)
02171     {
02172       ex._tao_print_exception (
02173         "TAO_StreamEndPoint::set_protocol_restriction");
02174       return 0;
02175     }
02176   return 1;
02177 }

void TAO_StreamEndPoint::set_source_id ( CORBA::Long  source_id  )  [virtual]

Used to set a unique id for packets sent by this streamendpoint.

Definition at line 2367 of file AVStreams_i.cpp.

References source_id_.

02368 {
02369   this->source_id_ = source_id;
02370 }

void TAO_StreamEndPoint::start ( const AVStreams::flowSpec the_spec  )  [virtual]

Start the stream, Empty the_spec means, for all the flows.

Definition at line 1805 of file AVStreams_i.cpp.

References ACE_DEBUG, ACE_Unbounded_Set_Ex< T, C >::end(), forward_flow_spec_set, TAO_Base_StreamEndPoint::handle_start(), LM_DEBUG, reverse_flow_spec_set, ACE_OS::strcmp(), and TAO_debug_level.

01806 {
01807   if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::start\n"));
01808   // Make the upcall into the app
01809   this->handle_start (flow_spec);
01810 
01811   if (flow_spec.length () > 0)
01812     {
01813       // Now call start on all the flow handlers.
01814       for (u_int i=0;i<flow_spec.length ();i++)
01815         {
01816           TAO_AV_FlowSpecSetItor end = this->forward_flow_spec_set.end ();
01817           for (TAO_AV_FlowSpecSetItor forward_begin = this->forward_flow_spec_set.begin ();
01818                forward_begin != end; ++forward_begin)
01819             {
01820               TAO_FlowSpec_Entry *entry = *forward_begin;
01821               if (ACE_OS::strcmp (entry->flowname (), flow_spec [i]) == 0)
01822                 {
01823                   //                  entry->protocol_object ()->start ();
01824                   if (entry->handler () != 0)
01825                   {
01826                     entry->handler ()->start (entry->role ());
01827                   }
01828                   if (entry->control_handler () != 0)
01829                   {
01830                     entry->control_handler ()->start (entry->role ());
01831                   }
01832                 }
01833             }
01834 
01835           end = this->reverse_flow_spec_set.end ();
01836           for (TAO_AV_FlowSpecSetItor reverse_begin = this->reverse_flow_spec_set.begin ();
01837                reverse_begin != end; ++reverse_begin)
01838             {
01839               TAO_FlowSpec_Entry *entry = *reverse_begin;
01840               if (ACE_OS::strcmp (entry->flowname (), flow_spec [i]) == 0)
01841                 {
01842                   //                  entry->protocol_object ()->start ();
01843                   if (entry->handler () != 0)
01844                   {
01845                     entry->handler ()->start (entry->role ());
01846                   }
01847                   if (entry->control_handler () != 0)
01848                   {
01849                     entry->control_handler ()->start (entry->role ());
01850                   }
01851                 }
01852             }
01853         }
01854     }
01855   else
01856     {
01857       TAO_AV_FlowSpecSetItor end = this->forward_flow_spec_set.end ();
01858       for (TAO_AV_FlowSpecSetItor forwardbegin = this->forward_flow_spec_set.begin ();
01859            forwardbegin != end; ++forwardbegin)
01860         {
01861           TAO_FlowSpec_Entry *entry = *forwardbegin;
01862           if (entry->handler () != 0)
01863             {
01864               entry->handler ()->start (entry->role ());
01865             }
01866           if (entry->control_handler () != 0)
01867             {
01868               entry->control_handler ()->start (entry->role ());
01869             }
01870         }
01871 
01872       end = this->reverse_flow_spec_set.end ();
01873       for (TAO_AV_FlowSpecSetItor reversebegin = this->reverse_flow_spec_set.begin ();
01874            reversebegin != end; ++reversebegin)
01875         {
01876           TAO_FlowSpec_Entry *entry = *reversebegin;
01877           //          entry->protocol_object ()->start ();
01878           if (entry->handler () != 0)
01879             {
01880               entry->handler ()->start (entry->role ());
01881             }
01882           if (entry->control_handler () != 0)
01883             {
01884               entry->control_handler ()->start (entry->role ());
01885             }
01886         }
01887     }
01888 }

void TAO_StreamEndPoint::stop ( const AVStreams::flowSpec the_spec  )  [virtual]

Stop the stream. Empty the_spec means, for all the flows.

Definition at line 1757 of file AVStreams_i.cpp.

References TAO_FlowSpec_Entry::control_handler(), ACE_Unbounded_Set_Ex< T, C >::end(), forward_flow_spec_set, TAO_Base_StreamEndPoint::handle_stop(), TAO_FlowSpec_Entry::handler(), TAO_FlowSpec_Entry::role(), TAO_AV_Flow_Handler::stop(), and ACE_OS::strcmp().

01758 {
01759   // Make the upcall into the app
01760   this->handle_stop (flow_spec);
01761 
01762   if (flow_spec.length () > 0)
01763     {
01764 
01765       for (u_int i=0;i<flow_spec.length ();i++)
01766         {
01767           TAO_AV_FlowSpecSetItor end = this->forward_flow_spec_set.end ();
01768           for (TAO_AV_FlowSpecSetItor begin = this->forward_flow_spec_set.begin ();
01769                begin != end; ++begin)
01770             {
01771               TAO_Forward_FlowSpec_Entry entry;
01772               entry.parse (flow_spec[i]);
01773               if (ACE_OS::strcmp ((*begin)->flowname (), entry.flowname ()) == 0)
01774                {
01775                  TAO_FlowSpec_Entry *entry = *begin;
01776                  //                  (*begin)->protocol_object ()->stop ();
01777                  if (entry->handler() != 0)
01778                    entry->handler ()->stop (entry->role ());
01779                  if (entry->control_handler () != 0)
01780                    entry->control_handler ()->stop (entry->role ());
01781                  break;
01782                }
01783             }
01784         }
01785     }
01786   else
01787     {
01788       TAO_AV_FlowSpecSetItor end = this->forward_flow_spec_set.end ();
01789       for (TAO_AV_FlowSpecSetItor begin = this->forward_flow_spec_set.begin ();
01790            begin != end; ++begin)
01791         {
01792           TAO_FlowSpec_Entry *entry = *begin;
01793           //          entry->protocol_object ()->stop ();
01794           if (entry->handler() != 0)
01795             entry->handler ()->stop (entry->role ());
01796           if (entry->control_handler () != 0)
01797             entry->control_handler ()->stop (entry->role ());
01798         }
01799     }
01800 }

int TAO_StreamEndPoint::translate_qos ( const AVStreams::streamQoS application_qos,
AVStreams::streamQoS network_qos 
) [protected]

translate from application level to network level qos.

Definition at line 1740 of file AVStreams_i.cpp.

Referenced by connect(), and request_connection().

01742 {
01743   u_int len = application_qos.length ();
01744   network_qos.length (len);
01745   for (u_int i=0;i<len;i++)
01746     {
01747       network_qos [i].QoSType = application_qos [i].QoSType;
01748       network_qos [i].QoSParams = application_qos [i].QoSParams;
01749     }
01750   return 0;
01751 }


Member Data Documentation

FlowEndPoint_Map TAO_StreamEndPoint::fep_map_ [protected]

hash table for the flownames and its corresponding flowEndpoint reference.

Definition at line 546 of file AVStreams_i.h.

u_int TAO_StreamEndPoint::flow_count_ [protected]

Count of the number of flows in this streamendpoint, used to generate unique names for the flows.

Definition at line 540 of file AVStreams_i.h.

Referenced by add_fep().

u_int TAO_StreamEndPoint::flow_num_ [protected]

current flow number used for system generation of flow names.

Definition at line 543 of file AVStreams_i.h.

AVStreams::flowSpec TAO_StreamEndPoint::flows_ [protected]

sequence of supported flow names.

Definition at line 549 of file AVStreams_i.h.

Referenced by add_fep(), and remove_fep().

TAO_AV_FlowSpecSet TAO_StreamEndPoint::forward_flow_spec_set [protected]

Definition at line 571 of file AVStreams_i.h.

Referenced by connect(), destroy(), TAO_StreamEndPoint_A::multiconnect(), request_connection(), start(), stop(), and ~TAO_StreamEndPoint().

AVStreams::key TAO_StreamEndPoint::key_ [protected]

Key used for encryption.

Definition at line 564 of file AVStreams_i.h.

Referenced by set_key().

ACE_CString TAO_StreamEndPoint::mcast_addr_ [protected]

Definition at line 569 of file AVStreams_i.h.

Referenced by TAO_StreamEndPoint().

ACE_Hash_Map_Manager<ACE_CString, TAO_FlowSpec_Entry*,ACE_Null_Mutex> TAO_StreamEndPoint::mcast_entry_map_ [protected]

Definition at line 570 of file AVStreams_i.h.

Referenced by TAO_StreamEndPoint_B::multiconnect(), and TAO_StreamEndPoint_A::multiconnect().

u_short TAO_StreamEndPoint::mcast_port_ [protected]

TAO_Forward_FlowSpec_Entry forward_entries_ [FLOWSPEC_MAX]; TAO_Reverse_FlowSpec_Entry reverse_entries_ [FLOWSPEC_MAX];

Definition at line 568 of file AVStreams_i.h.

Referenced by TAO_StreamEndPoint_A::multiconnect().

AVStreams::Negotiator_var TAO_StreamEndPoint::negotiator_ [protected]

our local negotiator for QoS.

Definition at line 555 of file AVStreams_i.h.

Referenced by connect(), and set_negotiator().

AVStreams::StreamEndPoint_var TAO_StreamEndPoint::peer_sep_ [protected]

Definition at line 573 of file AVStreams_i.h.

Referenced by connect().

CORBA::String_var TAO_StreamEndPoint::protocol_ [protected]

Chosen protocol for this streamendpoint based on availableprotocols property.

Definition at line 561 of file AVStreams_i.h.

Referenced by connect().

AVStreams::protocolSpec TAO_StreamEndPoint::protocols_ [protected]

Our available list of protocols.

Definition at line 558 of file AVStreams_i.h.

Referenced by connect(), and set_protocol_restriction().

TAO_AV_FlowSpecSet TAO_StreamEndPoint::reverse_flow_spec_set [protected]

Definition at line 572 of file AVStreams_i.h.

Referenced by connect(), destroy(), start(), and ~TAO_StreamEndPoint().

AVStreams::SFPStatus* TAO_StreamEndPoint::sfp_status_ [protected]

Definition at line 574 of file AVStreams_i.h.

Referenced by set_FPStatus().

CORBA::Long TAO_StreamEndPoint::source_id_ [protected]

source id used for multicast.

Definition at line 552 of file AVStreams_i.h.

Referenced by set_source_id().

AVStreams::StreamCtrl_var TAO_StreamEndPoint::streamctrl_ [protected]

Definition at line 575 of file AVStreams_i.h.

Referenced by TAO_StreamEndPoint_B::multiconnect(), and TAO_StreamEndPoint_A::multiconnect().


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