TAO_StreamEndPoint_A Class Reference

The "A" side of a streamendpoint. More...

#include <AVStreams_i.h>

Inheritance diagram for TAO_StreamEndPoint_A:

Inheritance graph
[legend]
Collaboration diagram for TAO_StreamEndPoint_A:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_StreamEndPoint_A (void)
 Constructor.

virtual CORBA::Boolean multiconnect (AVStreams::streamQoS &the_qos, AVStreams::flowSpec &the_spec)
 Used for ATM-style multicast.

virtual CORBA::Boolean connect_leaf (AVStreams::StreamEndPoint_B_ptr the_ep, AVStreams::streamQoS &the_qos, const AVStreams::flowSpec &the_flows)
 Used for ATM-style multicast.

virtual void disconnect_leaf (AVStreams::StreamEndPoint_B_ptr the_ep, const AVStreams::flowSpec &theSpec)
 Used to remove a multicast leaf.

virtual ~TAO_StreamEndPoint_A (void)
 Destructor.


Detailed Description

The "A" side of a streamendpoint.

Definition at line 582 of file AVStreams_i.h.


Constructor & Destructor Documentation

TAO_StreamEndPoint_A::TAO_StreamEndPoint_A void   ) 
 

Constructor.

Definition at line 2384 of file AVStreams_i.cpp.

References ACE_DEBUG, LM_DEBUG, and TAO_debug_level.

02385 {
02386   if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%P|%t) TAO_StreamEndPoint_A::TAO_StreamEndPoint_A: created\n"));
02387 }

TAO_StreamEndPoint_A::~TAO_StreamEndPoint_A void   )  [virtual]
 

Destructor.

Definition at line 2581 of file AVStreams_i.cpp.

02582 {
02583 }


Member Function Documentation

CORBA::Boolean TAO_StreamEndPoint_A::connect_leaf AVStreams::StreamEndPoint_B_ptr  the_ep,
AVStreams::streamQoS the_qos,
const AVStreams::flowSpec the_flows
[virtual]
 

Used for ATM-style multicast.

Definition at line 2563 of file AVStreams_i.cpp.

References AVStreams::flowSpec, and AVStreams::streamQoS.

02566 {
02567   throw AVStreams::notSupported ();
02568 }

void TAO_StreamEndPoint_A::disconnect_leaf AVStreams::StreamEndPoint_B_ptr  the_ep,
const AVStreams::flowSpec theSpec
[virtual]
 

Used to remove a multicast leaf.

Definition at line 2572 of file AVStreams_i.cpp.

References AVStreams::flowSpec.

02575 {
02576 
02577   throw AVStreams::notSupported ();
02578 
02579 }

CORBA::Boolean TAO_StreamEndPoint_A::multiconnect AVStreams::streamQoS the_qos,
AVStreams::flowSpec the_spec
[virtual]
 

Used for ATM-style multicast.

Reimplemented from TAO_StreamEndPoint.

Definition at line 2391 of file AVStreams_i.cpp.

References ACE_CString, ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, ACE_INET_Addr::addr_to_string(), TAO_FlowSpec_Entry::address(), ACE_Hash_Map_Manager_Ex< ACE_CString, TAO_FlowSpec_Entry *, ACE_Hash< ACE_CString >, ACE_Equal_To< ACE_CString >, ACE_Null_Mutex >::bind(), TAO_FlowSpec_Entry::carrier_protocol_str(), TAO_FlowSpec_Entry::direction(), TAO_FlowSpec_Entry::direction_str(), TAO_Forward_FlowSpec_Entry::entry_to_string(), ACE_Hash_Map_Manager_Ex< ACE_CString, TAO_FlowSpec_Entry *, ACE_Hash< ACE_CString >, ACE_Equal_To< ACE_CString >, ACE_Null_Mutex >::find(), TAO_FlowSpec_Entry::flow_protocol_str(), TAO_FlowSpec_Entry::flowname(), AVStreams::flowSpec, TAO_FlowSpec_Entry::format(), TAO_AV_QoS::get_flow_qos(), ACE_Unbounded_Set< T >::insert(), ACE_Singleton< TYPE, ACE_LOCK >::instance(), CORBA::is_nil(), LM_DEBUG, LM_ERROR, TAO_AV_Acceptor_Registry::open(), TAO_Forward_FlowSpec_Entry::parse(), TAO_Base_StreamEndPoint::qos(), ACE_INET_Addr::set(), TAO_FlowConnection::set_mcast_addr(), TAO_FlowConnection::set_protocol(), ACE_OS::strcmp(), AVStreams::streamQoS, CORBA::string_dup(), and TAO_debug_level.

