TAO_UIPMC_Transport Class Reference

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

#include <UIPMC_Transport.h>

Inheritance diagram for TAO_UIPMC_Transport:

Inheritance graph
[legend]
Collaboration diagram for TAO_UIPMC_Transport:

Collaboration graph
[legend]
List of all members.

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 messaging_init (CORBA::Octet major, CORBA::Octet minor)
 Initialising the messaging object.

virtual ACE_Event_Handlerevent_handler_i (void)
virtual TAO_Connection_Handlerconnection_handler_i (void)
virtual TAO_Pluggable_Messagingmessaging_object (void)
virtual ssize_t send (iovec *iov, int iovcnt, size_t &bytes_transferred, const ACE_Time_Value *max_wait_time)
 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.

virtual int register_handler (void)

Public Member Functions

 TAO_UIPMC_Transport (TAO_UIPMC_Connection_Handler *handler, TAO_ORB_Core *orb_core, CORBA::Boolean flag)
 Constructor.

 ~TAO_UIPMC_Transport (void)
 Default destructor.

virtual int handle_input (TAO_Resume_Handle &rh, ACE_Time_Value *max_wait_time=0, int block=0)
 Look for the documentation in Transport.h.


Private Member Functions

int process_message (void)
 Process the message that we have read.

void write_unique_id (TAO_OutputCDR &miop_hdr, unsigned long unique)
 Construct and write a unique ID to the MIOP header.


Private Attributes

TAO_UIPMC_Connection_Handlerconnection_handler_
TAO_Pluggable_Messagingmessaging_object_
 Our messaging object.


Detailed Description

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

Definition at line 51 of file UIPMC_Transport.h.


Constructor & Destructor Documentation

TAO_UIPMC_Transport::TAO_UIPMC_Transport TAO_UIPMC_Connection_Handler handler,
TAO_ORB_Core orb_core,
CORBA::Boolean  flag
 

Constructor.

Definition at line 71 of file UIPMC_Transport.cpp.

References ACE_NEW, and MIOP_MAX_DGRAM_SIZE.

00074   : TAO_Transport (IOP::TAG_UIPMC,
00075                    orb_core)
00076   , connection_handler_ (handler)
00077   , messaging_object_ (0)
00078 {
00079   // Use the normal GIOP object
00080   ACE_NEW (this->messaging_object_,
00081            TAO_GIOP_Message_Base (orb_core,
00082                                   this,
00083                                   MIOP_MAX_DGRAM_SIZE));
00084 
00085   // Replace the default wait strategy with our own
00086   // since we don't support waiting on anything.
00087   delete this->ws_;
00088   ACE_NEW (this->ws_,
00089            TAO_UIPMC_Wait_Never (this));
00090 }

TAO_UIPMC_Transport::~TAO_UIPMC_Transport void   ) 
 

Default destructor.

Definition at line 92 of file UIPMC_Transport.cpp.

00093 {
00094   delete this->messaging_object_;
00095 }


Member Function Documentation

TAO_Connection_Handler * TAO_UIPMC_Transport::connection_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 104 of file UIPMC_Transport.cpp.

00105 {
00106   return this->connection_handler_;
00107 }

ACE_Event_Handler * TAO_UIPMC_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 98 of file UIPMC_Transport.cpp.

00099 {
00100   return this->connection_handler_;
00101 }

int TAO_UIPMC_Transport::handle_input TAO_Resume_Handle rh,
ACE_Time_Value max_wait_time = 0,
int  block = 0
[virtual]
 

Look for the documentation in Transport.h.

Reimplemented from TAO_Transport.

Definition at line 433 of file UIPMC_Transport.cpp.

