#include <UIPMC_Transport.h>
Inheritance diagram for TAO_UIPMC_Transport< CONNECTION_HANDLER >:
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, TAO_Message_Semantics message_semantics, ACE_Time_Value *max_wait_time) |
virtual int | send_message (TAO_OutputCDR &stream, TAO_Stub *stub=0, TAO_Message_Semantics message_semantics=TAO_Transport::TAO_TWOWAY_REQUEST, ACE_Time_Value *max_time_wait=0) |
virtual ACE_Event_Handler * | event_handler_i (void) |
virtual TAO_Connection_Handler * | connection_handler_i (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 (CONNECTION_HANDLER *handler, TAO_ORB_Core *orb_core) | |
Constructor. | |
~TAO_UIPMC_Transport (void) | |
Default destructor. | |
virtual int | handle_input (TAO_Resume_Handle &rh, ACE_Time_Value *max_wait_time=0) |
Look for the documentation in Transport.h. | |
Private Member Functions | |
void | write_unique_id (TAO_OutputCDR &miop_hdr, unsigned long unique) |
Construct and write a unique ID to the MIOP header. | |
Private Attributes | |
CONNECTION_HANDLER * | connection_handler_ |
Definition at line 42 of file UIPMC_Transport.h.
TAO_UIPMC_Transport< CONNECTION_HANDLER >::TAO_UIPMC_Transport | ( | CONNECTION_HANDLER * | handler, | |
TAO_ORB_Core * | orb_core | |||
) |
Constructor.
Definition at line 70 of file UIPMC_Transport.cpp.
References ACE_NEW, and TAO_Transport::ws_.
00074 : TAO_Transport (IOP::TAG_UIPMC, 00075 orb_core, 00076 MIOP_MAX_DGRAM_SIZE) 00077 , connection_handler_ (handler) 00078 { 00079 // Replace the default wait strategy with our own 00080 // since we don't support waiting on anything. 00081 delete this->ws_; 00082 ACE_NEW (this->ws_, 00083 TAO_UIPMC_Wait_Never (this)); 00084 }
TAO_UIPMC_Transport< CONNECTION_HANDLER >::~TAO_UIPMC_Transport | ( | void | ) |
TAO_Connection_Handler * TAO_UIPMC_Transport< CONNECTION_HANDLER >::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 100 of file UIPMC_Transport.cpp.
References TAO_UIPMC_Transport< CONNECTION_HANDLER >::connection_handler_.
00101 { 00102 return this->connection_handler_; 00103 }
ACE_Event_Handler * TAO_UIPMC_Transport< CONNECTION_HANDLER >::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 93 of file UIPMC_Transport.cpp.
References TAO_UIPMC_Transport< CONNECTION_HANDLER >::connection_handler_.
00094 { 00095 return this->connection_handler_; 00096 }
int TAO_UIPMC_Transport< CONNECTION_HANDLER >::handle_input | ( | TAO_Resume_Handle & | rh, | |
ACE_Time_Value * | max_wait_time = 0 | |||
) | [virtual] |
Look for the documentation in Transport.h.
Reimplemented from TAO_Transport.
Definition at line 426 of file UIPMC_Transport.cpp.
References ACE_DEBUG, ACE_TEXT(), TAO_Transport_Mux_Strategy::connection_closed(), ACE_Message_Block::DONT_DELETE, TAO_ORB_Core::input_cdr_dblock_allocator(), LM_DEBUG, TAO_ORB_Core::locking_strategy(), ACE_CDR::mb_align(), ACE_Message_Block::MB_DATA, ACE_OS::memset(), MIOP_MAX_DGRAM_SIZE, TAO_Transport::orb_core_, TAO_Transport::process_parsed_messages(), TAO_UIPMC_Transport< CONNECTION_HANDLER >::recv(), TAO_debug_level, and TAO_Transport::tms_.
00428 { 00429 // If there are no messages then we can go ahead to read from the 00430 // handle for further reading.. 00431 00432 // The buffer on the stack which will be used to hold the input 00433 // messages 00434 char buf [MIOP_MAX_DGRAM_SIZE]; 00435 00436 #if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE) 00437 (void) ACE_OS::memset (buf, 00438 '\0', 00439 sizeof buf); 00440 #endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */ 00441 00442 // Create a data block 00443 ACE_Data_Block db (sizeof (buf), 00444 ACE_Message_Block::MB_DATA, 00445 buf, 00446 this->orb_core_->input_cdr_buffer_allocator (), 00447 this->orb_core_->locking_strategy (), 00448 ACE_Message_Block::DONT_DELETE, 00449 this->orb_core_->input_cdr_dblock_allocator ()); 00450 00451 // Create a message block 00452 ACE_Message_Block message_block (&db, 00453 ACE_Message_Block::DONT_DELETE, 00454 this->orb_core_->input_cdr_msgblock_allocator ()); 00455 00456 00457 // Align the message block 00458 ACE_CDR::mb_align (&message_block); 00459 00460 00461 // Read the message into the message block that we have created on 00462 // the stack. 00463 ssize_t n = this->recv (message_block.rd_ptr (), 00464 message_block.space (), 00465 max_wait_time); 00466 00467 // If there is an error return to the reactor.. 00468 if (n <= 0) 00469 { 00470 if (TAO_debug_level) 00471 { 00472 ACE_DEBUG ((LM_DEBUG, 00473 ACE_TEXT ("TAO: (%P|%t|%N|%l) recv returned error on transport %d after fault %p\n"), 00474 this->id (), 00475 ACE_TEXT ("handle_input ()\n"))); 00476 } 00477 00478 if (n == -1) 00479 this->tms_->connection_closed (); 00480 00481 return n; 00482 } 00483 00484 // Set the write pointer in the stack buffer. 00485 message_block.wr_ptr (n); 00486 00487 // Make a node of the message block.. 00488 TAO_Queued_Data qd (&message_block); 00489 size_t mesg_length = 0; 00490 00491 // Parse the incoming message for validity. The check needs to be 00492 // performed by the messaging objects. 00493 if (this->messaging_object ()->parse_next_message (qd, mesg_length) == -1) 00494 { 00495 if (TAO_debug_level) 00496 { 00497 ACE_DEBUG ((LM_DEBUG, 00498 ACE_TEXT ("TAO: (%P|%t|%N|%l) handle_input failed on transport %d after fault\n"), 00499 this->id () )); 00500 } 00501 00502 return -1; 00503 } 00504 00505 if (message_block.length () > mesg_length) 00506 { 00507 if (TAO_debug_level) 00508 { 00509 ACE_DEBUG ((LM_DEBUG, 00510 ACE_TEXT ("TAO: (%P|%t|%N|%l) handle_input failed on transport %d after fault\n"), 00511 this->id () )); 00512 } 00513 00514 return -1; 00515 } 00516 00517 // NOTE: We are not performing any queueing nor any checking for 00518 // missing data. We are assuming that ALL the data would be got in a 00519 // single read. 00520 00521 // Process the message 00522 return this->process_parsed_messages (&qd, rh); 00523 }
ssize_t TAO_UIPMC_Transport< CONNECTION_HANDLER >::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 322 of file UIPMC_Transport.cpp.
References ACE_CDR_BYTE_ORDER, ACE_DEBUG, TAO_UIPMC_Transport< CONNECTION_HANDLER >::connection_handler_, ACE_INET_Addr::get_host_addr(), ACE_INET_Addr::get_port_number(), LM_DEBUG, ACE_OS::memmove(), MIOP_FLAGS_OFFSET, MIOP_ID_CONTENT_OFFSET, MIOP_ID_LENGTH_OFFSET, MIOP_MAGIC_OFFSET, MIOP_MAX_LENGTH_ID, MIOP_MIN_HEADER_SIZE, ACE_CDR::swap_4(), and TAO_debug_level.
Referenced by TAO_UIPMC_Transport< CONNECTION_HANDLER >::handle_input().
00325 { 00326 ACE_INET_Addr from_addr; 00327 00328 ssize_t n = this->connection_handler_->peer ().recv (buf, 00329 len, 00330 from_addr); 00331 if (TAO_debug_level > 5) 00332 { 00333 ACE_DEBUG ((LM_DEBUG, 00334 "TAO_UIPMC_Transport::recv: received %d bytes from %s:%d\n", 00335 n, 00336 from_addr.get_host_addr (), 00337 from_addr.get_port_number ())); 00338 } 00339 00340 // Make sure that we at least have a MIOP header. 00341 if (n < MIOP_MIN_HEADER_SIZE) 00342 { 00343 if (TAO_debug_level > 0) 00344 { 00345 ACE_DEBUG ((LM_DEBUG, 00346 "TAO_UIPMC_Transport::recv: packet of size %d is too small from %s:%d\n", 00347 n, 00348 from_addr.get_host_addr (), 00349 from_addr.get_port_number ())); 00350 } 00351 return 0; 00352 } 00353 00354 // Check for MIOP magic bytes. 00355 if (buf[MIOP_MAGIC_OFFSET] != miop_magic [0] || 00356 buf[MIOP_MAGIC_OFFSET + 1] != miop_magic [1] || 00357 buf[MIOP_MAGIC_OFFSET + 2] != miop_magic [2] || 00358 buf[MIOP_MAGIC_OFFSET + 3] != miop_magic [3]) 00359 { 00360 if (TAO_debug_level > 0) 00361 { 00362 ACE_DEBUG ((LM_DEBUG, 00363 "TAO_UIPMC_Transport::recv: UIPMC packet didn't contain magic bytes.\n")); 00364 } 00365 00366 return 0; 00367 } 00368 00369 // Retrieve the byte order. 00370 // 0 = Big endian 00371 // 1 = Small endian 00372 CORBA::Octet byte_order = buf[MIOP_FLAGS_OFFSET] & 0x01; 00373 00374 // Ignore the header version, other flags, packet length and number of packets. 00375 00376 // Get the length of the ID. 00377 CORBA::ULong id_length; 00378 #if !defined (ACE_DISABLE_SWAP_ON_READ) 00379 if (byte_order == ACE_CDR_BYTE_ORDER) 00380 { 00381 id_length = *reinterpret_cast<ACE_CDR::ULong*> (&buf[MIOP_ID_LENGTH_OFFSET]); 00382 } 00383 else 00384 { 00385 ACE_CDR::swap_4 (&buf[MIOP_ID_LENGTH_OFFSET], 00386 reinterpret_cast<char*> (&id_length)); 00387 } 00388 #else 00389 id_length = *reinterpret_cast<ACE_CDR::ULong*> (&buf[MIOP_ID_LENGTH_OFFSET]); 00390 #endif /* ACE_DISABLE_SWAP_ON_READ */ 00391 00392 // Make sure that the length field is legal. 00393 if (id_length > MIOP_MAX_LENGTH_ID || 00394 static_cast<ssize_t> (MIOP_ID_CONTENT_OFFSET + id_length) > n) 00395 { 00396 if (TAO_debug_level > 0) 00397 { 00398 ACE_DEBUG ((LM_DEBUG, 00399 "TAO_UIPMC_Transport::recv: Invalid ID length.\n")); 00400 } 00401 00402 return 0; 00403 } 00404 00405 // Trim off the header for now. 00406 ssize_t const miop_header_size = (MIOP_ID_CONTENT_OFFSET + id_length + 7) & ~0x7; 00407 if (miop_header_size > n) 00408 { 00409 if (TAO_debug_level > 0) 00410 { 00411 ACE_DEBUG ((LM_DEBUG, 00412 "TAO_UIPMC_Transport::recv: MIOP packet not large enough for padding.\n")); 00413 } 00414 00415 return 0; 00416 } 00417 00418 n -= miop_header_size; 00419 ACE_OS::memmove (buf, buf + miop_header_size, n); 00420 00421 return n; 00422 }
int TAO_UIPMC_Transport< CONNECTION_HANDLER >::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 527 of file UIPMC_Transport.cpp.
00528 { 00529 // We never register register the handler with the reactor 00530 // as we never need to be informed about any incoming data, 00531 // assuming we only use one-ways. 00532 // If we would register and ICMP Messages would arrive, e.g 00533 // due to a not reachable server, we would get informed - as this 00534 // disturbs the general MIOP assumptions of not being 00535 // interested in any network failures, we ignore ICMP messages. 00536 return 0; 00537 }
ssize_t TAO_UIPMC_Transport< CONNECTION_HANDLER >::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 142 of file UIPMC_Transport.cpp.
References ACE_DEBUG, ACE_IOV_MAX, ACE_TEXT(), TAO_UIPMC_Transport< CONNECTION_HANDLER >::connection_handler_, ACE_OutputCDR::current(), ACE_INET_Addr::get_host_addr(), ACE_INET_Addr::get_port_number(), MIOP_Packet::iov, MIOP_Packet::iovcnt, MIOP_Packet::length, LM_DEBUG, MIOP_HEADER_SIZE, MIOP_MAX_DGRAM_SIZE, MIOP_MAX_FRAGMENTS, UIPMC_Message_Block_Data_Iterator::next_block(), ACE_Message_Block::rd_ptr(), 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 TAO_UIPMC_Transport< CONNECTION_HANDLER >::write_unique_id().
00145 { 00146 const ACE_INET_Addr &addr = this->connection_handler_->addr (); 00147 bytes_transferred = 0; 00148 00149 // Calculate the bytes to send. This value is only used for 00150 // error conditions to fake a good return. We do this for 00151 // semantic consistency with DIOP, and since errors aren't 00152 // handled correctly from send_i (our fault). If these 00153 // semantics are not desirable, the error handling problems 00154 // that need to be fixed can be found in 00155 // UIPMC_Connection_Handler::decr_refcount which will need to 00156 // deregister the connection handler from the UIPMC_Connector 00157 // cache. 00158 ssize_t bytes_to_send = 0; 00159 for (int i = 0; i < iovcnt; i++) 00160 bytes_to_send += iov[i].iov_len; 00161 00162 MIOP_Packet fragments[MIOP_MAX_FRAGMENTS]; 00163 MIOP_Packet *current_fragment = 0; 00164 int num_fragments = 1; 00165 00166 UIPMC_Message_Block_Data_Iterator mb_iter (iov, iovcnt); 00167 00168 // Initialize the first fragment 00169 current_fragment = &fragments[0]; 00170 current_fragment->iovcnt = 1; // The MIOP Header 00171 current_fragment->length = 0; 00172 00173 // Go through all of the message blocks. 00174 while (mb_iter.next_block (MIOP_MAX_DGRAM_SIZE - current_fragment->length, 00175 current_fragment->iov[current_fragment->iovcnt])) 00176 { 00177 // Increment the length and iovcnt. 00178 current_fragment->length += current_fragment->iov[current_fragment->iovcnt].iov_len; 00179 current_fragment->iovcnt++; 00180 00181 // Check if we've filled up this fragment or if we've run out of 00182 // iov entries. 00183 if (current_fragment->length == MIOP_MAX_DGRAM_SIZE || 00184 current_fragment->iovcnt == ACE_IOV_MAX) 00185 { 00186 // Make a new fragment. 00187 num_fragments++; 00188 00189 // Check if too many fragments 00190 if (num_fragments > MIOP_MAX_FRAGMENTS) 00191 { 00192 // This is an error as we do not send more. 00193 // Silently drop the message but log an error. 00194 00195 // Pluggable_Messaging::transport_message only 00196 // cares if it gets -1 or 0 so we can return a 00197 // partial length and it will think all has gone 00198 // well. 00199 if (TAO_debug_level > 0) 00200 { 00201 ACE_DEBUG ((LM_DEBUG, 00202 ACE_TEXT ("\n\nTAO (%P|%t) - ") 00203 ACE_TEXT ("UIPMC_Transport::send ") 00204 ACE_TEXT ("Message of size %d needs too many MIOP fragments (max is %d).\n") 00205 ACE_TEXT ("You may be able to increase ACE_MAX_DGRAM_SIZE.\n"), 00206 bytes_to_send, 00207 MIOP_MAX_FRAGMENTS)); 00208 } 00209 00210 // Pretend it is o.k. See note by bytes_to_send calculation. 00211 bytes_transferred = bytes_to_send; 00212 return 1; 00213 } 00214 00215 // Otherwise, initialize another fragment. 00216 current_fragment++; 00217 current_fragment->iovcnt = 1; // The MIOP Header 00218 current_fragment->length = MIOP_HEADER_SIZE; 00219 } 00220 } 00221 00222 // Build a generic MIOP Header. 00223 00224 // Allocate space on the stack for the header (add 8 to account for 00225 // the possibility of adjusting for alignment). 00226 char header_buffer[MIOP_HEADER_SIZE + 8]; 00227 TAO_OutputCDR miop_hdr (header_buffer, MIOP_HEADER_SIZE + 8); 00228 00229 miop_hdr.write_octet_array (miop_magic, 4); // Magic 00230 miop_hdr.write_octet (0x10); // Version 00231 CORBA::Octet *flags_field = reinterpret_cast<CORBA::Octet *> (miop_hdr.current ()->wr_ptr ()); 00232 00233 // Write flags octet: 00234 // Bit Description 00235 // 0 Endian 00236 // 1 Stop message flag (Assigned later) 00237 // 2 - 7 Set to 0 00238 miop_hdr.write_octet (TAO_ENCAP_BYTE_ORDER); // Flags 00239 00240 // Packet Length 00241 // NOTE: We can save pointers and write them later without byte swapping since 00242 // in CORBA, the sender chooses the endian. 00243 CORBA::UShort *packet_length = reinterpret_cast<CORBA::UShort *> (miop_hdr.current ()->wr_ptr ()); 00244 miop_hdr.write_short (0); 00245 00246 // Packet number 00247 CORBA::ULong *packet_number = reinterpret_cast<CORBA::ULong *> (miop_hdr.current ()->wr_ptr ()); 00248 miop_hdr.write_ulong (0); 00249 00250 // Number of packets field 00251 miop_hdr.write_ulong (num_fragments); 00252 00253 // UniqueId 00254 ptrdiff_t unique_id = reinterpret_cast<ptrdiff_t> (iov); 00255 this->write_unique_id (miop_hdr, 00256 static_cast<unsigned long> (unique_id)); 00257 00258 // Send the buffers. 00259 current_fragment = &fragments[0]; 00260 while (num_fragments > 0 && 00261 current_fragment->iovcnt > 1) 00262 { 00263 // Fill in the packet length header field. 00264 *packet_length = static_cast<CORBA::UShort> (current_fragment->length); 00265 00266 // If this is the last fragment, set the stop message flag. 00267 if (num_fragments == 1) 00268 { 00269 *flags_field |= 0x02; 00270 } 00271 00272 // Setup the MIOP header in the iov list. 00273 current_fragment->iov[0].iov_base = miop_hdr.current ()->rd_ptr (); 00274 current_fragment->iov[0].iov_len = MIOP_HEADER_SIZE; 00275 00276 // Send the fragment. - Need to check for errors!! 00277 ssize_t rc = this->connection_handler_->send (current_fragment->iov, 00278 current_fragment->iovcnt, 00279 addr); 00280 00281 if (rc <= 0) 00282 { 00283 if (TAO_debug_level > 0) 00284 { 00285 ACE_DEBUG ((LM_DEBUG, 00286 ACE_TEXT ("\n\nTAO (%P|%t) - ") 00287 ACE_TEXT ("UIPMC_Transport::send") 00288 ACE_TEXT (" %p\n\n"), 00289 ACE_TEXT ("Error returned from transport:"))); 00290 } 00291 00292 // Pretend it is o.k. See note by bytes_to_send calculation. 00293 bytes_transferred = bytes_to_send; 00294 return 1; 00295 } 00296 00297 // Increment the number of bytes transferred, but don't 00298 // count the MIOP header that we added. 00299 bytes_transferred += rc - MIOP_HEADER_SIZE; 00300 00301 if (TAO_debug_level > 0) 00302 { 00303 ACE_DEBUG ((LM_DEBUG, 00304 "TAO_UIPMC_Transport::send: sent %d bytes to %s:%d\n", 00305 rc, 00306 addr.get_host_addr (), 00307 addr.get_port_number ())); 00308 } 00309 00310 // Go to the next fragment. 00311 (*packet_number)++; 00312 ++current_fragment; 00313 --num_fragments; 00314 } 00315 00316 // Return total bytes transferred. 00317 return bytes_transferred; 00318 }
int TAO_UIPMC_Transport< CONNECTION_HANDLER >::send_message | ( | TAO_OutputCDR & | stream, | |
TAO_Stub * | stub = 0 , |
|||
TAO_Message_Semantics | 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.
Definition at line 563 of file UIPMC_Transport.cpp.
References ACE_DEBUG, ACE_TEXT(), ACE_OutputCDR::begin(), LM_DEBUG, TAO_Transport::send_message_shared(), and TAO_debug_level.
00567 { 00568 // Format the message in the stream first 00569 if (this->messaging_object_->format_message (stream) != 0) 00570 return -1; 00571 00572 // Strictly speaking, should not need to loop here because the 00573 // socket never gets set to a nonblocking mode ... some Linux 00574 // versions seem to need it though. Leaving it costs little. 00575 00576 // This guarantees to send all data (bytes) or return an error. 00577 ssize_t n = this->send_message_shared (stub, 00578 message_semantics, 00579 stream.begin (), 00580 max_wait_time); 00581 00582 if (n == -1) 00583 { 00584 if (TAO_debug_level) 00585 ACE_DEBUG ((LM_DEBUG, 00586 ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %m\n"), 00587 this->id (), 00588 ACE_TEXT ("send_message ()\n"))); 00589 00590 return -1; 00591 } 00592 00593 return 1; 00594 }
int TAO_UIPMC_Transport< CONNECTION_HANDLER >::send_request | ( | TAO_Stub * | stub, | |
TAO_ORB_Core * | orb_core, | |||
TAO_OutputCDR & | stream, | |||
TAO_Message_Semantics | message_semantics, | |||
ACE_Time_Value * | max_wait_time | |||
) | [virtual] |
@TODO: These methods IMHO should have more meaningful names. The names seem to indicate nothing.
Definition at line 541 of file UIPMC_Transport.cpp.
References TAO_Transport::orb_core().
00546 { 00547 if (this->ws_->sending_request (orb_core, 00548 message_semantics) == -1) 00549 return -1; 00550 00551 if (this->send_message (stream, 00552 stub, 00553 message_semantics, 00554 max_wait_time) == -1) 00555 00556 return -1; 00557 00558 return 0; 00559 }
void TAO_UIPMC_Transport< CONNECTION_HANDLER >::write_unique_id | ( | TAO_OutputCDR & | miop_hdr, | |
unsigned long | unique | |||
) | [private] |
Construct and write a unique ID to the MIOP header.
Definition at line 107 of file UIPMC_Transport.cpp.
References MIOP_ID_DEFAULT_LENGTH, ACE_OutputCDR::write_octet_array(), and ACE_OutputCDR::write_ulong().
Referenced by TAO_UIPMC_Transport< CONNECTION_HANDLER >::send().
00109 { 00110 // We currently construct a unique ID for each MIOP message by 00111 // concatenating the address of the buffer to a counter. We may 00112 // also need to use a MAC address or something more unique to 00113 // fully comply with the MIOP specification. 00114 00115 static unsigned long counter = 1; // Don't worry about race conditions on counter, 00116 // since buffer addresses can't be the same if 00117 // this is being called simultaneously. 00118 00119 CORBA::Octet unique_id[MIOP_ID_DEFAULT_LENGTH]; 00120 00121 unique_id[0] = static_cast<CORBA::Octet> (unique & 0xff); 00122 unique_id[1] = static_cast<CORBA::Octet> ((unique & 0xff00) >> 8); 00123 unique_id[2] = static_cast<CORBA::Octet> ((unique & 0xff0000) >> 16); 00124 unique_id[3] = static_cast<CORBA::Octet> ((unique & 0xff000000) >> 24); 00125 00126 unique_id[4] = static_cast<CORBA::Octet> (counter & 0xff); 00127 unique_id[5] = static_cast<CORBA::Octet> ((counter & 0xff00) >> 8); 00128 unique_id[6] = static_cast<CORBA::Octet> ((counter & 0xff0000) >> 16); 00129 unique_id[7] = static_cast<CORBA::Octet> ((counter & 0xff000000) >> 24); 00130 00131 unique_id[8] = 0; 00132 unique_id[9] = 0; 00133 unique_id[10] = 0; 00134 unique_id[11] = 0; 00135 00136 miop_hdr.write_ulong (MIOP_ID_DEFAULT_LENGTH); 00137 miop_hdr.write_octet_array (unique_id, MIOP_ID_DEFAULT_LENGTH); 00138 }
CONNECTION_HANDLER* TAO_UIPMC_Transport< CONNECTION_HANDLER >::connection_handler_ [private] |
The connection service handler used for accessing lower layer communication protocols.
Definition at line 102 of file UIPMC_Transport.h.
Referenced by TAO_UIPMC_Transport< CONNECTION_HANDLER >::connection_handler_i(), TAO_UIPMC_Transport< CONNECTION_HANDLER >::event_handler_i(), TAO_UIPMC_Transport< CONNECTION_HANDLER >::recv(), and TAO_UIPMC_Transport< CONNECTION_HANDLER >::send().