Public Member Functions | Protected Attributes

TAO_FlowEndPoint Class Reference

This class is used per flow e.g video flow and an audio flow to encapsulate the transport details. More...

#include <AVStreams_i.h>

Inheritance diagram for TAO_FlowEndPoint:
Inheritance graph
[legend]
Collaboration diagram for TAO_FlowEndPoint:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TAO_FlowEndPoint (void)
 default constructor.
 TAO_FlowEndPoint (const char *flowname, AVStreams::protocolSpec &protocols, const char *format)
int open (const char *flowname, AVStreams::protocolSpec &protocols, const char *format)
int set_flowname (const char *flowname)
virtual void set_flow_handler (const char *flowname, TAO_AV_Flow_Handler *handler)
virtual int set_protocol_object (const char *flowname, TAO_AV_Protocol_Object *object)
virtual CORBA::Boolean lock (void)
 lock the flow endpoint for a particular flow.
virtual void unlock (void)
 unlock the flow endpoint for subsequent use.
virtual void destroy (void)
 destroy this flow.
virtual
AVStreams::StreamEndPoint_ptr 
related_sep (void)
virtual void related_sep (AVStreams::StreamEndPoint_ptr related_sep)
virtual
AVStreams::FlowConnection_ptr 
related_flow_connection (void)
virtual void related_flow_connection (AVStreams::FlowConnection_ptr related_flow_connection)
 set method for the related flow connection attribute.
virtual AVStreams::FlowEndPoint_ptr get_connected_fep (void)
 returns the other flowendpoint to which this is connected.
virtual CORBA::Boolean use_flow_protocol (const char *fp_name, const CORBA::Any &fp_settings)
virtual void set_format (const char *format)
 sets the data format.
virtual void set_dev_params (const CosPropertyService::Properties &new_settings)
 sets the device parameters.
virtual void set_protocol_restriction (const AVStreams::protocolSpec &the_spec)
 sets the list of protocols to be used.
virtual CORBA::Boolean is_fep_compatible (AVStreams::FlowEndPoint_ptr fep)
 checks whether the passed flowendpoint is compatible with this.
virtual CORBA::Boolean set_peer (AVStreams::FlowConnection_ptr the_fc, AVStreams::FlowEndPoint_ptr the_peer_fep, AVStreams::QoS &the_qos)
 sets the peer flowendpoint.
virtual CORBA::Boolean set_Mcast_peer (AVStreams::FlowConnection_ptr the_fc, AVStreams::MCastConfigIf_ptr a_mcastconfigif, AVStreams::QoS &the_qos)
 sets the multicast peer flowendpoint, not implemented.
virtual CORBA::Boolean connect_to_peer (AVStreams::QoS &the_qos, const char *address, const char *use_flow_protocol)=0
virtual CORBA::Boolean connect_to_peer_i (TAO_FlowSpec_Entry::Role role, AVStreams::QoS &the_qos, const char *address, const char *use_flow_protocol)
 connect to the peer endpoint.
virtual char * go_to_listen (AVStreams::QoS &the_qos, CORBA::Boolean is_mcast, AVStreams::FlowEndPoint_ptr peer, char *&flowProtocol)=0
virtual char * go_to_listen_i (TAO_FlowSpec_Entry::Role role, AVStreams::QoS &the_qos, CORBA::Boolean is_mcast, AVStreams::FlowEndPoint_ptr peer, char *&flowProtocol)
 listen request from the peer.

Protected Attributes

AVStreams::StreamEndPoint_var related_sep_
 The related streamendpoint.
AVStreams::FlowConnection_var related_flow_connection_
 The related flow connection reference.
AVStreams::FlowEndPoint_var peer_fep_
 The peer flowendpoint reference.
AVStreams::protocolSpec protocols_
 Available protocols for this flowendpoint.
AVStreams::protocolSpec protocol_addresses_
 Address information for the protocols.
AVStreams::MCastConfigIf_var mcast_peer_
 The multicast peer endpoint.