References ACE_DEBUG, ACE_TEXT(), TAO_Transport_Mux_Strategy::connection_closed(), TAO_ORB_Core::input_cdr_dblock_allocator(), ACE_Message_Block::length(), LM_DEBUG, TAO_ORB_Core::locking_strategy(), ACE_CDR::mb_align(), ACE_OS::memset(), messaging_object(), MIOP_MAX_DGRAM_SIZE, TAO_Pluggable_Messaging::parse_next_message(), TAO_Transport::process_parsed_messages(), ACE_Message_Block::rd_ptr(), recv(), ACE_Message_Block::space(), ssize_t, TAO_debug_level, and ACE_Message_Block::wr_ptr().

00436 {
00437   // If there are no messages then we can go ahead to read from the
00438   // handle for further reading..
00439 
00440   // The buffer on the stack which will be used to hold the input
00441   // messages
00442   char buf [MIOP_MAX_DGRAM_SIZE];
00443 
00444 #if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE)
00445   (void) ACE_OS::memset (buf,
00446                          '\0',
00447                          sizeof buf);
00448 #endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
00449 
00450   // Create a data block
00451   ACE_Data_Block db (sizeof (buf),
00452                      ACE_Message_Block::MB_DATA,
00453                      buf,
00454                      this->orb_core_->input_cdr_buffer_allocator (),
00455                      this->orb_core_->locking_strategy (),
00456                      ACE_Message_Block::DONT_DELETE,
00457                      this->orb_core_->input_cdr_dblock_allocator ());
00458 
00459   // Create a message block
00460   ACE_Message_Block message_block (&db,
00461                                    ACE_Message_Block::DONT_DELETE,
00462                                    this->orb_core_->input_cdr_msgblock_allocator ());
00463 
00464 
00465   // Align the message block
00466   ACE_CDR::mb_align (&message_block);
00467 
00468 
00469   // Read the message into the  message block that we have created on
00470   // the stack.
00471   ssize_t n = this->recv (message_block.rd_ptr (),
00472                           message_block.space (),
00473                           max_wait_time);
00474 
00475   // If there is an error return to the reactor..
00476   if (n <= 0)
00477     {
00478       if (TAO_debug_level)
00479         {
00480           ACE_DEBUG ((LM_DEBUG,
00481                       ACE_TEXT ("TAO: (%P|%t|%N|%l) recv returned error on transport %d after fault %p\n"),
00482                       this->id (),
00483                       ACE_TEXT ("handle_input_i ()\n")));
00484         }
00485 
00486       if (n == -1)
00487         this->tms_->connection_closed ();
00488 
00489       return n;
00490     }
00491 
00492   // Set the write pointer in the stack buffer.
00493   message_block.wr_ptr (n);
00494 
00495 
00496   // Make a node of the message block..
00497   TAO_Queued_Data qd (&message_block);
00498   size_t mesg_length;
00499 
00500   // Parse the incoming message for validity. The check needs to be
00501   // performed by the messaging objects.
00502   if (this->messaging_object ()->parse_next_message (message_block,
00503                                                      qd,
00504                                                      mesg_length) == -1)
00505     {
00506       if (TAO_debug_level)
00507         {
00508           ACE_DEBUG ((LM_DEBUG,
00509                       ACE_TEXT ("TAO: (%P|%t|%N|%l) handle_input failed on transport %d after fault\n"),
00510                       this->id () ));
00511         }
00512 
00513       return -1;
00514     }
00515 
00516   if (message_block.length () > mesg_length)
00517     {
00518       if (TAO_debug_level)
00519         {
00520           ACE_DEBUG ((LM_DEBUG,
00521                       ACE_TEXT ("TAO: (%P|%t|%N|%l) handle_input  failed on transport %d after fault\n"),
00522                       this->id () ));
00523         }
00524 
00525       return -1;
00526     }
00527 
00528   // NOTE: We are not performing any queueing nor any checking for
00529   // missing data. We are assuming that ALL the data would be got in a
00530   // single read.
00531 
00532   // Process the message
00533   return this->process_parsed_messages (&qd, rh);
00534 }

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

