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)
 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
 

Constructor.

Definition at line 30 of file SCIOP_Transport.cpp.

References ACE_NEW, and TAO_TAG_SCIOP_PROFILE.

00032   : TAO_Transport (TAO_TAG_SCIOP_PROFILE,
00033                    orb_core)
00034   , connection_handler_ (handler)
00035   , messaging_object_ (0)
00036 {
00037   ACE_NEW (this->messaging_object_,
00038             TAO_GIOP_Message_Base (orb_core, this));
00039 }

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 41 of file SCIOP_Transport.cpp.

00042 {
00043   delete this->messaging_object_;
00044 }


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 53 of file SCIOP_Transport.cpp.

00054 {
00055   return this->connection_handler_;
00056 }

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 47 of file SCIOP_Transport.cpp.

00048 {
00049   return this->connection_handler_;
00050 }

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 196 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().

00199 {
00200   // Check whether we have a Bi Dir SCIOP policy set, whether the
00201   // messaging objects are ready to handle bidirectional connections
00202   // and also make sure that we have not recd. or sent any information
00203   // regarding this before...
00204   if (this->orb_core ()->bidir_giop_policy () &&
00205       this->messaging_object_->is_ready_for_bidirectional (msg) &&
00206       this->bidirectional_flag () < 0)
00207     {
00208       this->set_bidir_context_info (opdetails);
00209 
00210       // Set the flag to 1  (i.e., originating side)
00211       this->bidirectional_flag (1);
00212 
00213       // At the moment we enable BiDIR giop we have to get a new
00214       // request id to make sure that we follow the even/odd rule
00215       // for request id's. We only need to do this when enabled
00216       // it, after that the Transport Mux Strategy will make sure
00217       // that the rule is followed
00218       opdetails.request_id (this->tms ()->request_id ());
00219     }
00220 
00221   return TAO_Transport::generate_request_header (opdetails,
00222                                                  spec,
00223                                                  msg);
00224 }

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 303 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(), LM_ERROR, IIOP::ListenPoint::port, and CORBA::string_dup().

Referenced by set_bidir_context_info().

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

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 227 of file SCIOP_Transport.cpp.

References TAO_Pluggable_Messaging::init().

00229 {
00230   this->messaging_object_->init (major, minor);
00231 
00232   return 1;
00233 }

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

Access the underlying messaging object.

Implements TAO_Transport.

Definition at line 59 of file SCIOP_Transport.cpp.

00060 {
00061   return this->messaging_object_;
00062 }

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 78 of file SCIOP_Transport.cpp.

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

00081 {
00082   ssize_t n = this->connection_handler_->peer ().recv (buf,
00083                                                        len,
00084                                                        max_wait_time);
00085 
00086   // Do not print the error message if it is a timeout, which could
00087   // occur in thread-per-connection.
00088   if (n == -1 &&
00089       TAO_debug_level > 4 &&
00090       errno != ETIME)
00091     {
00092       ACE_DEBUG ((LM_DEBUG,
00093                   ACE_TEXT ("TAO (%P|%t) - SCIOP_Transport[%d]::recv, ")
00094                   ACE_TEXT ("read failure - %m\n"),
00095                   this->id ()));
00096     }
00097 
00098   // Error handling
00099   if (n == -1)
00100     {
00101       if (errno == EWOULDBLOCK)
00102         return 0;
00103 
00104 
00105       return -1;
00106     }
00107 
00108   // Most of the errors handling is common for
00109   // Now the message has been read
00110 
00111   // @@ What are the other error handling here??
00112   else if (n == 0)
00113     {
00114       return -1;
00115     }
00116 
00117   return n;
00118 }

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 65 of file SCIOP_Transport.cpp.

References ssize_t.

00068 {
00069   ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt,
00070                                                              max_wait_time);
00071   if (retval > 0)
00072     bytes_transferred = retval;
00073 
00074   return retval;
00075 }

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 144 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().

00148 {
00149   // Format the message in the stream first
00150   if (this->messaging_object_->format_message (stream) != 0)
00151     return -1;
00152 
00153   // This guarantees to send all data (bytes) or return an error.
00154   ssize_t n = this->send_message_shared (stub,
00155                                          message_semantics,
00156                                          stream.begin (),
00157                                          max_wait_time);
00158 
00159   if (n == -1)
00160     {
00161       if (TAO_debug_level)
00162         ACE_DEBUG ((LM_DEBUG,
00163                     ACE_TEXT ("TAO (%P|%t) - SCIOP_Transport[%d]::send_message, ")
00164                     ACE_TEXT (" write failure - %m\n"),
00165                     this->id ()));
00166       return -1;
00167     }
00168 
00169   return 1;
00170 }

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 173 of file SCIOP_Transport.cpp.

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

Referenced by send_message().

00177 {
00178   int r;
00179 
00180   {
00181     ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
00182 
00183     r = this->send_message_shared_i (stub, message_semantics,
00184                                      message_block, max_wait_time);
00185   }
00186 
00187   if (r == -1)
00188     {
00189       this->close_connection ();
00190     }
00191 
00192   return r;
00193 }

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 121 of file SCIOP_Transport.cpp.

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

00126 {
00127   if (this->ws_->sending_request (orb_core,
00128                                   message_semantics) == -1)
00129 
00130     return -1;
00131 
00132   if (this->send_message (stream,
00133                           stub,
00134                           message_semantics,
00135                           max_wait_time) == -1)
00136     return -1;
00137 
00138   this->first_request_sent();
00139 
00140   return 0;
00141 }

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 256 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().

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

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 236 of file SCIOP_Transport.cpp.

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

00237 {
00238   CORBA::Boolean byte_order;
00239   if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
00240     return -1;
00241 
00242   cdr.reset_byte_order (static_cast<int> (byte_order));
00243 
00244   IIOP::ListenPointList listen_list;
00245   if ((cdr >> listen_list) == 0)
00246     return -1;
00247 
00248   // As we have received a bidirectional information, set the flag to
00249   // 1 (i.e., non-originating side)
00250   this->bidirectional_flag (0);
00251 
00252   return this->connection_handler_->process_listen_point_list (listen_list);
00253 }


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 135 of file SCIOP_Transport.h.

TAO_Pluggable_Messaging* TAO_SCIOP_Transport::messaging_object_ [private]
 

Our messaging object.

Definition at line 138 of file SCIOP_Transport.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 16:03:13 2008 for TAO_Strategies by doxygen 1.3.6