TAO_SCIOP_Transport Class Reference

Specialization of the base TAO_Transport class to handle the SCIOP protocol. More...

#include <SCIOP_Transport.h>

Inheritance diagram for TAO_SCIOP_Transport:

Inheritance graph
[legend]
Collaboration diagram for TAO_SCIOP_Transport:

Collaboration graph
[legend]
List of all members.

Overridden Template Methods

Please check the documentation in "tao/Transport.h" for more details.

virtual int send_request (TAO_Stub *stub, TAO_ORB_Core *orb_core, TAO_OutputCDR &association, int message_semantics, ACE_Time_Value *max_wait_time)
virtual int send_message (TAO_OutputCDR &association, 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)
virtual int tear_listen_point_list (TAO_InputCDR &cdr)
virtual TAO_Connection_Handlerconnection_handler_i (void)
virtual ACE_Event_Handlerevent_handler_i (void)
virtual TAO_Pluggable_Messagingmessaging_object (void)
 Access the underlying messaging object.

virtual ssize_t send (iovec *iov, int iovcnt, size_t &bytes_transferred, const ACE_Time_Value *timeout=0)
virtual ssize_t recv (char *buf, size_t len, const ACE_Time_Value *s=0)
virtual int send_message_shared (TAO_Stub *stub, int message_semantics, const ACE_Message_Block *message_block, ACE_Time_Value *max_wait_time)

Public Member Functions

 TAO_SCIOP_Transport (TAO_SCIOP_Connection_Handler *handler, TAO_ORB_Core *orb_core, CORBA::Boolean flag)
 Constructor.


Protected Member Functions

virtual ~TAO_SCIOP_Transport (void)
 Destructor.


Private Member Functions

void set_bidir_context_info (TAO_Operation_Details &opdetails)
 Set the Bidirectional context info in the service context list.

int get_listen_point (IIOP::ListenPointList &listen_point_list, TAO_Acceptor *acceptor)

Private Attributes

TAO_SCIOP_Connection_Handlerconnection_handler_
TAO_Pluggable_Messagingmessaging_object_
 Our messaging object.


Detailed Description

Specialization of the base TAO_Transport class to handle the SCIOP protocol.

Specialization of the base TAO_Transport class to handle the SCIOP protocol.

Definition at line 48 of file SCIOP_Transport.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_SCIOP_Transport::TAO_SCIOP_Transport TAO_SCIOP_Connection_Handler handler,
TAO_ORB_Core orb_core,
CORBA::Boolean  flag
 

Constructor.

Definition at line 30 of file SCIOP_Transport.cpp.

References ACE_NEW, and TAO_TAG_SCIOP_PROFILE.

00033   : TAO_Transport (TAO_TAG_SCIOP_PROFILE,
00034                    orb_core)
00035   , connection_handler_ (handler)
00036   , messaging_object_ (0)
00037 {
00038 #if 0
00039   // First step in deprecating this.
00040   if (flag)
00041     {
00042       // Use the lite version of the protocol
00043       ACE_NEW (this->messaging_object_,
00044                TAO_GIOP_Message_Lite (orb_core));
00045     }
00046   else
00047 #endif /*if 0*/
00048     {
00049       // Use the normal GIOP object
00050       ACE_NEW (this->messaging_object_,
00051                TAO_GIOP_Message_Base (orb_core, this));
00052     }
00053 }

TAO_SCIOP_Transport::~TAO_SCIOP_Transport void   )  [protected, virtual]
 

Destructor.

Protected destructor to enforce proper memory management through the reference counting mechanism.

Definition at line 55 of file SCIOP_Transport.cpp.

00056 {
00057   delete this->messaging_object_;
00058 }


Member Function Documentation

