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 2416 of file AVStreams_i.cpp.

References ACE_DEBUG, LM_DEBUG, and TAO_debug_level.

02417 {
02418   if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%P|%t) TAO_StreamEndPoint_A::TAO_StreamEndPoint_A: created\n"));
02419 }

TAO_StreamEndPoint_A::~TAO_StreamEndPoint_A ( void   )  [virtual]

Destructor.

Definition at line 2613 of file AVStreams_i.cpp.

02614 {
02615 }


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 2595 of file AVStreams_i.cpp.

02598 {
02599   throw AVStreams::notSupported ();
02600 }

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 2604 of file AVStreams_i.cpp.

02607 {
02608 
02609   throw AVStreams::notSupported ();
02610 
02611 }

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 2423 of file AVStreams_i.cpp.

References CORBA::Exception::_tao_print_exception(), ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, ACE_INET_Addr::addr_to_string(), TAO_FlowSpec_Entry::address(), TAO_FlowSpec_Entry::carrier_protocol_str(), TAO_FlowSpec_Entry::direction_str(), TAO_Forward_FlowSpec_Entry::entry_to_string(), TAO_FlowSpec_Entry::flow_protocol_str(), TAO_FlowSpec_Entry::flowname(), TAO_FlowSpec_Entry::format(), TAO_StreamEndPoint::forward_flow_spec_set, TAO_AV_QoS::get_flow_qos(), TAO_Pseudo_Var_T< T >::in(), ACE_Unbounded_Set_Ex< T, C >::insert(), ACE_Singleton< TYPE, ACE_LOCK >::instance(), CORBA::is_nil(), LM_DEBUG, LM_ERROR, TAO_StreamEndPoint::mcast_entry_map_, TAO_StreamEndPoint::mcast_port_, TAO_AV_Acceptor_Registry::open(), TAO_Base_StreamEndPoint::qos(), TAO_FlowConnection::set_mcast_addr(), TAO_FlowConnection::set_protocol(), ACE_OS::strcmp(), TAO_StreamEndPoint::streamctrl_, CORBA::string_dup(), TAO_FlowSpec_Entry::TAO_AV_DIR_IN, TAO_FlowSpec_Entry::TAO_AV_DIR_OUT, and TAO_debug_level.

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


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