02393 {
02394   if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPointA::multiconnect\n"));
02395   try
02396     {
02397       int result = 0;
02398       TAO_AV_QoS qos (stream_qos);
02399       for (u_int i=0;i< flow_spec.length ();i++)
02400         {
02401           TAO_Forward_FlowSpec_Entry *forward_entry = 0;
02402           ACE_NEW_RETURN (forward_entry,
02403                           TAO_Forward_FlowSpec_Entry,
02404                           0);
02405           forward_entry->parse (flow_spec[i]);
02406           ACE_CString mcast_key (forward_entry->flowname ());
02407           AVStreams::FlowEndPoint_var flow_endpoint;
02408 
02409           // @@Naga: There is a problem in the full profile case for multiconnect. Since
02410           // multiconnect on sep_a is called everytime a sink is added and if called for
02411           // the same flow twice, the following code will just call add producer on the flow connection.
02412           // It is however very hard to find out if the flow producer is already in the flow connection
02413           // since comparing object references will not work and the flowproducer reference is
02414           // generated by _narrow. Our only hope is that _narrow on the same fep will return the same
02415           // pointer for the flowproducer in which case we can find out if the flowproducer exists in
02416           // fep set for that flowconnection.
02417           if (this->fep_map_.find (mcast_key, flow_endpoint) == 0)
02418             {
02419               try
02420                 {
02421                   AVStreams::QoS flow_qos;
02422                   result = qos.get_flow_qos (forward_entry->flowname (), flow_qos);
02423                   if (result < 0)
02424                     if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "QoS not found for %s\n", forward_entry->flowname ()));
02425                   // Narrow it to FlowProducer.
02426                   AVStreams::FlowProducer_var producer;
02427                   producer = AVStreams::FlowProducer::_narrow (flow_endpoint.in());
02428                   //
02429                   // Else narrow succeeeded.
02430                   if (!CORBA::is_nil (producer.in ()))
02431                     {
02432                       AVStreams::FlowConnection_var flow_connection;
02433                       try
02434                         {
02435                           if (CORBA::is_nil (this->streamctrl_.in ()))
02436                               {
02437                                 CORBA::Any_var streamctrl_any;
02438                                 streamctrl_any = this->get_property_value ("Related_StreamCtrl");
02439                                 AVStreams::StreamCtrl_ptr streamctrl;
02440                                 streamctrl_any.in () >>= streamctrl;
02441                                 this->streamctrl_ = AVStreams::StreamCtrl::_duplicate (streamctrl);
02442                               }
02443 
02444                           CORBA::Object_var flow_connection_obj =
02445                             this->streamctrl_->get_flow_connection (forward_entry->flowname ());
02446                           flow_connection = AVStreams::FlowConnection::_narrow (flow_connection_obj.in ());
02447                         }
02448                       catch (const CORBA::Exception&)
02449                         {
02450                           TAO_FlowConnection *flowConnection;
02451                           ACE_NEW_RETURN (flowConnection,
02452                                           TAO_FlowConnection,
02453                                           0);
02454                           //@@ Strategize the multicast address allocation.
02455                           flowConnection->set_mcast_addr (this->mcast_addr_, this->mcast_port_);
02456                           this->mcast_port_++;
02457                           flowConnection->set_protocol (forward_entry->carrier_protocol_str ());
02458                           flow_connection = flowConnection->_this ();
02459                           this->streamctrl_->set_flow_connection (forward_entry->flowname (),
02460                                                                   flow_connection.in ());
02461                         }
02462                       if (ACE_OS::strcmp (forward_entry->flow_protocol_str (), "") != 0)
02463                         {
02464                           CORBA::Any fp_settings;
02465                           flow_connection->use_flow_protocol (forward_entry->flow_protocol_str (),
02466                                                               fp_settings);
02467                         }
02468                       result = flow_connection->add_producer (producer.in (),
02469                                                               flow_qos);
02470                       if (result == 0)
02471                         ACE_ERROR_RETURN ((LM_ERROR, "TAO_StreamEndPoint_A::multiconnect: add_producer failed\n"), 0);
02472                     }
02473                 }
02474               catch (const CORBA::Exception& ex)
02475                 {
02476                   // Narrow failed and since its not a flowproducer its an error.
02477                   ex._tao_print_exception (
02478                     "FlowProducer::_narrow");
02479                   ACE_ERROR_RETURN ((LM_ERROR, "sep_a doesn't contain a flowproducer"), 0);
02480                 }
02481             }
02482           else
02483             {
02484               ACE_INET_Addr *mcast_addr;
02485               TAO_FlowSpec_Entry *entry = 0;
02486               result = this->mcast_entry_map_.find (mcast_key, entry);
02487               if (result == 0)
02488                 {
02489                   mcast_addr = dynamic_cast<ACE_INET_Addr *> (entry->address ());
02490                   char str_addr [BUFSIZ];
02491                   result = mcast_addr->addr_to_string (str_addr, BUFSIZ);
02492                   if (result < 0)
02493                     ACE_ERROR_RETURN ((LM_ERROR, "TAO_StreamEndPointA::multiconnect ::addr_to_string failed\n"), 0);
02494                   if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint_A::multiconnect:%s\n", str_addr));
02495                   TAO_Forward_FlowSpec_Entry new_entry (entry->flowname (),
02496                                                         entry->direction_str (),
02497                                                         entry->format (),
02498                                                         entry->flow_protocol_str (),
02499                                                         entry->carrier_protocol_str (),
02500                                                         entry->address ());
02501                   flow_spec[i] = CORBA::string_dup (new_entry.entry_to_string ());
02502                 }
02503               else
02504                 {
02505 
02506                   switch (forward_entry->direction ())
02507                     {
02508                     case TAO_FlowSpec_Entry::TAO_AV_DIR_IN:
02509                       {
02510                         ACE_NEW_RETURN (mcast_addr,
02511                                         ACE_INET_Addr,
02512                                         0);
02513                         mcast_addr->set (this->mcast_port_, this->mcast_addr_.c_str ());
02514                         this->mcast_port_++;
02515                         char buf[BUFSIZ];
02516                         mcast_addr->addr_to_string (buf, BUFSIZ);
02517                         if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "%s\n", buf));
02518                         TAO_Forward_FlowSpec_Entry *new_entry;
02519                         ACE_NEW_RETURN (new_entry,
02520                                         TAO_Forward_FlowSpec_Entry (forward_entry->flowname (),
02521                                                                     forward_entry->direction_str (),
02522                                                                     forward_entry->format (),
02523                                                                     forward_entry->flow_protocol_str (),
02524                                                                     forward_entry->carrier_protocol_str (),
02525                                                                     mcast_addr),
02526                                         0);
02527                         flow_spec[i] = CORBA::string_dup (new_entry->entry_to_string ());
02528                         //new_entry->is_multicast (1);
02529 
02530                         this->forward_flow_spec_set.insert (new_entry);
02531                         TAO_AV_Acceptor_Registry *acceptor_registry = TAO_AV_CORE::instance ()->acceptor_registry ();
02532                         result = acceptor_registry->open (this,
02533                                                           TAO_AV_CORE::instance (),
02534                                                           this->forward_flow_spec_set);
02535                         if (result < 0)
02536                           ACE_ERROR_RETURN ((LM_ERROR, "Acceptor_Registry::open failed\n"), 0);
02537                         result = this->mcast_entry_map_.bind (mcast_key, new_entry);
02538                         if (result < 0)
02539                           ACE_ERROR_RETURN ((LM_ERROR, "mcast_entry::bind failed"), 0);
02540                       }
02541                       break;
02542                     case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
02543                       // OUT implies we're the sink.
02544                       break;
02545                     default:
02546                       break;
02547                     }
02548                 }
02549             }
02550         }
02551     }
02552   catch (const CORBA::Exception& ex)
02553     {
02554       ex._tao_print_exception (
02555         "TAO_StreamEndPoint_A::multiconnect");
02556       return 0;
02557     }
02558   return 1;
02559 }


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 16:08:15 2008 for TAO_AV by doxygen 1.3.6