Initialising the messaging object.

Implements TAO_Transport.

Definition at line 605 of file UIPMC_Transport.cpp.

References TAO_Pluggable_Messaging::init().

00607 {
00608   this->messaging_object_->init (major,
00609                                  minor);
00610   return 1;
00611 }

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

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

Implements TAO_Transport.

Definition at line 110 of file UIPMC_Transport.cpp.

Referenced by handle_input().

00111 {
00112   return this->messaging_object_;
00113 }

int TAO_UIPMC_Transport::process_message void   )  [private]
 

Process the message that we have read.

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

Read len bytes from into buf.

Implements TAO_Transport.

Definition at line 330 of file UIPMC_Transport.cpp.

References ACE_CDR_BYTE_ORDER, ACE_DEBUG, ACE_INET_Addr::get_host_addr(), ACE_INET_Addr::get_port_number(), LM_DEBUG, TAO_UIPMC_Connection_Handler::mcast_dgram(), ACE_OS::memmove(), MIOP_FLAGS_OFFSET, MIOP_ID_CONTENT_OFFSET, MIOP_ID_LENGTH_OFFSET, miop_magic, MIOP_MAGIC_OFFSET, MIOP_MAX_LENGTH_ID, MIOP_MIN_HEADER_SIZE, ACE_SOCK_Dgram::recv(), ssize_t, ACE_CDR::swap_4(), and TAO_debug_level.

Referenced by handle_input().

00333 {
00334   ACE_INET_Addr from_addr;
00335 
00336   ssize_t n = this->connection_handler_->mcast_dgram ().recv (buf,
00337                                                               len,
00338                                                               from_addr);
00339   if (TAO_debug_level > 5)
00340     {
00341       ACE_DEBUG ((LM_DEBUG,
00342                   "TAO_UIPMC_Transport::recv_i: received %d bytes from %s:%d\n",
00343                   n,
00344                   from_addr.get_host_addr (),
00345                   from_addr.get_port_number ()));
00346     }
00347 
00348   // Make sure that we at least have a MIOP header.
00349   if (n < MIOP_MIN_HEADER_SIZE)
00350     {
00351       if (TAO_debug_level > 0)
00352         {
00353           ACE_DEBUG ((LM_DEBUG,
00354                       "TAO_UIPMC_Transport::recv_i: packet of size %d is too small from %s:%d\n",
00355                       n,
00356                       from_addr.get_host_addr (),
00357                       from_addr.get_port_number ()));
00358         }
00359       return 0;
00360     }
00361 
00362   // Check for MIOP magic bytes.
00363   if (buf[MIOP_MAGIC_OFFSET] != miop_magic [0] ||
00364       buf[MIOP_MAGIC_OFFSET + 1] != miop_magic [1] ||
00365       buf[MIOP_MAGIC_OFFSET + 2] != miop_magic [2] ||
00366       buf[MIOP_MAGIC_OFFSET + 3] != miop_magic [3])
00367     {
00368       if (TAO_debug_level > 0)
00369         {
00370           ACE_DEBUG ((LM_DEBUG,
00371                       "TAO_UIPMC_Transport::recv_i: UIPMC packet didn't contain magic bytes.\n"));
00372         }
00373 
00374       return 0;
00375     }
00376 
00377   // Retrieve the byte order.
00378   // 0 = Big endian
00379   // 1 = Small endian
00380   CORBA::Octet byte_order = buf[MIOP_FLAGS_OFFSET] & 0x01;
00381 
00382   // Ignore the header version, other flags, packet length and number of packets.
00383 
00384   // Get the length of the ID.
00385   CORBA::ULong id_length;
00386 #if !defined (ACE_DISABLE_SWAP_ON_READ)
00387   if (byte_order == ACE_CDR_BYTE_ORDER)
00388     {
00389       id_length = *reinterpret_cast<ACE_CDR::ULong*> (&buf[MIOP_ID_LENGTH_OFFSET]);
00390     }
00391   else
00392     {
00393       ACE_CDR::swap_4 (&buf[MIOP_ID_LENGTH_OFFSET],
00394                        reinterpret_cast<char*> (&id_length));
00395     }
00396 #else
00397   id_length = *reinterpret_cast<ACE_CDR::ULong*> (&buf[MIOP_ID_LENGTH_OFFSET]);
00398 #endif /* ACE_DISABLE_SWAP_ON_READ */
00399 
00400   // Make sure that the length field is legal.
00401   if (id_length > MIOP_MAX_LENGTH_ID ||
00402       static_cast<ssize_t> (MIOP_ID_CONTENT_OFFSET + id_length) > n)
00403     {
00404       if (TAO_debug_level > 0)
00405         {
00406           ACE_DEBUG ((LM_DEBUG,
00407                       "TAO_UIPMC_Transport::recv_i: Invalid ID length.\n"));
00408         }
00409 
00410       return 0;
00411     }
00412 
00413   // Trim off the header for now.
00414   ssize_t miop_header_size = (MIOP_ID_CONTENT_OFFSET + id_length + 7) & ~0x7;
00415   if (miop_header_size > n)
00416     {
00417       if (TAO_debug_level > 0)
00418         {
00419           ACE_DEBUG ((LM_DEBUG,
00420                       "TAO_UIPMC_Transport::recv_i: MIOP packet not large enough for padding.\n"));
00421         }
00422 
00423       return 0;
00424     }
00425 
00426   n -= miop_header_size;
00427   ACE_OS::memmove (buf, buf + miop_header_size, n);
00428 
00429   return n;
00430 }