CORBA::Boolean lock_
 Lock.
CORBA::String_var format_
CORBA::String_var flowname_
CosPropertyService::Properties dev_params_
TAO_AV_FlowSpecSet flow_spec_set_
CORBA::String_var reverse_channel_

Detailed Description

This class is used per flow e.g video flow and an audio flow to encapsulate the transport details.

Definition at line 883 of file AVStreams_i.h.


Constructor & Destructor Documentation

TAO_FlowEndPoint::TAO_FlowEndPoint ( void   ) 

default constructor.

Definition at line 3821 of file AVStreams_i.cpp.

  :lock_ (0)
{
}

TAO_FlowEndPoint::TAO_FlowEndPoint ( const char *  flowname,
AVStreams::protocolSpec protocols,
const char *  format 
)

Definition at line 3826 of file AVStreams_i.cpp.

{
  this->open (flowname, protocols, format);
}


Member Function Documentation

virtual CORBA::Boolean TAO_FlowEndPoint::connect_to_peer ( AVStreams::QoS the_qos,
const char *  address,
const char *  use_flow_protocol 
) [pure virtual]

This should be implemented in both the FlowProducer and consumer and hence is pure virtual since we need to know the role of the flowendpoint to create appropriate protocol objects. eg. in SFP to create Producer Object/ Consumer Object.

Implemented in TAO_FlowProducer, and TAO_FlowConsumer.

CORBA::Boolean TAO_FlowEndPoint::connect_to_peer_i ( TAO_FlowSpec_Entry::Role  role,
AVStreams::QoS the_qos,
const char *  address,
const char *  use_flow_protocol 
) [virtual]

connect to the peer endpoint.

Definition at line 4226 of file AVStreams_i.cpp.

{
  char direction [BUFSIZ];
  switch (role)
    {
    case TAO_FlowSpec_Entry::TAO_AV_PRODUCER:
      ACE_OS::strcpy (direction, "IN");
      break;
    case TAO_FlowSpec_Entry::TAO_AV_CONSUMER:
      ACE_OS::strcpy (direction, "OUT");
      break;
    default:
      break;
    }
  TAO_Forward_FlowSpec_Entry *entry;
  ACE_NEW_RETURN (entry,
                  TAO_Forward_FlowSpec_Entry (this->flowname_.in (),
                                              direction,
                                              this->format_.in (),
                                              use_flow_protocol,
                                              address),
                  0);
  this->flow_spec_set_.insert (entry);
  TAO_AV_Connector_Registry *connector_registry = TAO_AV_CORE::instance ()->connector_registry ();
  int result = connector_registry->open (this,
                                         TAO_AV_CORE::instance (),
                                         this->flow_spec_set_);
  if (result < 0)
    ACE_ERROR_RETURN ((LM_ERROR, "TAO_FlowEndPoint::connector_registry::open failed\n"), 0);
  this->reverse_channel_ = entry->get_local_addr_str ();
  return 1;
}

void TAO_FlowEndPoint::destroy ( void   )  [virtual]

destroy this flow.

Definition at line 3909 of file AVStreams_i.cpp.

{
  int result = TAO_AV_Core::deactivate_servant (this);
  if (result < 0)
    if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::destroy failed\n"));
  TAO_AV_FlowSpecSetItor end = this->flow_spec_set_.end ();
  for (TAO_AV_FlowSpecSetItor begin = this->flow_spec_set_.begin ();
       begin != end; ++begin)
    (*begin)->protocol_object ()->destroy ();
}

AVStreams::FlowEndPoint_ptr TAO_FlowEndPoint::get_connected_fep ( void   )  [virtual]

returns the other flowendpoint to which this is connected.

Definition at line 3947 of file AVStreams_i.cpp.

{
  return AVStreams::FlowEndPoint::_duplicate (this->peer_fep_.in ());
}

virtual char* TAO_FlowEndPoint::go_to_listen ( AVStreams::QoS the_qos,
CORBA::Boolean  is_mcast,
AVStreams::FlowEndPoint_ptr  peer,
char *&  flowProtocol 
) [pure virtual]

