#include <Transport.h>
Collaboration diagram for TAO_AV_Connector_Registry:
Public Member Functions | |
TAO_AV_Connector_Registry (void) | |
~TAO_AV_Connector_Registry (void) | |
int | open (TAO_Base_StreamEndPoint *endpoint, TAO_AV_Core *av_core, TAO_AV_FlowSpecSet &flow_spec_set) |
int | close (TAO_AV_Connector *connector) |
int | close_all (void) |
TAO_AV_ConnectorSetItor | begin (void) |
TAO_AV_ConnectorSetItor | end (void) |
Protected Attributes | |
TAO_AV_ConnectorSet | connectors_ |
Definition at line 273 of file Transport.h.
TAO_AV_Connector_Registry::TAO_AV_Connector_Registry | ( | void | ) |
int connect (TAO_FlowSpec_Entry *flowspec, TAO_AV_Transport *&transport); TAO_AV_Connector *get_connector (TAO_AV_Core::Protocol protocol); Return the connector bridges
Definition at line 50 of file Transport.cpp.
TAO_AV_Connector_Registry::~TAO_AV_Connector_Registry | ( | void | ) |
Definition at line 195 of file Transport.cpp.
References close_all().
00196 { 00197 this->close_all (); 00198 }
ACE_INLINE TAO_AV_ConnectorSetItor TAO_AV_Connector_Registry::begin | ( | void | ) |
Definition at line 62 of file Transport.inl.
References ACE_Unbounded_Set_Ex< T, C >::begin(), and connectors_.
Referenced by TAO_AV_Core::get_connector(), and TAO_AV_Core::remove_connector().
00063 { 00064 return this->connectors_.begin (); 00065 }
int TAO_AV_Connector_Registry::close | ( | TAO_AV_Connector * | connector | ) |
Definition at line 167 of file Transport.cpp.
References connectors_, and ACE_Unbounded_Set_Ex< T, C >::remove().
Referenced by close_all(), and TAO_AV_Core::remove_connector().
00168 { 00169 this->connectors_.remove (connector); 00170 00171 if (connector != 0) 00172 delete connector; 00173 return 0; 00174 }
int TAO_AV_Connector_Registry::close_all | ( | void | ) |
Definition at line 177 of file Transport.cpp.
References close(), connectors_, ACE_Unbounded_Set_Ex< T, C >::end(), and ACE_Unbounded_Set_Ex< T, C >::reset().
Referenced by ~TAO_AV_Connector_Registry().
00178 { 00179 for (TAO_AV_ConnectorSetItor i = this->connectors_.begin (); 00180 i != this->connectors_.end (); 00181 ++i) 00182 { 00183 if (*i != 0) 00184 continue; 00185 00186 (*i)->close (); 00187 00188 this->close (*i); 00189 } 00190 00191 this->connectors_.reset (); 00192 return 0; 00193 }
ACE_INLINE TAO_AV_ConnectorSetItor TAO_AV_Connector_Registry::end | ( | void | ) |
Definition at line 69 of file Transport.inl.
References connectors_, and ACE_Unbounded_Set_Ex< T, C >::end().
Referenced by TAO_AV_Core::get_connector(), and TAO_AV_Core::remove_connector().
00070 { 00071 return this->connectors_.end (); 00072 }
int TAO_AV_Connector_Registry::open | ( | TAO_Base_StreamEndPoint * | endpoint, | |
TAO_AV_Core * | av_core, | |||
TAO_AV_FlowSpecSet & | flow_spec_set | |||
) |
Definition at line 55 of file Transport.cpp.
References ACE_ERROR_RETURN, ACE_Unbounded_Set_Ex< T, C >::begin(), TAO_AV_Connector::connect(), connectors_, TAO_AV_Flow_Protocol_Factory::control_flow_factory(), ACE_Unbounded_Set_Ex< T, C >::end(), TAO_AV_Core::get_flow_protocol_factory(), TAO_AV_Core::get_transport_factory(), ACE_Unbounded_Set_Ex< T, C >::insert(), LM_ERROR, TAO_AV_Transport_Factory::make_connector(), TAO_AV_Connector::open(), ACE_OS::strcmp(), TAO_AV_Core::TAO_AV_CONTROL, and TAO_AV_Core::TAO_AV_DATA.
Referenced by TAO_FlowEndPoint::connect_to_peer_i(), TAO_AV_Core::init_forward_flows(), TAO_AV_Core::init_reverse_flows(), and TAO_StreamEndPoint_B::multiconnect().
00058 { 00059 00060 TAO_AV_FlowSpecSetItor last_flowspec = flow_spec_set.end (); 00061 00062 for (TAO_AV_FlowSpecSetItor flow_spec = flow_spec_set.begin (); 00063 flow_spec != last_flowspec; 00064 ++flow_spec) 00065 { 00066 TAO_FlowSpec_Entry *entry = (*flow_spec); 00067 ACE_Addr *address = entry->address (); 00068 const char *flow_protocol = entry->flow_protocol_str (); 00069 const char *transport_protocol = entry->carrier_protocol_str (); 00070 00071 if (ACE_OS::strcmp (flow_protocol,"") == 0) 00072 flow_protocol = transport_protocol; 00073 00074 if (address == 0) 00075 { 00076 // Protocol was specified without an endpoint. According to 00077 // the "iioploc" spec, this is valid. As such, we extend 00078 // this feature to all pluggable protocols. All TAO 00079 // pluggable protocols are expected to have the ability to 00080 // create a default endpoint. 00081 00082 ACE_ERROR_RETURN ((LM_ERROR, 00083 "Protocol was specified without an endpoint\n"), 00084 -1); 00085 } 00086 else 00087 { 00088 TAO_AV_Flow_Protocol_Factory *flow_factory = 00089 av_core->get_flow_protocol_factory (flow_protocol); 00090 TAO_AV_Transport_Factory *transport_factory = 00091 av_core->get_transport_factory (transport_protocol); 00092 00093 if ((flow_factory != 0) && (transport_factory != 0)) 00094 { 00095 // @@Naga:Instead of making a new connector every time we should try and see if a connector exists 00096 // for this transport already and hence we can reuse it. 00097 00098 TAO_AV_Connector *connector = transport_factory->make_connector (); 00099 00100 if (connector != 0) 00101 { 00102 // add connector to list. 00103 this->connectors_.insert (connector); 00104 00105 if (connector->open (endpoint, 00106 av_core, 00107 flow_factory) == -1) 00108 return -1; 00109 00110 TAO_AV_Transport *transport = 0; 00111 if (connector->connect (entry, 00112 transport, 00113 TAO_AV_Core::TAO_AV_DATA) == -1) 00114 return -1; 00115 entry->transport (transport); 00116 } 00117 else 00118 ACE_ERROR_RETURN ((LM_ERROR, 00119 "(%P|%t) Unable to create an " 00120 "connector for <%s>\n", 00121 entry->flowname ()), 00122 -1); 00123 00124 // Now see if the flow factory has a control flow factory. 00125 TAO_AV_Flow_Protocol_Factory *control_flow_factory = 00126 av_core->get_flow_protocol_factory(flow_factory->control_flow_factory ()); 00127 00128 if (control_flow_factory != 0) 00129 { 00130 TAO_AV_Connector *control_connector = 00131 transport_factory->make_connector (); 00132 00133 if (control_connector != 0) 00134 { 00135 // add connector to list. 00136 this->connectors_.insert (control_connector); 00137 00138 if (control_connector->open (endpoint, 00139 av_core, 00140 control_flow_factory) == -1) 00141 return -1; 00142 00143 TAO_AV_Transport *control_transport = 0; 00144 if (control_connector->connect (entry, 00145 control_transport, 00146 TAO_AV_Core::TAO_AV_CONTROL) == -1) 00147 return -1; 00148 entry->control_transport (control_transport); 00149 00150 // Now set the control object on the data flow object. 00151 entry->protocol_object ()->control_object (entry->control_protocol_object ()); 00152 } 00153 else 00154 ACE_ERROR_RETURN ((LM_ERROR, 00155 "(%P|%t) Unable to create an " 00156 "connector for <%s>\n", 00157 entry->flowname ()), 00158 -1); 00159 } 00160 } 00161 } 00162 } 00163 return 0; 00164 }
Definition at line 292 of file Transport.h.
Referenced by begin(), close(), close_all(), end(), and open().