int TAO_UIPMC_Transport::register_handler void   )  [protected, virtual]
 

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

Reimplemented from TAO_Transport.

Definition at line 537 of file UIPMC_Transport.cpp.

00538 {
00539   // We never register register the handler with the reactor
00540   // as we never need to be informed about any incoming data,
00541   // assuming we only use one-ways.
00542   // If we would register and ICMP Messages would arrive, e.g
00543   // due to a not reachable server, we would get informed - as this
00544   // disturbs the general MIOP assumptions of not being
00545   // interested in any network failures, we ignore ICMP messages.
00546   return 0;
00547 }

ssize_t TAO_UIPMC_Transport::send iovec iov,
int  iovcnt,
size_t &  bytes_transferred,
const ACE_Time_Value max_wait_time
[protected, virtual]
 

Write the complete Message_Block chain to the connection.

Implements TAO_Transport.

Definition at line 150 of file UIPMC_Transport.cpp.

References ACE_DEBUG, ACE_IOV_MAX, ACE_TEXT(), TAO_UIPMC_Connection_Handler::addr(), ACE_OutputCDR::current(), TAO_UIPMC_Connection_Handler::dgram(), ACE_INET_Addr::get_host_addr(), ACE_INET_Addr::get_port_number(), MIOP_Packet::iov, iovec::iov_base, iovec::iov_len, MIOP_Packet::iovcnt, MIOP_Packet::length, LM_DEBUG, MIOP_HEADER_SIZE, miop_magic, MIOP_MAX_DGRAM_SIZE, MIOP_MAX_FRAGMENTS, UIPMC_Message_Block_Data_Iterator::next_block(), ACE_Message_Block::rd_ptr(), ACE_SOCK_Dgram::send(), ssize_t, TAO_debug_level, TAO_ENCAP_BYTE_ORDER, ACE_Message_Block::wr_ptr(), ACE_OutputCDR::write_octet(), ACE_OutputCDR::write_octet_array(), ACE_OutputCDR::write_short(), ACE_OutputCDR::write_ulong(), and write_unique_id().

