diff options
Diffstat (limited to 'TAO/tao/GIOP_Message_Handler.h')
-rw-r--r-- | TAO/tao/GIOP_Message_Handler.h | 104 |
1 files changed, 54 insertions, 50 deletions
diff --git a/TAO/tao/GIOP_Message_Handler.h b/TAO/tao/GIOP_Message_Handler.h index 2b9295cf9bc..5bf41559d4e 100644 --- a/TAO/tao/GIOP_Message_Handler.h +++ b/TAO/tao/GIOP_Message_Handler.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// This may look like C, but it's really -*- C++ -*- // -*- C++ -*- // =================================================================== /** @@ -10,14 +10,14 @@ **/ // =================================================================== -#ifndef TAO_GIOP_MESSAGE_HANDLER_H -#define TAO_GIOP_MESSAGE_HANDLER_H +#ifndef TAO_GIOP_MESSAGE_HANDLER_H +#define TAO_GIOP_MESSAGE_HANDLER_H #include "ace/pre.h" #include "ace/Message_Block.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ +#endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/GIOP_Message_State.h" @@ -27,10 +27,10 @@ class TAO_GIOP_Message_Base; enum TAO_GIOP_Message_Status { - /// The buffer is waiting for the header of the message yet - TAO_GIOP_WAITING_FOR_HEADER = 0, + /// The buffer is waiting for the header of the message yet + TAO_GIOP_WAITING_FOR_HEADER = 0, - /// The buffer is waiting for the payload to appear on the socket + /// The buffer is waiting for the payload to appear on the socket TAO_GIOP_WAITING_FOR_PAYLOAD, /// The buffer has got multiple messages @@ -39,26 +39,26 @@ enum TAO_GIOP_Message_Status enum TAO_Message_Block_Content_Status { - /// The buffer has nomore info for processing ie. all information - /// have been processed + /// The buffer has nomore info for processing ie. all information + /// have been processed TAO_MESSAGE_BLOCK_COMPLETE = 3, /// The buffer has something meaningful and needs processing TAO_MESSAGE_BLOCK_NEEDS_PROCESSING, - /// The buffer has nothing meaningful. Need to read more data from - /// the socket to make the reamaining data meaningful + /// The buffer has nothing meaningful. Need to read more data from + /// the socket to make the reamaining data meaningful TAO_MESSAGE_BLOCK_INCOMPLETE }; /** * @class TAO_GIOP_Message_Handler * - * @brief GIOP specific message handler class + * @brief GIOP specific message handler class * - * This class does some of the message handling for GIOP. This class + * This class does some of the message handling for GIOP. This class * reads the message from the socket, splits the messages to create a - * CDR stream out of it and passes that to the higher layers of the ORB. + * CDR stream out of it and passes that to the higher layers of the ORB. * The read from the socket is done using a single 'read' instead of * reading the header and the payload seperately. */ @@ -68,93 +68,97 @@ class TAO_GIOP_Message_Handler public: /// Ctor TAO_GIOP_Message_Handler (TAO_ORB_Core *orb_core, - TAO_GIOP_Message_Base *base); + TAO_GIOP_Message_Base *base); - /// Read the message from the transport in to the + /// Read the message from the transport in to the /// <current_buffer_>. This method delegates responsibility of /// parsing to some of the helper methods. - int read_parse_message (TAO_Transport *transport); + int read_parse_message (TAO_Transport *transport); - /// Check whether we have atleast one complete message ready for + /// Check whether we have atleast one complete message ready for /// processing. int is_message_ready (TAO_Transport *transport); /// Do we have more messages for processing? int more_messages (void); - /// Reset the contents of the <current_buffer_> if no more requests + /// Reset the contents of the <current_buffer_> if no more requests /// need to be processed. We reset the contents of the - /// <message_state_> to parse and process the next request. + /// <message_state_> to parse and process the next request. void reset (int reset_flag); /// Return the underlying message state - TAO_GIOP_Message_State &message_state (void); + TAO_GIOP_Message_State &message_state (void); - /// Return the pointer to the data block within the message block + /// Return the pointer to the data block within the message block ACE_Data_Block *data_block (void) const; - /// Return the pointer to the datablock by duplicating it. + /// Return the pointer to the datablock by duplicating it. ACE_Data_Block *data_block_dup (void); - /// Return the rd_ptr of the <current_buffer_> + /// Return the rd_ptr of the <current_buffer_> char *rd_ptr (void) const; /// Return the position of the read pointer in the <current_buffer_> - size_t rd_pos (void) const; + size_t rd_pos (void) const; /// Return the position of the write pointer in the <current_buffer_> - size_t wr_pos (void) const; + size_t wr_pos (void) const; private: - /// Parses the header information from the <current_buffer_>. + /// Parses the header information from the <current_buffer_>. int parse_header (void); - /// Validates the first 4 bytes that contain the magic word - /// "GIOP". Also calls the validate_version () on the incoming + /// Validates the first 4 bytes that contain the magic word + /// "GIOP". Also calls the validate_version () on the incoming /// stream. - int parse_magic_bytes (void); + int parse_magic_bytes (void); - /// Gets the size of the payload from the <current_buffer_>. If the - /// size of the current buffer is less than the payload size, the + /// Gets the size of the payload from the <current_buffer_>. If the + /// size of the current buffer is less than the payload size, the /// size of the buffer is increased. - CORBA::ULong get_payload_size (void); + CORBA::ULong get_payload_size (void); - /// Extract a CORBA::ULong from the <current_buffer_> + /// Extract a CORBA::ULong from the <current_buffer_> CORBA::ULong read_ulong (const char *buf); - /// Get the next message from the <supp_buffer_> in to the + /// Get the next message from the <supp_buffer_> in to the /// <current_buffer_> int get_message (void); + /// Reads the message from the <transport> and sets the <wr_ptr> of + /// the buffer appropriately. + int read_messages (TAO_Transport *transport); + private: - /// The pointer to the object that holds us - TAO_GIOP_Message_Base *mesg_base_; + /// The pointer to the object that holds us + TAO_GIOP_Message_Base *mesg_base_; - /// The state of the message in the buffer + /// The state of the message in the buffer TAO_GIOP_Message_Status message_status_; - /// The size of the message that is being read of the socket. This - /// value is originally set to 1024 bytes. It is reset if we start - /// receiving messages with payloads greater than that. The current - /// value of <message_size_> would be the size of the last message + /// The size of the message that is being read of the socket. This + /// value is originally set to 1024 bytes. It is reset if we start + /// receiving messages with payloads greater than that. The current + /// value of <message_size_> would be the size of the last message /// received (ie. payload+headers). size_t message_size_; /// The buffer. rd_ptr() points to the beginning of the current - /// message, properly aligned wr_ptr() points to where the next - /// read() should put the data. + /// message, properly aligned wr_ptr() points to where the next + /// read() should put the data. ACE_Message_Block current_buffer_; - /// The supplementary buffer that holds just one message if the - /// <current_buffer_> has more than one message. One message from - /// the <current_buffer_> is taken and filled in this buffer, which - /// is then sent to the higher layers of the ORB. + /// The supplementary buffer that holds just one message if the + /// <current_buffer_> has more than one message. One message from + /// the <current_buffer_> is taken and filled in this buffer, which + /// is then sent to the higher layers of the ORB. ACE_Message_Block supp_buffer_; /// The message state. It represents the status of the messages that - /// have been read from the current_buffer_ + /// have been read from the current_buffer_ TAO_GIOP_Message_State message_state_; }; @@ -165,7 +169,7 @@ const size_t TAO_GIOP_MESSAGE_FLAGS_OFFSET = 6; const size_t TAO_GIOP_MESSAGE_TYPE_OFFSET = 7; const size_t TAO_GIOP_VERSION_MINOR_OFFSET = 5; const size_t TAO_GIOP_VERSION_MAJOR_OFFSET = 4; -const size_t TAO_GIOP_MESSAGE_FRAGMENT_HEADER = 4; +const size_t TAO_GIOP_MESSAGE_FRAGMENT_HEADER = 4; #if defined (__ACE_INLINE__) # include "tao/GIOP_Message_Handler.inl" |