diff options
author | bala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-03-10 02:39:37 +0000 |
---|---|---|
committer | bala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-03-10 02:39:37 +0000 |
commit | 732940402e77a037e597fdd0658eed8eb1d6f90d (patch) | |
tree | c0ea7a4d02aebd51a81385177b7db6c70c1e73f5 /TAO | |
parent | 5a9fddd73e11dfb719b46a293966084e239b0b53 (diff) | |
download | ATCD-732940402e77a037e597fdd0658eed8eb1d6f90d.tar.gz |
ChangeLogTag: Sat Mar 9 20:02:34 2002 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 30 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Base.cpp | 1024 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Base.h | 63 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Lite.cpp | 876 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Lite.h | 58 | ||||
-rw-r--r-- | TAO/tao/IIOP_Transport.cpp | 150 | ||||
-rw-r--r-- | TAO/tao/Pluggable_Messaging.h | 18 | ||||
-rw-r--r-- | TAO/tao/TAO_Server_Request.cpp | 147 |
8 files changed, 1231 insertions, 1135 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index a2571d35d78..c2cacc5bddc 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,33 @@ +Sat Mar 9 20:02:34 2002 Balachandran Natarajan <bala@cs.wustl.edu> + + * tao/GIOP_Message_Base.h: + * tao/GIOP_Message_Base.cpp: + * tao/GIOP_Message_Lite.h: + * tao/GIOP_Message_Lite.cpp: + * tao/IIOP_Transport.cpp: + * tao/Pluggable_Messaging.h: The state of the GIOP version that + got shared between threads created problems if the threads + processed messages of different GIOP versions. With muxed + connections one could expect different GIOP versions on the same + connection which is perfectly valid with latest CORBA specs. + + Removed shared state information of the GIOP version from the + GIOP_Message_Base class. All the state information is now on the + stack of the thread processing the request. This should fix + [BUG 1159]. + + * tao/TAO_Server_Request.cpp: If the upcall thread sends an + exception to the client, we were creating a new output CDR + stream instead of using the one that was already + created. Removed creation of a new CDR stream. + + The above two fixes should solve the problem reported in + tao-users newsgroup under the thread "wide-strings in + exceptions". Thanks to Val Dumiterscu + <val.dumitrescu@am-beo.com> for reporting the problem and Duane + Binder <duane.binder@veritas.com> for helping me to narrow down + the problem. + Sat Mar 9 16:22:25 2002 Craig Rodrigues <crodrigu@bbn.com> * performance-tests/Latency/Thread_Per_Connection/Test.idl: diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index 8dd2a41ad85..9607ed15dfd 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -20,11 +20,10 @@ ACE_RCSID (tao, GIOP_Message_Base, "$Id$") TAO_GIOP_Message_Base::TAO_GIOP_Message_Base (TAO_ORB_Core *orb_core, - size_t /*input_cdr_size*/) + size_t /*input_cdr_size*/) : orb_core_ (orb_core), message_state_ (orb_core, - this), - generator_parser_ (0) + this) { } @@ -37,12 +36,11 @@ TAO_GIOP_Message_Base::~TAO_GIOP_Message_Base (void) void -TAO_GIOP_Message_Base::init (CORBA::Octet major, - CORBA::Octet minor) +TAO_GIOP_Message_Base::init (CORBA::Octet /*major*/, + CORBA::Octet /*minor*/) { // Set the state - this->set_state (major, - minor); + // this->set_state (major, minor); } @@ -59,25 +57,37 @@ TAO_GIOP_Message_Base::generate_request_header ( TAO_OutputCDR &cdr ) { + // Get a parser for us + TAO_GIOP_Message_Generator_Parser *generator_parser = 0; + + CORBA::Octet major, minor; + + cdr.get_version (major, minor); + + // Get the state information that we need to use + this->set_state (major, + minor, + generator_parser); + // Write the GIOP header first if (!this->write_protocol_header (TAO_GIOP_REQUEST, - cdr)) + cdr)) { if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing GIOP header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing GIOP header \n"))); return -1; } // Now call the implementation for the rest of the header - if (!this->generator_parser_->write_request_header (op, - spec, - cdr)) + if (!generator_parser->write_request_header (op, + spec, + cdr)) { if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing request header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing request header \n"))); return -1; } @@ -92,26 +102,38 @@ TAO_GIOP_Message_Base::generate_locate_request_header ( TAO_OutputCDR &cdr ) { + // Get a parser for us + TAO_GIOP_Message_Generator_Parser *generator_parser = 0; + + CORBA::Octet major, minor; + + cdr.get_version (major, minor); + + // Get the state information that we need to use + this->set_state (major, + minor, + generator_parser); + // Write the GIOP header first if (!this->write_protocol_header (TAO_GIOP_LOCATEREQUEST, - cdr)) + cdr)) { if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing GIOP header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing GIOP header \n"))); return -1; } // Now call the implementation for the rest of the header - if (!this->generator_parser_->write_locate_request_header + if (!generator_parser->write_locate_request_header (op.request_id (), spec, cdr)) { if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing locate request header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing locate request header \n"))); return -1; @@ -127,13 +149,25 @@ TAO_GIOP_Message_Base::generate_reply_header ( TAO_Pluggable_Reply_Params_Base ¶ms ) { + // Get a parser for us + TAO_GIOP_Message_Generator_Parser *generator_parser = 0; + + CORBA::Octet major, minor; + + cdr.get_version (major, minor); + + // Get the state information that we need to use + this->set_state (major, + minor, + generator_parser); + // Write the GIOP header first if (!this->write_protocol_header (TAO_GIOP_REPLY, - cdr)) + cdr)) { if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing GIOP header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing GIOP header \n"))); return -1; } @@ -143,26 +177,26 @@ TAO_GIOP_Message_Base::generate_reply_header ( { // Now call the implementation for the rest of the header int result = - this->generator_parser_->write_reply_header (cdr, - params - ACE_ENV_ARG_PARAMETER); + generator_parser->write_reply_header (cdr, + params + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (!result) - { - if (TAO_debug_level > 4) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing reply ") - ACE_TEXT ("header\n"))); - - return -1; - } + { + if (TAO_debug_level > 4) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing reply ") + ACE_TEXT ("header\n"))); + + return -1; + } } ACE_CATCHANY { if (TAO_debug_level > 4) - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "TAO_GIOP_Message_Base::generate_reply_header"); + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "TAO_GIOP_Message_Base::generate_reply_header"); return -1; } @@ -174,8 +208,8 @@ TAO_GIOP_Message_Base::generate_reply_header ( int TAO_GIOP_Message_Base::read_message (TAO_Transport * /*transport*/, - int /*block */, - ACE_Time_Value * /*max_wait_time*/) + int /*block */, + ACE_Time_Value * /*max_wait_time*/) { return 0; } @@ -201,15 +235,15 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) #if !defined (ACE_ENABLE_SWAP_ON_WRITE) *ACE_reinterpret_cast (CORBA::ULong *, buf + - TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; + TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; #else if (!stream.do_byte_swap ()) *ACE_reinterpret_cast (CORBA::ULong *, - buf + TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; + buf + TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; else ACE_CDR::swap_4 (ACE_reinterpret_cast (char *, - &bodylen), - buf + TAO_GIOP_MESSAGE_SIZE_OFFSET); + &bodylen), + buf + TAO_GIOP_MESSAGE_SIZE_OFFSET); #endif /* ACE_ENABLE_SWAP_ON_WRITE */ if (TAO_debug_level > 2) @@ -219,16 +253,16 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) // dumped ACE_Message_Block* consolidated_block = 0; if (stream.begin()->cont () != 0) - { - consolidated_block = new ACE_Message_Block; - ACE_CDR::consolidate (consolidated_block, stream.begin ()); - buf = (char *) (consolidated_block->rd_ptr ()); - } + { + consolidated_block = new ACE_Message_Block; + ACE_CDR::consolidate (consolidated_block, stream.begin ()); + buf = (char *) (consolidated_block->rd_ptr ()); + } /// this->dump_msg ("send", - ACE_reinterpret_cast (u_char *, - buf), - total_len); + ACE_reinterpret_cast (u_char *, + buf), + total_len); // delete consolidated_block; @@ -267,9 +301,9 @@ TAO_GIOP_Message_Base::message_type ( case TAO_GIOP_CANCELREQUEST: // Does it happen? why?? default: - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ") - ACE_TEXT ("wrong message.\n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ") + ACE_TEXT ("wrong message.\n"))); } return TAO_PLUGGABLE_MESSAGE_MESSAGERROR; @@ -312,24 +346,24 @@ TAO_GIOP_Message_Base::missing_data (ACE_Message_Block &incoming) int TAO_GIOP_Message_Base::extract_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data *&qd) + TAO_Queued_Data *&qd) { TAO_GIOP_Message_State state (this->orb_core_, - this); + this); if (incoming.length () < TAO_GIOP_MESSAGE_HEADER_LEN) { if (incoming.length () > 0) - { - // Make a node which has a message block of the size of - // MESSAGE_HEADER_LEN. - qd = - this->make_queued_data (TAO_GIOP_MESSAGE_HEADER_LEN); - - qd->msg_block_->copy (incoming.rd_ptr (), - incoming.length ()); - qd->missing_data_ = -1; - } + { + // Make a node which has a message block of the size of + // MESSAGE_HEADER_LEN. + qd = + this->make_queued_data (TAO_GIOP_MESSAGE_HEADER_LEN); + + qd->msg_block_->copy (incoming.rd_ptr (), + incoming.length ()); + qd->missing_data_ = -1; + } return 0; } @@ -345,13 +379,13 @@ TAO_GIOP_Message_Base::extract_next_message (ACE_Message_Block &incoming, if (copying_len > incoming.length ()) { qd->missing_data_ = - copying_len - incoming.length (); + copying_len - incoming.length (); copying_len = incoming.length (); } qd->msg_block_->copy (incoming.rd_ptr (), - copying_len); + copying_len); incoming.rd_ptr (copying_len); qd->byte_order_ = state.byte_order_; @@ -363,7 +397,7 @@ TAO_GIOP_Message_Base::extract_next_message (ACE_Message_Block &incoming, int TAO_GIOP_Message_Base::consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming) + ACE_Message_Block &incoming) { // Look to see whether we had atleast parsed the GIOP header ... if (qd->missing_data_ == -1) @@ -371,54 +405,54 @@ TAO_GIOP_Message_Base::consolidate_node (TAO_Queued_Data *qd, // The data length that has been stuck in there during the last // read .... size_t len = - qd->msg_block_->length (); + qd->msg_block_->length (); // We know that we would have space for // TAO_GIOP_MESSAGE_HEADER_LEN here. So copy that much of data // from the <incoming> into the message block in <qd> qd->msg_block_->copy (incoming.rd_ptr (), - TAO_GIOP_MESSAGE_HEADER_LEN - len); + TAO_GIOP_MESSAGE_HEADER_LEN - len); // Move the rd_ptr () in the incoming message block.. incoming.rd_ptr (TAO_GIOP_MESSAGE_HEADER_LEN - len); TAO_GIOP_Message_State state (this->orb_core_, - this); + this); // Parse the message header now... if (state.parse_message_header (*qd->msg_block_) == -1) - return -1; + return -1; // Now grow the message block so that we can copy the rest of // the data... ACE_CDR::grow (qd->msg_block_, - state.message_size ()); + state.message_size ()); // Copy the pay load.. // Calculate the bytes that needs to be copied in the queue... - size_t copy_len = state.payload_size (); + size_t copy_len = state.payload_size (); // If teh data that needs to be copied is more than that is // available to us .. if (copy_len > incoming.length ()) - { - // Calculate the missing data.. - qd->missing_data_ = - copy_len - incoming.length (); - - // Set the actual possible copy_len that is available... - copy_len = incoming.length (); - } + { + // Calculate the missing data.. + qd->missing_data_ = + copy_len - incoming.length (); + + // Set the actual possible copy_len that is available... + copy_len = incoming.length (); + } else - { - qd->missing_data_ = 0; - } + { + qd->missing_data_ = 0; + } // ..now we are set to copy the right amount of data to the // node.. qd->msg_block_->copy (incoming.rd_ptr (), - copy_len); + copy_len); // Set the <rd_ptr> of the <incoming>.. incoming.rd_ptr (copy_len); @@ -435,19 +469,19 @@ TAO_GIOP_Message_Base::consolidate_node (TAO_Queued_Data *qd, size_t copy_len = qd->missing_data_; if (copy_len > incoming.length ()) - { - // Calculate the missing data.. - qd->missing_data_ = - copy_len - incoming.length (); + { + // Calculate the missing data.. + qd->missing_data_ = + copy_len - incoming.length (); - // Set the actual possible copy_len that is available... - copy_len = incoming.length (); - } + // Set the actual possible copy_len that is available... + copy_len = incoming.length (); + } // Copy the right amount of data in to the node... // node.. qd->msg_block_->copy (incoming.rd_ptr (), - copy_len); + copy_len); // Set the <rd_ptr> of the <incoming>.. qd->msg_block_->rd_ptr (copy_len); @@ -461,7 +495,7 @@ TAO_GIOP_Message_Base::consolidate_node (TAO_Queued_Data *qd, int TAO_GIOP_Message_Base::consolidate_fragments (TAO_Queued_Data *dqd, - const TAO_Queued_Data *sqd) + const TAO_Queued_Data *sqd) { if (dqd->byte_order_ != sqd->byte_order_ || dqd->major_version_ != sqd->major_version_ @@ -470,8 +504,8 @@ TAO_GIOP_Message_Base::consolidate_fragments (TAO_Queued_Data *dqd, // Yes, print it out in all debug levels!. This is an error by // CORBA 2.4 spec ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) incompatible fragments:") - ACE_TEXT ("different GIOP versions or byte order\n"))); + ACE_TEXT ("TAO (%P|%t) incompatible fragments:") + ACE_TEXT ("different GIOP versions or byte order\n"))); return -1; } @@ -490,11 +524,11 @@ TAO_GIOP_Message_Base::consolidate_fragments (TAO_Queued_Data *dqd, ACE_Message_Block *mb = dqd->msg_block_; ACE_CDR::grow (mb, - mb->size () + incoming_size); + mb->size () + incoming_size); // Copy the data dqd->msg_block_->copy (sqd->msg_block_->rd_ptr (), - incoming_size); + incoming_size); return 0; } @@ -526,37 +560,41 @@ TAO_GIOP_Message_Base::get_message_data (TAO_Queued_Data *qd) int TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, - TAO_Queued_Data *qd) + TAO_Queued_Data *qd) { // Set the upcall thread this->orb_core_->lf_strategy ().set_upcall_thread (this->orb_core_->leader_follower ()); - // Set the state internally for parsing and generating messages + // Get a parser for us + TAO_GIOP_Message_Generator_Parser *generator_parser = 0; + + // Get the state information that we need to use this->set_state (qd->major_version_, - qd->minor_version_); + qd->minor_version_, + generator_parser); // A buffer that we will use to initialise the CDR stream char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; #if defined(ACE_HAS_PURIFY) (void) ACE_OS::memset (repbuf, - '\0', - sizeof repbuf); + '\0', + sizeof repbuf); #endif /* ACE_HAS_PURIFY */ // Initialze an output CDR on the stack TAO_OutputCDR output (repbuf, - sizeof repbuf, - TAO_ENCAP_BYTE_ORDER, - this->orb_core_->output_cdr_buffer_allocator (), - this->orb_core_->output_cdr_dblock_allocator (), - this->orb_core_->output_cdr_msgblock_allocator (), - this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (), - qd->major_version_, - qd->minor_version_, - this->orb_core_->to_iso8859 (), - this->orb_core_->to_unicode ()); + sizeof repbuf, + TAO_ENCAP_BYTE_ORDER, + this->orb_core_->output_cdr_buffer_allocator (), + this->orb_core_->output_cdr_dblock_allocator (), + this->orb_core_->output_cdr_msgblock_allocator (), + this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (), + qd->major_version_, + qd->minor_version_, + this->orb_core_->to_iso8859 (), + this->orb_core_->to_unicode ()); // Get the read and write positions before we steal data. size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base (); @@ -565,17 +603,17 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, if (TAO_debug_level > 0) this->dump_msg ("recv", - ACE_reinterpret_cast (u_char *, - qd->msg_block_->rd_ptr ()), - qd->msg_block_->length ()); + ACE_reinterpret_cast (u_char *, + qd->msg_block_->rd_ptr ()), + qd->msg_block_->length ()); // Create a input CDR stream. We do the following // 1 - If the incoming message block has a data block with a flag - // DONT_DELETE (for the data block) we create an input CDR - // stream the same way. + // DONT_DELETE (for the data block) we create an input CDR + // stream the same way. // 2 - If the incoming message block had a datablock from heap just - // use it by duplicating it and make the flag 0. + // use it by duplicating it and make the flag 0. // NOTE: We use the same data block in which we read the message and // we pass it on to the higher layers of the ORB. So we dont to any // copies at all here. The same is also done in the higher layers. @@ -587,7 +625,7 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, flg = qd->msg_block_->self_flags (); if (ACE_BIT_ENABLED (flg, - ACE_Message_Block::DONT_DELETE)) + ACE_Message_Block::DONT_DELETE)) { // Use the same datablock db = qd->msg_block_->data_block (); @@ -601,13 +639,13 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, TAO_InputCDR input_cdr (db, - flg, - rd_pos, - wr_pos, - qd->byte_order_, - qd->major_version_, - qd->minor_version_, - this->orb_core_); + flg, + rd_pos, + wr_pos, + qd->byte_order_, + qd->major_version_, + qd->minor_version_, + this->orb_core_); // We know we have some request message. Check whether it is a @@ -624,13 +662,15 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, // could raise an exception or write things in the output CDR // stream return this->process_request (transport, - input_cdr, - output); + input_cdr, + output, + generator_parser); case TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST: return this->process_locate_request (transport, - input_cdr, - output); + input_cdr, + output, + generator_parser); default: return -1; } @@ -641,9 +681,13 @@ TAO_GIOP_Message_Base::process_reply_message ( TAO_Pluggable_Reply_Params ¶ms, TAO_Queued_Data *qd) { - // Set the state internally for parsing and generating messages + // Get a parser for us + TAO_GIOP_Message_Generator_Parser *generator_parser = 0; + + // Get the state information that we need to use this->set_state (qd->major_version_, - qd->minor_version_); + qd->minor_version_, + generator_parser); // Get the read and write positions before we steal data. size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base (); @@ -652,9 +696,9 @@ TAO_GIOP_Message_Base::process_reply_message ( if (TAO_debug_level > 0) this->dump_msg ("recv", - ACE_reinterpret_cast (u_char *, - qd->msg_block_->rd_ptr ()), - qd->msg_block_->length ()); + ACE_reinterpret_cast (u_char *, + qd->msg_block_->rd_ptr ()), + qd->msg_block_->length ()); // Create a empty buffer on stack @@ -662,13 +706,13 @@ TAO_GIOP_Message_Base::process_reply_message ( // we pass it on to the higher layers of the ORB. So we dont to any // copies at all here. The same is alos done in the higher layers. TAO_InputCDR input_cdr (qd->msg_block_->data_block (), - ACE_Message_Block::DONT_DELETE, - rd_pos, - wr_pos, - qd->byte_order_, - qd->major_version_, - qd->minor_version_, - this->orb_core_); + ACE_Message_Block::DONT_DELETE, + rd_pos, + wr_pos, + qd->byte_order_, + qd->major_version_, + qd->minor_version_, + this->orb_core_); // Reset the message state. Now, we are ready for the next nested // upcall if any. @@ -685,14 +729,14 @@ TAO_GIOP_Message_Base::process_reply_message ( { case TAO_PLUGGABLE_MESSAGE_REPLY: // Should be taken care by the state specific parsing - return this->generator_parser_->parse_reply (input_cdr, - params); + return generator_parser->parse_reply (input_cdr, + params); case TAO_PLUGGABLE_MESSAGE_LOCATEREPLY: - return this->generator_parser_->parse_locate_reply (input_cdr, - params); - default: - return -1; + return generator_parser->parse_locate_reply (input_cdr, + params); + default: + return -1; } } @@ -711,7 +755,7 @@ TAO_GIOP_Message_Base::generate_exception_reply ( { // Make the GIOP & reply header. this->generate_reply_header (cdr, - params); + params); x._tao_encode (cdr ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } @@ -722,8 +766,8 @@ TAO_GIOP_Message_Base::generate_exception_reply ( // Close the handle. ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ") - ACE_TEXT ("generate_exception_reply ()"))); + ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ") + ACE_TEXT ("generate_exception_reply ()"))); return -1; } ACE_ENDTRY; @@ -734,7 +778,7 @@ TAO_GIOP_Message_Base::generate_exception_reply ( int TAO_GIOP_Message_Base::write_protocol_header (TAO_GIOP_Message_Type t, - TAO_OutputCDR &msg) + TAO_OutputCDR &msg) { // Reset the message type // Reset the message type @@ -750,8 +794,11 @@ TAO_GIOP_Message_Base::write_protocol_header (TAO_GIOP_Message_Type t, 0x50 // 'P' }; - header[4] = this->generator_parser_->major_version (); - header[5] = this->generator_parser_->minor_version (); + CORBA::Octet major, minor = 0; + msg.get_version (major, minor); + + header[4] = major; + header[5] = minor; // We are putting the byte order. But at a later date if we support // fragmentation and when we want to use the other 6 bits in this @@ -769,16 +816,17 @@ TAO_GIOP_Message_Base::write_protocol_header (TAO_GIOP_Message_Type t, int TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, - TAO_InputCDR &cdr, - TAO_OutputCDR &output) + TAO_InputCDR &cdr, + TAO_OutputCDR &output, + TAO_GIOP_Message_Generator_Parser *parser) { // This will extract the request header, set <response_required> // and <sync_with_server> as appropriate. TAO_ServerRequest request (this, - cdr, - output, - transport, - this->orb_core_); + cdr, + output, + transport, + this->orb_core_); CORBA::ULong request_id = 0; CORBA::Boolean response_required = 0; @@ -789,12 +837,12 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, ACE_TRY { parse_error = - this->generator_parser_->parse_request_header (request); + parser->parse_request_header (request); // Throw an exception if the if (parse_error != 0) - ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, - CORBA::COMPLETED_NO)); + ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); request_id = request.request_id (); response_required = request.response_expected (); @@ -803,52 +851,52 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, // Do this before the reply is sent. this->orb_core_->request_dispatcher ()->dispatch ( - this->orb_core_, - request, - forward_to - ACE_ENV_ARG_PARAMETER); + this->orb_core_, + request, + forward_to + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (!CORBA::is_nil (forward_to.in ())) - { - // We should forward to another object... - TAO_Pluggable_Reply_Params_Base reply_params; - reply_params.request_id_ = request_id; - reply_params.reply_status_ = TAO_GIOP_LOCATION_FORWARD; - reply_params.svc_ctx_.length (0); - - // Send back the reply service context. - reply_params.service_context_notowned (&request.reply_service_info ()); - - // Make the GIOP header and Reply header - this->generate_reply_header (output, - reply_params); - - if (!(output << forward_to.in ())) - { - if (TAO_debug_level > 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) ERROR: Unable to marshal ") - ACE_TEXT ("forward reference.\n"))); - - return -1; - } - - int result = transport->send_message (output); - if (result == -1) - { - if (TAO_debug_level > 0) - { - // No exception but some kind of error, yet a - // response is required. - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") - ACE_TEXT ("cannot send reply\n"), - ACE_TEXT ("TAO_GIOP_Message_Base::process_request"))); - } - } - return result; - } + { + // We should forward to another object... + TAO_Pluggable_Reply_Params_Base reply_params; + reply_params.request_id_ = request_id; + reply_params.reply_status_ = TAO_GIOP_LOCATION_FORWARD; + reply_params.svc_ctx_.length (0); + + // Send back the reply service context. + reply_params.service_context_notowned (&request.reply_service_info ()); + + // Make the GIOP header and Reply header + this->generate_reply_header (output, + reply_params); + + if (!(output << forward_to.in ())) + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) ERROR: Unable to marshal ") + ACE_TEXT ("forward reference.\n"))); + + return -1; + } + + int result = transport->send_message (output); + if (result == -1) + { + if (TAO_debug_level > 0) + { + // No exception but some kind of error, yet a + // response is required. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") + ACE_TEXT ("cannot send reply\n"), + ACE_TEXT ("TAO_GIOP_Message_Base::process_request"))); + } + } + return result; + } } // Only CORBA exceptions are caught here. ACE_CATCHANY @@ -856,44 +904,44 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, int result = 0; if (response_required) - { - result = this->send_reply_exception (transport, - this->orb_core_, - request_id, - &request.reply_service_info (), - &ACE_ANY_EXCEPTION); - if (result == -1) - { - if (TAO_debug_level > 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") - ACE_TEXT ("cannot send exception\n"), - ACE_TEXT ("process_connector_request ()"))); - - ACE_PRINT_EXCEPTION ( - ACE_ANY_EXCEPTION, - "TAO_GIOP_Message_Base::process_request[1]"); - } - } - - } + { + result = this->send_reply_exception (transport, + this->orb_core_, + request_id, + &request.reply_service_info (), + &ACE_ANY_EXCEPTION); + if (result == -1) + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") + ACE_TEXT ("cannot send exception\n"), + ACE_TEXT ("process_connector_request ()"))); + + ACE_PRINT_EXCEPTION ( + ACE_ANY_EXCEPTION, + "TAO_GIOP_Message_Base::process_request[1]"); + } + } + + } else if (TAO_debug_level > 0) - { - // It is unfotunate that an exception (probably a system - // exception) was thrown by the upcall code (even by the - // user) when the client was not expecting a response. - // However, in this case, we cannot close the connection - // down, since it really isn't the client's fault. - - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) exception thrown ") - ACE_TEXT ("but client is not waiting a response\n"))); - - ACE_PRINT_EXCEPTION ( - ACE_ANY_EXCEPTION, - "TAO_GIOP_Message_Base::process_request[2]"); - } + { + // It is unfotunate that an exception (probably a system + // exception) was thrown by the upcall code (even by the + // user) when the client was not expecting a response. + // However, in this case, we cannot close the connection + // down, since it really isn't the client's fault. + + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) exception thrown ") + ACE_TEXT ("but client is not waiting a response\n"))); + + ACE_PRINT_EXCEPTION ( + ACE_ANY_EXCEPTION, + "TAO_GIOP_Message_Base::process_request[2]"); + } return result; } @@ -910,41 +958,41 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, int result = 0; if (response_required) - { - CORBA::UNKNOWN exception (CORBA::SystemException::_tao_minor_code - (TAO_UNHANDLED_SERVER_CXX_EXCEPTION, 0), - CORBA::COMPLETED_MAYBE); - - result = this->send_reply_exception (transport, - this->orb_core_, - request_id, - &request.reply_service_info (), - &exception); - if (result == -1) - { - if (TAO_debug_level > 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") - ACE_TEXT ("cannot send exception\n"), - ACE_TEXT ("process_request ()"))); - ACE_PRINT_EXCEPTION ( - exception, - "TAO_GIOP_Message_Base::process_request[3]"); - } - } - } + { + CORBA::UNKNOWN exception (CORBA::SystemException::_tao_minor_code + (TAO_UNHANDLED_SERVER_CXX_EXCEPTION, 0), + CORBA::COMPLETED_MAYBE); + + result = this->send_reply_exception (transport, + this->orb_core_, + request_id, + &request.reply_service_info (), + &exception); + if (result == -1) + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") + ACE_TEXT ("cannot send exception\n"), + ACE_TEXT ("process_request ()"))); + ACE_PRINT_EXCEPTION ( + exception, + "TAO_GIOP_Message_Base::process_request[3]"); + } + } + } else if (TAO_debug_level > 0) - { - // It is unfotunate that an exception (probably a system - // exception) was thrown by the upcall code (even by the - // user) when the client was not expecting a response. - // However, in this case, we cannot close the connection - // down, since it really isn't the client's fault. - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t|%N|%l) exception thrown ") - ACE_TEXT ("but client is not waiting a response\n"))); - } + { + // It is unfotunate that an exception (probably a system + // exception) was thrown by the upcall code (even by the + // user) when the client was not expecting a response. + // However, in this case, we cannot close the connection + // down, since it really isn't the client's fault. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t|%N|%l) exception thrown ") + ACE_TEXT ("but client is not waiting a response\n"))); + } return result; } @@ -957,13 +1005,14 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, int TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport, - TAO_InputCDR &input, - TAO_OutputCDR &output) + TAO_InputCDR &input, + TAO_OutputCDR &output, + TAO_GIOP_Message_Generator_Parser *parser) { // This will extract the request header, set <response_required> as // appropriate. TAO_GIOP_Locate_Request_Header locate_request (input, - this->orb_core_); + this->orb_core_); TAO_GIOP_Locate_Status_Msg status_info; @@ -976,18 +1025,18 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport, ACE_TRY { int parse_error = - this->generator_parser_->parse_locate_header (locate_request); + parser->parse_locate_header (locate_request); if (parse_error != 0) - { - ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, - CORBA::COMPLETED_NO)); - } + { + ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); + } TAO_ObjectKey tmp_key (locate_request.object_key ().length (), - locate_request.object_key ().length (), - locate_request.object_key ().get_buffer (), - 0); + locate_request.object_key ().length (), + locate_request.object_key ().get_buffer (), + 0); // Set it to an error state parse_error = 1; @@ -997,64 +1046,64 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport, // the reply CORBA::Boolean deferred_reply = 1; TAO_ServerRequest server_request (this, - req_id, - response_required, - deferred_reply, - tmp_key, - "_non_existent", - output, - transport, - this->orb_core_, - parse_error); + req_id, + response_required, + deferred_reply, + tmp_key, + "_non_existent", + output, + transport, + this->orb_core_, + parse_error); if (parse_error != 0) - { - ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, - CORBA::COMPLETED_NO)); - } + { + ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); + } CORBA::Object_var forward_to; this->orb_core_->request_dispatcher ()->dispatch ( - this->orb_core_, - server_request, - forward_to - ACE_ENV_ARG_PARAMETER); + this->orb_core_, + server_request, + forward_to + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (!CORBA::is_nil (forward_to.in ())) - { - status_info.status = TAO_GIOP_OBJECT_FORWARD; - status_info.forward_location_var = forward_to; - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("handle_locate has been called: forwarding\n"))); - } + { + status_info.status = TAO_GIOP_OBJECT_FORWARD; + status_info.forward_location_var = forward_to; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("handle_locate has been called: forwarding\n"))); + } else if (server_request.exception_type () == TAO_GIOP_NO_EXCEPTION) - { - // We got no exception, so the object is here. - status_info.status = TAO_GIOP_OBJECT_HERE; - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO: (%P|%t) handle_locate() : found\n"))); - } + { + // We got no exception, so the object is here. + status_info.status = TAO_GIOP_OBJECT_HERE; + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO: (%P|%t) handle_locate() : found\n"))); + } else - { - status_info.forward_location_var = server_request.forward_location (); - - if (!CORBA::is_nil (status_info.forward_location_var.in ())) - { - status_info.status = TAO_GIOP_OBJECT_FORWARD; - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("handle_locate has been called: forwarding\n"))); - } - else - { - // Normal exception, so the object is not here - status_info.status = TAO_GIOP_UNKNOWN_OBJECT; - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("handle_locate has been called: not here\n"))); - } - } + { + status_info.forward_location_var = server_request.forward_location (); + + if (!CORBA::is_nil (status_info.forward_location_var.in ())) + { + status_info.status = TAO_GIOP_OBJECT_FORWARD; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("handle_locate has been called: forwarding\n"))); + } + else + { + // Normal exception, so the object is not here + status_info.status = TAO_GIOP_UNKNOWN_OBJECT; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("handle_locate has been called: not here\n"))); + } + } } ACE_CATCHANY @@ -1062,9 +1111,9 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport, // Normal exception, so the object is not here status_info.status = TAO_GIOP_UNKNOWN_OBJECT; if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Base::process_locate_request - ") - ACE_TEXT ("CORBA exception raised\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Base::process_locate_request - ") + ACE_TEXT ("CORBA exception raised\n"))); } #if defined (TAO_HAS_EXCEPTIONS) ACE_CATCHALL @@ -1072,35 +1121,37 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport, // Normal exception, so the object is not here status_info.status = TAO_GIOP_UNKNOWN_OBJECT; if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Base::process_locate_request - ") - ACE_TEXT ("C++ exception raised\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Base::process_locate_request - ") + ACE_TEXT ("C++ exception raised\n"))); } #endif /* TAO_HAS_EXCEPTIONS */ ACE_ENDTRY; return this->make_send_locate_reply (transport, - locate_request, - status_info, - output); + locate_request, + status_info, + output, + parser); } int TAO_GIOP_Message_Base::make_send_locate_reply (TAO_Transport *transport, - TAO_GIOP_Locate_Request_Header &request, - TAO_GIOP_Locate_Status_Msg &status_info, - TAO_OutputCDR &output) + TAO_GIOP_Locate_Request_Header &request, + TAO_GIOP_Locate_Status_Msg &status_info, + TAO_OutputCDR &output, + TAO_GIOP_Message_Generator_Parser *parser) { // Note here we are making the Locate reply header which is *QUITE* // different from the reply header made by the make_reply () call.. // Make the GIOP message header this->write_protocol_header (TAO_GIOP_LOCATEREPLY, - output); + output); // This writes the header & body - this->generator_parser_->write_locate_reply_mesg (output, - request.request_id (), - status_info); + parser->write_locate_reply_mesg (output, + request.request_id (), + status_info); // Send the message int result = transport->send_message (output); @@ -1109,11 +1160,11 @@ TAO_GIOP_Message_Base::make_send_locate_reply (TAO_Transport *transport, if (result == -1) { if (TAO_debug_level > 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"), - ACE_TEXT ("TAO_GIOP_Message_Base::make_send_locate_reply"))); - } + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"), + ACE_TEXT ("TAO_GIOP_Message_Base::make_send_locate_reply"))); + } } return result; @@ -1136,29 +1187,29 @@ TAO_GIOP_Message_Base::send_error (TAO_Transport *transport) 0x49, // 'I' 0x4f, // 'O' 0x50, // 'P' - this->generator_parser_->major_version (), - this->generator_parser_->minor_version (), + (CORBA::Octet) 1, // Use the lowest GIOP version + (CORBA::Octet) 0, TAO_ENCAP_BYTE_ORDER, TAO_GIOP_MESSAGERROR, 0, 0, 0, 0 }; // @@ Q: How does this works with GIOP lite? - // A: It doesn't + // A: It doesn't this->dump_msg ("send_error", - (const u_char *) error_message, - TAO_GIOP_MESSAGE_HEADER_LEN); + (const u_char *) error_message, + TAO_GIOP_MESSAGE_HEADER_LEN); ACE_Data_Block data_block (TAO_GIOP_MESSAGE_HEADER_LEN, - ACE_Message_Block::MB_DATA, - error_message, - 0, - 0, - ACE_Message_Block::DONT_DELETE, - 0); + ACE_Message_Block::MB_DATA, + error_message, + 0, + 0, + ACE_Message_Block::DONT_DELETE, + 0); ACE_Message_Block message_block(&data_block, - ACE_Message_Block::DONT_DELETE); + ACE_Message_Block::DONT_DELETE); message_block.wr_ptr (TAO_GIOP_MESSAGE_HEADER_LEN); size_t bt; @@ -1166,49 +1217,40 @@ TAO_GIOP_Message_Base::send_error (TAO_Transport *transport) if (result == -1) { if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to transport %lu\n"), - transport->id ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to transport %lu\n"), + transport->id ())); } return result; } void -TAO_GIOP_Message_Base::set_state (CORBA::Octet def_major, - CORBA::Octet def_minor) +TAO_GIOP_Message_Base::set_state ( + CORBA::Octet def_major, + CORBA::Octet def_minor, + TAO_GIOP_Message_Generator_Parser *&gen_parser) { - // @@Bala Need to find a better way - // @@ Bala: what about a table: - // Accept_State implementations[] = { - // Version_10, - // Version_11 - // }; - // this->accept_state_ = &implementations[def_minor]; - // @@ of course it requires range checking and the array must be in - // some place where it is not detroyed too soon... - // @@ I'm not sure if this implementations should be dynamically - // loaded. switch (def_major) { case 1: switch (def_minor) - { - case 0: - this->generator_parser_ = - &this->tao_giop_impl_.tao_giop_10; - break; - case 1: - this->generator_parser_ = - &this->tao_giop_impl_.tao_giop_11; - break; - case 2: - this->generator_parser_ = - &this->tao_giop_impl_.tao_giop_12; - break; - default: - break; - } + { + case 0: + gen_parser = + &this->tao_giop_impl_.tao_giop_10; + break; + case 1: + gen_parser = + &this->tao_giop_impl_.tao_giop_11; + break; + case 2: + gen_parser = + &this->tao_giop_impl_.tao_giop_12; + break; + default: + break; + } break; default: break; @@ -1222,7 +1264,7 @@ TAO_GIOP_Message_Base::set_state (CORBA::Octet def_major, // // NOTE: this is IIOP-specific though it doesn't look like it is. It // relies on a TCP-ism: orderly disconnect, which doesn't exist in all -// transport protocols. Versions of GIOP atop some transport that's +// transport protocols. Versions of GIOP atop some transport that's // lacking orderly disconnect must define some transport-specific // handshaking (e.g. the XNS/SPP handshake convention) in order to // know that the same transport semantics are provided when shutdown @@ -1234,8 +1276,8 @@ TAO_GIOP_Message_Base::set_state (CORBA::Octet def_major, void TAO_GIOP_Message_Base:: send_close_connection (const TAO_GIOP_Message_Version &version, - TAO_Transport *transport, - void *) + TAO_Transport *transport, + void *) { // static CORBA::Octet @@ -1263,14 +1305,14 @@ TAO_GIOP_Message_Base:: // that this won't block (long) since we never set SO_LINGER this->dump_msg ("send_close_connection", - (const u_char *) close_message, - TAO_GIOP_MESSAGE_HEADER_LEN); + (const u_char *) close_message, + TAO_GIOP_MESSAGE_HEADER_LEN); #if 0 // @@CJC I don't think we need this check b/c the transport's send() // will simply return -1. However, I guess we could create something // like TAO_Tranport::is_closed() that returns whether the connection - // is already closed. The problem with that, however, is that it's + // is already closed. The problem with that, however, is that it's // entirely possible that is_closed() could return TRUE, and then the // transport could get closed down btw. the time it gets called and the // time that the send actually occurs. @@ -1278,20 +1320,20 @@ TAO_GIOP_Message_Base:: if (which == ACE_INVALID_HANDLE) { if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) TAO_GIOP_Message_Base::send_close_connection -" - " connection already closed\n")); + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) TAO_GIOP_Message_Base::send_close_connection -" + " connection already closed\n")); return; } #endif ACE_Data_Block data_block (TAO_GIOP_MESSAGE_HEADER_LEN, - ACE_Message_Block::MB_DATA, - close_message, - 0, - 0, - ACE_Message_Block::DONT_DELETE, - 0); + ACE_Message_Block::MB_DATA, + close_message, + 0, + 0, + ACE_Message_Block::DONT_DELETE, + 0); ACE_Message_Block message_block(&data_block); message_block.wr_ptr (TAO_GIOP_MESSAGE_HEADER_LEN); @@ -1300,15 +1342,15 @@ TAO_GIOP_Message_Base:: if (result == -1) { if (TAO_debug_level > 0) - ACE_ERROR ((LM_ERROR, - "(%P|%t) error closing connection %lu, errno = %d\n", - transport->id (), errno)); + ACE_ERROR ((LM_ERROR, + "(%P|%t) error closing connection %lu, errno = %d\n", + transport->id (), errno)); } transport->close_connection (); ACE_DEBUG ((LM_DEBUG, - "(%P|%t) shut down transport, handle %d\n", - transport-> id ())); + "(%P|%t) shut down transport, handle %d\n", + transport-> id ())); } @@ -1326,20 +1368,20 @@ TAO_GIOP_Message_Base::send_reply_exception ( char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; #if defined(ACE_HAS_PURIFY) (void) ACE_OS::memset (repbuf, - '\0', - sizeof repbuf); + '\0', + sizeof repbuf); #endif /* ACE_HAS_PURIFY */ TAO_OutputCDR output (repbuf, - sizeof repbuf, - TAO_ENCAP_BYTE_ORDER, - orb_core->output_cdr_buffer_allocator (), - orb_core->output_cdr_dblock_allocator (), - orb_core->output_cdr_msgblock_allocator (), - orb_core->orb_params ()->cdr_memcpy_tradeoff (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR, - orb_core->to_iso8859 (), - orb_core->to_unicode ()); + sizeof repbuf, + TAO_ENCAP_BYTE_ORDER, + orb_core->output_cdr_buffer_allocator (), + orb_core->output_cdr_dblock_allocator (), + orb_core->output_cdr_msgblock_allocator (), + orb_core->orb_params ()->cdr_memcpy_tradeoff (), + TAO_DEF_GIOP_MAJOR, + TAO_DEF_GIOP_MINOR, + orb_core->to_iso8859 (), + orb_core->to_unicode ()); TAO_Pluggable_Reply_Params_Base reply_params; reply_params.request_id_ = request_id; @@ -1348,7 +1390,7 @@ TAO_GIOP_Message_Base::send_reply_exception ( // We are going to send some data reply_params.argument_flag_ = 1; - // Send back the service context we received. (RTCORBA relies on + // Send back the service context we received. (RTCORBA relies on // this). reply_params.service_context_notowned (svc_info); @@ -1360,8 +1402,8 @@ TAO_GIOP_Message_Base::send_reply_exception ( } if (this->generate_exception_reply (output, - reply_params, - *x) == -1) + reply_params, + *x) == -1) return -1; return transport->send_message (output); @@ -1369,8 +1411,8 @@ TAO_GIOP_Message_Base::send_reply_exception ( void TAO_GIOP_Message_Base::dump_msg (const char *label, - const u_char *ptr, - size_t len) + const u_char *ptr, + size_t len) { if (TAO_debug_level >= 5) @@ -1378,63 +1420,67 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, static const char digits[] = "0123456789ABCD"; static const char *names[] = { - "Request", - "Reply", - "CancelRequest", - "LocateRequest", - "LocateReply", - "CloseConnection", - "MessageError", - "Fragment" + "Request", + "Reply", + "CancelRequest", + "LocateRequest", + "LocateReply", + "CloseConnection", + "MessageError", + "Fragment" }; // Message name. const char *message_name = "UNKNOWN MESSAGE"; u_long slot = ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET]; if (slot < sizeof (names) / sizeof (names[0])) - message_name = names[slot]; + message_name = names[slot]; // Byte order. int byte_order = ptr[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & 0x01; + // Get the version info + // CORBA::Octet major = ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]; + CORBA::Octet minor = ptr[TAO_GIOP_VERSION_MINOR_OFFSET]; + // request/reply id. CORBA::ULong tmp = 0; CORBA::ULong *id = &tmp; if (ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REQUEST || - ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY) - { - // @@ Only works if ServiceContextList is empty.... - if (this->generator_parser_->minor_version () < 2) - { - id = ACE_reinterpret_cast (CORBA::ULong *, - (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN + 4)); - - } - else - { - id = ACE_reinterpret_cast (CORBA::ULong *, - (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN)); - } - } + ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY) + { + // @@ Only works if ServiceContextList is empty.... + if (minor < 2) + { + id = ACE_reinterpret_cast (CORBA::ULong *, + (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN + 4)); + + } + else + { + id = ACE_reinterpret_cast (CORBA::ULong *, + (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN)); + } + } // Print. ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P | %t): %s GIOP v%c.%c msg, ") - ACE_TEXT ("%d data bytes, %s endian, %s = %u\n"), - label, - digits[ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]], - digits[ptr[TAO_GIOP_VERSION_MINOR_OFFSET]], - len - TAO_GIOP_MESSAGE_HEADER_LEN , - (byte_order == TAO_ENCAP_BYTE_ORDER) ? "my" : "other", - message_name, - *id)); + ACE_TEXT ("(%P | %t): %s GIOP v%c.%c msg, ") + ACE_TEXT ("%d data bytes, %s endian, %s = %u\n"), + label, + digits[ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]], + digits[ptr[TAO_GIOP_VERSION_MINOR_OFFSET]], + len - TAO_GIOP_MESSAGE_HEADER_LEN , + (byte_order == TAO_ENCAP_BYTE_ORDER) ? "my" : "other", + message_name, + *id)); if (TAO_debug_level >= 10) - ACE_HEX_DUMP ((LM_DEBUG, - (const char *) ptr, - len, - ACE_TEXT ("GIOP message"))); + ACE_HEX_DUMP ((LM_DEBUG, + (const char *) ptr, + len, + ACE_TEXT ("GIOP message"))); } } @@ -1447,11 +1493,25 @@ TAO_GIOP_Message_Base::generate_locate_reply_header ( } int -TAO_GIOP_Message_Base::is_ready_for_bidirectional (void) +TAO_GIOP_Message_Base::is_ready_for_bidirectional (TAO_OutputCDR &msg) { + // Get a parser for us + TAO_GIOP_Message_Generator_Parser *parser = 0; + + CORBA::Octet major, minor = 0; + + msg.get_version (major, minor); + + // Get the state information that we need to use + this->set_state (major, + minor, + parser); + // We dont really know.. So ask the generator and parser objects that // we know. - return this->generator_parser_->is_ready_for_bidirectional (); + // @@ TODO: Need to make this faster, instead of making virtual + // call, try todo the check within this class + return parser->is_ready_for_bidirectional (); } @@ -1471,14 +1531,14 @@ TAO_GIOP_Message_Base::make_queued_data (size_t sz) // allocate ACE_CDR::MAX_ALIGNMENT extra. ACE_Data_Block *db = this->orb_core_->data_block_for_message_block (sz + - ACE_CDR::MAX_ALIGNMENT); + ACE_CDR::MAX_ALIGNMENT); ACE_Allocator *alloc = this->orb_core_->message_block_msgblock_allocator (); ACE_Message_Block mb (db, - 0, - alloc); + 0, + alloc); ACE_Message_Block *new_mb = mb.duplicate (); diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h index 6d5337be3e9..cd5ffc5fe55 100644 --- a/TAO/tao/GIOP_Message_Base.h +++ b/TAO/tao/GIOP_Message_Base.h @@ -47,7 +47,7 @@ public: /// Constructor TAO_GIOP_Message_Base (TAO_ORB_Core *orb_core, - size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE); + size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE); /// Dtor virtual ~TAO_GIOP_Message_Base (void); @@ -55,7 +55,7 @@ public: /// Initialize the underlying state object based on the <major> and /// <minor> revision numbers virtual void init (CORBA::Octet major, - CORBA::Octet minor); + CORBA::Octet minor); /// Reset the messaging the object virtual void reset (void); @@ -63,8 +63,8 @@ public: /// Write the RequestHeader in to the <cdr> stream. The underlying /// implementation of the mesaging should do the right thing. virtual int generate_request_header (TAO_Operation_Details &op, - TAO_Target_Specification &spec, - TAO_OutputCDR &cdr); + TAO_Target_Specification &spec, + TAO_OutputCDR &cdr); /// Write the RequestHeader in to the <cdr> stream. virtual int generate_locate_request_header ( @@ -84,8 +84,8 @@ public: /// message is read and handled. Returns -1 on errors. If <block> is /// 1, then reply is read in a blocking manner. virtual int read_message (TAO_Transport *transport, - int block = 0, - ACE_Time_Value *max_wait_time = 0); + int block = 0, + ACE_Time_Value *max_wait_time = 0); /// Format the message. As we have not written the message length in @@ -105,23 +105,23 @@ public: * 0 if there are no more messages in <incoming>. */ virtual int extract_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data *&qd); + TAO_Queued_Data *&qd); /// Check whether the node <qd> needs consolidation from <incoming> virtual int consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming); + ACE_Message_Block &incoming); /// Get the details of the message parsed through the <qd>. virtual void get_message_data (TAO_Queued_Data *qd); /// @@Bala:Docu?? virtual int consolidate_fragments (TAO_Queued_Data *dqd, - const TAO_Queued_Data *sqd); + const TAO_Queued_Data *sqd); /// Process the request message that we have received on the /// connection virtual int process_request_message (TAO_Transport *transport, - TAO_Queued_Data *qd); + TAO_Queued_Data *qd); /// Parse the reply message that we received and return the reply @@ -143,22 +143,25 @@ protected: /// Processes the <GIOP_REQUEST> messages int process_request (TAO_Transport *transport, - TAO_InputCDR &input, - TAO_OutputCDR &output); + TAO_InputCDR &input, + TAO_OutputCDR &output, + TAO_GIOP_Message_Generator_Parser *); /// Processes the <GIOP_LOCATE_REQUEST> messages int process_locate_request (TAO_Transport *transport, - TAO_InputCDR &input, - TAO_OutputCDR &output); + TAO_InputCDR &input, + TAO_OutputCDR &output, + TAO_GIOP_Message_Generator_Parser *); /// Set the state void set_state (CORBA::Octet major, - CORBA::Octet minor); + CORBA::Octet minor, + TAO_GIOP_Message_Generator_Parser *&); /// Print out a debug messages.. void dump_msg (const char *label, - const u_char *ptr, - size_t len); + const u_char *ptr, + size_t len); /// Get the message type. The return value would be one of the /// following: @@ -174,33 +177,33 @@ private: /// NOTE: If the GIOP header happens to change in the future, we can /// push this method in to the generator_parser classes. int write_protocol_header (TAO_GIOP_Message_Type t, - TAO_OutputCDR &msg); - + TAO_OutputCDR &msg); /// Make a <GIOP_LOCATEREPLY> and hand that over to the transport so /// that it can be sent over the connection. /// NOTE:As on date 1.1 & 1.2 seem to have similar headers. Till an /// unmanageable difference comes let them be implemented here. int make_send_locate_reply (TAO_Transport *transport, - TAO_GIOP_Locate_Request_Header &request, - TAO_GIOP_Locate_Status_Msg &status, - TAO_OutputCDR &output); + TAO_GIOP_Locate_Request_Header &request, + TAO_GIOP_Locate_Status_Msg &status, + TAO_OutputCDR &output, + TAO_GIOP_Message_Generator_Parser *); /// Send error messages int send_error (TAO_Transport *transport); /// Close a connection, first sending GIOP::CloseConnection. void send_close_connection (const TAO_GIOP_Message_Version &version, - TAO_Transport *transport, - void *ctx); + TAO_Transport *transport, + void *ctx); /// We must send a LocateReply through <transport>, this request /// resulted in some kind of exception. int send_reply_exception (TAO_Transport *transport, - TAO_ORB_Core* orb_core, - CORBA::ULong request_id, - IOP::ServiceContextList *svc_info, - CORBA::Exception *x); + TAO_ORB_Core* orb_core, + CORBA::ULong request_id, + IOP::ServiceContextList *svc_info, + CORBA::Exception *x); /// Write the locate reply header @@ -210,7 +213,7 @@ private: /// Is the messaging object ready for processing BiDirectional /// request/response? - virtual int is_ready_for_bidirectional (void); + virtual int is_ready_for_bidirectional (TAO_OutputCDR &msg); /// Creates a new node for the queue with a message block in the /// node of size <sz>.. @@ -230,7 +233,7 @@ private: protected: /// The generator and parser state. - TAO_GIOP_Message_Generator_Parser *generator_parser_; + // TAO_GIOP_Message_Generator_Parser *generator_parser_; }; diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp index 121ef472b72..5484ec35373 100644 --- a/TAO/tao/GIOP_Message_Lite.cpp +++ b/TAO/tao/GIOP_Message_Lite.cpp @@ -20,15 +20,15 @@ #endif /* __ACE_INLINE__ */ ACE_RCSID (tao, - GIOP_Message_Lite, - "$Id$") + GIOP_Message_Lite, + "$Id$") static const size_t TAO_GIOP_LITE_HEADER_LEN = 5; static const size_t TAO_GIOP_LITE_MESSAGE_SIZE_OFFSET = 0; static const size_t TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET = 4; TAO_GIOP_Message_Lite::TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core, - size_t /*input_cdr_size*/) + size_t /*input_cdr_size*/) : orb_core_ (orb_core), message_type_ (0), message_size_ (0), @@ -44,7 +44,7 @@ TAO_GIOP_Message_Lite::~TAO_GIOP_Message_Lite (void) void TAO_GIOP_Message_Lite::init (CORBA::Octet, - CORBA::Octet) + CORBA::Octet) { return; } @@ -66,11 +66,11 @@ TAO_GIOP_Message_Lite::generate_request_header ( { // Write the GIOPLite header first if (!this->write_protocol_header (TAO_GIOP_REQUEST, - cdr)) + cdr)) { if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing GIOP header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing GIOP header \n"))); return -1; @@ -78,12 +78,12 @@ TAO_GIOP_Message_Lite::generate_request_header ( // Now call the implementation for the rest of the header if (!this->write_request_header (op, - spec, - cdr)) + spec, + cdr)) { if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing request header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing request header \n"))); return -1; } @@ -102,23 +102,23 @@ TAO_GIOP_Message_Lite::generate_locate_request_header ( { // Write the GIOPLite header first if (!this->write_protocol_header (TAO_GIOP_LOCATEREQUEST, - cdr)) + cdr)) { if (TAO_debug_level > 3) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing GIOPLite header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing GIOPLite header \n"))); return -1; } // Now call the implementation for the rest of the header if (!this->write_locate_request_header (op.request_id (), - spec, - cdr)) + spec, + cdr)) { if (TAO_debug_level > 4) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing locate request header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing locate request header \n"))); return -1; } @@ -135,22 +135,22 @@ TAO_GIOP_Message_Lite::generate_reply_header ( { // Write the GIOPLite header first if (!this->write_protocol_header (TAO_GIOP_REPLY, - cdr)) + cdr)) { if (TAO_debug_level > 3) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing GIOPLite header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing GIOPLite header \n"))); return -1; } // Now call the implementation for the rest of the header if (!this->write_reply_header (cdr, - params)) + params)) { if (TAO_debug_level > 4) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Error in writing reply header \n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Error in writing reply header \n"))); return -1; } @@ -161,8 +161,8 @@ TAO_GIOP_Message_Lite::generate_reply_header ( int TAO_GIOP_Message_Lite::read_message (TAO_Transport * /*transport*/, - int /*block */, - ACE_Time_Value * /*max_wait_time*/) + int /*block */, + ACE_Time_Value * /*max_wait_time*/) { return 1; } @@ -198,11 +198,11 @@ TAO_GIOP_Message_Lite::format_message (TAO_OutputCDR &stream) #else if (!stream.do_byte_swap ()) *ACE_reinterpret_cast (CORBA::ULong *, - buf + offset) = bodylen; + buf + offset) = bodylen; else ACE_CDR::swap_4 (ACE_reinterpret_cast (char *, - &bodylen), - buf + offset); + &bodylen), + buf + offset); #endif /* ACE_ENABLE_SWAP_ON_WRITE */ // Strictly speaking, should not need to loop here because the @@ -215,17 +215,17 @@ TAO_GIOP_Message_Lite::format_message (TAO_OutputCDR &stream) // dumped ACE_Message_Block* consolidated_block = 0; if (stream.begin()->cont() != 0) - { - consolidated_block = new ACE_Message_Block; - ACE_CDR::consolidate(consolidated_block, stream.begin()); - buf = (char *) (consolidated_block->rd_ptr ()); - } + { + consolidated_block = new ACE_Message_Block; + ACE_CDR::consolidate(consolidated_block, stream.begin()); + buf = (char *) (consolidated_block->rd_ptr ()); + } /// this->dump_msg ("send", - ACE_reinterpret_cast (u_char *, - buf), - stream.length ()); + ACE_reinterpret_cast (u_char *, + buf), + stream.length ()); // delete consolidated_block; @@ -288,9 +288,9 @@ TAO_GIOP_Message_Lite::message_type (void) case TAO_GIOP_FRAGMENT: // Never happens: why?? default: - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ") - ACE_TEXT ("wrong message.\n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ") + ACE_TEXT ("wrong message.\n"))); } // In case of some errors @@ -320,21 +320,21 @@ TAO_GIOP_Message_Lite::missing_data (ACE_Message_Block &block) int TAO_GIOP_Message_Lite::extract_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data *&qd) + TAO_Queued_Data *&qd) { if (incoming.length () < TAO_GIOP_LITE_HEADER_LEN) { if (incoming.length () > 0) - { - // Make a node which has a message block of the size of - // MESSAGE_HEADER_LEN. - qd = - this->make_queued_data (TAO_GIOP_LITE_HEADER_LEN); - - qd->msg_block_->copy (incoming.rd_ptr (), - incoming.length ()); - qd->missing_data_ = -1; - } + { + // Make a node which has a message block of the size of + // MESSAGE_HEADER_LEN. + qd = + this->make_queued_data (TAO_GIOP_LITE_HEADER_LEN); + + qd->msg_block_->copy (incoming.rd_ptr (), + incoming.length ()); + qd->missing_data_ = -1; + } return 0; } @@ -351,13 +351,13 @@ TAO_GIOP_Message_Lite::extract_next_message (ACE_Message_Block &incoming, if (copying_len > incoming.length ()) { qd->missing_data_ = - copying_len - incoming.length (); + copying_len - incoming.length (); copying_len = incoming.length (); } qd->msg_block_->copy (incoming.rd_ptr (), - copying_len); + copying_len); incoming.rd_ptr (copying_len); qd->byte_order_ = TAO_ENCAP_BYTE_ORDER; @@ -369,7 +369,7 @@ TAO_GIOP_Message_Lite::extract_next_message (ACE_Message_Block &incoming, int TAO_GIOP_Message_Lite::consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming) + ACE_Message_Block &incoming) { // Look to see whether we had atleast parsed the GIOP header ... if (qd->missing_data_ == -1) @@ -377,25 +377,25 @@ TAO_GIOP_Message_Lite::consolidate_node (TAO_Queued_Data *qd, // The data length that has been stuck in there during the last // read .... size_t len = - qd->msg_block_->length (); + qd->msg_block_->length (); // We know that we would have space for // TAO_GIOP_MESSAGE_HEADER_LEN here. So copy that much of data // from the <incoming> into the message block in <qd> qd->msg_block_->copy (incoming.rd_ptr (), - TAO_GIOP_LITE_HEADER_LEN - len); + TAO_GIOP_LITE_HEADER_LEN - len); // Move the rd_ptr () in the incoming message block.. incoming.rd_ptr (TAO_GIOP_LITE_HEADER_LEN - len); // Parse the message header now... if (this->parse_incoming_messages (*qd->msg_block_) == -1) - return -1; + return -1; // Now grow the message block so that we can copy the rest of // the data... ACE_CDR::grow (qd->msg_block_, - this->message_size_ + TAO_GIOP_LITE_HEADER_LEN); + this->message_size_ + TAO_GIOP_LITE_HEADER_LEN); // Copy the pay load.. @@ -405,23 +405,23 @@ TAO_GIOP_Message_Lite::consolidate_node (TAO_Queued_Data *qd, // If teh data that needs to be copied is more than that is // available to us .. if (copy_len > incoming.length ()) - { - // Calculate the missing data.. - qd->missing_data_ = - copy_len - incoming.length (); - - // Set the actual possible copy_len that is available... - copy_len = incoming.length (); - } + { + // Calculate the missing data.. + qd->missing_data_ = + copy_len - incoming.length (); + + // Set the actual possible copy_len that is available... + copy_len = incoming.length (); + } else - { - qd->missing_data_ = 0; - } + { + qd->missing_data_ = 0; + } // ..now we are set to copy the right amount of data to the // node.. qd->msg_block_->copy (incoming.rd_ptr (), - copy_len); + copy_len); // Set the <rd_ptr> of the <incoming>.. incoming.rd_ptr (copy_len); @@ -438,19 +438,19 @@ TAO_GIOP_Message_Lite::consolidate_node (TAO_Queued_Data *qd, size_t copy_len = qd->missing_data_; if (copy_len > incoming.length ()) - { - // Calculate the missing data.. - qd->missing_data_ = - copy_len - incoming.length (); + { + // Calculate the missing data.. + qd->missing_data_ = + copy_len - incoming.length (); - // Set the actual possible copy_len that is available... - copy_len = incoming.length (); - } + // Set the actual possible copy_len that is available... + copy_len = incoming.length (); + } // Copy the right amount of data in to the node... // node.. qd->msg_block_->copy (incoming.rd_ptr (), - copy_len); + copy_len); // Set the <rd_ptr> of the <incoming>.. qd->msg_block_->rd_ptr (copy_len); @@ -480,7 +480,7 @@ TAO_GIOP_Message_Lite::get_message_data (TAO_Queued_Data *qd) int TAO_GIOP_Message_Lite::consolidate_fragments (TAO_Queued_Data * /*dqd*/, - const TAO_Queued_Data * /*sqd*/) + const TAO_Queued_Data * /*sqd*/) { // We dont know what fragments are??? return -1; @@ -488,7 +488,7 @@ TAO_GIOP_Message_Lite::consolidate_fragments (TAO_Queued_Data * /*dqd*/, int TAO_GIOP_Message_Lite::process_request_message (TAO_Transport *transport, - TAO_Queued_Data *qd) + TAO_Queued_Data *qd) { // Set the upcall thread this->orb_core_->lf_strategy ().set_upcall_thread ( @@ -499,22 +499,22 @@ TAO_GIOP_Message_Lite::process_request_message (TAO_Transport *transport, #if defined(ACE_HAS_PURIFY) (void) ACE_OS::memset (repbuf, - '\0', - sizeof repbuf); + '\0', + sizeof repbuf); #endif /* ACE_HAS_PURIFY */ // Initialze an output CDR on the stack TAO_OutputCDR output (repbuf, - sizeof repbuf, - TAO_ENCAP_BYTE_ORDER, - this->orb_core_->output_cdr_buffer_allocator (), - this->orb_core_->output_cdr_dblock_allocator (), - this->orb_core_->output_cdr_msgblock_allocator (), - this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (), - qd->major_version_, - qd->minor_version_, - this->orb_core_->to_iso8859 (), - this->orb_core_->to_unicode ()); + sizeof repbuf, + TAO_ENCAP_BYTE_ORDER, + this->orb_core_->output_cdr_buffer_allocator (), + this->orb_core_->output_cdr_dblock_allocator (), + this->orb_core_->output_cdr_msgblock_allocator (), + this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (), + qd->major_version_, + qd->minor_version_, + this->orb_core_->to_iso8859 (), + this->orb_core_->to_unicode ()); // Get the read and write positions before we steal data. size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base (); @@ -522,9 +522,9 @@ TAO_GIOP_Message_Lite::process_request_message (TAO_Transport *transport, rd_pos += TAO_GIOP_LITE_HEADER_LEN; this->dump_msg ("recv", - ACE_reinterpret_cast (u_char *, - qd->msg_block_->rd_ptr ()), - qd->msg_block_->length ()); + ACE_reinterpret_cast (u_char *, + qd->msg_block_->rd_ptr ()), + qd->msg_block_->length ()); // Create a input CDR stream. @@ -533,13 +533,13 @@ TAO_GIOP_Message_Lite::process_request_message (TAO_Transport *transport, // copies at all here. The same is also done in the higher layers. TAO_InputCDR input_cdr (qd->msg_block_->data_block (), - ACE_Message_Block::DONT_DELETE, - rd_pos, - wr_pos, - qd->byte_order_, - qd->major_version_, - qd->minor_version_, - this->orb_core_); + ACE_Message_Block::DONT_DELETE, + rd_pos, + wr_pos, + qd->byte_order_, + qd->major_version_, + qd->minor_version_, + this->orb_core_); // We know we have some request message. Check whether it is a @@ -551,12 +551,12 @@ TAO_GIOP_Message_Lite::process_request_message (TAO_Transport *transport, // could raise an exception or write things in the output CDR // stream return this->process_request (transport, - input_cdr, - output); + input_cdr, + output); case TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST: return this->process_locate_request (transport, - input_cdr, - output); + input_cdr, + output); default: return -1; } @@ -576,9 +576,9 @@ TAO_GIOP_Message_Lite::process_reply_message ( rd_pos += TAO_GIOP_LITE_HEADER_LEN; this->dump_msg ("recv", - ACE_reinterpret_cast (u_char *, - qd->msg_block_->rd_ptr ()), - qd->msg_block_->length ()); + ACE_reinterpret_cast (u_char *, + qd->msg_block_->rd_ptr ()), + qd->msg_block_->length ()); // Create a empty buffer on stack @@ -586,13 +586,13 @@ TAO_GIOP_Message_Lite::process_reply_message ( // we pass it on to the higher layers of the ORB. So we dont to any // copies at all here. The same is alos done in the higher layers. TAO_InputCDR input_cdr (qd->msg_block_->data_block (), - ACE_Message_Block::DONT_DELETE, - rd_pos, - wr_pos, - qd->byte_order_, - qd->major_version_, - qd->minor_version_, - this->orb_core_); + ACE_Message_Block::DONT_DELETE, + rd_pos, + wr_pos, + qd->byte_order_, + qd->major_version_, + qd->minor_version_, + this->orb_core_); // Reset the message state. Now, we are ready for the next nested // upcall if any. @@ -612,12 +612,12 @@ TAO_GIOP_Message_Lite::process_reply_message ( case TAO_GIOP_REPLY: // Should be taken care by the state specific parsing return this->parse_reply (input_cdr, - params); + params); case TAO_GIOP_LOCATEREPLY: // We call parse_reply () here because, the message format for // the LOCATEREPLY & REPLY are same. return this->parse_reply (input_cdr, - params); + params); default: return -1; } @@ -638,7 +638,7 @@ TAO_GIOP_Message_Lite::generate_exception_reply ( { // Make the GIOP & reply header. They are version specific. this->write_reply_header (cdr, - params); + params); x._tao_encode (cdr ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } @@ -649,8 +649,8 @@ TAO_GIOP_Message_Lite::generate_exception_reply ( // Close the handle. ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ") - ACE_TEXT ("generate_exception_reply ()"))); + ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ") + ACE_TEXT ("generate_exception_reply ()"))); return -1; } ACE_ENDTRY; @@ -668,7 +668,7 @@ TAO_GIOP_Message_Lite::write_protocol_header ( // Reset the message type msg.reset (); - // @@ Bala: this is something to think harder about: right now we + // @@ Bala: this is something to think harder about: right now we // leave the space to store the length, and later we set it, but the // way we do it is CDR specific... Maybe the XXXStream classes // should support a 'save your current position' method that returns @@ -678,7 +678,7 @@ TAO_GIOP_Message_Lite::write_protocol_header ( // (eventually we may want TAO to generate fragments), or protocols // based on chunking.... // - // Write a dummy <size> later it is set to the right value... @@ + // Write a dummy <size> later it is set to the right value... @@ CORBA::ULong size = 0; msg.write_ulong (size); @@ -690,16 +690,16 @@ TAO_GIOP_Message_Lite::write_protocol_header ( int TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, - TAO_InputCDR &cdr, - TAO_OutputCDR &output) + TAO_InputCDR &cdr, + TAO_OutputCDR &output) { // This will extract the request header, set <response_required> // and <sync_with_server> as appropriate. TAO_ServerRequest request (this, - cdr, - output, - transport, - this->orb_core_); + cdr, + output, + transport, + this->orb_core_); CORBA::ULong request_id = 0; CORBA::Boolean response_required = 0; @@ -710,12 +710,12 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, ACE_TRY { parse_error = - this->parse_request_header (request); + this->parse_request_header (request); // Throw an exception if the if (parse_error != 0) - ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, - CORBA::COMPLETED_NO)); + ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); request_id = request.request_id (); response_required = request.response_expected (); @@ -724,51 +724,51 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, // Do this before the reply is sent. this->orb_core_->adapter_registry ()->dispatch (request.object_key (), - request, - forward_to - ACE_ENV_ARG_PARAMETER); + request, + forward_to + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (!CORBA::is_nil (forward_to.in ())) - { - // We should forward to another object... - TAO_Pluggable_Reply_Params reply_params (this->orb_core_); - reply_params.request_id_ = request_id; - reply_params.reply_status_ = TAO_GIOP_LOCATION_FORWARD; - reply_params.svc_ctx_.length (0); - - // Send back the reply service context list. - reply_params.service_context_notowned (&request.reply_service_info ()); - - // Make the GIOP header and Reply header - this->generate_reply_header (output, - reply_params); - - if (!(output << forward_to.in ())) - { - if (TAO_debug_level > 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) ERROR: Unable to marshal ") - ACE_TEXT ("forward reference.\n"))); - - return -1; - } - - int result = transport->send_message (output); - if (result == -1) - { - if (TAO_debug_level > 0) - { - // No exception but some kind of error, yet a - // response is required. - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") - ACE_TEXT ("cannot send reply\n"), - ACE_TEXT ("TAO_GIOP_Message_Lite::process_request"))); - } - } - return result; - } + { + // We should forward to another object... + TAO_Pluggable_Reply_Params reply_params (this->orb_core_); + reply_params.request_id_ = request_id; + reply_params.reply_status_ = TAO_GIOP_LOCATION_FORWARD; + reply_params.svc_ctx_.length (0); + + // Send back the reply service context list. + reply_params.service_context_notowned (&request.reply_service_info ()); + + // Make the GIOP header and Reply header + this->generate_reply_header (output, + reply_params); + + if (!(output << forward_to.in ())) + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) ERROR: Unable to marshal ") + ACE_TEXT ("forward reference.\n"))); + + return -1; + } + + int result = transport->send_message (output); + if (result == -1) + { + if (TAO_debug_level > 0) + { + // No exception but some kind of error, yet a + // response is required. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") + ACE_TEXT ("cannot send reply\n"), + ACE_TEXT ("TAO_GIOP_Message_Lite::process_request"))); + } + } + return result; + } } // Only CORBA exceptions are caught here. ACE_CATCHANY @@ -776,41 +776,41 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, int result = 0; if (response_required) - { - result = this->send_reply_exception (transport, - this->orb_core_, - request_id, - &request.reply_service_info (), - &ACE_ANY_EXCEPTION); - if (result == -1) - { - if (TAO_debug_level > 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") - ACE_TEXT ("cannot send exception\n"), - ACE_TEXT ("process_request ()"))); - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "TAO: "); - } - } - - } + { + result = this->send_reply_exception (transport, + this->orb_core_, + request_id, + &request.reply_service_info (), + &ACE_ANY_EXCEPTION); + if (result == -1) + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") + ACE_TEXT ("cannot send exception\n"), + ACE_TEXT ("process_request ()"))); + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "TAO: "); + } + } + + } else if (TAO_debug_level > 0) - { - // It is unfotunate that an exception (probably a system - // exception) was thrown by the upcall code (even by the - // user) when the client was not expecting a response. - // However, in this case, we cannot close the connection - // down, since it really isn't the client's fault. + { + // It is unfotunate that an exception (probably a system + // exception) was thrown by the upcall code (even by the + // user) when the client was not expecting a response. + // However, in this case, we cannot close the connection + // down, since it really isn't the client's fault. - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) exception thrown ") - ACE_TEXT ("but client is not waiting a response\n"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) exception thrown ") + ACE_TEXT ("but client is not waiting a response\n"))); - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "TAO: "); - } + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "TAO: "); + } return result; } @@ -827,43 +827,43 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, int result = 0; if (response_required) - { - CORBA::UNKNOWN exception ( - CORBA::SystemException::_tao_minor_code ( - TAO_UNHANDLED_SERVER_CXX_EXCEPTION, - 0 - ), - CORBA::COMPLETED_MAYBE - ); - - result = this->send_reply_exception (transport, - this->orb_core_, - request_id, - &request.reply_service_info (), - &exception); - if (result == -1) - { - if (TAO_debug_level > 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") - ACE_TEXT ("cannot send exception\n"), - ACE_TEXT ("process_request ()"))); - ACE_PRINT_EXCEPTION (exception, "TAO: "); - } - } - } + { + CORBA::UNKNOWN exception ( + CORBA::SystemException::_tao_minor_code ( + TAO_UNHANDLED_SERVER_CXX_EXCEPTION, + 0 + ), + CORBA::COMPLETED_MAYBE + ); + + result = this->send_reply_exception (transport, + this->orb_core_, + request_id, + &request.reply_service_info (), + &exception); + if (result == -1) + { + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ") + ACE_TEXT ("cannot send exception\n"), + ACE_TEXT ("process_request ()"))); + ACE_PRINT_EXCEPTION (exception, "TAO: "); + } + } + } else if (TAO_debug_level > 0) - { - // It is unfotunate that an exception (probably a system - // exception) was thrown by the upcall code (even by the - // user) when the client was not expecting a response. - // However, in this case, we cannot close the connection - // down, since it really isn't the client's fault. - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t|%N|%l) exception thrown ") - ACE_TEXT ("but client is not waiting a response\n"))); - } + { + // It is unfotunate that an exception (probably a system + // exception) was thrown by the upcall code (even by the + // user) when the client was not expecting a response. + // However, in this case, we cannot close the connection + // down, since it really isn't the client's fault. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t|%N|%l) exception thrown ") + ACE_TEXT ("but client is not waiting a response\n"))); + } return result; } @@ -876,13 +876,13 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, int TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport, - TAO_InputCDR &input, - TAO_OutputCDR &output) + TAO_InputCDR &input, + TAO_OutputCDR &output) { // This will extract the request header, set <response_required> as // appropriate. TAO_GIOP_Locate_Request_Header locate_request (input, - this->orb_core_); + this->orb_core_); TAO_GIOP_Locate_Status_Msg status_info; @@ -895,25 +895,25 @@ TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport, ACE_TRY { int parse_error = - this->parse_locate_header (locate_request); + this->parse_locate_header (locate_request); if (parse_error != 0) - { - ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, - CORBA::COMPLETED_NO)); - } + { + ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); + } // Execute a fake request to find out if the object is there or // if the POA can activate it on demand... char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; TAO_OutputCDR dummy_output (repbuf, - sizeof repbuf); + sizeof repbuf); // This output CDR is not used! TAO_ObjectKey tmp_key (locate_request.object_key ().length (), - locate_request.object_key ().length (), - locate_request.object_key ().get_buffer (), - 0); + locate_request.object_key ().length (), + locate_request.object_key ().get_buffer (), + 0); // Set it to an error state parse_error = 1; @@ -923,63 +923,63 @@ TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport, // the reply CORBA::Boolean deferred_reply = 1; TAO_ServerRequest server_request (this, - req_id, - response_required, - deferred_reply, - tmp_key, - "_non_existent", - dummy_output, - transport, - this->orb_core_, - parse_error); + req_id, + response_required, + deferred_reply, + tmp_key, + "_non_existent", + dummy_output, + transport, + this->orb_core_, + parse_error); if (parse_error != 0) - { - ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, - CORBA::COMPLETED_NO)); - } + { + ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); + } CORBA::Object_var forward_to; this->orb_core_->adapter_registry ()->dispatch (server_request.object_key (), - server_request, - forward_to - ACE_ENV_ARG_PARAMETER); + server_request, + forward_to + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (!CORBA::is_nil (forward_to.in ())) - { - status_info.status = TAO_GIOP_OBJECT_FORWARD; - status_info.forward_location_var = forward_to; - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("handle_locate has been called: forwarding\n"))); - } + { + status_info.status = TAO_GIOP_OBJECT_FORWARD; + status_info.forward_location_var = forward_to; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("handle_locate has been called: forwarding\n"))); + } else if (server_request.exception_type () == TAO_GIOP_NO_EXCEPTION) - { - // We got no exception, so the object is here. - status_info.status = TAO_GIOP_OBJECT_HERE; - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO: (%P|%t) handle_locate() : found\n"))); - } + { + // We got no exception, so the object is here. + status_info.status = TAO_GIOP_OBJECT_HERE; + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO: (%P|%t) handle_locate() : found\n"))); + } else - { - status_info.forward_location_var = server_request.forward_location (); - - if (!CORBA::is_nil (status_info.forward_location_var.in ())) - { - status_info.status = TAO_GIOP_OBJECT_FORWARD; - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("handle_locate has been called: forwarding\n"))); - } - else - { - // Normal exception, so the object is not here - status_info.status = TAO_GIOP_UNKNOWN_OBJECT; - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("handle_locate has been called: not here\n"))); - } - } + { + status_info.forward_location_var = server_request.forward_location (); + + if (!CORBA::is_nil (status_info.forward_location_var.in ())) + { + status_info.status = TAO_GIOP_OBJECT_FORWARD; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("handle_locate has been called: forwarding\n"))); + } + else + { + // Normal exception, so the object is not here + status_info.status = TAO_GIOP_UNKNOWN_OBJECT; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("handle_locate has been called: not here\n"))); + } + } } ACE_CATCHANY @@ -987,9 +987,9 @@ TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport, // Normal exception, so the object is not here status_info.status = TAO_GIOP_UNKNOWN_OBJECT; if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Lite::process_locate_request - ") - ACE_TEXT ("CORBA exception raised\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Lite::process_locate_request - ") + ACE_TEXT ("CORBA exception raised\n"))); } #if defined (TAO_HAS_EXCEPTIONS) ACE_CATCHALL @@ -997,17 +997,17 @@ TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport, // Normal exception, so the object is not here status_info.status = TAO_GIOP_UNKNOWN_OBJECT; if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Lite::process_locate_request - ") - ACE_TEXT ("C++ exception raised\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Lite::process_locate_request - ") + ACE_TEXT ("C++ exception raised\n"))); } #endif /* TAO_HAS_EXCEPTIONS */ ACE_ENDTRY; return this->make_send_locate_reply (transport, - output, - locate_request, - status_info); + output, + locate_request, + status_info); } @@ -1023,12 +1023,12 @@ TAO_GIOP_Message_Lite::make_send_locate_reply ( // different from the reply header made by the make_reply () call.. // Make the GIOP message header this->write_protocol_header (TAO_GIOP_LOCATEREPLY, - output); + output); // This writes the header & body this->write_locate_reply_mesg (output, - request.request_id (), - status_info); + request.request_id (), + status_info); // Send the message int result = transport->send_message (output); @@ -1037,11 +1037,11 @@ TAO_GIOP_Message_Lite::make_send_locate_reply ( if (result == -1) { if (TAO_debug_level > 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"), - ACE_TEXT ("TAO_GIOP_Message_Lite::make_send_locate_reply"))); - } + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"), + ACE_TEXT ("TAO_GIOP_Message_Lite::make_send_locate_reply"))); + } } return result; @@ -1049,37 +1049,37 @@ TAO_GIOP_Message_Lite::make_send_locate_reply ( int TAO_GIOP_Message_Lite::parse_reply (TAO_InputCDR &cdr, - TAO_Pluggable_Reply_Params ¶ms) + TAO_Pluggable_Reply_Params ¶ms) { // Read the request id if (!cdr.read_ulong (params.request_id_)) { if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t|%N|%l) : ") - ACE_TEXT ("TAO_GIOP_Message_Lite::parse_reply, ") - ACE_TEXT ("extracting request id"))); - } + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t|%N|%l) : ") + ACE_TEXT ("TAO_GIOP_Message_Lite::parse_reply, ") + ACE_TEXT ("extracting request id"))); + } return -1; } CORBA::ULong rep_stat = 0; - // and the reply status type. status can be NO_EXCEPTION, + // and the reply status type. status can be NO_EXCEPTION, // SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD // CAnnot handle LOCATION_FORWARD_PERM here if (!cdr.read_ulong (rep_stat)) { if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t|%N|%l) : ") - ACE_TEXT ("TAO_GIOP_Message_Lite::parse_reply, ") - ACE_TEXT ("extracting reply status\n"))); - } + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t|%N|%l) : ") + ACE_TEXT ("TAO_GIOP_Message_Lite::parse_reply, ") + ACE_TEXT ("extracting reply status\n"))); + } return -1; } @@ -1106,10 +1106,10 @@ TAO_GIOP_Message_Lite::parse_reply (TAO_InputCDR &cdr, break; default: if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%N|%l) Unknown reply status \n"))); - } + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%N|%l) Unknown reply status \n"))); + } } // Steal the contents in to the reply CDR and loose ownership of the @@ -1131,7 +1131,7 @@ TAO_GIOP_Message_Lite::write_reply_header ( { // Write the GIOP Lite header first this->write_protocol_header (TAO_GIOP_REPLY, - output); + output); // Write the request ID output.write_ulong (reply.request_id_); @@ -1178,9 +1178,9 @@ TAO_GIOP_Message_Lite::write_request_header ( } // Sync scope - ignored by server if request is not oneway. else if (response_flags == CORBA::Octet (TAO::SYNC_WITH_TRANSPORT) - || response_flags == CORBA::Octet (TAO::SYNC_NONE) - || response_flags == CORBA::Octet (TAO::SYNC_EAGER_BUFFERING) - || response_flags == CORBA::Octet (TAO::SYNC_DELAYED_BUFFERING)) + || response_flags == CORBA::Octet (TAO::SYNC_NONE) + || response_flags == CORBA::Octet (TAO::SYNC_EAGER_BUFFERING) + || response_flags == CORBA::Octet (TAO::SYNC_DELAYED_BUFFERING)) { // No response required. out_stream << CORBA::Any::from_octet (0); @@ -1216,18 +1216,18 @@ TAO_GIOP_Message_Lite::write_request_header ( else { if (TAO_debug_level) - { - ACE_DEBUG (( - LM_DEBUG, - ACE_TEXT ("(%N |%l) Unable to handle this request \n") - )); - } + { + ACE_DEBUG (( + LM_DEBUG, + ACE_TEXT ("(%N |%l) Unable to handle this request \n") + )); + } return 0; } out_stream.write_string (opdetails.opname_len (), - opdetails.opname ()); + opdetails.opname ()); return 1; } @@ -1254,12 +1254,12 @@ TAO_GIOP_Message_Lite::write_locate_request_header ( else { if (TAO_debug_level) - { - ACE_DEBUG (( - LM_DEBUG, - ACE_TEXT ("(%N |%l) Unable to handle this request \n") - )); - } + { + ACE_DEBUG (( + LM_DEBUG, + ACE_TEXT ("(%N |%l) Unable to handle this request \n") + )); + } return 0; } @@ -1302,8 +1302,8 @@ TAO_GIOP_Message_Lite::parse_request_header (TAO_ServerRequest &request) if (hdr_status) { request.object_key ().replace (key_length, key_length, - (CORBA::Octet*)input.rd_ptr (), - 0); + (CORBA::Octet*)input.rd_ptr (), + 0); input.skip_bytes (key_length); } @@ -1313,20 +1313,20 @@ TAO_GIOP_Message_Lite::parse_request_header (TAO_ServerRequest &request) hdr_status = hdr_status && input.read_ulong (length); if (hdr_status) - { - // Do not include NULL character at the end. - // @@ This is not getting demarshaled using the codeset - // translators! + { + // Do not include NULL character at the end. + // @@ This is not getting demarshaled using the codeset + // translators! - // Notice that there are no memory allocations involved - // here! + // Notice that there are no memory allocations involved + // here! - request.operation (input.rd_ptr (), - length - 1, - 0 /* TAO_ServerRequest does NOT own string */); + request.operation (input.rd_ptr (), + length - 1, + 0 /* TAO_ServerRequest does NOT own string */); - hdr_status = input.skip_bytes (length); - } + hdr_status = input.skip_bytes (length); + } } else { @@ -1339,8 +1339,8 @@ TAO_GIOP_Message_Lite::parse_request_header (TAO_ServerRequest &request) hdr_status = hdr_status && input.read_string (tmp.inout ()); request.operation (tmp._retn (), - 0, - 1 /* TAO_ServerRequest owns string */); + 0, + 1 /* TAO_ServerRequest owns string */); } return hdr_status ? 0 : -1; @@ -1386,27 +1386,27 @@ TAO_GIOP_Message_Lite::send_reply_exception ( #if defined(ACE_HAS_PURIFY) (void) ACE_OS::memset (repbuf, - '\0', - sizeof repbuf); + '\0', + sizeof repbuf); #endif /* ACE_HAS_PURIFY */ TAO_OutputCDR output (repbuf, - sizeof repbuf, - TAO_ENCAP_BYTE_ORDER, - orb_core->output_cdr_buffer_allocator (), - orb_core->output_cdr_dblock_allocator (), - orb_core->output_cdr_msgblock_allocator (), - orb_core->orb_params ()->cdr_memcpy_tradeoff (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR, - orb_core->to_iso8859 (), - orb_core->to_unicode ()); + sizeof repbuf, + TAO_ENCAP_BYTE_ORDER, + orb_core->output_cdr_buffer_allocator (), + orb_core->output_cdr_dblock_allocator (), + orb_core->output_cdr_msgblock_allocator (), + orb_core->orb_params ()->cdr_memcpy_tradeoff (), + TAO_DEF_GIOP_MAJOR, + TAO_DEF_GIOP_MINOR, + orb_core->to_iso8859 (), + orb_core->to_unicode ()); // Make the GIOP & reply header. They are version specific. TAO_Pluggable_Reply_Params reply_params (orb_core); reply_params.request_id_ = request_id; reply_params.svc_ctx_.length (0); - // Send back the service context we received. (RTCORBA relies on + // Send back the service context we received. (RTCORBA relies on // this). reply_params.service_context_notowned (svc_info); @@ -1420,13 +1420,13 @@ TAO_GIOP_Message_Lite::send_reply_exception ( reply_params.reply_status_ = TAO_GIOP_USER_EXCEPTION; if (CORBA::SystemException::_downcast (x) != 0) - { - reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION; - } + { + reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION; + } // Make the GIOP & reply header. They are version specific. this->write_reply_header (output, - reply_params); + reply_params); x->_tao_encode (output ACE_ENV_ARG_PARAMETER); @@ -1439,9 +1439,9 @@ TAO_GIOP_Message_Lite::send_reply_exception ( // Close the handle. ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception on transport %lu: %p\n"), - transport->id (), - ACE_TEXT ("send_reply_exception ()"))); + ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception on transport %lu: %p\n"), + transport->id (), + ACE_TEXT ("send_reply_exception ()"))); return -1; } ACE_ENDTRY; @@ -1462,7 +1462,7 @@ TAO_GIOP_Message_Lite::write_locate_reply_mesg ( // Make the GIOP message header this->write_protocol_header (TAO_GIOP_LOCATEREPLY, - output); + output); // Make the header for the locate request output.write_ulong (request_id); @@ -1473,12 +1473,12 @@ TAO_GIOP_Message_Lite::write_locate_reply_mesg ( CORBA::Object_ptr object_ptr = status_info.forward_location_var.in (); if ((output << object_ptr) == 0) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t|%N|%l) make_locate_reply-") - ACE_TEXT ("cannot marshal object reference\n"))); - } + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t|%N|%l) make_locate_reply-") + ACE_TEXT ("cannot marshal object reference\n"))); + } } return 1; @@ -1501,32 +1501,32 @@ TAO_GIOP_Message_Lite::send_error (TAO_Transport *transport) }; this->dump_msg ("send_error", - (const u_char *) error_message, - TAO_GIOP_LITE_HEADER_LEN); + (const u_char *) error_message, + TAO_GIOP_LITE_HEADER_LEN); ACE_Data_Block data_block (TAO_GIOP_LITE_HEADER_LEN, - ACE_Message_Block::MB_DATA, - error_message, - 0, - 0, - ACE_Message_Block::DONT_DELETE, - 0); + ACE_Message_Block::MB_DATA, + error_message, + 0, + 0, + ACE_Message_Block::DONT_DELETE, + 0); ACE_Message_Block message_block(&data_block); message_block.wr_ptr (TAO_GIOP_LITE_HEADER_LEN); size_t bt; int result = transport->send_message_block_chain (&message_block, - bt); + bt); if (result == -1) { if (TAO_debug_level > 0) - { - ACE_DEBUG (( - LM_DEBUG, - ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to transport %lu, errno = %d\n"), - transport->id (), errno - )); - } + { + ACE_DEBUG (( + LM_DEBUG, + ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to transport %lu, errno = %d\n"), + transport->id (), errno + )); + } } return result; @@ -1534,8 +1534,8 @@ TAO_GIOP_Message_Lite::send_error (TAO_Transport *transport) void TAO_GIOP_Message_Lite::dump_msg (const char *label, - const u_char *ptr, - size_t len) + const u_char *ptr, + size_t len) { static const char *names [] = { @@ -1556,9 +1556,9 @@ TAO_GIOP_Message_Lite::dump_msg (const char *label, u_long slot = ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET]; if (slot < sizeof (names)/sizeof(names[0])) - { - message_name = names [slot]; - } + { + message_name = names [slot]; + } // Byte order. int byte_order = TAO_ENCAP_BYTE_ORDER; @@ -1568,31 +1568,31 @@ TAO_GIOP_Message_Lite::dump_msg (const char *label, CORBA::ULong *id = &tmp; if (ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REQUEST || - ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY) - { - // We are not sure where the read pointer is pointing - // to. So, try to align teh pointer to a 4 byte boundary. - char *buf = ACE_ptr_align_binary (ptr + TAO_GIOP_LITE_HEADER_LEN, 4); + ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY) + { + // We are not sure where the read pointer is pointing + // to. So, try to align teh pointer to a 4 byte boundary. + char *buf = ACE_ptr_align_binary (ptr + TAO_GIOP_LITE_HEADER_LEN, 4); - id = ACE_reinterpret_cast (CORBA::ULong *, - (char * ) (buf)); - } + id = ACE_reinterpret_cast (CORBA::ULong *, + (char * ) (buf)); + } // Print. ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P | %t):%s GIOP lite msg, ") - ACE_TEXT ("%d data bytes, %s endian, <%s = %d> \n"), - label, - len - TAO_GIOP_LITE_HEADER_LEN, - (byte_order == TAO_ENCAP_BYTE_ORDER) ? "my" : "other", - message_name, - *id)); + ACE_TEXT ("(%P | %t):%s GIOP lite msg, ") + ACE_TEXT ("%d data bytes, %s endian, <%s = %d> \n"), + label, + len - TAO_GIOP_LITE_HEADER_LEN, + (byte_order == TAO_ENCAP_BYTE_ORDER) ? "my" : "other", + message_name, + *id)); if (TAO_debug_level >= 10) - ACE_HEX_DUMP ((LM_DEBUG, - (const char *) ptr, - len, - ACE_TEXT ("GIOP lite message"))); + ACE_HEX_DUMP ((LM_DEBUG, + (const char *) ptr, + len, + ACE_TEXT ("GIOP lite message"))); } } @@ -1610,14 +1610,14 @@ TAO_GIOP_Message_Lite::make_queued_data (size_t sz) // allocate ACE_CDR::MAX_ALIGNMENT extra. ACE_Data_Block *db = this->orb_core_->data_block_for_message_block (sz + - ACE_CDR::MAX_ALIGNMENT); + ACE_CDR::MAX_ALIGNMENT); ACE_Allocator *alloc = this->orb_core_->message_block_msgblock_allocator (); ACE_Message_Block mb (db, - 0, - alloc); + 0, + alloc); ACE_Message_Block *new_mb = mb.duplicate (); @@ -1638,7 +1638,7 @@ TAO_GIOP_Message_Lite::generate_locate_reply_header ( int -TAO_GIOP_Message_Lite::is_ready_for_bidirectional (void) +TAO_GIOP_Message_Lite::is_ready_for_bidirectional (TAO_OutputCDR & ) { // No we dont support.. return 0; diff --git a/TAO/tao/GIOP_Message_Lite.h b/TAO/tao/GIOP_Message_Lite.h index 601f899822e..e13a8078b4e 100644 --- a/TAO/tao/GIOP_Message_Lite.h +++ b/TAO/tao/GIOP_Message_Lite.h @@ -45,7 +45,7 @@ public: /// Constructor TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core, - size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE); + size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE); /// Dtor virtual ~TAO_GIOP_Message_Lite (void); @@ -59,8 +59,8 @@ public: /// Write the RequestHeader in to the <cdr> stream. The underlying /// implementation of the mesaging should do the right thing. virtual int generate_request_header (TAO_Operation_Details &op, - TAO_Target_Specification &spec, - TAO_OutputCDR &cdr); + TAO_Target_Specification &spec, + TAO_OutputCDR &cdr); /// Write the RequestHeader in to the <cdr> stream. virtual int generate_locate_request_header ( @@ -76,8 +76,8 @@ public: /// Dummy method to .. virtual int read_message (TAO_Transport *transport, - int block = 0, - ACE_Time_Value *max_wait_time = 0); + int block = 0, + ACE_Time_Value *max_wait_time = 0); /// Format the message. As we have not written the message length in @@ -106,23 +106,23 @@ public: * 0 if there are no more messages in <incoming>. */ virtual int extract_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data *&qd); + TAO_Queued_Data *&qd); /// Check whether the node <qd> needs consolidation from <incoming> virtual int consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming); + ACE_Message_Block &incoming); /// Get the details of the message parsed through the <qd>. virtual void get_message_data (TAO_Queued_Data *qd); /// @@Bala: Docu??? virtual int consolidate_fragments (TAO_Queued_Data *dqd, - const TAO_Queued_Data *sqd); + const TAO_Queued_Data *sqd); /// Process the request message that we have received on the /// connection virtual int process_request_message (TAO_Transport *transport, - TAO_Queued_Data *qd); + TAO_Queued_Data *qd); /// Parse the reply message that we received and return the reply /// information though <reply_info> @@ -143,47 +143,47 @@ private: /// NOTE: If the GIOP header happens to change in the future, we can /// push this method in to the generator_parser classes. int write_protocol_header (TAO_GIOP_Message_Type t, - TAO_OutputCDR &msg); + TAO_OutputCDR &msg); /// Processes the <GIOP_REQUEST> messages int process_request (TAO_Transport *transport, - TAO_InputCDR &input, - TAO_OutputCDR &output); + TAO_InputCDR &input, + TAO_OutputCDR &output); /// Processes the <GIOP_LOCATE_REQUEST> messages int process_locate_request (TAO_Transport *transport, - TAO_InputCDR &input, - TAO_OutputCDR &output); + TAO_InputCDR &input, + TAO_OutputCDR &output); /// Make a <GIOP_LOCATEREPLY> and hand that over to the transport so /// that it can be sent over the connection. /// NOTE:As on date 1.1 & 1.2 seem to have similar headers. Till an /// unmanageable difference comes let them be implemented here. int make_send_locate_reply (TAO_Transport *transport, - TAO_OutputCDR &output, - TAO_GIOP_Locate_Request_Header &request, - TAO_GIOP_Locate_Status_Msg &status); + TAO_OutputCDR &output, + TAO_GIOP_Locate_Request_Header &request, + TAO_GIOP_Locate_Status_Msg &status); /// Send error messages int send_error (TAO_Transport *transport); /// Close a connection, first sending GIOP::CloseConnection. void send_close_connection (const TAO_GIOP_Message_Version &version, - TAO_Transport *transport, - void *ctx); + TAO_Transport *transport, + void *ctx); /// We must send a LocateReply through <transport>, this request /// resulted in some kind of exception. int send_reply_exception (TAO_Transport *transport, - TAO_ORB_Core* orb_core, - CORBA::ULong request_id, - IOP::ServiceContextList *svc_info, - CORBA::Exception *x); + TAO_ORB_Core* orb_core, + CORBA::ULong request_id, + IOP::ServiceContextList *svc_info, + CORBA::Exception *x); /// Print out a debug messages.. void dump_msg (const char *label, - const u_char *ptr, - size_t len); + const u_char *ptr, + size_t len); TAO_Queued_Data *make_queued_data (size_t sz); @@ -194,7 +194,7 @@ private: /// Is the messaging object ready for processing BiDirectional /// request/response? - virtual int is_ready_for_bidirectional (void); + virtual int is_ready_for_bidirectional (TAO_OutputCDR &msg); private: @@ -234,11 +234,11 @@ private: /// Parse the reply message int parse_reply (TAO_InputCDR &input, - TAO_Pluggable_Reply_Params ¶ms); + TAO_Pluggable_Reply_Params ¶ms); /// Parse the locate reply message from the server int parse_locate_reply (TAO_InputCDR &input, - TAO_Pluggable_Reply_Params ¶ms); + TAO_Pluggable_Reply_Params ¶ms); private: @@ -246,7 +246,7 @@ private: TAO_ORB_Core *orb_core_; /// The message type that we are going to process.. - CORBA::Octet message_type_; + CORBA::Octet message_type_; /// The pay load size CORBA::ULong message_size_; diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 56eac4cc260..c4194fb4010 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -26,10 +26,10 @@ ACE_RCSID (tao, IIOP_Transport, "$Id$") TAO_IIOP_Transport::TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler, - TAO_ORB_Core *orb_core, - CORBA::Boolean flag) + TAO_ORB_Core *orb_core, + CORBA::Boolean flag) : TAO_Transport (TAO_TAG_IIOP_PROFILE, - orb_core) + orb_core) , connection_handler_ (handler) , messaging_object_ (0) { @@ -37,13 +37,13 @@ TAO_IIOP_Transport::TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler, { // Use the lite version of the protocol ACE_NEW (this->messaging_object_, - TAO_GIOP_Message_Lite (orb_core)); + TAO_GIOP_Message_Lite (orb_core)); } else { // Use the normal GIOP object ACE_NEW (this->messaging_object_, - TAO_GIOP_Message_Base (orb_core)); + TAO_GIOP_Message_Base (orb_core)); } } @@ -66,11 +66,11 @@ TAO_IIOP_Transport::messaging_object (void) ssize_t TAO_IIOP_Transport::send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *max_wait_time) + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time) { ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt, - max_wait_time); + max_wait_time); if (retval > 0) bytes_transferred = retval; @@ -79,12 +79,12 @@ TAO_IIOP_Transport::send_i (iovec *iov, int iovcnt, ssize_t TAO_IIOP_Transport::recv_i (char *buf, - size_t len, - const ACE_Time_Value *max_wait_time) + size_t len, + const ACE_Time_Value *max_wait_time) { ssize_t n = this->connection_handler_->peer ().recv (buf, - len, - max_wait_time); + len, + max_wait_time); // Do not print the error message if it is a timeout, which could // occur in thread-per-connection. @@ -93,16 +93,16 @@ TAO_IIOP_Transport::recv_i (char *buf, errno != ETIME) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - %p \n"), - ACE_TEXT ("TAO - read message failure ") - ACE_TEXT ("recv_i () \n"))); + ACE_TEXT ("TAO (%P|%t) - %p \n"), + ACE_TEXT ("TAO - read message failure ") + ACE_TEXT ("recv_i () \n"))); } // Error handling if (n == -1) { if (errno == EWOULDBLOCK) - return 0; + return 0; return -1; @@ -126,8 +126,8 @@ TAO_IIOP_Transport::register_handler_i (void) if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Transport::register_handler %d\n", - this->id ())); + "TAO (%P|%t) - IIOP_Transport::register_handler %d\n", + this->id ())); } ACE_Reactor *r = this->orb_core_->reactor (); @@ -142,25 +142,25 @@ TAO_IIOP_Transport::register_handler_i (void) // Register the handler with the reactor return r->register_handler (this->connection_handler_, - ACE_Event_Handler::READ_MASK); + ACE_Event_Handler::READ_MASK); } int TAO_IIOP_Transport::send_request (TAO_Stub *stub, - TAO_ORB_Core *orb_core, - TAO_OutputCDR &stream, - int two_way, - ACE_Time_Value *max_wait_time) + TAO_ORB_Core *orb_core, + TAO_OutputCDR &stream, + int two_way, + ACE_Time_Value *max_wait_time) { if (this->ws_->sending_request (orb_core, - two_way) == -1) + two_way) == -1) return -1; if (this->send_message (stream, - stub, - two_way, - max_wait_time) == -1) + stub, + two_way, + max_wait_time) == -1) return -1; @@ -169,9 +169,9 @@ TAO_IIOP_Transport::send_request (TAO_Stub *stub, int TAO_IIOP_Transport::send_message (TAO_OutputCDR &stream, - TAO_Stub *stub, - int twoway, - ACE_Time_Value *max_wait_time) + TAO_Stub *stub, + int twoway, + ACE_Time_Value *max_wait_time) { // Format the message in the stream first if (this->messaging_object_->format_message (stream) != 0) @@ -179,17 +179,17 @@ TAO_IIOP_Transport::send_message (TAO_OutputCDR &stream, // This guarantees to send all data (bytes) or return an error. ssize_t n = this->send_message_i (stub, - twoway, - stream.begin (), - max_wait_time); + twoway, + stream.begin (), + max_wait_time); if (n == -1) { if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"), - this->id (), - ACE_TEXT ("send_message ()\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"), + this->id (), + ACE_TEXT ("send_message ()\n"))); return -1; } @@ -199,15 +199,15 @@ TAO_IIOP_Transport::send_message (TAO_OutputCDR &stream, int TAO_IIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg) + TAO_Target_Specification &spec, + TAO_OutputCDR &msg) { // Check whether we have a Bi Dir IIOP policy set, whether the // messaging objects are ready to handle bidirectional connections // and also make sure that we have not recd. or sent any information // regarding this before... if (this->orb_core ()->bidir_giop_policy () && - this->messaging_object_->is_ready_for_bidirectional () && + this->messaging_object_->is_ready_for_bidirectional (msg) && this->bidirectional_flag () < 0) { this->set_bidir_context_info (opdetails); @@ -222,16 +222,16 @@ TAO_IIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails, return TAO_Transport::generate_request_header (opdetails, - spec, - msg); + spec, + msg); } int TAO_IIOP_Transport::messaging_init (CORBA::Octet major, - CORBA::Octet minor) + CORBA::Octet minor) { this->messaging_object_->init (major, - minor); + minor); return 1; } @@ -272,12 +272,12 @@ TAO_IIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) { // Check whether it is a IIOP acceptor if ((*acceptor)->tag () == TAO_TAG_IIOP_PROFILE) - { - // @@ Why isn't the return value checked! - // -Ossama - this->get_listen_point (listen_point_list, - *acceptor); - } + { + // @@ Why isn't the return value checked! + // -Ossama + this->get_listen_point (listen_point_list, + *acceptor); + } } // We have the ListenPointList at this point. Create a output CDR @@ -291,7 +291,7 @@ TAO_IIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) // Add this info in to the svc_list opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP, - cdr); + cdr); return; } @@ -303,7 +303,7 @@ TAO_IIOP_Transport::get_listen_point ( { TAO_IIOP_Acceptor *iiop_acceptor = ACE_dynamic_cast (TAO_IIOP_Acceptor *, - acceptor ); + acceptor ); // Get the array of endpoints serviced by TAO_IIOP_Acceptor const ACE_INET_Addr *endpoint_addr = @@ -320,10 +320,10 @@ TAO_IIOP_Transport::get_listen_point ( == -1) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) Could not resolve local ") - ACE_TEXT ("host address in ") - ACE_TEXT ("get_listen_point()\n")), - -1); + ACE_TEXT ("(%P|%t) Could not resolve local ") + ACE_TEXT ("host address in ") + ACE_TEXT ("get_listen_point()\n")), + -1); } // Note: Looks like there is no point in sending the list of @@ -333,13 +333,13 @@ TAO_IIOP_Transport::get_listen_point ( // Get the hostname for the local address if (iiop_acceptor->hostname (this->orb_core_, - local_addr, - local_interface.out ()) == -1) + local_addr, + local_interface.out ()) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) Could not resolve local host") - ACE_TEXT (" name \n")), - -1); + ACE_TEXT ("(%P|%t) Could not resolve local host") + ACE_TEXT (" name \n")), + -1); } for (size_t index = 0; @@ -347,20 +347,20 @@ TAO_IIOP_Transport::get_listen_point ( index++) { if (local_addr.get_ip_address() - == endpoint_addr[index].get_ip_address()) - { - // Get the count of the number of elements - CORBA::ULong len = listen_point_list.length (); - - // Increase the length by 1 - listen_point_list.length (len + 1); - - // We have the connection and the acceptor endpoint on the - // same interface - IIOP::ListenPoint &point = listen_point_list[len]; - point.host = CORBA::string_dup (local_interface.in ()); - point.port = endpoint_addr[index].get_port_number (); - } + == endpoint_addr[index].get_ip_address()) + { + // Get the count of the number of elements + CORBA::ULong len = listen_point_list.length (); + + // Increase the length by 1 + listen_point_list.length (len + 1); + + // We have the connection and the acceptor endpoint on the + // same interface + IIOP::ListenPoint &point = listen_point_list[len]; + point.host = CORBA::string_dup (local_interface.in ()); + point.port = endpoint_addr[index].get_port_number (); + } } return 1; diff --git a/TAO/tao/Pluggable_Messaging.h b/TAO/tao/Pluggable_Messaging.h index dd7ff672518..8edfcc69027 100644 --- a/TAO/tao/Pluggable_Messaging.h +++ b/TAO/tao/Pluggable_Messaging.h @@ -36,7 +36,7 @@ class TAO_Queued_Data; // @@ The more I think I about this class, I feel that this class need // not be a ABC as it is now. Instead we have these options // (1) Parametrize this class with the "Messaging Object". Then the -// implementations can just redirect the request to the class +// implementations can just redirect the request to the class // that it has been specialised with // (2) Use a bridge pattern here ie. the interface exposed by this // class will redirect the request to the implementation which @@ -102,8 +102,8 @@ public: * number of bytes that needs to be read from the connection. */ virtual int read_message (TAO_Transport *transport, - int block = 0, - ACE_Time_Value *max_wait_time = 0) = 0; + int block = 0, + ACE_Time_Value *max_wait_time = 0) = 0; /// Format the message in the <cdr>. May not be needed in /// general. @@ -111,7 +111,7 @@ public: /// Do any initialisations that may be needed. virtual void init (CORBA::Octet major, - CORBA::Octet minor) = 0; + CORBA::Octet minor) = 0; /// Parse the incoming messages.. virtual int parse_incoming_messages (ACE_Message_Block &message_block) = 0; @@ -128,20 +128,20 @@ public: * 0 if there are no more messages in <incoming>. */ virtual int extract_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data *&qd) = 0; + TAO_Queued_Data *&qd) = 0; /// Check whether the node <qd> needs consolidation from <incoming> virtual int consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming) = 0; + ACE_Message_Block &incoming) = 0; /// @@Bala:Docu?? virtual int consolidate_fragments (TAO_Queued_Data *dqd, - const TAO_Queued_Data *sqd) = 0; + const TAO_Queued_Data *sqd) = 0; /// Parse the request message, make an upcall and send the reply back /// to the "request initiator" virtual int process_request_message (TAO_Transport *transport, - TAO_Queued_Data *qd) = 0; + TAO_Queued_Data *qd) = 0; /// Parse the reply message that we received and return the reply @@ -159,7 +159,7 @@ public: /// Is the messaging object ready for processing BiDirectional /// request/response? - virtual int is_ready_for_bidirectional (void) = 0; + virtual int is_ready_for_bidirectional (TAO_OutputCDR &msg) = 0; /// Reset the messaging the object virtual void reset (void) = 0; diff --git a/TAO/tao/TAO_Server_Request.cpp b/TAO/tao/TAO_Server_Request.cpp index 5303381f18c..4853ab6b0cb 100644 --- a/TAO/tao/TAO_Server_Request.cpp +++ b/TAO/tao/TAO_Server_Request.cpp @@ -24,8 +24,8 @@ #endif /* ! __ACE_INLINE__ */ ACE_RCSID (tao, - TAO_Server_Request, - "$Id$") + TAO_Server_Request, + "$Id$") #if defined (ACE_ENABLE_TIMEPROBES) @@ -44,15 +44,15 @@ enum // Setup Timeprobes ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Server_Request_Timeprobe_Description, - TAO_SERVER_REQUEST_START); + TAO_SERVER_REQUEST_START); #endif /* ACE_ENABLE_TIMEPROBES */ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base, - TAO_InputCDR &input, - TAO_OutputCDR &output, - TAO_Transport *transport, - TAO_ORB_Core *orb_core) + TAO_InputCDR &input, + TAO_OutputCDR &output, + TAO_Transport *transport, + TAO_ORB_Core *orb_core) : mesg_base_ (mesg_base), operation_ (), incoming_ (&input), @@ -73,7 +73,7 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base, #if TAO_HAS_INTERCEPTORS == 1 , interceptor_count_ (0) , rs_pi_current_ () -#endif /* TAO_HAS_INTERCEPTORS == 1 */ +#endif /* TAO_HAS_INTERCEPTORS == 1 */ { ACE_FUNCTION_TIMEPROBE (TAO_SERVER_REQUEST_START); // No-op. @@ -81,15 +81,15 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base, // This constructor is used, by the locate request code. TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base, - CORBA::ULong request_id, - CORBA::Boolean response_expected, - CORBA::Boolean deferred_reply, - TAO_ObjectKey &object_key, - const char *operation, - TAO_OutputCDR &output, - TAO_Transport *transport, - TAO_ORB_Core *orb_core, - int &parse_error) + CORBA::ULong request_id, + CORBA::Boolean response_expected, + CORBA::Boolean deferred_reply, + TAO_ObjectKey &object_key, + const char *operation, + TAO_OutputCDR &output, + TAO_Transport *transport, + TAO_ORB_Core *orb_core, + int &parse_error) : mesg_base_ (mesg_base), operation_ (operation), incoming_ (0), @@ -109,7 +109,7 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base, #if TAO_HAS_INTERCEPTORS == 1 , interceptor_count_ (0) , rs_pi_current_ () -#endif /* TAO_HAS_INTERCEPTORS == 1 */ +#endif /* TAO_HAS_INTERCEPTORS == 1 */ { this->profile_.object_key (object_key); parse_error = 0; @@ -167,7 +167,7 @@ TAO_ServerRequest::init_reply (void) // Construct a REPLY header. this->mesg_base_->generate_reply_header (*this->outgoing_, - reply_params); + reply_params); // Finish the GIOP Reply header, then marshal the exception. if (reply_params.reply_status_ == TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD) @@ -176,11 +176,11 @@ TAO_ServerRequest::init_reply (void) CORBA::Object_ptr object_ptr = this->forward_location_.in (); if ((*this->outgoing_ << object_ptr) == 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO_GIOP_ServerRequest::marshal - ") - ACE_TEXT ("encoding forwarded objref failed\n"))); - } + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO_GIOP_ServerRequest::marshal - ") + ACE_TEXT ("encoding forwarded objref failed\n"))); + } } } @@ -207,7 +207,7 @@ TAO_ServerRequest::send_no_exception_reply (void) // Construct a REPLY header. this->mesg_base_->generate_reply_header (*this->outgoing_, - reply_params); + reply_params); // Send the message. int result = this->transport_->send_message (*this->outgoing_); @@ -215,15 +215,15 @@ TAO_ServerRequest::send_no_exception_reply (void) if (result == -1) { if (TAO_debug_level > 0) - { - // No exception but some kind of error, yet a response - // is required. - ACE_ERROR (( - LM_ERROR, - ACE_TEXT ("TAO: (%P|%t) %p: cannot send NO_EXCEPTION reply\n"), - ACE_TEXT ("TAO_GIOP_ServerRequest::send_no_exception_reply") - )); - } + { + // No exception but some kind of error, yet a response + // is required. + ACE_ERROR (( + LM_ERROR, + ACE_TEXT ("TAO: (%P|%t) %p: cannot send NO_EXCEPTION reply\n"), + ACE_TEXT ("TAO_GIOP_ServerRequest::send_no_exception_reply") + )); + } } } @@ -234,14 +234,14 @@ TAO_ServerRequest::tao_send_reply (void) if (result == -1) { if (TAO_debug_level > 0) - { - // No exception but some kind of error, yet a response - // is required. - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"), - ACE_TEXT ("TAO_ServerRequest::tao_send_reply"))); - - } + { + // No exception but some kind of error, yet a response + // is required. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"), + ACE_TEXT ("TAO_ServerRequest::tao_send_reply"))); + + } } } @@ -268,11 +268,13 @@ TAO_ServerRequest::tao_send_reply_exception (CORBA::Exception &ex) // Check whether we are able to downcast the exception if (CORBA::SystemException::_downcast (&ex) != 0) - { - reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION; - } + { + reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION; + } // Create a new output CDR stream + +# if 0 #if defined(ACE_HAS_PURIFY) // Only inititialize the buffer if we're compiling with Purify. // Otherwise, there is no real need to do so, especially since @@ -282,37 +284,38 @@ TAO_ServerRequest::tao_send_reply_exception (CORBA::Exception &ex) #else char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; #endif /* ACE_HAS_PURIFY */ - +#endif /*if 0*/ + /* TAO_OutputCDR output (repbuf, - sizeof repbuf, - TAO_ENCAP_BYTE_ORDER, - this->orb_core_->output_cdr_buffer_allocator (), - this->orb_core_->output_cdr_dblock_allocator (), - this->orb_core_->output_cdr_msgblock_allocator (), - this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (), - TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR, - this->orb_core_->to_iso8859 (), - this->orb_core_->to_unicode ()); + sizeof repbuf, + TAO_ENCAP_BYTE_ORDER, + this->orb_core_->output_cdr_buffer_allocator (), + this->orb_core_->output_cdr_dblock_allocator (), + this->orb_core_->output_cdr_msgblock_allocator (), + this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (), + TAO_DEF_GIOP_MAJOR, + TAO_DEF_GIOP_MINOR, + this->orb_core_->to_iso8859 (), + this->orb_core_->to_unicode ());*/ // Make the reply message - if (this->mesg_base_->generate_exception_reply (output, - reply_params, - ex) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t|%N|%l): ") - ACE_TEXT ("could not make exception reply\n"))); + if (this->mesg_base_->generate_exception_reply (*this->outgoing_, + reply_params, + ex) == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t|%N|%l): ") + ACE_TEXT ("could not make exception reply\n"))); - } + } // Send the message - if (this->transport_->send_message (output) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO: (%P|%t|%N|%l): ") - ACE_TEXT ("could not send exception reply\n"))); - } + if (this->transport_->send_message (*this->outgoing_) == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO: (%P|%t|%N|%l): ") + ACE_TEXT ("could not send exception reply\n"))); + } } else if (TAO_debug_level > 0) { @@ -323,7 +326,7 @@ TAO_ServerRequest::tao_send_reply_exception (CORBA::Exception &ex) // down, since it really isn't the client's fault. ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) exception thrown ") - ACE_TEXT ("but client is not waiting a response\n"))); + ACE_TEXT ("(%P|%t) exception thrown ") + ACE_TEXT ("but client is not waiting a response\n"))); } } |