00153 {
00154   const ACE_INET_Addr &addr = this->connection_handler_->addr ();
00155   bytes_transferred = 0;
00156 
00157   // Calculate the bytes to send.  This value is only used for
00158   // error conditions to fake a good return.  We do this for
00159   // semantic consistency with DIOP, and since errors aren't
00160   // handled correctly from send_i (our fault).  If these
00161   // semantics are not desirable, the error handling problems
00162   // that need to be fixed can be found in
00163   // UIPMC_Connection_Handler::decr_refcount which will need to
00164   // deregister the connection handler from the UIPMC_Connector
00165   // cache.
00166   ssize_t bytes_to_send = 0;
00167   for (int i = 0; i < iovcnt; i++)
00168      bytes_to_send += iov[i].iov_len;
00169 
00170   MIOP_Packet fragments[MIOP_MAX_FRAGMENTS];
00171   MIOP_Packet *current_fragment;
00172   int num_fragments = 1;
00173 
00174   UIPMC_Message_Block_Data_Iterator mb_iter (iov, iovcnt);
00175 
00176   // Initialize the first fragment
00177   current_fragment = &fragments[0];
00178   current_fragment->iovcnt = 1;  // The MIOP Header
00179   current_fragment->length = MIOP_HEADER_SIZE;
00180 
00181   // Go through all of the message blocks.
00182   while (mb_iter.next_block (MIOP_MAX_DGRAM_SIZE - current_fragment->length,
00183                              current_fragment->iov[current_fragment->iovcnt]))
00184     {
00185       // Increment the length and iovcnt.
00186       current_fragment->length += current_fragment->iov[current_fragment->iovcnt].iov_len;
00187       current_fragment->iovcnt++;
00188 
00189       // Check if we've filled up this fragment or if we've run out of
00190       // iov entries.
00191       if (current_fragment->length == MIOP_MAX_DGRAM_SIZE ||
00192           current_fragment->iovcnt == ACE_IOV_MAX)
00193         {
00194           // Make a new fragment.
00195           num_fragments++;
00196 
00197           // Check if too many fragments
00198           if (num_fragments > MIOP_MAX_FRAGMENTS)
00199             {
00200               // This is an error as we do not send more.
00201               // Silently drop the message but log an error.
00202 
00203               // Pluggable_Messaging::transport_message only
00204               // cares if it gets -1 or 0 so we can return a
00205               // partial length and it will think all has gone
00206               // well.
00207               if (TAO_debug_level > 0)
00208                 {
00209                   ACE_DEBUG ((LM_DEBUG,
00210                               ACE_TEXT ("\n\nTAO (%P|%t) ")
00211                               ACE_TEXT ("UIPMC_Transport::send_i ")
00212                               ACE_TEXT ("Message of size %d needs too many MIOP fragments (max is %d).\n")
00213                               ACE_TEXT ("You may be able to increase ACE_MAX_DGRAM_SIZE.\n"),
00214                               bytes_to_send,
00215                               MIOP_MAX_FRAGMENTS));
00216                 }
00217 
00218               // Pretend it is o.k.  See note by bytes_to_send calculation.
00219               bytes_transferred = bytes_to_send;
00220               return 1;
00221             }
00222 
00223           // Otherwise, initialize another fragment.
00224           current_fragment++;
00225           current_fragment->iovcnt = 1;  // The MIOP Header
00226           current_fragment->length = MIOP_HEADER_SIZE;
00227         }
00228     }
00229 
00230   // Build a generic MIOP Header.
00231 
00232   // Allocate space on the stack for the header (add 8 to account for
00233   // the possibility of adjusting for alignment).
00234   char header_buffer[MIOP_HEADER_SIZE + 8];
00235   TAO_OutputCDR miop_hdr (header_buffer, MIOP_HEADER_SIZE + 8);
00236 
00237   miop_hdr.write_octet_array (miop_magic, 4);   // Magic
00238   miop_hdr.write_octet (0x10);                  // Version
00239   CORBA::Octet *flags_field = reinterpret_cast<CORBA::Octet *> (miop_hdr.current ()->wr_ptr ());
00240 
00241   // Write flags octet:
00242   //  Bit        Description
00243   //   0         Endian
00244   //   1         Stop message flag (Assigned later)
00245   //   2 - 7     Set to 0
00246   miop_hdr.write_octet (TAO_ENCAP_BYTE_ORDER);  // Flags
00247 
00248   // Packet Length
00249   // NOTE: We can save pointers and write them later without byte swapping since
00250   //       in CORBA, the sender chooses the endian.
00251   CORBA::UShort *packet_length = reinterpret_cast<CORBA::UShort *> (miop_hdr.current ()->wr_ptr ());
00252   miop_hdr.write_short (0);
00253 
00254   // Packet number
00255   CORBA::ULong *packet_number = reinterpret_cast<CORBA::ULong *> (miop_hdr.current ()->wr_ptr ());
00256   miop_hdr.write_ulong (0);
00257 
00258   // Number of packets field
00259   miop_hdr.write_ulong (num_fragments);
00260 
00261   // UniqueId
00262   ptrdiff_t unique_id = reinterpret_cast<ptrdiff_t> (iov);
00263   this->write_unique_id (miop_hdr,
00264                          static_cast<unsigned long> (unique_id));
00265 
00266   // Send the buffers.
00267   current_fragment = &fragments[0];
00268   while (num_fragments > 0 &&
00269          current_fragment->iovcnt > 1)
00270     {
00271       // Fill in the packet length header field.
00272       *packet_length = static_cast<CORBA::UShort> (current_fragment->length);
00273 
00274       // If this is the last fragment, set the stop message flag.
00275       if (num_fragments == 1)
00276         {
00277           *flags_field |= 0x02;
00278         }
00279 
00280       // Setup the MIOP header in the iov list.
00281       current_fragment->iov[0].iov_base = miop_hdr.current ()->rd_ptr ();
00282       current_fragment->iov[0].iov_len = MIOP_HEADER_SIZE;
00283 
00284       // Send the fragment. - Need to check for errors!!
00285       ssize_t rc = this->connection_handler_->dgram ().send (current_fragment->iov,
00286                                                              current_fragment->iovcnt,
00287                                                              addr);
00288 
00289       if (rc <= 0)
00290         {
00291           if (TAO_debug_level > 0)
00292             {
00293               ACE_DEBUG ((LM_DEBUG,
00294                           ACE_TEXT ("\n\nTAO (%P|%t) ")
00295                           ACE_TEXT ("UIPMC_Transport::send")
00296                           ACE_TEXT (" %p\n\n"),
00297                           ACE_TEXT ("Error returned from transport:")));
00298             }
00299 
00300             // Pretend it is o.k.  See note by bytes_to_send calculation.
00301             bytes_transferred = bytes_to_send;
00302             return 1;
00303         }
00304 
00305       // Increment the number of bytes transferred, but don't
00306       // count the MIOP header that we added.
00307       bytes_transferred += rc - MIOP_HEADER_SIZE;
00308 
00309       if (TAO_debug_level > 0)
00310         {
00311           ACE_DEBUG ((LM_DEBUG,
00312                       "TAO_UIPMC_Transport::send_i: sent %d bytes to %s:%d\n",
00313                       rc,
00314                       addr.get_host_addr (),
00315                       addr.get_port_number ()));
00316         }
00317 
00318       // Go to the next fragment.
00319       (*packet_number)++;
00320       ++current_fragment;
00321       --num_fragments;
00322     }
00323 
00324   // Return total bytes transferred.
00325   return bytes_transferred;
00326 }

