#include <Incoming_Message_Queue.h>
Collaboration diagram for TAO_Queued_Data:

Public Member Functions | |
| TAO_Queued_Data (ACE_Allocator *alloc=0) | |
| Default Constructor. | |
| TAO_Queued_Data (ACE_Message_Block *mb, ACE_Allocator *alloc=0) | |
| Constructor. | |
| TAO_Queued_Data (const TAO_Queued_Data &qd) | |
| Copy constructor. | |
| int | consolidate (void) |
Static Public Member Functions | |
| TAO_Queued_Data * | make_queued_data (ACE_Allocator *alloc=0) |
| Creation of a node in the queue. | |
| void | release (TAO_Queued_Data *qd) |
| Deletion of a node from the queue. | |
| TAO_Queued_Data * | duplicate (TAO_Queued_Data &qd) |
Public Attributes | |
| ACE_Message_Block * | msg_block_ |
| The message block that contains the message. | |
| CORBA::Octet | major_version_ |
| CORBA::Octet | minor_version_ |
| CORBA::Octet | byte_order_ |
| The byte order of the message that is stored in the node. | |
| CORBA::Octet | more_fragments_ |
| TAO_Pluggable_Message_Type | msg_type_ |
| The message type of the message. | |
| TAO_Queued_Data * | next_ |
| Pounter to the next element in the queue. | |
Missing Data details | |
The missing_data_ member contains the number of bytes of data missing from msg_block_. | |
| size_t | missing_data_ |
Static Private Member Functions | |
| void | replace_data_block (ACE_Message_Block &mb) |
Private Attributes | |
| ACE_Allocator * | allocator_ |
| The allocator used to allocate this class. | |
This class contains necessary information about a message that is stored in the queue. Such a node can be used by the incoming thread from the reactor to dequeue and process the message by sending it to the higher layers of the ORB.
The ACE_Message_Block contained within this class may contain a chain of message blocks (usually when GIOP fragments are involved). In that case consolidate () needs to be called prior to being sent to higher layers of the ORB when the GIOP fragment chain is complete.
Definition at line 119 of file Incoming_Message_Queue.h.
|
|
Default Constructor.
Definition at line 173 of file Incoming_Message_Queue.cpp. References TAO_PLUGGABLE_MESSAGE_MESSAGERROR. Referenced by duplicate(), and make_queued_data().
00174 : msg_block_ (0), 00175 missing_data_ (0), 00176 major_version_ (0), 00177 minor_version_ (0), 00178 byte_order_ (0), 00179 more_fragments_ (0), 00180 msg_type_ (TAO_PLUGGABLE_MESSAGE_MESSAGERROR), 00181 next_ (0), 00182 allocator_ (alloc) 00183 { 00184 } |
|
||||||||||||
|
Constructor.
Definition at line 186 of file Incoming_Message_Queue.cpp. References TAO_PLUGGABLE_MESSAGE_MESSAGERROR.
00188 : msg_block_ (mb), 00189 missing_data_ (0), 00190 major_version_ (0), 00191 minor_version_ (0), 00192 byte_order_ (0), 00193 more_fragments_ (0), 00194 msg_type_ (TAO_PLUGGABLE_MESSAGE_MESSAGERROR), 00195 next_ (0), 00196 allocator_ (alloc) 00197 { 00198 } |
|
|
Copy constructor.
Definition at line 200 of file Incoming_Message_Queue.cpp.
00201 : msg_block_ (qd.msg_block_->duplicate ()), 00202 missing_data_ (qd.missing_data_), 00203 major_version_ (qd.major_version_), 00204 minor_version_ (qd.minor_version_), 00205 byte_order_ (qd.byte_order_), 00206 more_fragments_ (qd.more_fragments_), 00207 msg_type_ (qd.msg_type_), 00208 next_ (0), 00209 allocator_ (qd.allocator_) 00210 { 00211 } |
|
|
Consolidate this fragments chained message blocks into one.
Definition at line 324 of file Incoming_Message_Queue.cpp. References clone_mb_nocopy_size(), ACE_CDR::consolidate(), ACE_Message_Block::cont(), msg_block_, and ACE_Message_Block::release(). Referenced by TAO_GIOP_Message_Base::consolidate_fragmented_message().
00325 {
00326 // Is this a chain of fragments?
00327 if (this->more_fragments_ && this->msg_block_->cont () != 0)
00328 {
00329 // Create a message block big enough to hold the entire chain
00330 ACE_Message_Block *dest = clone_mb_nocopy_size (
00331 this->msg_block_,
00332 this->msg_block_->total_length ());
00333
00334 if (0 == dest)
00335 {
00336 // out of memory
00337 return -1;
00338 }
00339 // Memory allocation succeeded, the new message block can hold the consolidated
00340 // message. The following code just copies all the data into this new message block.
00341 // No further memory allocation will take place.
00342
00343 // Reset the cont() parameter. We have cloned the message
00344 // block but not the chain as we will no longer have chain.
00345 dest->cont (0);
00346
00347 // Use ACE_CDR to consolidate the chain for us
00348 ACE_CDR::consolidate (dest, this->msg_block_);
00349
00350 // free the original message block chain
00351 this->msg_block_->release ();
00352
00353 // Set the message block to the new consolidated message block
00354 this->msg_block_ = dest;
00355 this->more_fragments_ = 0;
00356 }
00357
00358 return 0;
00359 }
|
|
|
Duplicate ourselves. This creates a copy of ourselves on the heap and returns a pointer to the duplicated node. Definition at line 277 of file Incoming_Message_Queue.cpp. References ACE_BIT_ENABLED, ACE_DEBUG, ACE_NEW_MALLOC_RETURN, ACE_NEW_RETURN, allocator_, LM_DEBUG, ACE_Allocator::malloc(), msg_block_, replace_data_block(), ACE_Message_Block::self_flags(), TAO_debug_level, and TAO_Queued_Data(). Referenced by TAO_Transport::handle_input_parse_data().
00278 {
00279 // Check to see if the underlying block is on the stack. If not it
00280 // is fine. If the datablock is on stack, try to make a copy of that
00281 // before doing a duplicate.
00282 // @@ todo: Theoretically this should be within the Message Block,
00283 // but we dont have much scope to do this in that mess. Probably in
00284 // the next stage of MB rewrite we should be okay
00285 ACE_Message_Block::Message_Flags fl =
00286 sqd.msg_block_->self_flags ();
00287
00288 if (ACE_BIT_ENABLED (fl,
00289 ACE_Message_Block::DONT_DELETE))
00290 (void) TAO_Queued_Data::replace_data_block (*sqd.msg_block_);
00291
00292
00293 TAO_Queued_Data *qd = 0;
00294
00295 if (sqd.allocator_)
00296 {
00297 ACE_NEW_MALLOC_RETURN (qd,
00298 static_cast<TAO_Queued_Data *> (
00299 sqd.allocator_->malloc (sizeof (TAO_Queued_Data))),
00300 TAO_Queued_Data (sqd),
00301 0);
00302
00303 return qd;
00304 }
00305
00306 // No allocator, so use the global pool!
00307 // @@ TODO: We should be removing this at some point of time!
00308 if (TAO_debug_level == 4)
00309 {
00310 // This debug is for testing purposes!
00311 ACE_DEBUG ((LM_DEBUG,
00312 "TAO (%P|%t) - Queued_Data[%d]::duplicate\n",
00313 "Using global pool for allocation \n"));
00314 }
00315
00316 ACE_NEW_RETURN (qd,
00317 TAO_Queued_Data (sqd),
00318 0);
00319
00320 return qd;
00321 }
|
|
|
Creation of a node in the queue.
Definition at line 215 of file Incoming_Message_Queue.cpp. References ACE_DEBUG, ACE_NEW_MALLOC_RETURN, ACE_NEW_RETURN, LM_DEBUG, ACE_Allocator::malloc(), TAO_debug_level, and TAO_Queued_Data(). Referenced by TAO_GIOP_Message_Lite::make_queued_data(), and TAO_GIOP_Message_Base::make_queued_data().
00216 {
00217 TAO_Queued_Data *qd = 0;
00218
00219 if (alloc)
00220 {
00221 ACE_NEW_MALLOC_RETURN (qd,
00222 static_cast<TAO_Queued_Data *> (
00223 alloc->malloc (sizeof (TAO_Queued_Data))),
00224 TAO_Queued_Data (alloc),
00225 0);
00226
00227 return qd;
00228 }
00229
00230 // No allocator, so use the global pool!
00231 // @@ TODO: We should be removing this at some point of time!
00232 if (TAO_debug_level == 4)
00233 {
00234 // This debug is for testing purposes!
00235 ACE_DEBUG ((LM_DEBUG,
00236 "TAO (%P|%t) - Queued_Data::get_queued_data\n"
00237 "Using global pool for allocation \n"));
00238 }
00239
00240 ACE_NEW_RETURN (qd,
00241 TAO_Queued_Data,
00242 0);
00243
00244 return qd;
00245 }
|
|
|
|
Replace the datablock with a one allocated on the heap or allocator Definition at line 22 of file Incoming_Message_Queue.inl. References ACE_Data_Block::clone_nocopy(), ACE_Message_Block::clr_self_flags(), ACE_Message_Block::copy(), ACE_Message_Block::data_block(), ACE_Data_Block::duplicate(), ACE_Message_Block::length(), ACE_CDR::mb_align(), ACE_Message_Block::rd_ptr(), ACE_Data_Block::size(), ACE_CDR::total_length(), and ACE_Message_Block::wr_ptr(). Referenced by duplicate().
00023 {
00024 size_t const newsize =
00025 ACE_CDR::total_length (&mb, 0) + ACE_CDR::MAX_ALIGNMENT;
00026
00027 ACE_Data_Block *db =
00028 mb.data_block ()->clone_nocopy ();
00029
00030 if (db->size (newsize) == -1)
00031 return;
00032
00033 ACE_Message_Block tmp (db);
00034 ACE_CDR::mb_align (&tmp);
00035
00036 tmp.copy (mb.rd_ptr (), mb.length());
00037 mb.data_block (tmp.data_block ()->duplicate ());
00038
00039 mb.rd_ptr (tmp.rd_ptr ());
00040 mb.wr_ptr (tmp.wr_ptr ());
00041
00042 // Remove the DONT_DELETE flags from mb
00043 mb.clr_self_flags (ACE_Message_Block::DONT_DELETE);
00044 }
|
|
|
The allocator used to allocate this class.
Definition at line 192 of file Incoming_Message_Queue.h. Referenced by duplicate(), and release(). |
|
|
The byte order of the message that is stored in the node.
Definition at line 170 of file Incoming_Message_Queue.h. Referenced by TAO_GIOP_Message_Lite::init_queued_data(), TAO_GIOP_Message_Base::init_queued_data(), TAO_GIOP_Message_Base::parse_request_id(), TAO_GIOP_Message_Lite::process_reply_message(), TAO_GIOP_Message_Base::process_reply_message(), TAO_GIOP_Message_Lite::process_request_message(), and TAO_GIOP_Message_Base::process_request_message(). |
|
|
Many protocols like GIOP have a major and minor version information that would be needed to read and decipher the message. Definition at line 166 of file Incoming_Message_Queue.h. Referenced by TAO_GIOP_Message_Base::consolidate_fragmented_message(), TAO_GIOP_Message_Base::discard_fragmented_message(), TAO_GIOP_Message_Lite::init_queued_data(), TAO_GIOP_Message_Base::init_queued_data(), TAO_GIOP_Message_Base::parse_request_id(), TAO_GIOP_Message_Lite::process_reply_message(), TAO_GIOP_Message_Base::process_reply_message(), TAO_GIOP_Message_Lite::process_request_message(), and TAO_GIOP_Message_Base::process_request_message(). |
|
|
|
Data missing in the above message that hasn't been read or processed yet, the value TAO_MISSING_DATA_UNDEFINED indicates it hasn't been processed yet, otherwise greater or equal zero. Definition at line 160 of file Incoming_Message_Queue.h. Referenced by TAO_Transport::consolidate_enqueue_message(), TAO_GIOP_Message_Lite::consolidate_node(), TAO_GIOP_Message_Base::consolidate_node(), TAO_Transport::consolidate_process_message(), TAO_GIOP_Message_Lite::extract_next_message(), TAO_GIOP_Message_Base::extract_next_message(), TAO_Transport::handle_input(), TAO_Transport::handle_input_missing_data(), TAO_Transport::handle_input_parse_data(), TAO_Transport::handle_input_parse_extra_messages(), TAO_GIOP_Message_Lite::parse_next_message(), TAO_GIOP_Message_Base::parse_next_message(), and TAO_Transport::process_parsed_messages(). |
|
|
Some messages can be fragmented by the protocol (this is an ORB level fragmentation on top of the TCP/IP fragmentation. This member indicates whether the message that we have recd. and queue already has more fragments that is missing.. Definition at line 176 of file Incoming_Message_Queue.h. Referenced by TAO_Transport::consolidate_enqueue_message(), TAO_GIOP_Message_Base::consolidate_fragmented_message(), TAO_Transport::consolidate_process_message(), TAO_Transport::handle_input_parse_data(), and TAO_GIOP_Message_Base::init_queued_data(). |
|
|
|
|
Pounter to the next element in the queue.
Definition at line 182 of file Incoming_Message_Queue.h. Referenced by TAO_Incoming_Message_Queue::dequeue_head(), TAO_Incoming_Message_Queue::dequeue_tail(), TAO_Incoming_Message_Queue::enqueue_tail(), TAO::Incoming_Message_Stack::pop(), and TAO::Incoming_Message_Stack::push(). |
1.3.6