TAO_Connection_Handler * TAO_SCIOP_Transport::connection_handler_i void   )  [virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Implements TAO_Transport.

Definition at line 67 of file SCIOP_Transport.cpp.

00068 {
00069   return this->connection_handler_;
00070 }

ACE_Event_Handler * TAO_SCIOP_Transport::event_handler_i void   )  [protected, virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Implements TAO_Transport.

Definition at line 61 of file SCIOP_Transport.cpp.

00062 {
00063   return this->connection_handler_;
00064 }

int TAO_SCIOP_Transport::generate_request_header TAO_Operation_Details opdetails,
TAO_Target_Specification spec,
TAO_OutputCDR msg
[virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Reimplemented from TAO_Transport.

Definition at line 210 of file SCIOP_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().

00213 {
00214   // Check whether we have a Bi Dir SCIOP policy set, whether the
00215   // messaging objects are ready to handle bidirectional connections
00216   // and also make sure that we have not recd. or sent any information
00217   // regarding this before...
00218   if (this->orb_core ()->bidir_giop_policy () &&
00219       this->messaging_object_->is_ready_for_bidirectional (msg) &&
00220       this->bidirectional_flag () < 0)
00221     {
00222       this->set_bidir_context_info (opdetails);
00223 
00224       // Set the flag to 1  (i.e., originating side)
00225       this->bidirectional_flag (1);
00226 
00227       // At the moment we enable BiDIR giop we have to get a new
00228       // request id to make sure that we follow the even/odd rule
00229       // for request id's. We only need to do this when enabled
00230       // it, after that the Transport Mux Strategy will make sure
00231       // that the rule is followed
00232       opdetails.request_id (this->tms ()->request_id ());
00233     }
00234 
00235   return TAO_Transport::generate_request_header (opdetails,
00236                                                  spec,
00237                                                  msg);
00238 }

int TAO_SCIOP_Transport::get_listen_point IIOP::ListenPointList listen_point_list,
TAO_Acceptor acceptor
[private]
 

Add the listen points in to the if this connection is in the same interface as that of the endpoints in the

Definition at line 317 of file SCIOP_Transport.cpp.

References ACE_ERROR_RETURN, ACE_TEXT, TAO_SCIOP_Acceptor::endpoint_count(), TAO_SCIOP_Acceptor::endpoints(), ACE_INET_Addr::get_ip_address(), ACE_INET_Addr::get_port_number(), IIOP::ListenPoint::host, TAO_SCIOP_Acceptor::hostname(), TAO::unbounded_value_sequence< ListenPoint >::length(), LM_ERROR, IIOP::ListenPoint::port, and CORBA::string_dup().

Referenced by set_bidir_context_info().

00320 {
00321   TAO_SCIOP_Acceptor *sciop_acceptor =
00322     dynamic_cast<TAO_SCIOP_Acceptor *> (acceptor );
00323 
00324   // Get the array of endpoints serviced by TAO_SCIOP_Acceptor
00325   const ACE_INET_Addr *endpoint_addr =
00326     sciop_acceptor->endpoints ();
00327 
00328   // Get the endpoint count
00329   size_t count =
00330     sciop_acceptor->endpoint_count ();
00331 
00332   // Get the local address of the connection
00333   ACE_INET_Addr local_addr;
00334 
00335   if (this->connection_handler_->peer ().get_local_addr (local_addr)
00336       == -1)
00337     {
00338       ACE_ERROR_RETURN ((LM_ERROR,
00339                          ACE_TEXT ("(%P|%t) Could not resolve local ")
00340                          ACE_TEXT ("host address in ")
00341                          ACE_TEXT ("get_listen_point()\n")),
00342                         -1);
00343     }
00344 
00345   // Note: Looks like there is no point in sending the list of
00346   // endpoints on interfaces on which this connection has not
00347   // been established. If this is wrong, please correct me.
00348   CORBA::String_var local_interface;
00349 
00350   // Get the hostname for the local address
00351   if (sciop_acceptor->hostname (this->orb_core_,
00352                                local_addr,
00353                                local_interface.out ()) == -1)
00354     {
00355       ACE_ERROR_RETURN ((LM_ERROR,
00356                          ACE_TEXT ("(%P|%t) Could not resolve local host")
00357                          ACE_TEXT (" name \n")),
00358                         -1);
00359     }
00360 
00361   for (size_t index = 0;
00362        index != count;
00363        index++)
00364     {
00365       if (local_addr.get_ip_address()
00366           == endpoint_addr[index].get_ip_address())
00367         {
00368           // Get the count of the number of elements
00369           CORBA::ULong len = listen_point_list.length ();
00370 
00371           // Increase the length by 1
00372           listen_point_list.length (len + 1);
00373 
00374           // We have the connection and the acceptor endpoint on the
00375           // same interface
00376           IIOP::ListenPoint &point = listen_point_list[len];
00377           point.host = CORBA::string_dup (local_interface.in ());
00378           point.port = endpoint_addr[index].get_port_number ();
00379         }
00380     }
00381 
00382   return 1;
00383 }

int TAO_SCIOP_Transport::messaging_init CORBA::Octet  major,
CORBA::Octet  minor
[virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Implements TAO_Transport.

Definition at line 241 of file SCIOP_Transport.cpp.

References TAO_Pluggable_Messaging::init().

00243 {
00244   this->messaging_object_->init (major, minor);
00245 
00246   return 1;
00247 }

TAO_Pluggable_Messaging * TAO_SCIOP_Transport::messaging_object void   )  [protected, virtual]
 

Access the underlying messaging object.

Implements TAO_Transport.

Definition at line 73 of file SCIOP_Transport.cpp.

00074 {
00075   return this->messaging_object_;
00076 }

ssize_t TAO_SCIOP_Transport::recv char *  buf,
size_t  len,
const ACE_Time_Value s = 0
[protected, virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Implements TAO_Transport.

Definition at line 92 of file SCIOP_Transport.cpp.

References ACE_DEBUG, ACE_TEXT, ETIME, EWOULDBLOCK, LM_DEBUG, ssize_t, and TAO_debug_level.

00095 {
00096   ssize_t n = this->connection_handler_->peer ().recv (buf,
00097                                                        len,
00098                                                        max_wait_time);
00099 
00100   // Do not print the error message if it is a timeout, which could
00101   // occur in thread-per-connection.
00102   if (n == -1 &&
00103       TAO_debug_level > 4 &&
00104       errno != ETIME)
00105     {
00106       ACE_DEBUG ((LM_DEBUG,
00107                   ACE_TEXT ("TAO (%P|%t) - SCIOP_Transport[%d]::recv, ")
00108                   ACE_TEXT ("read failure - %m\n"),
00109                   this->id ()));
00110     }
00111 
00112   // Error handling
00113   if (n == -1)
00114     {
00115       if (errno == EWOULDBLOCK)
00116         return 0;
00117 
00118 
00119       return -1;
00120     }
00121 
00122   // Most of the errors handling is common for
00123   // Now the message has been read
00124 
00125   // @@ What are the other error handling here??
00126   else if (n == 0)
00127     {
00128       return -1;
00129     }
00130 
00131   return n;
00132 }

ssize_t TAO_SCIOP_Transport::send iovec iov,
int  iovcnt,
size_t &  bytes_transferred,
const ACE_Time_Value timeout = 0
[protected, virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Implements TAO_Transport.

Definition at line 79 of file SCIOP_Transport.cpp.

References ssize_t.

00082 {
00083   ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt,
00084                                                              max_wait_time);
00085   if (retval > 0)
00086     bytes_transferred = retval;
00087 
00088   return retval;
00089 }

int TAO_SCIOP_Transport::send_message TAO_OutputCDR association,
TAO_Stub stub = 0,
int  message_semantics = TAO_Transport::TAO_TWOWAY_REQUEST,
ACE_Time_Value max_time_wait = 0
[virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Implements TAO_Transport.

Definition at line 158 of file SCIOP_Transport.cpp.

References ACE_DEBUG, ACE_TEXT, ACE_OutputCDR::begin(), TAO_Pluggable_Messaging::format_message(), LM_DEBUG, send_message_shared(), ssize_t, and TAO_debug_level.

Referenced by send_request().

00162 {
00163   // Format the message in the stream first
00164   if (this->messaging_object_->format_message (stream) != 0)
00165     return -1;
00166 
00167   // This guarantees to send all data (bytes) or return an error.
00168   ssize_t n = this->send_message_shared (stub,
00169                                          message_semantics,
00170                                          stream.begin (),
00171                                          max_wait_time);
00172 
00173   if (n == -1)
00174     {
00175       if (TAO_debug_level)
00176         ACE_DEBUG ((LM_DEBUG,
00177                     ACE_TEXT ("TAO (%P|%t) - SCIOP_Transport[%d]::send_message, ")
00178                     ACE_TEXT (" write failure - %m\n"),
00179                     this->id ()));
00180       return -1;
00181     }
00182 
00183   return 1;
00184 }

int TAO_SCIOP_Transport::send_message_shared TAO_Stub stub,
int  message_semantics,
const ACE_Message_Block message_block,
ACE_Time_Value max_wait_time
[protected, virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Reimplemented from TAO_Transport.

Definition at line 187 of file SCIOP_Transport.cpp.

References ACE_GUARD_RETURN, TAO_Transport::close_connection(), and TAO_Transport::send_message_shared_i().

Referenced by send_message().

00191 {
00192   int r;
00193 
00194   {
00195     ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
00196 
00197     r = this->send_message_shared_i (stub, message_semantics,
00198                                      message_block, max_wait_time);
00199   }
00200 
00201   if (r == -1)
00202     {
00203       this->close_connection ();
00204     }
00205 
00206   return r;
00207 }

int TAO_SCIOP_Transport::send_request TAO_Stub stub,
TAO_ORB_Core orb_core,
TAO_OutputCDR association,
int  message_semantics,
ACE_Time_Value max_wait_time
[virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Implements TAO_Transport.

Definition at line 135 of file SCIOP_Transport.cpp.

References TAO_Transport::first_request_sent(), send_message(), and TAO_Wait_Strategy::sending_request().

00140 {
00141   if (this->ws_->sending_request (orb_core,
00142                                   message_semantics) == -1)
00143 
00144     return -1;
00145 
00146   if (this->send_message (stream,
00147                           stub,
00148                           message_semantics,
00149                           max_wait_time) == -1)
00150     return -1;
00151 
00152   this->first_request_sent();
00153 
00154   return 0;
00155 }

void TAO_SCIOP_Transport::set_bidir_context_info TAO_Operation_Details opdetails  )  [private]
 

Set the Bidirectional context info in the service context list.

Definition at line 270 of file SCIOP_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, TAO_ENCAP_BYTE_ORDER, and TAO_TAG_SCIOP_PROFILE.

Referenced by generate_request_header().

00271 {
00272   // Get a handle to the acceptor registry
00273   TAO_Acceptor_Registry &ar =
00274     this->orb_core ()->lane_resources ().acceptor_registry ();
00275 
00276   // Get the first acceptor in the registry
00277   TAO_AcceptorSetIterator acceptor = ar.begin ();
00278 
00279   IIOP::ListenPointList listen_point_list;
00280 
00281   for (;
00282        acceptor != ar.end ();
00283        acceptor++)
00284     {
00285       // Check whether it is a SCIOP acceptor
00286       if ((*acceptor)->tag () == TAO_TAG_SCIOP_PROFILE)
00287         {
00288           if (this->get_listen_point (listen_point_list,
00289                                       *acceptor) == -1)
00290             {
00291               ACE_ERROR ((LM_ERROR,
00292                           "TAO (%P|%t) - SCIOP_Transport::set_bidir_info, "
00293                           "error getting listen_point \n"));
00294 
00295               return;
00296             }
00297         }
00298     }
00299 
00300   // We have the ListenPointList at this point. Create a output CDR
00301   // stream at this point
00302   TAO_OutputCDR cdr;
00303 
00304   // Marshall the information into the stream
00305   if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0)
00306       || (cdr << listen_point_list) == 0)
00307     return;
00308 
00309   // Add this info in to the svc_list
00310   opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP,
00311                                                     cdr);
00312 
00313   return;
00314 }

int TAO_SCIOP_Transport::tear_listen_point_list TAO_InputCDR cdr  )  [virtual]
 

Todo:
These methods IMHO should have more meaningful names. The names seem to indicate nothing.

Reimplemented from TAO_Transport.

Definition at line 250 of file SCIOP_Transport.cpp.

References TAO_Transport::bidirectional_flag(), TAO_SCIOP_Connection_Handler::process_listen_point_list(), and ACE_InputCDR::reset_byte_order().

00251 {
00252   CORBA::Boolean byte_order;
00253   if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
00254     return -1;
00255 
00256   cdr.reset_byte_order (static_cast<int> (byte_order));
00257 
00258   IIOP::ListenPointList listen_list;
00259   if ((cdr >> listen_list) == 0)
00260     return -1;
00261 
00262   // As we have received a bidirectional information, set the flag to
00263   // 1 (i.e., non-originating side)
00264   this->bidirectional_flag (0);
00265 
00266   return this->connection_handler_->process_listen_point_list (listen_list);
00267 }


Member Data Documentation

TAO_SCIOP_Connection_Handler* TAO_SCIOP_Transport::connection_handler_ [private]
 

The connection service handler used for accessing lower layer communication protocols.

Definition at line 136 of file SCIOP_Transport.h.

TAO_Pluggable_Messaging* TAO_SCIOP_Transport::messaging_object_ [private]
 

Our messaging object.

Definition at line 139 of file SCIOP_Transport.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:41:36 2006 for TAO_Strategies by doxygen 1.3.6