int TAO_UIPMC_Transport::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]
 

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

Implements TAO_Transport.

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

00575 {
00576   // Format the message in the stream first
00577   if (this->messaging_object_->format_message (stream) != 0)
00578     return -1;
00579 
00580   // Strictly speaking, should not need to loop here because the
00581   // socket never gets set to a nonblocking mode ... some Linux
00582   // versions seem to need it though.  Leaving it costs little.
00583 
00584   // This guarantees to send all data (bytes) or return an error.
00585   ssize_t n = this->send_message_shared (stub,
00586                                          message_semantics,
00587                                          stream.begin (),
00588                                          max_wait_time);
00589 
00590   if (n == -1)
00591     {
00592       if (TAO_debug_level)
00593         ACE_DEBUG ((LM_DEBUG,
00594                     ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"),
00595                     this->id (),
00596                     ACE_TEXT ("send_message ()\n")));
00597 
00598       return -1;
00599     }
00600 
00601   return 1;
00602 }

int TAO_UIPMC_Transport::send_request TAO_Stub stub,
TAO_ORB_Core orb_core,
TAO_OutputCDR stream,
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 550 of file UIPMC_Transport.cpp.

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

00555 {
00556   if (this->ws_->sending_request (orb_core,
00557                                   message_semantics) == -1)
00558     return -1;
00559 
00560   if (this->send_message (stream,
00561                           stub,
00562                           message_semantics,
00563                           max_wait_time) == -1)
00564 
00565     return -1;
00566 
00567   return 0;
00568 }

