From e56d37d5485a0619a72cb452e50a915b29c14192 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Tue, 24 Jul 2007 09:42:03 +0000 Subject: Tue Jul 24 09:41:23 UTC 2007 Johnny Willemsen --- TAO/ChangeLog | 16 ++++++++++++ TAO/tao/GIOP.pidl | 29 +++++++++++++++++++++ TAO/tao/GIOP_Message_Base.cpp | 45 +------------------------------- TAO/tao/GIOP_Message_Base.h | 9 ------- TAO/tao/GIOP_Message_State.cpp | 53 +++++++++++++++++++++++++++++++++----- TAO/tao/GIOP_Message_State.h | 9 +++++-- TAO/tao/GIOP_Message_State.inl | 4 +-- TAO/tao/Incoming_Message_Stack.h | 2 +- TAO/tao/Incoming_Message_Stack.inl | 2 +- TAO/tao/Queued_Data.h | 1 - TAO/tao/Transport.cpp | 4 +-- 11 files changed, 106 insertions(+), 68 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index f6c01ed29f6..2d018375dca 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,19 @@ +Tue Jul 24 09:41:23 UTC 2007 Johnny Willemsen + + * tao/Incoming_Message_Stack.{h,inl}: + Made top method const + + * tao/GIOP.pidl: + Added several enums as mentioned in the CORBA spec + + * tao/GIOP_Message_Base.{h,cpp}: + * tao/GIOP_Message_State.{h,cpp,inl}: + Moved message_type method to the state class, this one now + converts an Octet to TAO_Pluggable_Message_Type + + * tao/Transport.cpp: + Const changes + Tue Jul 24 08:17:23 UTC 2007 Johnny Willemsen * tao/Queued_Data.{h,cpp,inl}: diff --git a/TAO/tao/GIOP.pidl b/TAO/tao/GIOP.pidl index 3fbce7bca86..a830165b05e 100644 --- a/TAO/tao/GIOP.pidl +++ b/TAO/tao/GIOP.pidl @@ -57,6 +57,35 @@ module GIOP case ProfileAddr: IOP::TaggedProfile profile; case ReferenceAddr: IORAddressingInfo ior; }; + + enum MsgType { + Request, + Reply, + CancelRequest, + LocateRequest, + LocateReply, + CloseConnection, + MessageError, + Fragment + }; + + enum ReplyStatusType { + NO_EXCEPTION, + USER_EXCEPTION, + SYSTEM_EXCEPTION, + LOCATION_FORWARD, + LOCATION_FORWARD_PERM, + NEEDS_ADDRESSING_MODE + }; + + enum LocateStatusType { + UNKNOWN_OBJECT, + OBJECT_HERE, + OBJECT_FORWARD, + OBJECT_FORWARD_PERM, + LOC_SYSTEM_EXCEPTION, + LOC_NEEDS_ADDRESSING_MODE + }; }; #endif /* TAO_GIOP_PIDL */ diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index 1fd5493ae3c..ffd482eadfc 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -294,49 +294,6 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) return 0; } -TAO_Pluggable_Message_Type -TAO_GIOP_Message_Base::message_type ( - const TAO_GIOP_Message_State &msg_state) const -{ - // Convert to the right type of Pluggable Messaging message type. - - switch (msg_state.message_type ()) - { - case TAO_GIOP_REQUEST: - return TAO_PLUGGABLE_MESSAGE_REQUEST; - case TAO_GIOP_LOCATEREQUEST: - return TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST; - - case TAO_GIOP_LOCATEREPLY: - return TAO_PLUGGABLE_MESSAGE_LOCATEREPLY; - - case TAO_GIOP_REPLY: - return TAO_PLUGGABLE_MESSAGE_REPLY; - - case TAO_GIOP_CLOSECONNECTION: - return TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION; - - case TAO_GIOP_FRAGMENT: - return TAO_PLUGGABLE_MESSAGE_FRAGMENT; - - case TAO_GIOP_MESSAGERROR: - return TAO_PLUGGABLE_MESSAGE_MESSAGERROR; - - case TAO_GIOP_CANCELREQUEST: - return TAO_PLUGGABLE_MESSAGE_CANCELREQUEST; - - default: - if (TAO_debug_level > 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ") - ACE_TEXT ("wrong message.\n"))); - } - } - - return TAO_PLUGGABLE_MESSAGE_MESSAGERROR; -} - int TAO_GIOP_Message_Base::parse_next_message (ACE_Message_Block &incoming, TAO_Queued_Data &qd, @@ -1647,7 +1604,7 @@ TAO_GIOP_Message_Base::init_queued_data ( qd->major_version_ = state.giop_version ().major; qd->minor_version_ = state.giop_version ().minor; qd->more_fragments_ = state.more_fragments (); - qd->msg_type_ = this->message_type (state); + qd->msg_type_ = state.message_type (); } int diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h index 0670b8d8b11..48af8ea2fb7 100644 --- a/TAO/tao/GIOP_Message_Base.h +++ b/TAO/tao/GIOP_Message_Base.h @@ -185,15 +185,6 @@ protected: /// Print out a debug messages.. void dump_msg (const char *label, const u_char *ptr, size_t len); - /// Get the message type. The return value would be one of the - /// following: - /// TAO_PLUGGABLE_MESSAGE_REQUEST, - /// TAO_PLUGGABLE_MESSAGE_REPLY, - /// TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION, - /// TAO_PLUGGABLE_MESSAGE_MESSAGE_ERROR. - TAO_Pluggable_Message_Type message_type ( - const TAO_GIOP_Message_State &state) const; - /// Writes the GIOP header in to @a msg /// @note If the GIOP header happens to change in the future, we can /// push this method in to the generator_parser classes. diff --git a/TAO/tao/GIOP_Message_State.cpp b/TAO/tao/GIOP_Message_State.cpp index c2f3c9203bb..664d2e111f6 100644 --- a/TAO/tao/GIOP_Message_State.cpp +++ b/TAO/tao/GIOP_Message_State.cpp @@ -58,7 +58,7 @@ TAO_GIOP_Message_State::parse_message_header_i (ACE_Message_Block &incoming) return -1; // Get the message type - this->message_type_ = buf[TAO_GIOP_MESSAGE_TYPE_OFFSET]; + this->message_type_ = this->message_type (buf[TAO_GIOP_MESSAGE_TYPE_OFFSET]); // Get the size of the message.. this->get_payload_size (buf); @@ -67,14 +67,13 @@ TAO_GIOP_Message_State::parse_message_header_i (ACE_Message_Block &incoming) { switch (this->message_type_) { - case TAO_GIOP_MESSAGERROR: - case TAO_GIOP_CLOSECONNECTION: + case TAO_PLUGGABLE_MESSAGE_MESSAGERROR: + case TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION: if (TAO_debug_level > 0) { - CORBA::Octet& t = this->message_type_; const char* which = - (t == TAO_GIOP_CLOSECONNECTION) ? "CloseConnection" : - (t == TAO_GIOP_MESSAGERROR) ? "MessageError" : "unknown"; + (this->message_type_ == TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION) ? "CloseConnection" : + (this->message_type_ == TAO_PLUGGABLE_MESSAGE_MESSAGERROR) ? "MessageError" : "unknown"; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - GIOP %s received \n"), which)); } @@ -92,6 +91,48 @@ TAO_GIOP_Message_State::parse_message_header_i (ACE_Message_Block &incoming) return 0; // success } +TAO_Pluggable_Message_Type +TAO_GIOP_Message_State::message_type (CORBA::Octet type) const +{ + // Convert to the right type of Pluggable Messaging message type. + + switch (type) + { + case TAO_GIOP_REQUEST: + return TAO_PLUGGABLE_MESSAGE_REQUEST; + case TAO_GIOP_LOCATEREQUEST: + return TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST; + + case TAO_GIOP_LOCATEREPLY: + return TAO_PLUGGABLE_MESSAGE_LOCATEREPLY; + + case TAO_GIOP_REPLY: + return TAO_PLUGGABLE_MESSAGE_REPLY; + + case TAO_GIOP_CLOSECONNECTION: + return TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION; + + case TAO_GIOP_FRAGMENT: + return TAO_PLUGGABLE_MESSAGE_FRAGMENT; + + case TAO_GIOP_MESSAGERROR: + return TAO_PLUGGABLE_MESSAGE_MESSAGERROR; + + case TAO_GIOP_CANCELREQUEST: + return TAO_PLUGGABLE_MESSAGE_CANCELREQUEST; + + default: + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ") + ACE_TEXT ("wrong message.\n"))); + } + } + + return TAO_PLUGGABLE_MESSAGE_MESSAGERROR; +} + int TAO_GIOP_Message_State::parse_magic_bytes (char *buf) { diff --git a/TAO/tao/GIOP_Message_State.h b/TAO/tao/GIOP_Message_State.h index b01892ac617..1d374d9c5b8 100644 --- a/TAO/tao/GIOP_Message_State.h +++ b/TAO/tao/GIOP_Message_State.h @@ -25,6 +25,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/Pluggable_Messaging_Utils.h" + TAO_BEGIN_VERSIONED_NAMESPACE_DECL /** @@ -60,7 +62,7 @@ public: CORBA::Octet byte_order (void) const; /// Return the message type - CORBA::Octet message_type (void) const; + TAO_Pluggable_Message_Type message_type (void) const; /// Return the more fragments CORBA::Octet more_fragments (void) const; @@ -71,6 +73,9 @@ private: /// Parse the message header. int parse_message_header_i (ACE_Message_Block &incoming); + /// Get the message type. + TAO_Pluggable_Message_Type message_type (CORBA::Octet type) const; + /// Checks for the magic word 'GIOP' in the start of the incoing /// stream int parse_magic_bytes (char *buf); @@ -100,7 +105,7 @@ private: CORBA::Octet byte_order_; /// MsgType above - CORBA::Octet message_type_; + TAO_Pluggable_Message_Type message_type_; /// in byte_order! CORBA::ULong message_size_; diff --git a/TAO/tao/GIOP_Message_State.inl b/TAO/tao/GIOP_Message_State.inl index 0406dc9df60..970212f6358 100644 --- a/TAO/tao/GIOP_Message_State.inl +++ b/TAO/tao/GIOP_Message_State.inl @@ -9,7 +9,7 @@ TAO_GIOP_Message_State::TAO_GIOP_Message_State (void) : giop_version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR), byte_order_ (0), - message_type_ (0), + message_type_ (TAO_PLUGGABLE_MESSAGE_REQUEST), message_size_ (0), more_fragments_ (0) { @@ -36,7 +36,7 @@ TAO_GIOP_Message_State::byte_order (void) const return this->byte_order_; } -ACE_INLINE CORBA::Octet +ACE_INLINE TAO_Pluggable_Message_Type TAO_GIOP_Message_State::message_type (void) const { return this->message_type_; diff --git a/TAO/tao/Incoming_Message_Stack.h b/TAO/tao/Incoming_Message_Stack.h index 936d2f50a20..9bed4ffdda0 100644 --- a/TAO/tao/Incoming_Message_Stack.h +++ b/TAO/tao/Incoming_Message_Stack.h @@ -64,7 +64,7 @@ public: /// peeking top element of stack /// @return 0 for Ok, -1 for error - int top (TAO_Queued_Data* &data); + int top (TAO_Queued_Data* &data) const; private: /// top element of stack diff --git a/TAO/tao/Incoming_Message_Stack.inl b/TAO/tao/Incoming_Message_Stack.inl index fd13e03a54e..838332a0fb3 100644 --- a/TAO/tao/Incoming_Message_Stack.inl +++ b/TAO/tao/Incoming_Message_Stack.inl @@ -49,7 +49,7 @@ Incoming_Message_Stack::pop (TAO_Queued_Data* &data) } ACE_INLINE int -Incoming_Message_Stack::top (TAO_Queued_Data* &data) +Incoming_Message_Stack::top (TAO_Queued_Data* &data) const { if (this->top_ == 0) return -1; diff --git a/TAO/tao/Queued_Data.h b/TAO/tao/Queued_Data.h index 3376cf48bff..1cb65b81dd8 100644 --- a/TAO/tao/Queued_Data.h +++ b/TAO/tao/Queued_Data.h @@ -43,7 +43,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL * case consolidate () needs to be called prior to being sent to higher * layers of the ORB when the GIOP fragment chain is complete. */ - class TAO_Export TAO_Queued_Data { public: diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index ce44d35eb47..90cc6f24465 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -532,7 +532,7 @@ TAO_Transport::send_message_block_chain_i (const ACE_Message_Block *mb, synch_message.push_back (this->head_, this->tail_); - const int n = this->drain_queue_i (); + int const n = this->drain_queue_i (); if (n == -1) { @@ -2226,7 +2226,7 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, } // Get the that we have received - const TAO_Pluggable_Message_Type t = qd->msg_type_; + TAO_Pluggable_Message_Type const t = qd->msg_type_; #if TAO_HAS_TRANSPORT_CURRENT == 1 // Update stats, if any -- cgit v1.2.1