#include <IIOP_SSL_Connector.h>
Inheritance diagram for TAO::IIOP_SSL_Connector:
Concrete instance of the TAO_Connector class. Responsible for establishing a connection with a server and is called from the Connector_Registry.
Definition at line 43 of file IIOP_SSL_Connector.h.
typedef ACE_Strategy_Connector<IIOP_SSL_Connection_Handler, ACE_SOCK_CONNECTOR> TAO::IIOP_SSL_Connector::BASE_CONNECTOR |
Definition at line 70 of file IIOP_SSL_Connector.h.
typedef TAO_Connect_Concurrency_Strategy<IIOP_SSL_Connection_Handler> TAO::IIOP_SSL_Connector::CONNECT_CONCURRENCY_STRATEGY |
Definition at line 59 of file IIOP_SSL_Connector.h.
typedef TAO_Connect_Creation_Strategy<IIOP_SSL_Connection_Handler> TAO::IIOP_SSL_Connector::CONNECT_CREATION_STRATEGY |
Definition at line 62 of file IIOP_SSL_Connector.h.
typedef ACE_Connect_Strategy<IIOP_SSL_Connection_Handler, ACE_SOCK_CONNECTOR> TAO::IIOP_SSL_Connector::CONNECT_STRATEGY |
Definition at line 66 of file IIOP_SSL_Connector.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::IIOP_SSL_Connector::IIOP_SSL_Connector | ( | void | ) |
Constructor.
Definition at line 22 of file IIOP_SSL_Connector.cpp.
00023 : TAO_IIOP_Connector (), 00024 connect_strategy_ (), 00025 base_connector_ () 00026 { 00027 }
TAO::IIOP_SSL_Connector::~IIOP_SSL_Connector | ( | void | ) |
Destructor.
Definition at line 29 of file IIOP_SSL_Connector.cpp.
References ~IIOP_SSL_Connector().
Referenced by ~IIOP_SSL_Connector().
int TAO::IIOP_SSL_Connector::cancel_svc_handler | ( | TAO_Connection_Handler * | svc_handler | ) | [protected, virtual] |
Reimplemented from TAO_IIOP_Connector.
Definition at line 277 of file IIOP_SSL_Connector.cpp.
References base_connector_, ACE_Connector< SVC_HANDLER, >::cancel(), and cancel_svc_handler().
Referenced by cancel_svc_handler().
00279 { 00280 IIOP_SSL_Connection_Handler* handler= 00281 dynamic_cast<IIOP_SSL_Connection_Handler*> (svc_handler); 00282 00283 if (handler) 00284 // Cancel from the connector 00285 return this->base_connector_.cancel (handler); 00286 00287 return -1; 00288 }
int TAO::IIOP_SSL_Connector::close | ( | void | ) | [virtual] |
Reimplemented from TAO_IIOP_Connector.
Definition at line 65 of file IIOP_SSL_Connector.cpp.
References base_connector_, ACE_Strategy_Connector< SVC_HANDLER, >::close(), ACE_Strategy_Connector< SVC_HANDLER, >::concurrency_strategy(), and ACE_Strategy_Connector< SVC_HANDLER, >::creation_strategy().
00066 { 00067 delete this->base_connector_.creation_strategy (); 00068 delete this->base_connector_.concurrency_strategy (); 00069 return this->base_connector_.close (); 00070 }
TAO_Transport * TAO::IIOP_SSL_Connector::make_connection | ( | TAO::Profile_Transport_Resolver * | r, | |
TAO_Transport_Descriptor_Interface & | desc, | |||
ACE_Time_Value * | timeout = 0 | |||
) | [protected, virtual] |
Reimplemented from TAO_IIOP_Connector.
Definition at line 110 of file IIOP_SSL_Connector.cpp.
References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), base_connector_, TAO_IIOP_Connection_Handler::close(), TAO_Transport::close_connection(), ACE_Connector< SVC_HANDLER, >::connect(), TAO_Transport::connection_handler(), TAO_Transport_Descriptor_Interface::endpoint(), TAO_IIOP_Endpoint::host(), TAO_Transport::id(), TAO_Transport::is_connected(), TAO_LF_Event::keep_waiting(), LM_DEBUG, LM_ERROR, make_connection(), TAO_IIOP_Endpoint::object_addr(), TAO_IIOP_Endpoint::port(), TAO_Transport::purge_entry(), TAO_Wait_Strategy::register_handler(), TAO_Connect_Strategy::synch_options(), TAO_debug_level, ACE_Synch_Options::timeout(), TAO_Connection_Handler::transport(), TAO_Transport::wait_strategy(), and ACE_Time_Value::zero.
Referenced by make_connection().
00114 { 00115 TAO_IIOP_Endpoint *iiop_endpoint = 00116 dynamic_cast<TAO_IIOP_Endpoint *> (desc.endpoint ()); 00117 00118 if (iiop_endpoint == 0) 00119 return 0; 00120 00121 const ACE_INET_Addr &remote_address = 00122 iiop_endpoint->object_addr (); 00123 00124 if (TAO_debug_level > 4) 00125 ACE_DEBUG ((LM_DEBUG, 00126 ACE_TEXT ("(%P|%t) IIOP_SSL_Connector::connect ") 00127 ACE_TEXT ("making a new connection \n"))); 00128 00129 // Get the right synch options 00130 ACE_Synch_Options synch_options; 00131 00132 this->active_connect_strategy_->synch_options (max_wait_time, synch_options); 00133 00134 // If we don't need to block for a transport just set the timeout to 00135 // be zero. 00136 ACE_Time_Value tmp_zero (ACE_Time_Value::zero); 00137 if (!r->blocked_connect ()) 00138 { 00139 synch_options.timeout (ACE_Time_Value::zero); 00140 max_wait_time = &tmp_zero; 00141 } 00142 00143 00144 IIOP_SSL_Connection_Handler *svc_handler = 0; 00145 00146 // Connect. 00147 int result = 00148 this->base_connector_.connect (svc_handler, remote_address, synch_options); 00149 00150 // The connect() method creates the service handler and bumps the 00151 // #REFCOUNT# up one extra. There are three possibilities from 00152 // calling connect(): (a) connection succeeds immediately - in this 00153 // case, the #REFCOUNT# on the handler is two; (b) connection 00154 // completion is pending - in this case, the #REFCOUNT# on the 00155 // handler is also two; (c) connection fails immediately - in this 00156 // case, the #REFCOUNT# on the handler is one since close() gets 00157 // called on the handler. 00158 // 00159 // The extra reference count in 00160 // TAO_Connect_Creation_Strategy::make_svc_handler() is needed in 00161 // the case when connection completion is pending and we are going 00162 // to wait on a variable in the handler to changes, signifying 00163 // success or failure. Note, that this increment cannot be done 00164 // once the connect() returns since this might be too late if 00165 // another thread pick up the completion and potentially deletes the 00166 // handler before we get a chance to increment the reference count. 00167 00168 // Make sure that we always do a remove_reference 00169 ACE_Event_Handler_var svc_handler_auto_ptr (svc_handler); 00170 00171 TAO_Transport *transport = 00172 svc_handler->transport (); 00173 00174 if (result == -1) 00175 { 00176 // No immediate result, wait for completion 00177 if (errno == EWOULDBLOCK) 00178 { 00179 // Try to wait until connection completion. Incase we block, then we 00180 // get a connected transport or not. In case of non block we get 00181 // a connected or not connected transport 00182 if (!this->wait_for_connection_completion (r, 00183 transport, 00184 max_wait_time)) 00185 { 00186 if (TAO_debug_level > 2) 00187 ACE_ERROR ((LM_ERROR, "TAO (%P|%t) - IIOP_SSL_Connector::" 00188 "make_connection, " 00189 "wait for completion failed\n")); 00190 } 00191 } 00192 else 00193 { 00194 // Transport is not usable 00195 transport = 0; 00196 } 00197 } 00198 00199 // In case of errors transport is zero 00200 if (transport == 0) 00201 { 00202 // Give users a clue to the problem. 00203 if (TAO_debug_level) 00204 { 00205 ACE_DEBUG ((LM_ERROR, 00206 "TAO (%P|%t) - IIOP_SSL_Connector::make_connection, " 00207 "connection to <%s:%d> failed (%p)\n", 00208 iiop_endpoint->host (), iiop_endpoint->port (), 00209 "errno")); 00210 } 00211 00212 return 0; 00213 } 00214 00215 if (transport->connection_handler ()->keep_waiting ()) 00216 { 00217 svc_handler->add_reference (); 00218 } 00219 00220 // At this point, the connection has be successfully connected. 00221 // #REFCOUNT# is one. 00222 if (TAO_debug_level > 2) 00223 ACE_DEBUG ((LM_DEBUG, 00224 "TAO (%P|%t) - IIOP_SSL_Connector::make_connection, " 00225 "new connection to <%s:%d> on Transport[%d]\n", 00226 iiop_endpoint->host (), iiop_endpoint->port (), 00227 svc_handler->peer ().get_handle ())); 00228 00229 // Add the handler to Cache 00230 int retval = 00231 this->orb_core ()->lane_resources ().transport_cache ().cache_transport ( 00232 &desc, 00233 transport); 00234 00235 // Failure in adding to cache. 00236 if (retval != 0) 00237 { 00238 // Close the handler. 00239 svc_handler->close (); 00240 00241 if (TAO_debug_level > 0) 00242 { 00243 ACE_ERROR ((LM_ERROR, 00244 "TAO (%P|%t) - IIOP_SSL_Connector::make_connection, " 00245 "could not add the new connection to cache\n")); 00246 } 00247 00248 return 0; 00249 } 00250 00251 if (transport->is_connected () && 00252 transport->wait_strategy ()->register_handler () != 0) 00253 { 00254 // Registration failures. 00255 00256 // Purge from the connection cache, if we are not in the cache, this 00257 // just does nothing. 00258 (void) transport->purge_entry (); 00259 00260 // Close the handler. 00261 (void) transport->close_connection (); 00262 00263 if (TAO_debug_level > 0) 00264 ACE_ERROR ((LM_ERROR, 00265 "TAO (%P|%t) - IIOP_SSL_Connector [%d]::make_connection, " 00266 "could not register the transport " 00267 "in the reactor.\n", 00268 transport->id ())); 00269 00270 return 0; 00271 } 00272 00273 return transport; 00274 }
int TAO::IIOP_SSL_Connector::open | ( | TAO_ORB_Core * | orb_core | ) | [virtual] |
Reimplemented from TAO_IIOP_Connector.
Definition at line 34 of file IIOP_SSL_Connector.cpp.
References ACE_NEW_RETURN, base_connector_, connect_strategy_, ACE_Strategy_Connector< SVC_HANDLER, >::open(), and TAO_ORB_Core::thr_mgr().
00035 { 00036 this->orb_core (orb_core); 00037 00038 // Create our connect strategy 00039 if (this->create_connect_strategy () == -1) 00040 return -1; 00041 00042 // Our connect creation strategy 00043 CONNECT_CREATION_STRATEGY *connect_creation_strategy = 0; 00044 00045 ACE_NEW_RETURN (connect_creation_strategy, 00046 CONNECT_CREATION_STRATEGY (orb_core->thr_mgr (), 00047 orb_core), 00048 -1); 00049 00050 // Our activation strategy 00051 CONNECT_CONCURRENCY_STRATEGY *concurrency_strategy = 0; 00052 00053 ACE_NEW_RETURN (concurrency_strategy, 00054 CONNECT_CONCURRENCY_STRATEGY (orb_core), 00055 -1); 00056 00057 00058 return this->base_connector_.open (this->orb_core ()->reactor (), 00059 connect_creation_strategy, 00060 &this->connect_strategy_, 00061 concurrency_strategy); 00062 }
int TAO::IIOP_SSL_Connector::set_validate_endpoint | ( | TAO_Endpoint * | ep | ) | [protected, virtual] |
Reimplemented from TAO_IIOP_Connector.
Definition at line 73 of file IIOP_SSL_Connector.cpp.
References ACE_DEBUG, ACE_TEXT(), AF_INET, ACE_Addr::get_type(), LM_DEBUG, TAO_IIOP_Endpoint::object_addr(), set_validate_endpoint(), TAO_Endpoint::tag(), and TAO_debug_level.
Referenced by set_validate_endpoint().
00074 { 00075 if (endpoint->tag () != IOP::TAG_INTERNET_IOP) 00076 return -1; 00077 00078 TAO_IIOP_Endpoint *iiop_endpoint = 00079 dynamic_cast<TAO_IIOP_Endpoint *> (endpoint); 00080 00081 if (iiop_endpoint == 0) 00082 return -1; 00083 00084 const ACE_INET_Addr &remote_address = iiop_endpoint->object_addr (); 00085 00086 // Verify that the remote ACE_INET_Addr was initialized properly. 00087 // Failure can occur if hostname lookup failed when initializing the 00088 // remote ACE_INET_Addr. 00089 if (remote_address.get_type () != AF_INET 00090 #if defined (ACE_HAS_IPV6) 00091 && remote_address.get_type () != AF_INET6 00092 #endif /* ACE HAS_IPV6 */ 00093 ) 00094 { 00095 if (TAO_debug_level > 0) 00096 { 00097 ACE_DEBUG ((LM_DEBUG, 00098 ACE_TEXT ("TAO (%P|%t) - IIOP_SSL connection failed.\n") 00099 ACE_TEXT ("TAO (%P|%t) - This is most likely ") 00100 ACE_TEXT ("due to a hostname lookup failure.\n"))); 00101 } 00102 00103 return -1; 00104 } 00105 00106 return 0; 00107 }
BASE_CONNECTOR TAO::IIOP_SSL_Connector::base_connector_ [private] |
The connector initiating connection requests for IIOP_SSL.
Reimplemented from TAO_IIOP_Connector.
Definition at line 95 of file IIOP_SSL_Connector.h.
Referenced by cancel_svc_handler(), close(), make_connection(), and open().
CONNECT_STRATEGY TAO::IIOP_SSL_Connector::connect_strategy_ [private] |
Our connect strategy.
Reimplemented from TAO_IIOP_Connector.
Definition at line 92 of file IIOP_SSL_Connector.h.
Referenced by open().