#include <SSLIOP_Transport.h>
Inheritance diagram for TAO::SSLIOP::Transport:
Overridden Template Methods | |
These are implementations of template methods declared by TAO_Transport. | |
virtual int | send_request (TAO_Stub *stub, TAO_ORB_Core *orb_core, TAO_OutputCDR &stream, int message_semantics, ACE_Time_Value *max_wait_time) |
virtual int | send_message (TAO_OutputCDR &stream, TAO_Stub *stub=0, int message_semantics=TAO_Transport::TAO_TWOWAY_REQUEST, ACE_Time_Value *max_time_wait=0) |
virtual int | generate_request_header (TAO_Operation_Details &opdetails, TAO_Target_Specification &spec, TAO_OutputCDR &msg) |
virtual int | messaging_init (CORBA::Octet major, CORBA::Octet minor) |
Initialising the messaging object. | |
virtual int | tear_listen_point_list (TAO_InputCDR &cdr) |
Open teh service context list and process it. | |
virtual ACE_Event_Handler * | event_handler_i (void) |
virtual TAO_Connection_Handler * | connection_handler_i (void) |
virtual TAO_Pluggable_Messaging * | messaging_object (void) |
virtual ssize_t | send (iovec *iov, int iovcnt, size_t &bytes_transferred, const ACE_Time_Value *timeout=0) |
Write the complete Message_Block chain to the connection. | |
virtual ssize_t | recv (char *buf, size_t len, const ACE_Time_Value *s=0) |
Read len bytes from into buf. | |
Public Member Functions | |
Transport (Connection_Handler *handler, TAO_ORB_Core *orb_core) | |
Constructor. | |
~Transport (void) | |
Default destructor. | |
virtual int | handle_input (TAO_Resume_Handle &rh, ACE_Time_Value *max_wait_time=0) |
Private Member Functions | |
void | set_bidir_context_info (TAO_Operation_Details &opdetails) |
int | get_listen_point (IIOP::ListenPointList &listen_point_list, TAO_Acceptor *acceptor) |
Private Attributes | |
Connection_Handler * | connection_handler_ |
TAO_Pluggable_Messaging * | messaging_object_ |
Our messaging object. |
SSLIOP-specific transport implementation.
Definition at line 62 of file SSLIOP_Transport.h.
|
Constructor.
Definition at line 26 of file SSLIOP_Transport.cpp. References ACE_NEW.
00029 : TAO_Transport (IOP::TAG_INTERNET_IOP, orb_core), 00030 connection_handler_ (handler), 00031 messaging_object_ (0) 00032 { 00033 // Use the normal GIOP object 00034 ACE_NEW (this->messaging_object_, 00035 TAO_GIOP_Message_Base (orb_core, this)); 00036 } |
|
Default destructor.
Definition at line 38 of file SSLIOP_Transport.cpp.
00039 { 00040 delete this->messaging_object_; 00041 } |
|
Implements TAO_Transport. Definition at line 50 of file SSLIOP_Transport.cpp.
00051 { 00052 return this->connection_handler_; 00053 } |
|
Implements TAO_Transport. Definition at line 44 of file SSLIOP_Transport.cpp.
00045 { 00046 return this->connection_handler_; 00047 } |
|
Reimplemented from TAO_Transport. Definition at line 187 of file SSLIOP_Transport.cpp. References TAO_ORB_Core::bidir_giop_policy(), TAO_Transport::bidirectional_flag(), TAO_Transport::generate_request_header(), TAO_Pluggable_Messaging::is_ready_for_bidirectional(), TAO_Transport::orb_core(), TAO_Operation_Details::request_id(), and set_bidir_context_info().
00191 { 00192 // Check whether we have a Bi Dir IIOP policy set, whether the 00193 // messaging objects are ready to handle bidirectional connections 00194 // and also make sure that we have not recd. or sent any information 00195 // regarding this before... 00196 if (this->orb_core ()->bidir_giop_policy () 00197 && this->messaging_object_->is_ready_for_bidirectional (msg) 00198 && this->bidirectional_flag () < 0) 00199 { 00200 this->set_bidir_context_info (opdetails); 00201 00202 // Set the flag to 1 00203 this->bidirectional_flag (1); 00204 00205 // At the moment we enable BiDIR giop we have to get a new 00206 // request id to make sure that we follow the even/odd rule 00207 // for request id's. We only need to do this when enabled 00208 // it, after that the Transport Mux Strategy will make sure 00209 // that the rule is followed 00210 opdetails.request_id (this->tms ()->request_id ()); 00211 } 00212 00213 // We are going to pass on this request to the underlying messaging 00214 // layer. It should take care of this request 00215 return TAO_Transport::generate_request_header (opdetails, 00216 spec, 00217 msg); 00218 } |
|
Add the listen points in acceptor to the listen_point_list if this connection is in the same interface as that of the endpoints in the acceptor. Definition at line 301 of file SSLIOP_Transport.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), TAO_IIOP_Acceptor::endpoint_count(), TAO_IIOP_Acceptor::endpoints(), ACE_Addr::get_type(), IIOP::ListenPoint::host, TAO_IIOP_Acceptor::hostname(), LM_ERROR, ACE_Svc_Handler<, >::peer(), IIOP::ListenPoint::port, ACE_INET_Addr::set_port_number(), TAO::SSLIOP::Acceptor::ssl_component(), ACE_OS::strchr(), and CORBA::string_dup(). Referenced by set_bidir_context_info().
00304 { 00305 TAO::SSLIOP::Acceptor *ssliop_acceptor = 00306 dynamic_cast<TAO::SSLIOP::Acceptor *> (acceptor); 00307 00308 if (ssliop_acceptor == 0) 00309 return -1; 00310 00311 // Get the array of IIOP (not SSLIOP!) endpoints serviced by the 00312 // SSLIOP_Acceptor. 00313 const ACE_INET_Addr *endpoint_addr = 00314 ssliop_acceptor->endpoints (); 00315 00316 // Get the count 00317 const size_t count = 00318 ssliop_acceptor->endpoint_count (); 00319 00320 // The SSL port is stored in the SSLIOP::SSL component associated 00321 // with the SSLIOP_Acceptor. 00322 const ::SSLIOP::SSL &ssl = ssliop_acceptor->ssl_component (); 00323 00324 // Get the local address of the connection 00325 ACE_INET_Addr local_addr; 00326 { 00327 if (this->connection_handler_->peer ().get_local_addr (local_addr) 00328 == -1) 00329 { 00330 ACE_ERROR_RETURN ((LM_ERROR, 00331 ACE_TEXT ("(%P|%t) Could not resolve local host") 00332 ACE_TEXT (" address in get_listen_point()\n")), 00333 -1); 00334 } 00335 00336 } 00337 00338 // Note: Looks like there is no point in sending the list of 00339 // endpoints on interfaces on which this connection has not 00340 // been established. If this is wrong, please correct me. 00341 CORBA::String_var local_interface; 00342 00343 // Get the hostname for the local address 00344 if (ssliop_acceptor->hostname (this->orb_core_, 00345 local_addr, 00346 local_interface.out ()) == -1) 00347 { 00348 ACE_ERROR_RETURN ((LM_ERROR, 00349 ACE_TEXT ("(%P|%t) Could not resolve local host") 00350 ACE_TEXT (" name \n")), 00351 -1); 00352 } 00353 00354 #if defined (ACE_HAS_IPV6) 00355 // If this is an IPv6 decimal linklocal address containing a scopeid than 00356 // remove the scopeid from the information being sent. 00357 const char *cp_scope = 0; 00358 if (local_addr.get_type () == PF_INET6 && 00359 (cp_scope = ACE_OS::strchr (local_interface.in (), '%')) != 0) 00360 { 00361 CORBA::ULong len = cp_scope - local_interface.in (); 00362 local_interface[len] = '\0'; 00363 } 00364 #endif /* ACE_HAS_IPV6 */ 00365 00366 for (size_t index = 0; index < count; ++index) 00367 { 00368 // Make sure port numbers are equal so the following comparison 00369 // only concerns the IP(v4/v6) address. 00370 local_addr.set_port_number (endpoint_addr[index].get_port_number ()); 00371 00372 if (local_addr == endpoint_addr[index]) 00373 { 00374 // Get the count of the number of elements 00375 const CORBA::ULong len = listen_point_list.length (); 00376 00377 // Increase the length by 1 00378 listen_point_list.length (len + 1); 00379 00380 // We have the connection and the acceptor endpoint on the 00381 // same interface 00382 IIOP::ListenPoint & point = listen_point_list[len]; 00383 point.host = CORBA::string_dup (local_interface.in ()); 00384 00385 // All endpoints, if more than one, serviced by the 00386 // SSLIOP_Acceptor should be listening on the same port (due 00387 // to the bind to the INADDR_ANY address). 00388 point.port = ssl.port; 00389 } 00390 } 00391 00392 return 1; 00393 } |
|
Overload of the handle_input () in the TAO_Transport class. This is required to set up the state guard. The thread-per-connection and wait on RW strategies call this handle_input (). Reimplemented from TAO_Transport. Definition at line 62 of file SSLIOP_Transport.cpp. References TAO_Transport::handle_input().
00064 { 00065 int result = 0; 00066 00067 // Set up the SSLIOP::Current object. 00068 TAO::SSLIOP::State_Guard ssl_state_guard (this->connection_handler_, 00069 result); 00070 00071 if (result == -1) 00072 return -1; 00073 00074 return TAO_Transport::handle_input (rh, max_wait_time); 00075 } |
|
Initialising the messaging object.
Implements TAO_Transport. Definition at line 221 of file SSLIOP_Transport.cpp. References TAO_Pluggable_Messaging::init().
00223 { 00224 this->messaging_object_->init (major, 00225 minor); 00226 return 1; 00227 } |
|
Implements TAO_Transport. Definition at line 56 of file SSLIOP_Transport.cpp.
00057 { 00058 return this->messaging_object_; 00059 } |
|
Read len bytes from into buf.
Implements TAO_Transport. Definition at line 93 of file SSLIOP_Transport.cpp. References ACE_DEBUG, ACE_TEXT(), ETIME, EWOULDBLOCK, LM_DEBUG, ACE_Svc_Handler<, >::peer(), ssize_t, and TAO_debug_level.
00096 { 00097 const ssize_t n = this->connection_handler_->peer ().recv (buf, 00098 len, 00099 max_wait_time); 00100 00101 // Most of the errors handling is common for 00102 // Now the message has been read 00103 if (n == -1 00104 && TAO_debug_level > 4 00105 && errno != ETIME) 00106 { 00107 ACE_DEBUG ((LM_DEBUG, 00108 ACE_TEXT ("TAO (%P|%t) - %p \n"), 00109 ACE_TEXT ("TAO - read message failure ") 00110 ACE_TEXT ("recv_i () \n"))); 00111 } 00112 00113 // Error handling 00114 if (n == -1) 00115 { 00116 if (errno == EWOULDBLOCK) 00117 return 0; 00118 00119 return -1; 00120 } 00121 // @@ What are the other error handling here?? 00122 else if (n == 0) 00123 { 00124 return -1; 00125 } 00126 00127 return n; 00128 } |
|
Write the complete Message_Block chain to the connection.
Implements TAO_Transport. Definition at line 78 of file SSLIOP_Transport.cpp. References ACE_Svc_Handler<, >::peer(), and ssize_t.
00082 { 00083 const ssize_t retval = 00084 this->connection_handler_->peer ().sendv (iov, iovcnt, max_wait_time); 00085 00086 if (retval > 0) 00087 bytes_transferred = retval; 00088 00089 return retval; 00090 } |
|
Implements TAO_Transport. Definition at line 151 of file SSLIOP_Transport.cpp. References ACE_DEBUG, ACE_TEXT(), ACE_OutputCDR::begin(), TAO_Pluggable_Messaging::format_message(), LM_DEBUG, TAO_Transport::send_message_shared(), ssize_t, and TAO_debug_level. Referenced by send_request().
00155 { 00156 // Format the message in the stream first 00157 if (this->messaging_object_->format_message (stream) != 0) 00158 return -1; 00159 00160 // Strictly speaking, should not need to loop here because the 00161 // socket never gets set to a nonblocking mode ... some Linux 00162 // versions seem to need it though. Leaving it costs little. 00163 00164 // This guarantees to send all data (bytes) or return an error. 00165 const ssize_t n = this->send_message_shared (stub, 00166 message_semantics, 00167 stream.begin (), 00168 max_wait_time); 00169 00170 if (n == -1) 00171 { 00172 if (TAO_debug_level) 00173 ACE_DEBUG ((LM_DEBUG, 00174 ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport ") 00175 ACE_TEXT ("%d after fault %p\n"), 00176 this->id (), 00177 ACE_TEXT ("send_message ()\n"))); 00178 00179 return -1; 00180 } 00181 00182 return 1; 00183 } |
|
Implements TAO_Transport. Definition at line 131 of file SSLIOP_Transport.cpp. References send_message(), and TAO_Wait_Strategy::sending_request().
00136 { 00137 if (this->ws_->sending_request (orb_core, message_semantics) == -1) 00138 return -1; 00139 00140 if (this->send_message (stream, 00141 stub, 00142 message_semantics, 00143 max_wait_time) == -1) 00144 00145 return -1; 00146 00147 return 0; 00148 } |
|
Set the Bidirectional context info in the service context list. Definition at line 253 of file SSLIOP_Transport.cpp. References TAO_Thread_Lane_Resources::acceptor_registry(), ACE_ERROR, TAO_Acceptor_Registry::begin(), TAO_Acceptor_Registry::end(), get_listen_point(), TAO_ORB_Core::lane_resources(), LM_ERROR, TAO_Transport::orb_core(), TAO_Operation_Details::request_service_context(), TAO_Service_Context::set_context(), TAO_AcceptorSetIterator, and TAO_ENCAP_BYTE_ORDER. Referenced by generate_request_header().
00255 { 00256 // Get a handle on to the acceptor registry 00257 TAO_Acceptor_Registry &ar = 00258 this->orb_core ()->lane_resources ().acceptor_registry (); 00259 00260 // Get the first acceptor in the registry 00261 TAO_AcceptorSetIterator acceptor = ar.begin (); 00262 00263 IIOP::ListenPointList listen_point_list; 00264 00265 for (; 00266 acceptor != ar.end (); 00267 acceptor++) 00268 { 00269 // Check whether it is a IIOP acceptor 00270 if ((*acceptor)->tag () == IOP::TAG_INTERNET_IOP) 00271 { 00272 if (this->get_listen_point (listen_point_list, 00273 *acceptor) == -1) 00274 { 00275 ACE_ERROR ((LM_ERROR, 00276 "TAO (%P|%t) - SSLIOP_Transport::set_bidir_info, ", 00277 "error getting listen_point \n")); 00278 00279 return; 00280 } 00281 } 00282 } 00283 00284 // We have the ListenPointList at this point. Create a output CDR 00285 // stream at this point 00286 TAO_OutputCDR cdr; 00287 00288 // Marshall the information into the stream 00289 if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) 00290 || (cdr << listen_point_list) == 0) 00291 return; 00292 00293 // Add this info in to the svc_list 00294 opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP, 00295 cdr); 00296 return; 00297 } |
|
Open teh service context list and process it.
Reimplemented from TAO_Transport. Definition at line 231 of file SSLIOP_Transport.cpp. References TAO_Transport::bidirectional_flag(), TAO::SSLIOP::Connection_Handler::process_listen_point_list(), and ACE_InputCDR::reset_byte_order().
00232 { 00233 CORBA::Boolean byte_order; 00234 if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) 00235 return -1; 00236 00237 cdr.reset_byte_order (static_cast<int> (byte_order)); 00238 00239 IIOP::ListenPointList listen_list; 00240 if ((cdr >> listen_list) == 0) 00241 return -1; 00242 00243 // As we have received a bidirectional information, set the flag to 00244 // 0 00245 this->bidirectional_flag (0); 00246 00247 return this->connection_handler_->process_listen_point_list (listen_list); 00248 } |
|
The connection service handler used for accessing lower layer communication protocols. Definition at line 145 of file SSLIOP_Transport.h. |
|
Our messaging object.
Definition at line 148 of file SSLIOP_Transport.h. |