This should be implemented in both the FlowProducer and consumer and hence is pure virtual since we need to know the role of the flowendpoint to create appropriate protocol objects. eg. in SFP to create Producer Object/ Consumer Object.

Implemented in TAO_FlowProducer, and TAO_FlowConsumer.

char * TAO_FlowEndPoint::go_to_listen_i ( TAO_FlowSpec_Entry::Role  role,
AVStreams::QoS the_qos,
CORBA::Boolean  is_mcast,
AVStreams::FlowEndPoint_ptr  peer,
char *&  flowProtocol 
) [virtual]

listen request from the peer.

Definition at line 4141 of file AVStreams_i.cpp.

{
  char direction [BUFSIZ];
  switch (role)
    {
    case TAO_FlowSpec_Entry::TAO_AV_PRODUCER:
      ACE_OS::strcpy (direction, "IN");
      break;
    case TAO_FlowSpec_Entry::TAO_AV_CONSUMER:
      ACE_OS::strcpy (direction, "OUT");
      break;
    default:
      break;
    }
  AVStreams::protocolSpec my_protocol_spec, peer_protocol_spec;
  AVStreams::protocolSpec *temp_protocols = 0;
  CORBA::Any_var AvailableProtocols_ptr =
    peer_fep->get_property_value ("AvailableProtocols");
  AvailableProtocols_ptr.in () >>= temp_protocols;
  peer_protocol_spec = *temp_protocols;
  AvailableProtocols_ptr =
    this->get_property_value ("AvailableProtocols");
  AvailableProtocols_ptr.in () >>= temp_protocols;
  my_protocol_spec = *temp_protocols;
  int protocol_match = 0;
  CORBA::String_var listen_protocol;
  u_int i =0;
  for (i=0;i<my_protocol_spec.length ();i++)
    {
      CORBA::String_var my_protocol_string;
      for (u_int j=0;j<peer_protocol_spec.length ();j++)
        {
          CORBA::String_var peer_protocol_string;
          my_protocol_string = CORBA::string_dup (my_protocol_spec[i]);
          peer_protocol_string = CORBA::string_dup (peer_protocol_spec[j]);
          if (ACE_OS::strcmp (my_protocol_string.in (), peer_protocol_string.in ()) == 0)
            {
              listen_protocol = my_protocol_string;
              protocol_match = 1;
              break;
            }
        }
      if (protocol_match)
        break;
    }
  if (!protocol_match)
    ACE_ERROR_RETURN ((LM_ERROR, "TAO_FlowEndPoint::go_to_listen failed: no protoocol match\n"), 0);

  for (u_int j=0;j<this->protocol_addresses_.length ();j++)
    if (ACE_OS::strncmp (this->protocol_addresses_ [j], listen_protocol.in (), ACE_OS::strlen (listen_protocol.in ())) == 0)
      {
        // Now listen on that protocol.
        TAO_Forward_FlowSpec_Entry *entry;
        ACE_NEW_RETURN (entry,
                        TAO_Forward_FlowSpec_Entry (this->flowname_.in (),
                                                    direction,
                                                    this->format_.in (),
                                                    flowProtocol,
                                                    this->protocol_addresses_ [j]),
                        0);

        TAO_AV_Acceptor_Registry *acceptor_registry = TAO_AV_CORE::instance ()->acceptor_registry ();
        this->flow_spec_set_.insert (entry);
        int result = acceptor_registry->open (this,
                                              TAO_AV_CORE::instance (),
                                              this->flow_spec_set_);
        if (result < 0)
          return 0;
        char *listen_address = entry->get_local_addr_str ();
        char *address;
        ACE_NEW_RETURN (address,
                        char [BUFSIZ],
                        0);
        ACE_OS::sprintf (address, "%s=%s", listen_protocol.in (), listen_address);
        return address;
      }
  return 0;
}

