diff options
Diffstat (limited to 'TAO/tao/GIOP_Message_Lite.cpp')
-rw-r--r-- | TAO/tao/GIOP_Message_Lite.cpp | 645 |
1 files changed, 243 insertions, 402 deletions
diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp index f9ae079b940..eff9e97cd7e 100644 --- a/TAO/tao/GIOP_Message_Lite.cpp +++ b/TAO/tao/GIOP_Message_Lite.cpp @@ -10,8 +10,7 @@ #include "tao/GIOP_Message_Locate_Header.h" #include "tao/target_specification.h" #include "tao/Leader_Follower.h" -#include "tao/LF_Strategy.h" -#include "tao/Transport.h" +#include "Transport.h" #if !defined (__ACE_INLINE__) # include "tao/GIOP_Message_Lite.i" @@ -24,17 +23,60 @@ 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*/) - : orb_core_ (orb_core), - message_type_ (0), - message_size_ (0), - byte_order_ (ACE_CDR_BYTE_ORDER) + size_t input_cdr_size) + :message_state_ (orb_core), + output_ (0), + cdr_buffer_alloc_ ( + orb_core->resource_factory ()->output_cdr_buffer_allocator () + ), + cdr_dblock_alloc_ ( + orb_core->resource_factory ()->output_cdr_dblock_allocator () + ), + cdr_msgblock_alloc_ ( + orb_core->resource_factory ()->output_cdr_msgblock_allocator () + ), + input_cdr_ (orb_core->create_input_cdr_data_block (input_cdr_size), + 0, + TAO_ENCAP_BYTE_ORDER, + TAO_DEF_GIOP_MAJOR, + TAO_DEF_GIOP_MINOR, + orb_core), + current_offset_ (0) { +#if defined (ACE_HAS_PURIFY) + (void) ACE_OS::memset (this->repbuf_, + '\0', + sizeof this->repbuf_); +#endif /* ACE_HAS_PURIFY */ + ACE_NEW (this->output_, + TAO_OutputCDR (this->repbuf_, + sizeof this->repbuf_, + TAO_ENCAP_BYTE_ORDER, + this->cdr_buffer_alloc_, + this->cdr_dblock_alloc_, + this->cdr_msgblock_alloc_, + orb_core->orb_params ()->cdr_memcpy_tradeoff (), + TAO_DEF_GIOP_MAJOR, + TAO_DEF_GIOP_MINOR, + orb_core->to_iso8859 (), + orb_core->to_unicode ())); } TAO_GIOP_Message_Lite::~TAO_GIOP_Message_Lite (void) { + // Explicitly call the destructor of the output CDR first. They need + // the allocators during destruction. + delete this->output_; + + // Then call the destructor of our allocators + if (this->cdr_dblock_alloc_ != 0) + this->cdr_dblock_alloc_->remove (); + // delete this->cdr_dblock_alloc_; + + if (this->cdr_buffer_alloc_ != 0) + this->cdr_buffer_alloc_->remove (); + // delete this->cdr_buffer_alloc_; } @@ -45,11 +87,40 @@ TAO_GIOP_Message_Lite::init (CORBA::Octet, return; } +int +TAO_GIOP_Message_Lite::parse_header (void) +{ + // Get the read pointer + char *buf = this->input_cdr_.rd_ptr (); + + // @@ Bala: i added the following comment, does it make sense? + // In GIOPLite the version, byte order info, etc. are hardcoded, and + // not transmitted over the wire. + this->message_state_.byte_order = TAO_ENCAP_BYTE_ORDER; + this->message_state_.giop_version.major = TAO_DEF_GIOP_MAJOR; + this->message_state_.giop_version.minor = TAO_DEF_GIOP_MINOR; + + // Get the message type. + this->message_state_.message_type = buf[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET]; + + this->input_cdr_.reset_byte_order (this->message_state_.byte_order); + + // The first bytes are the length of the message. + this->input_cdr_.read_ulong (this->message_state_.message_size); + + return 0; +} + + void -TAO_GIOP_Message_Lite::reset (void) +TAO_GIOP_Message_Lite::reset (int reset_flag) { - this->message_type_ = 0; - this->message_size_ = 0; + // Reset the message state + this->message_state_.reset (reset_flag); + + if (reset_flag) + this->input_cdr_.reset_contents (); + //What else??? } @@ -151,10 +222,105 @@ TAO_GIOP_Message_Lite::generate_reply_header ( int -TAO_GIOP_Message_Lite::read_message (TAO_Transport * /*transport*/, +TAO_GIOP_Message_Lite::read_message (TAO_Transport *transport, int /*block */, - ACE_Time_Value * /*max_wait_time*/) + ACE_Time_Value *max_wait_time) { + if (this->message_state_.header_received () == 0) + { + int retval = + TAO_GIOP_Utils::read_bytes_input (transport, + this->input_cdr_, + TAO_GIOP_LITE_HEADER_LEN , + max_wait_time); + if (retval == -1) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - \n") + ACE_TEXT ("TAO_GIOP_Message_Lite::read_message \n"))); + } + + return -1; + } + + // Read the rest of the stuff. That should be read by the + // corresponding states + if (this->parse_header () == -1) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t|%N%l) -\n"), + ACE_TEXT ("TAO_GIOP_Message_Lite::handle_input \n"))); + return -1; + } + + if (this->input_cdr_.grow (TAO_GIOP_LITE_HEADER_LEN + + this->message_state_.message_size) == -1) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t|%N|%l) - %p\n"), + ACE_TEXT ("ACE_CDR::grow"))); + return -1; + } + + // Growing the buffer may have reset the rd_ptr(), but we want + // to leave it just after the GIOP header (that was parsed + // already); + this->input_cdr_.skip_bytes (TAO_GIOP_LITE_HEADER_LEN); + } + + size_t missing_data = + this->message_state_.message_size - this->current_offset_; + + ssize_t n = + TAO_GIOP_Utils::read_buffer (transport, + this->input_cdr_.rd_ptr () + + this->current_offset_, + missing_data, + max_wait_time); + + if (n == -1) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - %p\n"), + ACE_TEXT ("TAO_GIOP_Message_Lite::handle_input, read_buffer[1] \n"))); + return -1; + } + else if (n == 0) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - %p\n"), + ACE_TEXT ("TAO_GIOP_Message_Lite::handle_input, read_buffer[2]\n"))); + return -1; + } + + this->current_offset_ += n; + + if (this->current_offset_ == + this->message_state_.message_size) + { + if (TAO_debug_level >= 4) + { + size_t header_len = TAO_GIOP_LITE_HEADER_LEN ; + + char *buf = this->input_cdr_.rd_ptr (); + buf -= header_len; + size_t msg_len = this->input_cdr_.length () + header_len; + this->dump_msg ("recv", + ACE_reinterpret_cast (u_char *, + buf), + msg_len); + } + } + + if (this->current_offset_ != this->message_state_.message_size) + return 0; + return 1; } @@ -228,46 +394,16 @@ TAO_GIOP_Message_Lite::format_message (TAO_OutputCDR &stream) } -int -TAO_GIOP_Message_Lite::parse_incoming_messages (ACE_Message_Block &block) -{ - // Get the read pointer - char *buf = block.rd_ptr (); - - CORBA::ULong x = 0; -#if !defined (ACE_DISABLE_SWAP_ON_READ) - if (!(this->byte_order_ != ACE_CDR_BYTE_ORDER)) - { - x = *ACE_reinterpret_cast (ACE_CDR::ULong*, buf); - } - else - { - ACE_CDR::swap_4 (buf, ACE_reinterpret_cast (char*, &x)); - } -#else - x = *ACE_reinterpret_cast (ACE_CDR::ULong*, buf); -#endif /* ACE_DISABLE_SWAP_ON_READ */ - - this->message_size_ = x; - - // Get the message type. - this->message_type_ = buf[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET]; - - return 0; -} - TAO_Pluggable_Message_Type TAO_GIOP_Message_Lite::message_type (void) { - switch (this->message_type_) + switch (this->message_state_.message_type) { case TAO_GIOP_REQUEST: - return TAO_PLUGGABLE_MESSAGE_REQUEST; case TAO_GIOP_LOCATEREQUEST: - return TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST; + return TAO_PLUGGABLE_MESSAGE_REQUEST; case TAO_GIOP_LOCATEREPLY: - return TAO_PLUGGABLE_MESSAGE_LOCATEREPLY; case TAO_GIOP_REPLY: return TAO_PLUGGABLE_MESSAGE_REPLY; @@ -289,265 +425,54 @@ TAO_GIOP_Message_Lite::message_type (void) } -ssize_t -TAO_GIOP_Message_Lite::missing_data (ACE_Message_Block &block) -{ - // Actual message size including the header.. - CORBA::ULong msg_size = - this->message_size_ + TAO_GIOP_LITE_HEADER_LEN; - - size_t len = block.length (); - - if (len > msg_size) - { - return -1; - } - else if (len == msg_size) - return 0; - - return msg_size - len; -} - - -int -TAO_GIOP_Message_Lite::extract_next_message (ACE_Message_Block &incoming, - 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; - } - return 0; - } - - if (this->parse_incoming_messages (incoming) == -1) - { - return -1; - } - - size_t copying_len = - this->message_size_ + TAO_GIOP_LITE_HEADER_LEN; - - qd = this->make_queued_data (copying_len); - - if (copying_len > incoming.length ()) - { - qd->missing_data_ = - copying_len - incoming.length (); - - copying_len = incoming.length (); - } - - qd->msg_block_->copy (incoming.rd_ptr (), - copying_len); - - incoming.rd_ptr (copying_len); - qd->byte_order_ = TAO_ENCAP_BYTE_ORDER; - qd->major_version_ = TAO_DEF_GIOP_MAJOR; - qd->minor_version_ = TAO_DEF_GIOP_MINOR; - qd->msg_type_ = this->message_type (); - return 1; -} - -int -TAO_GIOP_Message_Lite::consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming) -{ - // Look to see whether we had atleast parsed the GIOP header ... - if (qd->missing_data_ == -1) - { - // The data length that has been stuck in there during the last - // read .... - size_t len = - 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); - - // 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; - - // 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); - - // Copy the pay load.. - - // Calculate the bytes that needs to be copied in the queue... - size_t copy_len = this->message_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 (); - } - else - { - 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); - - // Set the <rd_ptr> of the <incoming>.. - incoming.rd_ptr (copy_len); - - // Get the other details... - qd->byte_order_ = TAO_ENCAP_BYTE_ORDER; - qd->major_version_ = TAO_DEF_GIOP_MAJOR; - qd->minor_version_ = TAO_DEF_GIOP_MINOR; - qd->msg_type_ = this->message_type (); - } - else - { - // @@todo: Need to abstract this out to a seperate method... - size_t copy_len = qd->missing_data_; - - 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 (); - } - - // Copy the right amount of data in to the node... - // node.. - qd->msg_block_->copy (incoming.rd_ptr (), - copy_len); - - // Set the <rd_ptr> of the <incoming>.. - qd->msg_block_->rd_ptr (copy_len); - - } - - return 0; -} - - -void -TAO_GIOP_Message_Lite::get_message_data (TAO_Queued_Data *qd) -{ - // Get the message information - qd->byte_order_ = - ACE_CDR_BYTE_ORDER; - qd->major_version_ = - TAO_DEF_GIOP_MAJOR; - qd->minor_version_ = - TAO_DEF_GIOP_MINOR; - - qd->msg_type_= - this->message_type (); - - this->reset (); -} - -int -TAO_GIOP_Message_Lite::consolidate_fragments (TAO_Queued_Data * /*dqd*/, - const TAO_Queued_Data * /*sqd*/) -{ - // We dont know what fragments are??? - return -1; -} - int TAO_GIOP_Message_Lite::process_request_message (TAO_Transport *transport, - TAO_Queued_Data *qd) + TAO_ORB_Core *orb_core) { // Set the upcall thread - this->orb_core_->lf_strategy ().set_upcall_thread ( - this->orb_core_->leader_follower ()); + orb_core->lf_strategy ().set_upcall_thread (orb_core->leader_follower ()); - // A buffer that we will use to initialise the CDR stream - char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; + // Reset the output CDR stream. + // @@@@Is it necessary here? + this->output_->reset (); -#if defined(ACE_HAS_PURIFY) - (void) ACE_OS::memset (repbuf, - '\0', - sizeof repbuf); -#endif /* ACE_HAS_PURIFY */ + // + // Take out all the information from the <message_state> and reset + // it so that nested upcall on the same transport can be handled. + // - // 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 ()); - - // Get the read and write positions before we steal data. - size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base (); - size_t wr_pos = qd->msg_block_->wr_ptr () - qd->msg_block_->base (); - 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 ()); - - - // Create a input CDR stream. - // 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. - - 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_); + // Notice that the message_state is only modified in one thread at a + // time because the reactor does not call handle_input() for the + // same Event_Handler in two threads at the same time. + + // Steal the input CDR from the message state. + TAO_InputCDR input_cdr (ACE_InputCDR::Transfer_Contents (this->input_cdr_), + orb_core); + + // Send the message state for the service layer like FT to log the + // messages + // @@@ Needed for DOORS + // orb_core->services_log_msg_rcv (this->message_state_); + // Reset the message state. Now, we are ready for the next nested + // upcall if any. + this->message_state_.reset (0); // We know we have some request message. Check whether it is a // GIOP_REQUEST or GIOP_LOCATE_REQUEST to take action. - switch (qd->msg_type_) + switch (this->message_state_.message_type) { - case TAO_PLUGGABLE_MESSAGE_REQUEST: + case TAO_GIOP_REQUEST: // Should be taken care by the state specific invocations. They // could raise an exception or write things in the output CDR // stream return this->process_request (transport, - input_cdr, - output); - case TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST: + orb_core, + input_cdr); + case TAO_GIOP_LOCATEREQUEST: return this->process_locate_request (transport, - input_cdr, - output); + orb_core, + input_cdr); default: return -1; } @@ -555,59 +480,21 @@ TAO_GIOP_Message_Lite::process_request_message (TAO_Transport *transport, int TAO_GIOP_Message_Lite::process_reply_message ( - TAO_Pluggable_Reply_Params ¶ms, - TAO_Queued_Data *qd + TAO_Pluggable_Reply_Params ¶ms ) { - - - // Get the read and write positions before we steal data. - size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base (); - size_t wr_pos = qd->msg_block_->wr_ptr () - qd->msg_block_->base (); - 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 ()); - - - // Create a empty buffer on stack - // 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 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_); - - // Reset the message state. Now, we are ready for the next nested - // upcall if any. - // this->message_handler_.reset (0); - - // We know we have some reply message. Check whether it is a - // GIOP_REPLY or GIOP_LOCATE_REPLY to take action. - - // Once we send the InputCDR stream we need to just forget about - // the stream and never touch that again for anything. We basically - // loose ownership of the data_block. - // We know we have some reply message. Check whether it is a // GIOP_REPLY or GIOP_LOCATE_REPLY to take action. - switch (qd->msg_type_) + switch (this->message_state_.message_type) { case TAO_GIOP_REPLY: // Should be taken care by the state specific parsing - return this->parse_reply (input_cdr, + return this->parse_reply (this->input_cdr_, 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, + return this->parse_reply (this->input_cdr_, params); default: return -1; @@ -681,16 +568,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_ORB_Core *orb_core, + TAO_InputCDR &cdr) { // This will extract the request header, set <response_required> // and <sync_with_server> as appropriate. TAO_ServerRequest request (this, cdr, - output, + *this->output_, transport, - this->orb_core_); + orb_core); CORBA::Environment &ACE_TRY_ENV = TAO_default_environment (); @@ -715,16 +602,16 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, CORBA::Object_var forward_to; // Do this before the reply is sent. - this->orb_core_->adapter_registry ()->dispatch (request.object_key (), - request, - forward_to, - ACE_TRY_ENV); + orb_core->adapter_registry ()->dispatch (request.object_key (), + request, + forward_to, + ACE_TRY_ENV); 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_); + TAO_Pluggable_Reply_Params reply_params (orb_core); reply_params.request_id_ = request_id; reply_params.reply_status_ = TAO_GIOP_LOCATION_FORWARD; reply_params.svc_ctx_.length (0); @@ -733,12 +620,12 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, reply_params.service_context_notowned (&request.reply_service_info ()); // Make the GIOP header and Reply header - this->generate_reply_header (output, + this->generate_reply_header (*this->output_, reply_params); - output << forward_to.in (); + *this->output_ << forward_to.in (); - int result = transport->send_message (output); + int result = transport->send_message (*this->output_); if (result == -1) { if (TAO_debug_level > 0) @@ -762,7 +649,7 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, if (response_required) { result = this->send_reply_exception (transport, - this->orb_core_, + orb_core, request_id, &request.reply_service_info (), &ACE_ANY_EXCEPTION); @@ -821,7 +708,7 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, ); result = this->send_reply_exception (transport, - this->orb_core_, + orb_core, request_id, &request.reply_service_info (), &exception); @@ -860,13 +747,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_ORB_Core* orb_core, + TAO_InputCDR &input) { // This will extract the request header, set <response_required> as // appropriate. TAO_GIOP_Locate_Request_Header locate_request (input, - this->orb_core_); + orb_core); TAO_GIOP_Locate_Status_Msg status_info; @@ -914,7 +801,7 @@ TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport, "_non_existent", dummy_output, transport, - this->orb_core_, + orb_core, parse_error); if (parse_error != 0) @@ -925,10 +812,10 @@ TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport, CORBA::Object_var forward_to; - this->orb_core_->adapter_registry ()->dispatch (server_request.object_key (), - server_request, - forward_to, - ACE_TRY_ENV); + orb_core->adapter_registry ()->dispatch (server_request.object_key (), + server_request, + forward_to, + ACE_TRY_ENV); ACE_TRY_CHECK; if (!CORBA::is_nil (forward_to.in ())) @@ -989,7 +876,6 @@ TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport, ACE_ENDTRY; return this->make_send_locate_reply (transport, - output, locate_request, status_info); } @@ -998,7 +884,6 @@ TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport, int TAO_GIOP_Message_Lite::make_send_locate_reply ( TAO_Transport *transport, - TAO_OutputCDR &output, TAO_GIOP_Locate_Request_Header &request, TAO_GIOP_Locate_Status_Msg &status_info ) @@ -1007,15 +892,15 @@ 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); + *this->output_); // This writes the header & body - this->write_locate_reply_mesg (output, + this->write_locate_reply_mesg (*this->output_, request.request_id (), status_info); // Send the message - int result = transport->send_message (output); + int result = transport->send_message (*this->output_); // Print out message if there is an error if (result == -1) @@ -1096,10 +981,6 @@ TAO_GIOP_Message_Lite::parse_reply (TAO_InputCDR &cdr, } } - // Steal the contents in to the reply CDR and loose ownership of the - // data block. - params.input_cdr_.exchange_data_blocks (cdr); - return 0; } @@ -1554,12 +1435,10 @@ TAO_GIOP_Message_Lite::dump_msg (const char *label, 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); - + // @@ Only works if ServiceContextList is empty.... id = ACE_reinterpret_cast (CORBA::ULong *, - (char * ) (buf)); + (char * ) (ptr)); + } // Print. @@ -1571,47 +1450,9 @@ TAO_GIOP_Message_Lite::dump_msg (const char *label, (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"))); } } -TAO_Queued_Data * -TAO_GIOP_Message_Lite::make_queued_data (size_t sz) -{ - // Get a node for the queue.. - TAO_Queued_Data *qd = - TAO_Queued_Data::get_queued_data (); - - // Make a datablock for the size requested + something. The - // "something" is required because we are going to align the data - // block in the message block. During alignment we could loose some - // bytes. As we may not know how many bytes will be lost, we will - // allocate ACE_CDR::MAX_ALIGNMENT extra. - ACE_Data_Block *db = - this->orb_core_->data_block_for_message_block (sz + - ACE_CDR::MAX_ALIGNMENT); - - ACE_Allocator *alloc = - this->orb_core_->message_block_msgblock_allocator (); - - ACE_Message_Block mb (db, - 0, - alloc); - - ACE_Message_Block *new_mb = mb.duplicate (); - - ACE_CDR::mb_align (new_mb); - - qd->msg_block_ = new_mb; - - return qd; -} - int TAO_GIOP_Message_Lite::generate_locate_reply_header ( TAO_OutputCDR & /*cdr*/, |