diff options
-rw-r--r-- | TAO/tao/GIOP_Message_State.inl | 46 | ||||
-rw-r--r-- | TAO/tao/Incoming_Message_Queue.cpp | 121 | ||||
-rw-r--r-- | TAO/tao/Incoming_Message_Queue.h | 99 | ||||
-rw-r--r-- | TAO/tao/Incoming_Message_Queue.inl | 55 | ||||
-rw-r--r-- | TAO/tao/LIST_OF_TODO | 10 |
5 files changed, 331 insertions, 0 deletions
diff --git a/TAO/tao/GIOP_Message_State.inl b/TAO/tao/GIOP_Message_State.inl new file mode 100644 index 00000000000..9238ba596d4 --- /dev/null +++ b/TAO/tao/GIOP_Message_State.inl @@ -0,0 +1,46 @@ +// -*- C++ -*- + +//$Id$ + +ACE_INLINE CORBA::ULong +TAO_GIOP_Message_State::message_size (void) const +{ + return this->message_size_ + TAO_GIOP_MESSAGE_HEADER_LEN; +} + +ACE_INLINE CORBA::ULong +TAO_GIOP_Message_State::payload_size (void) const +{ + return this->message_size_; +} + +ACE_INLINE CORBA::Octet +TAO_GIOP_Message_State::byte_order (void) const +{ + return this->byte_order_; +} + +#if 0 +ACE_INLINE int +TAO_GIOP_Message_State::message_fragmented (void) +{ + if (this->more_fragments) + return 1; + + return 0; +} + +ACE_INLINE void +TAO_GIOP_Message_State::reset (int /*reset_contents*/) +{ + this->message_size = 0; + this->more_fragments = 0; +} + +ACE_INLINE CORBA::Boolean +TAO_GIOP_Message_State::header_received (void) const +{ + return this->message_size != 0; +} + +#endif diff --git a/TAO/tao/Incoming_Message_Queue.cpp b/TAO/tao/Incoming_Message_Queue.cpp new file mode 100644 index 00000000000..e5b239b775c --- /dev/null +++ b/TAO/tao/Incoming_Message_Queue.cpp @@ -0,0 +1,121 @@ +#include "Incoming_Message_Queue.h" +#include "ORB_Core.h" +#include "debug.h" + +#if !defined (__ACE_INLINE__) +# include "Incoming_Message_Queue.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (tao, Incoming_Message_Queue, "$Id$") + + +TAO_Incoming_Message_Queue::TAO_Incoming_Message_Queue (TAO_ORB_Core *orb_core) + : queued_data_ (0), + size_ (0), + orb_core_ (orb_core) +{ +} + +TAO_Incoming_Message_Queue::~TAO_Incoming_Message_Queue (void) +{ + // Need to delete all the unused data-blocks +} + +int +TAO_Incoming_Message_Queue::add_message (ACE_Message_Block *incoming, + size_t missing_data, + CORBA::Octet byte_order) + +{ + // Allocate memory for TAO_Queued_Data + TAO_Queued_Data *qd = this->get_node (); + + if (qd == 0) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) Could not make a node \n"))); + } + return -1; + } + + // Set the data block + qd->msg_block_ = incoming; + + // Set the byte_order + qd->byte_order_ = byte_order; + + qd->missing_data_ = missing_data; + + this->add_node (qd); + + // increment the size of the list + ++this->size_; + + return 1; +} + +void +TAO_Incoming_Message_Queue::copy_message (ACE_Message_Block &block) +{ + if (this->size_ > 0) + { + size_t n = 0; + + if (block.length () <= this->queued_data_->missing_data_) + { + n = block.length (); + } + else + { + n = this->queued_data_->missing_data_; + } + + this->queued_data_->msg_block_->copy (block.rd_ptr (), + n); + this->queued_data_->missing_data_ -= n; + } +} + +ACE_Message_Block * +TAO_Incoming_Message_Queue::dequeue_head (CORBA::Octet &byte_order) +{ + TAO_Queued_Data *tmp = + this->queued_data_->next_; + + if (tmp->missing_data_ != 0) + return 0; + + ACE_Message_Block *db = + tmp->msg_block_; + + this->queued_data_->next_ = tmp->next_; + byte_order = tmp->byte_order_; + + delete tmp; + + // Decrease the size + --this->size_; + + return db; +} + +int +TAO_Incoming_Message_Queue::add_node ( + TAO_Incoming_Message_Queue::TAO_Queued_Data *nd) +{ + if (this->size_ == 0) + { + this->queued_data_ = nd; + this->queued_data_->next_ = this->queued_data_; + } + else + { + nd->next_ = this->queued_data_->next_; + this->queued_data_->next_ = nd; + this->queued_data_ = nd; + } + + return 0; +} diff --git a/TAO/tao/Incoming_Message_Queue.h b/TAO/tao/Incoming_Message_Queue.h new file mode 100644 index 00000000000..ffe0f379e1d --- /dev/null +++ b/TAO/tao/Incoming_Message_Queue.h @@ -0,0 +1,99 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Incoming_Queued_Message.h + * + * $Id$ + * + * @author Balachandran Natarajan <bala@cs.wustl.edu> + */ +//============================================================================= + +#ifndef TAO_INCOMING_MESSAGE_QUEUE_H +#define TAO_INCOMING_MESSAGE_QUEUE_H +#include "ace/pre.h" + +#include "corbafwd.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/// Forward declarations +class ACE_Data_Block; +class TAO_ORB_Core; +class TAO_Queued_Data; +class TAO_Transport; + +/** + * @class TAO_Incoming_Message_Queue + * //@@Bala: Documentation.. + */ + +class TAO_Export TAO_Incoming_Message_Queue +{ +public: + /// Ctor. + TAO_Incoming_Message_Queue (TAO_ORB_Core *orb_core); + + /// Dtor. + ~TAO_Incoming_Message_Queue (void); + + + /// @@Bala:Docu + int add_message (ACE_Message_Block *block, + size_t missing_data, + CORBA::Octet byte_order); + + void copy_message (ACE_Message_Block &block); + + CORBA::ULong queue_length (void); + + int is_complete_message (void); + + size_t missing_data (void) const; + void missing_data (size_t data); + + char *wr_ptr (void) const; + ACE_Message_Block *dequeue_head (CORBA::Octet &byte_order); + +private: + + friend class TAO_Transport; + + /// @@Bala:Docu + class TAO_Export TAO_Queued_Data + { + public: + TAO_Queued_Data (void); + + /// The actual message queue + ACE_Message_Block *msg_block_; + + CORBA::ULong missing_data_; + + CORBA::Octet byte_order_; + + TAO_Queued_Data *next_; + }; + + TAO_Queued_Data* get_node (void); + int add_node (TAO_Queued_Data *nd); + +private: + /// + TAO_Queued_Data *queued_data_; + + /// @@Bala:Docu + CORBA::ULong size_; + + TAO_ORB_Core *orb_core_; +}; + + +#if defined (__ACE_INLINE__) +# include "Incoming_Message_Queue.inl" +#endif /* __ACE_INLINE__ */ + +#endif /*TAO_INCOMING_MESSAGE_QUEUE_H*/ diff --git a/TAO/tao/Incoming_Message_Queue.inl b/TAO/tao/Incoming_Message_Queue.inl new file mode 100644 index 00000000000..10713dcf732 --- /dev/null +++ b/TAO/tao/Incoming_Message_Queue.inl @@ -0,0 +1,55 @@ +// -*- C++ -*- +//$Id$ +ACE_INLINE CORBA::ULong +TAO_Incoming_Message_Queue::queue_length (void) +{ + return this->size_; +} + +ACE_INLINE int +TAO_Incoming_Message_Queue::is_complete_message (void) +{ + if (this->size_ != 0 && + this->queued_data_->missing_data_ == 0) + return 0; + + return 1; +} + +ACE_INLINE char * +TAO_Incoming_Message_Queue::wr_ptr (void) const +{ + return this->queued_data_->msg_block_->wr_ptr (); +} + +ACE_INLINE size_t +TAO_Incoming_Message_Queue::missing_data (void) const +{ + if (this->size_ != 0) + return this->queued_data_->missing_data_; + + return 0; +} + + + +ACE_INLINE TAO_Incoming_Message_Queue::TAO_Queued_Data * +TAO_Incoming_Message_Queue::get_node (void) +{ + // @@TODO: Use the global pool for allocationg... + TAO_Queued_Data *qd = 0; + ACE_NEW_RETURN (qd, + TAO_Queued_Data, + 0); + + return qd; +} + +ACE_INLINE +TAO_Incoming_Message_Queue::TAO_Queued_Data::TAO_Queued_Data (void) + : msg_block_ (0), + missing_data_ (0), + byte_order_ (0), + next_ (0) +{ +} diff --git a/TAO/tao/LIST_OF_TODO b/TAO/tao/LIST_OF_TODO new file mode 100644 index 00000000000..75a0901a22e --- /dev/null +++ b/TAO/tao/LIST_OF_TODO @@ -0,0 +1,10 @@ +- Fragmentation +- test for Muli-threaded client & server (muxing tests) +- test LongUpCalls +- Problem with two messages coming in two diffrent GIOP versions.. +- Remove allocation of data block for reply handlers. Can use + stack based stuff +- Remove the allocation of data blocks in Reply_Params. +- AMI tests +- run purify quantify +- DSI_Gateway tests |