CORBA::Boolean TAO_FlowEndPoint::is_fep_compatible ( AVStreams::FlowEndPoint_ptr  fep  )  [virtual]

checks whether the passed flowendpoint is compatible with this.

Definition at line 4045 of file AVStreams_i.cpp.

{
  const char *exception_message = "";
  try
    {
      // check whether the passed flowendpoint is compatible with this flowendpoint.
      // should we check for the availableFormats and choose one format.
      // get my format value
      CORBA::Any_var format_ptr;
      CORBA::String_var my_format, peer_format;

      exception_message = "TAO_FlowEndPoint::is_fep_compatible - Format";
      format_ptr = this->get_property_value ("Format");

      const char *temp_format = 0;
      format_ptr.in () >>= temp_format;
      my_format = CORBA::string_dup (temp_format);
      // get my peer's format value
      exception_message = "TAO_FlowEndPoint::is_fep_compatible - Format[2]";
      format_ptr = peer_fep->get_property_value ("Format");
      format_ptr.in () >>= temp_format;
      peer_format = CORBA::string_dup (temp_format);
      if (ACE_OS::strcmp (my_format.in (),
                          peer_format.in ()) != 0)
        return 0;

      // since formats are same, check for a common protocol
      CORBA::Any_var AvailableProtocols_ptr;
      AVStreams::protocolSpec my_protocol_spec, peer_protocol_spec;
      AVStreams::protocolSpec *temp_protocols = 0;

      exception_message =
        "TAO_FlowEndPoint::is_fep_compatible - AvailableProtocols";
      AvailableProtocols_ptr = this->get_property_value ("AvailableProtocols");
      AvailableProtocols_ptr.in () >>= temp_protocols;
      my_protocol_spec = *temp_protocols;

      exception_message =
        "TAO_FlowEndPoint::is_fep_compatible - AvailableProtocols[2]";
      AvailableProtocols_ptr = peer_fep->get_property_value ("AvailableProtocols");
      AvailableProtocols_ptr.in () >>= temp_protocols;
      peer_protocol_spec = *temp_protocols;

      int protocol_match = 0;
      for (u_int i=0;i<my_protocol_spec.length ();i++)
        {
          CORBA::String_var my_protocol_string;
          for (u_int j=0;j<peer_protocol_spec.length ();j++)
            {
              CORBA::String_var peer_protocol_string;
              my_protocol_string = CORBA::string_dup (my_protocol_spec[i]);
              peer_protocol_string = CORBA::string_dup (peer_protocol_spec[j]);
              if (ACE_OS::strcmp (my_protocol_string.in (), peer_protocol_string.in ()) == 0)
                {
                  protocol_match = 1;
                  break;
                }
            }
          if (protocol_match)
            break;
        }
      if (!protocol_match)
        return 0;
    }
  catch (const CosPropertyService::PropertyNotFound& nf)
    {
      nf._tao_print_exception (exception_message);
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("TAO_FlowEndPoint::is_fep_compatible");
      return 0;
    }
  return 1;
}

CORBA::Boolean TAO_FlowEndPoint::lock ( void   )  [virtual]

lock the flow endpoint for a particular flow.

Definition at line 3890 of file AVStreams_i.cpp.

{
  // lock the current flowendpoint

  if (this->lock_)
    return 0;
  this->lock_ = 1;
  return 1;
}

int TAO_FlowEndPoint::open ( const char *  flowname,
AVStreams::protocolSpec protocols,
const char *  format 
)

Definition at line 3840 of file AVStreams_i.cpp.

