From d8d5a5cedc29745542c27b13f2cd7bc50a5b3827 Mon Sep 17 00:00:00 2001 From: bala Date: Mon, 28 Feb 2000 22:16:52 +0000 Subject: *** empty log message *** --- TAO/tao/GIOP_Message_Acceptors.cpp | 31 +++++++++++++++++ TAO/tao/GIOP_Message_Acceptors.i | 32 ------------------ TAO/tao/GIOP_Message_Base.cpp | 68 -------------------------------------- TAO/tao/GIOP_Message_Base.h | 2 +- TAO/tao/GIOP_Message_Base.i | 65 ++++++++++++++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 101 deletions(-) diff --git a/TAO/tao/GIOP_Message_Acceptors.cpp b/TAO/tao/GIOP_Message_Acceptors.cpp index 1e892280aee..af112ee2363 100644 --- a/TAO/tao/GIOP_Message_Acceptors.cpp +++ b/TAO/tao/GIOP_Message_Acceptors.cpp @@ -547,6 +547,37 @@ TAO_GIOP_Message_Acceptors::minor_version (void) return this->accept_state_->minor_version (); } +int +TAO_GIOP_Message_Acceptors:: + validate_version (TAO_GIOP_Message_State *state) +{ + char *buf = state->cdr.rd_ptr (); + CORBA::Octet incoming_major = + buf[this->major_version_offset ()]; + CORBA::Octet incoming_minor = + buf[this->minor_version_offset ()]; + + if (this->implementations_.check_revision (incoming_major, + incoming_minor) == 0) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("TAO (%P|%t|%N|%l) bad version <%d.%d>\n"), + incoming_major, incoming_minor)); + return -1; + } + + // Sets the version + // @@Bala Need to remove this as redundant data + state->giop_version.minor = incoming_minor; + state->giop_version.major = incoming_major; + + // Sets the state + this->set_state (incoming_major, + incoming_minor); + + return 0; +} //////////////////////////////////////////////////////////// // Methods that should not be called from the acceptor side diff --git a/TAO/tao/GIOP_Message_Acceptors.i b/TAO/tao/GIOP_Message_Acceptors.i index a7063d165d2..a083a1e43f2 100644 --- a/TAO/tao/GIOP_Message_Acceptors.i +++ b/TAO/tao/GIOP_Message_Acceptors.i @@ -76,38 +76,6 @@ TAO_GIOP_Message_Acceptors:: } -ACE_INLINE int -TAO_GIOP_Message_Acceptors:: - validate_version (TAO_GIOP_Message_State *state) -{ - char *buf = state->cdr.rd_ptr (); - CORBA::Octet incoming_major = - buf[this->major_version_offset ()]; - CORBA::Octet incoming_minor = - buf[this->minor_version_offset ()]; - - if (this->implementations_.check_revision (incoming_major, - incoming_minor) == 0) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("TAO (%P|%t|%N|%l) bad version <%d.%d>\n"), - incoming_major, incoming_minor)); - return -1; - } - - // Sets the version - // @@Bala Need to remove this as redundant data - state->giop_version.minor = incoming_minor; - state->giop_version.major = incoming_major; - - // Sets the state - this->set_state (incoming_major, - incoming_minor); - - return 0; -} - ACE_INLINE void TAO_GIOP_Message_Acceptors:: set_state (CORBA::Octet def_major, diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index 20dd76f5ca7..45fcdb3792b 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -347,74 +347,6 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, } } - - -int -TAO_GIOP_Message_Base::parse_header (TAO_GIOP_Message_State *state) -{ - char *buf = state->cdr.rd_ptr (); - - // Let us be specific that it is for 1.0 - if (this->minor_version () == 0 && - this->major_version () == 1) - { - state->byte_order = buf[this->flags_offset ()]; - if (TAO_debug_level > 2 - && state->byte_order != 0 && state->byte_order != 1) - { - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("TAO (%P|%t) invalid byte order <%d>") - ASYS_TEXT (" for version <1.0>\n"), - state->byte_order)); - return -1; - } - } - else - { - state->byte_order = - (CORBA::Octet) (buf[this->flags_offset ()]& 0x01); - state->more_fragments = - (CORBA::Octet) (buf[this->flags_offset ()]& 0x02); - - if (TAO_debug_level > 2 - && (buf[this->flags_offset ()] & ~0x3) != 0) - { - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("TAO (%P|%t) invalid flags for <%d>") - ASYS_TEXT (" for version <%d %d> \n"), - buf[this->flags_offset ()], - this->major_version (), - this->minor_version ())); - return -1; - } - } - - // Get the message type - state->message_type = buf[this->message_type_offset ()]; - - // Reset our input CDR stream - state->cdr.reset_byte_order (state->byte_order); - - - state->cdr.skip_bytes (this->message_size_offset ()); - state->cdr.read_ulong (state->message_size); - - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("TAO (%P|%t) Parsed header = <%d,%d,%d,%d,%d>\n"), - this->major_version (), - this->minor_version (), - state->byte_order, - state->message_type, - state->message_size)); - } - - return 1; -} - - - // Send an "I can't understand you" message -- again, the message is // prefabricated for simplicity. This implies abortive disconnect (at // the application level, if not at the level of TCP). diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h index 57e9b08081b..3945ab26ef8 100644 --- a/TAO/tao/GIOP_Message_Base.h +++ b/TAO/tao/GIOP_Message_Base.h @@ -134,7 +134,7 @@ private: virtual int validate_version (TAO_GIOP_Message_State *state) = 0; // This will do a validation of the versions that arrive in the transport. - virtual int parse_header (TAO_GIOP_Message_State *state); + int parse_header (TAO_GIOP_Message_State *state); // Parses the header of the GIOP messages for validity virtual int parse_magic_bytes (TAO_GIOP_Message_State *state); diff --git a/TAO/tao/GIOP_Message_Base.i b/TAO/tao/GIOP_Message_Base.i index e437b2b6963..b4807d45ff1 100644 --- a/TAO/tao/GIOP_Message_Base.i +++ b/TAO/tao/GIOP_Message_Base.i @@ -1,3 +1,4 @@ +// -*- C++ -*- //$Id$ // @@ -77,3 +78,67 @@ TAO_GIOP_Message_Base::parse_magic_bytes ( return 0; } + +ACE_INLINE int +TAO_GIOP_Message_Base::parse_header (TAO_GIOP_Message_State *state) +{ + char *buf = state->cdr.rd_ptr (); + + // Let us be specific that it is for 1.0 + if (this->minor_version () == 0 && + this->major_version () == 1) + { + state->byte_order = buf[this->flags_offset ()]; + if (TAO_debug_level > 2 + && state->byte_order != 0 && state->byte_order != 1) + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("TAO (%P|%t) invalid byte order <%d>") + ASYS_TEXT (" for version <1.0>\n"), + state->byte_order)); + return -1; + } + } + else + { + state->byte_order = + (CORBA::Octet) (buf[this->flags_offset ()]& 0x01); + state->more_fragments = + (CORBA::Octet) (buf[this->flags_offset ()]& 0x02); + + if (TAO_debug_level > 2 + && (buf[this->flags_offset ()] & ~0x3) != 0) + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("TAO (%P|%t) invalid flags for <%d>") + ASYS_TEXT (" for version <%d %d> \n"), + buf[this->flags_offset ()], + this->major_version (), + this->minor_version ())); + return -1; + } + } + + // Get the message type + state->message_type = buf[this->message_type_offset ()]; + + // Reset our input CDR stream + state->cdr.reset_byte_order (state->byte_order); + + + state->cdr.skip_bytes (this->message_size_offset ()); + state->cdr.read_ulong (state->message_size); + + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("TAO (%P|%t) Parsed header = <%d,%d,%d,%d,%d>\n"), + this->major_version (), + this->minor_version (), + state->byte_order, + state->message_type, + state->message_size)); + } + + return 1; +} -- cgit v1.2.1