void TAO_UIPMC_Transport::write_unique_id TAO_OutputCDR miop_hdr,
unsigned long  unique
[private]
 

Construct and write a unique ID to the MIOP header.

Definition at line 117 of file UIPMC_Transport.cpp.

References MIOP_ID_DEFAULT_LENGTH, ACE_OutputCDR::write_octet_array(), and ACE_OutputCDR::write_ulong().

Referenced by send().

00118 {
00119   // We currently construct a unique ID for each MIOP message by
00120   // concatenating the address of the buffer to a counter.  We may
00121   // also need to use a MAC address or something more unique to
00122   // fully comply with the MIOP specification.
00123 
00124   static unsigned long counter = 1;  // Don't worry about race conditions on counter,
00125                                      // since buffer addresses can't be the same if
00126                                      // this is being called simultaneously.
00127 
00128   CORBA::Octet unique_id[MIOP_ID_DEFAULT_LENGTH];
00129 
00130   unique_id[0] = static_cast<CORBA::Octet> (unique & 0xff);
00131   unique_id[1] = static_cast<CORBA::Octet> ((unique & 0xff00) >> 8);
00132   unique_id[2] = static_cast<CORBA::Octet> ((unique & 0xff0000) >> 16);
00133   unique_id[3] = static_cast<CORBA::Octet> ((unique & 0xff000000) >> 24);
00134 
00135   unique_id[4] = static_cast<CORBA::Octet> (counter & 0xff);
00136   unique_id[5] = static_cast<CORBA::Octet> ((counter & 0xff00) >> 8);
00137   unique_id[6] = static_cast<CORBA::Octet> ((counter & 0xff0000) >> 16);
00138   unique_id[7] = static_cast<CORBA::Octet> ((counter & 0xff000000) >> 24);
00139 
00140   unique_id[8] = 0;
00141   unique_id[9] = 0;
00142   unique_id[10] = 0;
00143   unique_id[11] = 0;
00144 
00145   miop_hdr.write_ulong (MIOP_ID_DEFAULT_LENGTH);
00146   miop_hdr.write_octet_array (unique_id, MIOP_ID_DEFAULT_LENGTH);
00147 }


Member Data Documentation

TAO_UIPMC_Connection_Handler* TAO_UIPMC_Transport::connection_handler_ [private]
 

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

Definition at line 122 of file UIPMC_Transport.h.

TAO_Pluggable_Messaging* TAO_UIPMC_Transport::messaging_object_ [private]
 

Our messaging object.

Definition at line 125 of file UIPMC_Transport.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:05:23 2006 for TAO_PortableGroup by doxygen 1.3.6