{
  this->flowname_ = flowname;
  this->format_ = format;

  if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_FlowEndPoint::open\n"));
  try
    {
      CORBA::Any flowname_any;
      flowname_any <<= flowname;
      this->define_property ("FlowName",
                             flowname_any);
      this->set_format (format);
      this->protocol_addresses_ = protocols;
      AVStreams::protocolSpec protocol_spec (protocols.length ());
      protocol_spec.length (protocols.length ());
      if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "%N:%l\n"));
      for (u_int i=0;i<protocols.length ();i++)
        {
          CORBA::String_var address = CORBA::string_dup (protocols [i]);
          TAO_Forward_FlowSpec_Entry entry ("", "", "", "", address.in ());
          protocol_spec [i] = CORBA::string_dup (entry.carrier_protocol_str ());
          if (TAO_debug_level > 0)
            ACE_DEBUG ((LM_DEBUG,
                        "[%s]\n",
                        static_cast<char const*>(protocol_spec[i])));
        }
      this->set_protocol_restriction (protocol_spec);
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("TAO_FlowEndPoint::open");
      return -1;
    }
  return 0;
}

void TAO_FlowEndPoint::related_flow_connection ( AVStreams::FlowConnection_ptr  related_flow_connection  )  [virtual]

set method for the related flow connection attribute.

Definition at line 3940 of file AVStreams_i.cpp.

{
  this->related_flow_connection_ = AVStreams::FlowConnection::_duplicate (related_flow_connection);
}

AVStreams::FlowConnection_ptr TAO_FlowEndPoint::related_flow_connection ( void   )  [virtual]

Definition at line 3934 of file AVStreams_i.cpp.

{
  return AVStreams::FlowConnection::_duplicate (this->related_flow_connection_.in ());
}

AVStreams::StreamEndPoint_ptr TAO_FlowEndPoint::related_sep ( void   )  [virtual]

get method for the related streamendpoint under which this flowendpoint is.

Definition at line 3921 of file AVStreams_i.cpp.

{

  return AVStreams::StreamEndPoint::_duplicate (this->related_sep_.in ());
}

void TAO_FlowEndPoint::related_sep ( AVStreams::StreamEndPoint_ptr  related_sep  )  [virtual]

set method for the related streamendpoint under which this flowendpoint is.

Definition at line 3928 of file AVStreams_i.cpp.

{
  this->related_sep_ = AVStreams::StreamEndPoint::_duplicate (related_sep);
}

void TAO_FlowEndPoint::set_dev_params ( const CosPropertyService::Properties &  new_settings  )  [virtual]

sets the device parameters.

Definition at line 3993 of file AVStreams_i.cpp.

{
  this->dev_params_ = new_settings;
  try
    {
      CORBA::Any DevParams_property;
      DevParams_property <<= new_settings;
      this->define_property ("DevParams",
                             DevParams_property);
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception (
        "TAO_FlowEndPoint::set_dev_params");
    }
}

void TAO_FlowEndPoint::set_flow_handler ( const char *  flowname,
TAO_AV_Flow_Handler handler 
) [virtual]

Reimplemented from TAO_Base_StreamEndPoint.

Definition at line 3834 of file AVStreams_i.cpp.

{
}

int TAO_FlowEndPoint::set_flowname ( const char *  flowname  ) 

Definition at line 3881 of file AVStreams_i.cpp.

{
  this->flowname_ = flowname;
  return 0;
}

void TAO_FlowEndPoint::set_format ( const char *  format  )  [virtual]

sets the data format.

Definition at line 3974 of file AVStreams_i.cpp.

{
  this->format_ = format;
  try
    {
      // make this a property so that is_fep_compatible can query this and
      // check if 2 flowendpoints are compatible.
      CORBA::Any format_val;
      format_val <<= format;
      this->define_property ("Format",
                             format_val);
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("TAO_FlowEndpoint::set_format");
    }
}

CORBA::Boolean TAO_FlowEndPoint::set_Mcast_peer ( AVStreams::FlowConnection_ptr  the_fc,
AVStreams::MCastConfigIf_ptr  a_mcastconfigif,
AVStreams::QoS the_qos 
) [virtual]

sets the multicast peer flowendpoint, not implemented.

Definition at line 4132 of file AVStreams_i.cpp.

{
  this->mcast_peer_ = AVStreams::MCastConfigIf::_duplicate (mcast_peer);
  return 0;
}

CORBA::Boolean TAO_FlowEndPoint::set_peer ( AVStreams::FlowConnection_ptr  the_fc,
AVStreams::FlowEndPoint_ptr  the_peer_fep,
AVStreams::QoS the_qos 
) [virtual]

sets the peer flowendpoint.

Definition at line 4122 of file AVStreams_i.cpp.

{
  this->peer_fep_ =
    AVStreams::FlowEndPoint::_duplicate (the_peer_fep);
  return 1;
}

int TAO_FlowEndPoint::set_protocol_object ( const char *  flowname,
TAO_AV_Protocol_Object object 
) [virtual]

Reimplemented from TAO_Base_StreamEndPoint.

Definition at line 4263 of file AVStreams_i.cpp.

{
  return 0;
}

void TAO_FlowEndPoint::set_protocol_restriction ( const AVStreams::protocolSpec the_spec  )  [virtual]

sets the list of protocols to be used.

Definition at line 4011 of file AVStreams_i.cpp.

{
  try
    {
      u_int i = 0;
      if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "%N:%l\n"));
      for (i=0;i<protocols.length ();i++)
        {
          const char *protocol = (protocols)[i];
          if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "%s\n", protocol));
        }
      CORBA::Any AvailableProtocols_property;
      AvailableProtocols_property <<= protocols;
      this->define_property ("AvailableProtocols",
                             AvailableProtocols_property);
      AVStreams::protocolSpec *temp_spec = 0;
      CORBA::Any_var temp_any = this->get_property_value ("AvailableProtocols");
      temp_any.in () >>= temp_spec;
      if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "%N:%l\n"));
      for (i=0;i<temp_spec->length ();i++)
        {
          const char *protocol = (*temp_spec)[i];
          if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "%s\n", protocol));
        }
      this->protocols_ = protocols;
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception (
        "TAO_FlowEndpoint::set_protocol_restriction");
    }
}

void TAO_FlowEndPoint::unlock ( void   )  [virtual]

unlock the flow endpoint for subsequent use.

Definition at line 3902 of file AVStreams_i.cpp.

{
  this->lock_ = 0;
}

CORBA::Boolean TAO_FlowEndPoint::use_flow_protocol ( const char *  fp_name,
const CORBA::Any fp_settings 
) [virtual]

Definition at line 3953 of file AVStreams_i.cpp.

{
  try
    {
      // Define the property called FlowProtocol
      CORBA::Any flowname_property;
      flowname_property <<= fp_name;
      this->define_property ("FlowProtocol",
                             flowname_property);
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception (
        "TAO_FlowEndPoint::use_flow_protocol");
      return 0;
    }
  return 1;
}


Member Data Documentation

CosPropertyService::Properties TAO_FlowEndPoint::dev_params_ [protected]

Definition at line 1023 of file AVStreams_i.h.

Definition at line 1024 of file AVStreams_i.h.

Definition at line 1022 of file AVStreams_i.h.

Definition at line 1021 of file AVStreams_i.h.

Lock.

Definition at line 1019 of file AVStreams_i.h.

AVStreams::MCastConfigIf_var TAO_FlowEndPoint::mcast_peer_ [protected]

The multicast peer endpoint.

Definition at line 1016 of file AVStreams_i.h.

AVStreams::FlowEndPoint_var TAO_FlowEndPoint::peer_fep_ [protected]

The peer flowendpoint reference.

Definition at line 1007 of file AVStreams_i.h.

Address information for the protocols.

Definition at line 1013 of file AVStreams_i.h.

Available protocols for this flowendpoint.

Definition at line 1010 of file AVStreams_i.h.

AVStreams::FlowConnection_var TAO_FlowEndPoint::related_flow_connection_ [protected]

The related flow connection reference.

Definition at line 1004 of file AVStreams_i.h.

AVStreams::StreamEndPoint_var TAO_FlowEndPoint::related_sep_ [protected]

The related streamendpoint.

Definition at line 1001 of file AVStreams_i.h.

Definition at line 1025 of file AVStreams_i.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines