diff options
author | bala <balanatarajan@users.noreply.github.com> | 2000-04-19 19:56:25 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2000-04-19 19:56:25 +0000 |
commit | 9a0a9e01f7f7beaecfe5ca7880557e6436391543 (patch) | |
tree | afb31952a763410290f505bba37d9f4cdb029f21 | |
parent | 9b79dede3dc6187792b6e6a757ed95d212698c86 (diff) | |
download | ATCD-9a0a9e01f7f7beaecfe5ca7880557e6436391543.tar.gz |
ChangeLogTag: Wed Apr 19 14:46:13 2000 Balachandran Natarajan <bala@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 26 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Accept_State.cpp | 320 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Accept_State.h | 43 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Accept_State.i | 4 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Acceptors.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Acceptors.i | 10 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Base.cpp | 13 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Connectors.cpp | 48 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Connectors.i | 6 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Headers.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Headers.h | 44 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Headers.i | 41 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Lite.cpp | 53 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Lite.h | 2 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Lite.i | 39 | ||||
-rw-r--r-- | TAO/tao/GIOP_Server_Request.h | 19 | ||||
-rw-r--r-- | TAO/tao/GIOP_Server_Request.i | 22 | ||||
-rw-r--r-- | TAO/tao/GIOP_Utils.h | 14 | ||||
-rw-r--r-- | TAO/tao/IIOP_Transport.cpp | 12 | ||||
-rw-r--r-- | TAO/tao/SHMIOP_Transport.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/UIOP_Transport.cpp | 13 |
21 files changed, 527 insertions, 225 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 42fe6feb6e4..68cfa873a9b 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,29 @@ +Wed Apr 19 14:46:13 2000 Balachandran Natarajan <bala@cs.wustl.edu> + + * tao/IIOP_Transport.cpp (messaging_init): + * tao/SHMIOP_Transport.cpp: + * tao/UIOP_Transport.cpp: + * tao/GIOP_Message_Accept_State.cpp: + * tao/GIOP_Message_Accept_State.h: + * tao/GIOP_Message_Accept_State.i: + * tao/GIOP_Message_Acceptors.cpp: + * tao/GIOP_Message_Acceptors.i: + * tao/GIOP_Message_Base.cpp: + * tao/GIOP_Message_Connectors.cpp: + * tao/GIOP_Message_Connectors.i: + * tao/GIOP_Message_Headers.cpp: + * tao/GIOP_Message_Headers.h: + * tao/GIOP_Message_Headers.i: + * tao/GIOP_Message_Lite.cpp: + * tao/GIOP_Message_Lite.h: + * tao/GIOP_Message_Lite.i: + * tao/GIOP_Server_Request.h: + * tao/GIOP_Server_Request.i: + * tao/GIOP_Utils.h: Implemented the GIOP1.2 message formats. The + clients and servers would now be able to recognise the 1.2 + message formats. I have not switched the GIOP format for TAO + from 1.1 to 1.2, as some more work is pending. + Wed Apr 19 12:11:47 2000 Carlos O'Ryan <coryan@uci.edu> * examples/Simulator/Event_Supplier/DOVE_Supplier.cpp: diff --git a/TAO/tao/GIOP_Message_Accept_State.cpp b/TAO/tao/GIOP_Message_Accept_State.cpp index 0e3c0e9ab5a..88998585b0e 100644 --- a/TAO/tao/GIOP_Message_Accept_State.cpp +++ b/TAO/tao/GIOP_Message_Accept_State.cpp @@ -89,6 +89,49 @@ TAO_GIOP_Message_Accept_State::marshal_reply_status (TAO_OutputCDR &output, } } +CORBA::Boolean +TAO_GIOP_Message_Accept_State:: + unmarshall_object_key (TAO_ObjectKey &object_key, + TAO_InputCDR &input) +{ + CORBA::Boolean hdr_status = + (CORBA::Boolean) input.good_bit (); + + CORBA::Long key_length = 0; + hdr_status = hdr_status && input.read_long (key_length); + if (hdr_status) + { + object_key.replace (key_length, + key_length, + (CORBA::Octet*)input.rd_ptr (), + 0); + input.skip_bytes (key_length); + } + + return hdr_status; +} + + + +CORBA::Boolean +TAO_GIOP_Message_Accept_State:: +unmarshall_iop_profile (TAO_ObjectKey & /*object_key*/, + IOP::TaggedProfile & /*profile*/, + TAO_InputCDR & /*cdr*/) +{ + return 0; +} + + +CORBA::Boolean +TAO_GIOP_Message_Accept_State:: +unmarshall_ref_addr (TAO_ObjectKey & /*object_key*/, + GIOP::IORAddressingInfo & /*profile*/, + TAO_InputCDR & /*cdr*/) +{ + return 0; +} + //////////////////////////////////////////////////////////////////////////////// // TAO_GIOP_Message_Accept_State_10 methods @@ -109,15 +152,13 @@ TAO_GIOP_Message_Accept_State_10:: // Get the input CDR in the request class TAO_InputCDR& input = request.incoming (); - IOP::ServiceContextList service_info; + IOP::ServiceContextList &service_info = + request.service_info (); + input >> service_info; - // This method is going to a copy?? Data copy?? Need to figure out a - // way to avoid this - request.service_info (service_info); - - - CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit (); + CORBA::Boolean hdr_status = + (CORBA::Boolean) input.good_bit (); CORBA::ULong req_id; // Get the rest of the request header ... @@ -139,15 +180,8 @@ TAO_GIOP_Message_Accept_State_10:: // the reference count on the CDR message block, because this key // will not outlive the request (or the message block). - CORBA::Long key_length = 0; - hdr_status = hdr_status && input.read_long (key_length); - if (hdr_status) - { - request.object_key ().replace (key_length, key_length, - (CORBA::Octet*)input.rd_ptr (), - 0); - input.skip_bytes (key_length); - } + hdr_status = this->unmarshall_object_key (request.object_key (), + input); ACE_CString operation_name; if (input.char_translator () == 0) @@ -305,18 +339,10 @@ TAO_GIOP_Message_Accept_State_10:: // Store it in the Locate request classes request.request_id (req_id); - TAO_ObjectKey object_key; - - // Note that here there are no unions and so no problems - hdr_status = hdr_status && (msg >> object_key); - - // Get the underlying TargetAddress from the request class - GIOP::TargetAddress &target = request.target_address (); - - // Put this object key in the target_adderss - // This has a "new" in it. Need to change that to something more - // efficient - target.object_key (object_key); + // Get the object key + hdr_status = + this->unmarshall_object_key (request.object_key (), + msg); return hdr_status ? 0 : -1; } @@ -335,7 +361,8 @@ write_locate_reply_mesg (TAO_OutputCDR &output, if (status_info.status == TAO_GIOP_OBJECT_FORWARD) { - CORBA::Object_ptr object_ptr = status_info.forward_location_var.in (); + CORBA::Object_ptr object_ptr = + status_info.forward_location_var.in (); if ((output << object_ptr) == 0) { if (TAO_debug_level > 0) @@ -410,8 +437,34 @@ TAO_GIOP_Message_Accept_State_12:: // message header instead. request.sync_with_server ((response_flags == 129)); - hdr_status = hdr_status && this->unmarshall_target_addr (request, - input); + // Read the discriminant of the union. + CORBA::Short disc = 0; + hdr_status = hdr_status && input.read_short (disc); + + if (hdr_status) + { + if (disc == GIOP::KeyAddr) + { + hdr_status = + this->unmarshall_object_key (request.object_key (), + input); + } + else if (disc == GIOP::ProfileAddr) + { + hdr_status = + this->unmarshall_iop_profile (request.object_key (), + request.tagged_profile (), + input); + } + else if (disc == GIOP::ReferenceAddr) + { + hdr_status = + this->unmarshall_ref_addr (request.object_key (), + request.addressing_info (), + input); + } + } + ACE_CString operation_name; if (input.char_translator () == 0) { @@ -450,13 +503,14 @@ TAO_GIOP_Message_Accept_State_12:: // verify a digital signature, if that is required in this security // environment. It may be required even when using IPSEC security // infrastructure. - IOP::ServiceContextList service_info; - input >> service_info; + IOP::ServiceContextList &service_info = + request.service_info (); - // This method is going to a copy?? Data copy?? Need to figure out a - // way to avoid this - request.service_info (service_info); + input >> service_info; + // Reset the read_ptr to an 8-byte boundary + input.align_read_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR); + return hdr_status ? 0 : -1; } @@ -477,80 +531,188 @@ TAO_GIOP_Message_Accept_State_12:: // Store it in the Locate request classes request.request_id (req_id); - // - // ADD STUFF - // - // - + // Read the discriminant of the union. + CORBA::Short disc = 0; + hdr_status = + hdr_status && msg.read_short (disc); + if (hdr_status) + { + if (disc == GIOP::KeyAddr) + { + hdr_status = + this->unmarshall_object_key (request.object_key (), + msg); + } + else if (disc == GIOP::ProfileAddr) + { + hdr_status = + this->unmarshall_iop_profile (request.object_key (), + request.tagged_profile (), + msg); + } + else if (disc == GIOP::ReferenceAddr) + { + hdr_status = + this->unmarshall_ref_addr (request.object_key (), + request.addressing_info (), + msg); + } + } + + // Reset the pointer to an 8-byte bouns]dary + msg.align_read_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR); return hdr_status ? 0 : -1; } - -CORBA::Boolean +CORBA::Boolean TAO_GIOP_Message_Accept_State_12:: - unmarshall_target_addr (TAO_GIOP_ServerRequest &request, - TAO_InputCDR &input) + unmarshall_iop_profile (TAO_ObjectKey &object_key, + IOP::TaggedProfile &profile_addr, + TAO_InputCDR &input) { - CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit (); - - // We use ad-hoc demarshalling here: there is no need to increase - // the reference count on the CDR message block, because this key - // will not outlive the request (or the message block). + CORBA::Boolean hdr_status = + (CORBA::Boolean) input.good_bit (); - // Read the discriminant of the union. - CORBA::Short disc = 0; - hdr_status = hdr_status && input.read_short (disc); + // Extract the TaggedProfile + // @@We can also look in to the CDR stream to extract the + // members of the struct (TaggedProfile) directly. A place + // for optimzation. Once we have this working we can implement + // this + hdr_status &= input >> profile_addr; + + // Extract the object key from the TaggedProfile + if (hdr_status) + { + object_key.replace (profile_addr.profile_data.length (), + profile_addr.profile_data.length (), + profile_addr.profile_data.get_buffer ()); + + } + + return hdr_status; +} + +CORBA::Boolean +TAO_GIOP_Message_Accept_State_12:: + unmarshall_ref_addr (TAO_ObjectKey &object_key, + GIOP::IORAddressingInfo &addr_info, + TAO_InputCDR &input) +{ + CORBA::Boolean hdr_status = + (CORBA::Boolean) input.good_bit (); + + //Extract the Addressing info + // @@We can also look in to the CDR stream to extract the + // members of the struct (AddressingInfo) directly. A place + // for optimzation. Once we have this working we can implement + // this + hdr_status &= input>> addr_info; + + // Extract the object key if (hdr_status) { - if (disc == GIOP::KeyAddr) - { - CORBA::Long key_length = 0; - hdr_status = hdr_status && input.read_long (key_length); - if (hdr_status) - { - request.object_key ().replace (key_length, key_length, - (CORBA::Octet*)input.rd_ptr (), - 0); - input.skip_bytes (key_length); - } - } - else if (disc == GIOP::ProfileAddr) - { - // Need to add stuff here, Bala - } - - else if (disc == GIOP::ReferenceAddr) - { - // Need to add stuff here, Bala - } + // Get the IOP::TaggedProfile + IOP::TaggedProfile &tag = + addr_info.ior.profiles [addr_info.selected_profile_index]; + + // Replace the object key + object_key.replace (tag.profile_data.length (), + tag.profile_data.length (), + tag.profile_data.get_buffer ()); } return hdr_status; } + + CORBA::Boolean TAO_GIOP_Message_Accept_State_12:: -write_reply_header (TAO_OutputCDR & /*output*/, - TAO_Pluggable_Reply_Params & /*reply_params*/, +write_reply_header (TAO_OutputCDR & output, + TAO_Pluggable_Reply_Params &reply, CORBA::Environment & /*ACE_TRY_ENV*/) ACE_THROW_SPEC ((CORBA::SystemException)) { + // Write the request ID + output.write_ulong (reply.request_id_); + + // Write the reply status + if (reply.reply_status_ == + TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM) + { + // Not sure when we will use this. + output.write_ulong (TAO_GIOP_LOCATION_FORWARD_PERM); + } + else if (reply.reply_status_ == + TAO_PLUGABLE_MESSAGE_NEEDS_ADDRESSING_MODE) + { + // Not sure when we will use this. + output.write_ulong (TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE); + } + else + { + this->marshal_reply_status (output, + reply); + } + + // Service context list + this->marshal_svc_ctx (output, + reply); + + if (output.align_write_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR) == -1) + return 0; + return 1; } CORBA::Boolean TAO_GIOP_Message_Accept_State_12:: -write_locate_reply_mesg (TAO_OutputCDR & /*output*/, - CORBA::ULong /*request_id*/, - TAO_GIOP_Locate_Status_Msg & /*status*/) +write_locate_reply_mesg (TAO_OutputCDR & output, + CORBA::ULong request_id, + TAO_GIOP_Locate_Status_Msg &status_info) { + // Make the header for the locate request + output.write_ulong (request_id); + output.write_ulong (status_info.status); + + if (output.align_write_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR) == -1) + return 0; + + switch (status_info.status) + { + + // More likely than not we will not have this in TAO + case TAO_GIOP_OBJECT_FORWARD: + case TAO_GIOP_OBJECT_FORWARD_PERM: + { + CORBA::Object_ptr object_ptr = + status_info.forward_location_var.in (); + if ((output << object_ptr) == 0) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("TAO (%P|%t|%N|%l) write_locate_reply_mesg-") + ASYS_TEXT (" cannot marshal object reference\n"))); + } + } + break; + case TAO_GIOP_LOC_SYSTEM_EXCEPTION: + case TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE: + // Do we do these in TAO?? + // What to do here???? I dont really know. I have to do a survey + // of the specifications that uses this. + break; + default: + break; + } + return 1; } diff --git a/TAO/tao/GIOP_Message_Accept_State.h b/TAO/tao/GIOP_Message_Accept_State.h index 83151f00123..b6616b06702 100644 --- a/TAO/tao/GIOP_Message_Accept_State.h +++ b/TAO/tao/GIOP_Message_Accept_State.h @@ -50,7 +50,7 @@ class TAO_OutputCDR; class TAO_GIOP_Locate_Status_Msg; class TAO_Pluggable_Reply_Params; -class TAO_GIOP_Message_Accept_State +class TAO_Export TAO_GIOP_Message_Accept_State { // = TITLE // TAO_GIOP_Message_Accept_State @@ -91,9 +91,28 @@ public: protected: CORBA::Boolean marshal_svc_ctx (TAO_OutputCDR &output, TAO_Pluggable_Reply_Params &reply); + // Marshalls the service context void marshal_reply_status (TAO_OutputCDR &output, TAO_Pluggable_Reply_Params &reply); + // Marshall the reply status + + virtual CORBA::Boolean + unmarshall_object_key (TAO_ObjectKey &object_key, + TAO_InputCDR &cdr); + // Unmarshals the received object key + + virtual CORBA::Boolean + unmarshall_iop_profile (TAO_ObjectKey &object_key, + IOP::TaggedProfile &profile, + TAO_InputCDR &cdr); + // Unmarshall the IOP::TaggedProfile + + virtual CORBA::Boolean + unmarshall_ref_addr (TAO_ObjectKey &object_key, + GIOP::IORAddressingInfo &profile, + TAO_InputCDR &cdr); + // Unmarshalls the GIOP::IORAddressingInfo }; @@ -113,7 +132,7 @@ protected: // is set)? I think it is OK if GIOP 1.1 depends on 1.0 (and 1.2 // depends on both), but not vice-versa.... -class TAO_GIOP_Message_Accept_State_10 : public TAO_GIOP_Message_Accept_State +class TAO_Export TAO_GIOP_Message_Accept_State_10 : public TAO_GIOP_Message_Accept_State { // = TITLE // TAO_GIOP_Message_Accept_State_10 @@ -151,7 +170,7 @@ public: /*****************************************************************/ -class TAO_GIOP_Message_Accept_State_11: public TAO_GIOP_Message_Accept_State_10 +class TAO_Export TAO_GIOP_Message_Accept_State_11: public TAO_GIOP_Message_Accept_State_10 { // = TITLE // TAO_GIOP_Message_Accept_State_11 @@ -163,7 +182,7 @@ public: /********************************************************************/ -class TAO_GIOP_Message_Accept_State_12 : public TAO_GIOP_Message_Accept_State +class TAO_Export TAO_GIOP_Message_Accept_State_12 : public TAO_GIOP_Message_Accept_State { // = TITLE // TAO_GIOP_Message_Accept_State_12 @@ -197,16 +216,24 @@ public: virtual CORBA::Octet major_version (void); virtual CORBA::Octet minor_version (void); // Our versions + private: - CORBA::Boolean unmarshall_target_addr (TAO_GIOP_ServerRequest &request, - TAO_InputCDR &input); + virtual CORBA::Boolean + unmarshall_iop_profile (TAO_ObjectKey &object_key, + IOP::TaggedProfile &profile, + TAO_InputCDR &cdr); + + virtual CORBA::Boolean + unmarshall_ref_addr (TAO_ObjectKey &object_key, + GIOP::IORAddressingInfo &ref_addr, + TAO_InputCDR &cdr); }; /*****************************************************************/ -class TAO_GIOP_Message_Accept_Impl +class TAO_Export TAO_GIOP_Message_Accept_Impl { // = TITLE // = DESCRIPTION @@ -217,8 +244,10 @@ class TAO_GIOP_Message_Accept_Impl CORBA::Octet incoming_minor); // Performs a check of the revision tags + TAO_GIOP_Message_Accept_State_10 version_10; TAO_GIOP_Message_Accept_State_11 version_11; + TAO_GIOP_Message_Accept_State_12 version_12; // The concrete implementations that we hold }; diff --git a/TAO/tao/GIOP_Message_Accept_State.i b/TAO/tao/GIOP_Message_Accept_State.i index b777583df5c..28133efa3b7 100644 --- a/TAO/tao/GIOP_Message_Accept_State.i +++ b/TAO/tao/GIOP_Message_Accept_State.i @@ -19,8 +19,8 @@ TAO_GIOP_Message_Accept_Impl::check_revision (CORBA::Octet incoming_major, // @@ Bala: does this means that we reject GIOP 1.2 messages? I // think you are right to do so, because we don't export GIOP 1.2 // IORs.... - if (incoming_major > 1 || - incoming_minor > 1) + if (incoming_major > TAO_DEF_GIOP_MAJOR || + incoming_minor > TAO_DEF_GIOP_MINOR) return 0; return 1; diff --git a/TAO/tao/GIOP_Message_Acceptors.cpp b/TAO/tao/GIOP_Message_Acceptors.cpp index f63ab1de589..ec2e34c6e5b 100644 --- a/TAO/tao/GIOP_Message_Acceptors.cpp +++ b/TAO/tao/GIOP_Message_Acceptors.cpp @@ -342,14 +342,14 @@ TAO_GIOP_Message_Acceptors:: #if (TAO_NO_IOR_TABLE == 0) const CORBA::Octet *object_key = - locate_request.target_address ().object_key ().get_buffer (); + locate_request.object_key ().get_buffer (); if (ACE_OS::memcmp (object_key, &TAO_POA::objectkey_prefix[0], TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) { CORBA::ULong len = - locate_request.target_address ().object_key ().length (); + locate_request.object_key ().length (); ACE_CString object_id (ACE_reinterpret_cast (const char *, object_key), @@ -395,9 +395,9 @@ TAO_GIOP_Message_Acceptors:: // This could be tricky if the target_address does not have the // object key. Till then .. Bala - TAO_ObjectKey tmp_key (locate_request.target_address ().object_key ().length (), - locate_request.target_address ().object_key ().length (), - locate_request.target_address ().object_key ().get_buffer (), + TAO_ObjectKey tmp_key (locate_request.object_key ().length (), + locate_request.object_key ().length (), + locate_request.object_key ().get_buffer (), 0); // Set it to an error state diff --git a/TAO/tao/GIOP_Message_Acceptors.i b/TAO/tao/GIOP_Message_Acceptors.i index ba81d2ef1ef..90a429b8528 100644 --- a/TAO/tao/GIOP_Message_Acceptors.i +++ b/TAO/tao/GIOP_Message_Acceptors.i @@ -70,10 +70,16 @@ set_state (CORBA::Octet def_major, switch (def_minor) { case 0: - this->accept_state_ = &this->implementations_.version_10; + this->accept_state_ = + &this->implementations_.version_10; break; case 1: - this->accept_state_ = &this->implementations_.version_11; + this->accept_state_ = + &this->implementations_.version_11; + break; + case 2: + this->accept_state_ = + &this->implementations_.version_12; break; default: break; diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index 00b0d0f2dc2..44e32267e74 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -349,8 +349,17 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY) { // @@ Only works if ServiceContextList is empty.... - id = ACE_reinterpret_cast (CORBA::ULong *, - (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN + 4)); + if (this->minor_version () < 2) + { + id = ACE_reinterpret_cast (CORBA::ULong *, + (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN + 4)); + + } + else + { + id = ACE_reinterpret_cast (CORBA::ULong *, + (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN)); + } } // Print. diff --git a/TAO/tao/GIOP_Message_Connectors.cpp b/TAO/tao/GIOP_Message_Connectors.cpp index fb8efe6d357..12f02fc16a0 100644 --- a/TAO/tao/GIOP_Message_Connectors.cpp +++ b/TAO/tao/GIOP_Message_Connectors.cpp @@ -531,8 +531,52 @@ TAO_GIOP_Message_Connector_12:: int TAO_GIOP_Message_Connector_12:: -parse_reply (TAO_Message_State_Factory & /*mesg_state*/, - TAO_Pluggable_Reply_Params & /*params*/) +parse_reply (TAO_Message_State_Factory &mesg_state, + TAO_Pluggable_Reply_Params ¶ms) { + // Cast to the GIOP Message state + TAO_GIOP_Message_State *state = ACE_dynamic_cast (TAO_GIOP_Message_State *, + &mesg_state); + if (TAO_GIOP_Message_Connectors::parse_reply (*state, + params) + == -1) + return -1; + + switch (state->message_type) + { + case TAO_GIOP_REQUEST: + // We could get this in Bi_Dir GIOP + // So, we take some action. + break; + case TAO_GIOP_CANCELREQUEST: + case TAO_GIOP_LOCATEREQUEST: + // Errors + case TAO_GIOP_CLOSECONNECTION: + default: + ACE_ERROR_RETURN ((LM_ERROR, + ASYS_TEXT ("TAO (%P|%t) %N:%l parse_reply: ") + ASYS_TEXT ("wrong message.\n")), + -1); + case TAO_GIOP_LOCATEREPLY: + // Handle after the switch + break; + case TAO_GIOP_REPLY: + if ((state->cdr >> params.svc_ctx_) == 0) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("TAO (%P|%t) parse_reply, ") + ASYS_TEXT ("extracting context\n"))); + return -1; + } + // Rest of the stuff after the switch + break; + case TAO_GIOP_FRAGMENT: + // Never happens: why?? + break; + } + + // Align the read pointer on an 8-byte boundary + state->cdr.align_read_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR); return 0; } diff --git a/TAO/tao/GIOP_Message_Connectors.i b/TAO/tao/GIOP_Message_Connectors.i index a8f7fc95783..13f898170d2 100644 --- a/TAO/tao/GIOP_Message_Connectors.i +++ b/TAO/tao/GIOP_Message_Connectors.i @@ -12,3 +12,9 @@ ACE_INLINE TAO_GIOP_Message_Connector_11::TAO_GIOP_Message_Connector_11 (void) { } + +/******************************************************/ +ACE_INLINE +TAO_GIOP_Message_Connector_12::TAO_GIOP_Message_Connector_12 (void) +{ +} diff --git a/TAO/tao/GIOP_Message_Headers.cpp b/TAO/tao/GIOP_Message_Headers.cpp index f2d9d61d076..71e27e38905 100644 --- a/TAO/tao/GIOP_Message_Headers.cpp +++ b/TAO/tao/GIOP_Message_Headers.cpp @@ -5,5 +5,4 @@ # include "tao/GIOP_Message_Headers.i" #endif /* __ACE_INLINE__ */ -// @@ Bala: the RCSID macro is missing, please check all your files -// @@ and make sure they conform to the ACE guidelines. +ACE_RCSID(tao, GIOP_Message_Headers, "$Id$") diff --git a/TAO/tao/GIOP_Message_Headers.h b/TAO/tao/GIOP_Message_Headers.h index 14f1bffc7bf..a72af9d472d 100644 --- a/TAO/tao/GIOP_Message_Headers.h +++ b/TAO/tao/GIOP_Message_Headers.h @@ -7,10 +7,7 @@ // TAO // // = FILENAME -// @@ Bala: if you change the name of the file don't forget to -// change the documentation too (i hate this, IMHO the RCS id is -// enough, but it is part of the guidelines). -// GIOP_Assorted_Header.h +// GIOP_Message_Headers.h // // = DESCRIPTION // Some assorted GIOP structure mappings @@ -30,7 +27,7 @@ // @@ them? Only the Locate_Request header?! // @@ Bala: the TAO_Export macros are missing here too! -class TAO_GIOP_Locate_Request_Header +class TAO_Export TAO_GIOP_Locate_Request_Header { // = TITLE // Location service support @@ -45,20 +42,17 @@ public: CORBA::ULong request_id (void); // Get the request id - void addressing_disposition (CORBA::Short discriminant); - // Set the addressing the disposition + const TAO_ObjectKey &object_key (void) const; + // Get the object_key in read mode.. - CORBA::Short addressing_disposition (void); - // Return the addressing disposition + TAO_ObjectKey &object_key (void); + // Get the object_key in read/write mode.. - const GIOP::TargetAddress &target_address (void) const; - // Get in read mode + IOP::TaggedProfile &tagged_profile (void); + // get the tagged_profile in the read/write mode - GIOP::TargetAddress &target_address (void); - // Get in read/write mode - - // TAO_ObjectKey &object_key_ref (void); - // Get the Object Key in read/write mode + GIOP::IORAddressingInfo &addressing_info (void); + // get the addressing info in the read/write mode TAO_InputCDR &incoming_stream (void); // Get the CDR stream for read/write @@ -67,14 +61,20 @@ private: CORBA::ULong request_id_; // Request id - CORBA::Short addressing_disposition_; - // This is the discrminant type for the union encapsulated in - // TargetAddress. + TAO_ObjectKey object_key_; + // Object Key + + IOP::TaggedProfile profile_; + // The Tagged profile. This class would have the Tagged Profile - GIOP::TargetAddress target_address_; - // Introduced by GIOP 1.2. Will not cause us any harm if it is there - // for other versions. + GIOP::IORAddressingInfo addr_info_; + // The addressing info + // The above two declarations are not used in TAO as on date. It is + // here so that we can use this if we get to that point. The + // object_key extracted from these would still be available in + // <object_key_>. + TAO_InputCDR *incoming_; // Incoming CDR stream }; diff --git a/TAO/tao/GIOP_Message_Headers.i b/TAO/tao/GIOP_Message_Headers.i index 31cf4167810..24420b32260 100644 --- a/TAO/tao/GIOP_Message_Headers.i +++ b/TAO/tao/GIOP_Message_Headers.i @@ -1,10 +1,12 @@ +// -*- C++ -*- //$Id$ ACE_INLINE TAO_GIOP_Locate_Request_Header::TAO_GIOP_Locate_Request_Header (TAO_InputCDR &msg) : request_id_ (0), - addressing_disposition_ (0), - target_address_ (), + object_key_ (), + profile_ (), + addr_info_ (), incoming_ (&msg) { } @@ -21,42 +23,35 @@ TAO_GIOP_Locate_Request_Header::request_id (void) return this->request_id_; } -ACE_INLINE void -TAO_GIOP_Locate_Request_Header::addressing_disposition (CORBA::Short - add) +ACE_INLINE const TAO_ObjectKey & +TAO_GIOP_Locate_Request_Header::object_key (void) const { - this->addressing_disposition_ = add; + return object_key_; } -ACE_INLINE CORBA::Short -TAO_GIOP_Locate_Request_Header::addressing_disposition (void) +ACE_INLINE TAO_ObjectKey & +TAO_GIOP_Locate_Request_Header::object_key (void) { - return this->addressing_disposition_; + return this->object_key_; } -ACE_INLINE const GIOP::TargetAddress & -TAO_GIOP_Locate_Request_Header::target_address (void) const +ACE_INLINE IOP::TaggedProfile& +TAO_GIOP_Locate_Request_Header::tagged_profile (void) { - return this->target_address_; + return this->profile_; } -ACE_INLINE GIOP::TargetAddress & -TAO_GIOP_Locate_Request_Header::target_address (void) + +ACE_INLINE GIOP::IORAddressingInfo & +TAO_GIOP_Locate_Request_Header::addressing_info (void) { - return this->target_address_; + return this->addr_info_; } + ACE_INLINE TAO_InputCDR & TAO_GIOP_Locate_Request_Header::incoming_stream (void) { return *this->incoming_; } -/*TAO_ObjectKey & -TAO_GIOP_Locate_Request_Header::object_key_ref (void) -{ - // Not a good idea, need to check here.. - return this->target_address_.object_key (); - // For the rest do the checeks here -} -*/ diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp index d199bd6f08e..d9b83173bb2 100644 --- a/TAO/tao/GIOP_Message_Lite.cpp +++ b/TAO/tao/GIOP_Message_Lite.cpp @@ -15,41 +15,7 @@ # include "tao/GIOP_Message_Lite.i" #endif /* __ACE_INLINE__ */ -TAO_GIOP_Message_Lite::TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core) - :cdr_buffer_alloc_ (orb_core->resource_factory ()->output_cdr_buffer_allocator ()), - cdr_dblock_alloc_ (orb_core->resource_factory ()->output_cdr_dblock_allocator ()) -{ -#if defined (ACE_HAS_PURIFY) - (void) ACE_OS::memset (this->repbuf_, - '\0', - sizeof this->repbuf_); -#endif /* ACE_HAS_PURIFY */ - ACE_NEW (this->output_, - TAO_OutputCDR (this->repbuf_, - sizeof this->repbuf_, - TAO_ENCAP_BYTE_ORDER, - this->cdr_buffer_alloc_, - this->cdr_dblock_alloc_, - orb_core->orb_params ()->cdr_memcpy_tradeoff (), - orb_core->to_iso8859 (), - orb_core->to_unicode ())); -} -TAO_GIOP_Message_Lite::~TAO_GIOP_Message_Lite (void) -{ - // Explicitly call the destructor of the output CDR first. They need - // the allocators during destruction. - delete this->output_; - - // Then call the destructor of our allocators - if (this->cdr_dblock_alloc_ != 0) - this->cdr_dblock_alloc_->remove (); - // delete this->cdr_dblock_alloc_; - - if (this->cdr_buffer_alloc_ != 0) - this->cdr_buffer_alloc_->remove (); - // delete this->cdr_buffer_alloc_; -} CORBA::Boolean TAO_GIOP_Message_Lite:: @@ -858,14 +824,14 @@ TAO_GIOP_Message_Lite:: #if (TAO_NO_IOR_TABLE == 0) const CORBA::Octet *object_key = - locate_request.target_address ().object_key ().get_buffer (); + locate_request.object_key ().get_buffer (); if (ACE_OS::memcmp (object_key, &TAO_POA::objectkey_prefix[0], TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) { CORBA::ULong len = - locate_request.target_address ().object_key ().length (); + locate_request.object_key ().length (); ACE_CString object_id (ACE_reinterpret_cast (const char *, object_key), @@ -912,9 +878,9 @@ TAO_GIOP_Message_Lite:: // This could be tricky if the target_address does not have the // object key. Till then .. Bala - TAO_ObjectKey tmp_key (locate_request.target_address ().object_key ().length (), - locate_request.target_address ().object_key ().length (), - locate_request.target_address ().object_key ().get_buffer (), + TAO_ObjectKey tmp_key (locate_request.object_key ().length (), + locate_request.object_key ().length (), + locate_request.object_key ().get_buffer (), 0); // Set it to an error state @@ -1100,17 +1066,12 @@ TAO_GIOP_Message_Lite:: // Store it in the Locate request classes request.request_id (req_id); - TAO_ObjectKey object_key; + TAO_ObjectKey &object_key = + request.object_key (); // Note that here there are no unions and so no problems hdr_status = hdr_status && (msg >> object_key); - // Get the underlying TargetAddress from the request class - GIOP::TargetAddress &target = request.target_address (); - - // Put this object key in the target_adderss - target.object_key (object_key); - return hdr_status ? 0 : -1; } diff --git a/TAO/tao/GIOP_Message_Lite.h b/TAO/tao/GIOP_Message_Lite.h index 8819960ed4d..5928868ef55 100644 --- a/TAO/tao/GIOP_Message_Lite.h +++ b/TAO/tao/GIOP_Message_Lite.h @@ -20,7 +20,6 @@ #define TAO_GIOP_MESSAGE_LITE_H #include "ace/pre.h" -//#include "tao/target_specification.h" #include "tao/CDR.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -30,6 +29,7 @@ #include "tao/GIOP_Utils.h" #include "tao/GIOP_Message_State.h" +#include "tao/ORB_Core.h" class TAO_GIOP_ServerRequest; class TAO_GIOP_Locate_Request_Header; diff --git a/TAO/tao/GIOP_Message_Lite.i b/TAO/tao/GIOP_Message_Lite.i index c5c25aac236..e64e37395cd 100644 --- a/TAO/tao/GIOP_Message_Lite.i +++ b/TAO/tao/GIOP_Message_Lite.i @@ -1,6 +1,45 @@ //$Id$ +ACE_INLINE +TAO_GIOP_Message_Lite::TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core) + :cdr_buffer_alloc_ (orb_core->resource_factory ()->output_cdr_buffer_allocator ()), + cdr_dblock_alloc_ (orb_core->resource_factory ()->output_cdr_dblock_allocator ()) +{ +#if defined (ACE_HAS_PURIFY) + (void) ACE_OS::memset (this->repbuf_, + '\0', + sizeof this->repbuf_); +#endif /* ACE_HAS_PURIFY */ + ACE_NEW (this->output_, + TAO_OutputCDR (this->repbuf_, + sizeof this->repbuf_, + TAO_ENCAP_BYTE_ORDER, + this->cdr_buffer_alloc_, + this->cdr_dblock_alloc_, + orb_core->orb_params ()->cdr_memcpy_tradeoff (), + orb_core->to_iso8859 (), + orb_core->to_unicode ())); +} + +ACE_INLINE +TAO_GIOP_Message_Lite::~TAO_GIOP_Message_Lite (void) +{ + // Explicitly call the destructor of the output CDR first. They need + // the allocators during destruction. + delete this->output_; + + // Then call the destructor of our allocators + if (this->cdr_dblock_alloc_ != 0) + this->cdr_dblock_alloc_->remove (); + // delete this->cdr_dblock_alloc_; + + if (this->cdr_buffer_alloc_ != 0) + this->cdr_buffer_alloc_->remove (); + // delete this->cdr_buffer_alloc_; +} + + ACE_INLINE int TAO_GIOP_Message_Lite::parse_header (TAO_GIOP_Message_State *state) { diff --git a/TAO/tao/GIOP_Server_Request.h b/TAO/tao/GIOP_Server_Request.h index bf0e97f042f..05880288251 100644 --- a/TAO/tao/GIOP_Server_Request.h +++ b/TAO/tao/GIOP_Server_Request.h @@ -32,6 +32,7 @@ #include "tao/ORB.h" #include "tao/Principal.h" #include "tao/GIOP_Message_Base.h" +#include "tao/GIOPC.h" class TAO_Export TAO_GIOP_ServerRequest : public CORBA_ServerRequest { @@ -175,10 +176,12 @@ public: void requesting_principal (CORBA_Principal_ptr principal); // set the requesting principal + + IOP::TaggedProfile &tagged_profile (void); + // get the tagged_profile - void header_length (size_t len); - - void message_size_offset (size_t len); + GIOP::IORAddressingInfo &addressing_info (void); + // get the addressing info private: TAO_Pluggable_Messaging *mesg_base_; @@ -238,6 +241,16 @@ private: TAO_ObjectKey object_key_; // The object key of the destination object. + + IOP::TaggedProfile profile_; + // The Tagged profile. This class would have the Tagged Profile + + GIOP::IORAddressingInfo addr_info_; + // The addressing info + + // The above two declarations are not used in TAO as on date. It is + // here so that we can use this anyday. The object_key extracted + // from these would still be available in <object_key_>. CORBA::Principal_var requesting_principal_; // Identifies the requester diff --git a/TAO/tao/GIOP_Server_Request.i b/TAO/tao/GIOP_Server_Request.i index c52b5d333a1..6d9efed18b0 100644 --- a/TAO/tao/GIOP_Server_Request.i +++ b/TAO/tao/GIOP_Server_Request.i @@ -137,14 +137,14 @@ TAO_GIOP_ServerRequest::requesting_principal (CORBA_Principal_ptr this->requesting_principal_ = principal; } -//ACE_INLINE void -//TAO_GIOP_ServerRequest::header_length (size_t len) -//{ -// this->header_len_ = len; -//} -// -//ACE_INLINE void -//TAO_GIOP_ServerRequest::message_size_offset (size_t len) -//{ -// this->message_size_offset_ = len; -//} +ACE_INLINE IOP::TaggedProfile & +TAO_GIOP_ServerRequest::tagged_profile (void) +{ + return this->profile_; +} + +ACE_INLINE GIOP::IORAddressingInfo & +TAO_GIOP_ServerRequest::addressing_info (void) +{ + return this->addr_info_; +} diff --git a/TAO/tao/GIOP_Utils.h b/TAO/tao/GIOP_Utils.h index a75dd09ad99..a41326e2722 100644 --- a/TAO/tao/GIOP_Utils.h +++ b/TAO/tao/GIOP_Utils.h @@ -24,8 +24,9 @@ #include "tao/Pluggable_Messaging.h" #include "tao/Object.h" -// @@ Bala: i believe we still have a guideline to use #pragma once on -// platforms that support it... +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ typedef enum GIOP_Messages { @@ -56,11 +57,7 @@ typedef enum GIOP_LocateStatusType TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE //GIOP 1.2 }TAO_GIOP_Locate_Status_Type; -// @@ Bala: what about the TAO_Export? If a user tries to plug a -// protocol on NT and need this class for something he would not be -// able to use it without the export macro. - -class TAO_GIOP_Locate_Status_Msg +class TAO_Export TAO_GIOP_Locate_Status_Msg { // =TITLE // Hold the relevant information for every type of Locate mesg. @@ -104,9 +101,8 @@ typedef enum GIOP_ReplyStatusType } TAO_GIOP_Reply_Status_Type; -// @@ Bala: more missing TAO_Export macros. -class TAO_GIOP_ReplyHeader +class TAO_Export TAO_GIOP_ReplyHeader { // = TITLE // This class embodies the header of a GIOP reply. diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 186e1af7b5b..bdb402e7d2b 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -139,6 +139,7 @@ TAO_IIOP_Client_Transport:: TAO_IIOP_Client_Transport::~TAO_IIOP_Client_Transport (void) { + delete this->client_mesg_factory_; } @@ -339,9 +340,14 @@ TAO_IIOP_Client_Transport::messaging_init (CORBA::Octet major, 0); break; case 1: - ACE_NEW_RETURN (this->client_mesg_factory_, - TAO_GIOP_Message_Connector_11, - 0); + ACE_NEW_RETURN (this->client_mesg_factory_, + TAO_GIOP_Message_Connector_11, + 0); + break; + case 2: + ACE_NEW_RETURN (this->client_mesg_factory_, + TAO_GIOP_Message_Connector_12, + 0); break; default: if (TAO_debug_level > 0) diff --git a/TAO/tao/SHMIOP_Transport.cpp b/TAO/tao/SHMIOP_Transport.cpp index a346fa5fe74..a193bfb9d52 100644 --- a/TAO/tao/SHMIOP_Transport.cpp +++ b/TAO/tao/SHMIOP_Transport.cpp @@ -136,6 +136,7 @@ TAO_SHMIOP_Client_Transport:: TAO_SHMIOP_Client_Transport::~TAO_SHMIOP_Client_Transport (void) { + delete this->client_mesg_factory_; } TAO_SHMIOP_Client_Connection_Handler * @@ -333,10 +334,15 @@ TAO_SHMIOP_Client_Transport::messaging_init (CORBA::Octet major, 0); break; case 1: - ACE_NEW_RETURN (this->client_mesg_factory_, + ACE_NEW_RETURN (this->client_mesg_factory_, TAO_GIOP_Message_Connector_11, 0); - break; + break; + case 2: + ACE_NEW_RETURN (this->client_mesg_factory_, + TAO_GIOP_Message_Connector_12, + 0); + break; default: if (TAO_debug_level > 0) { diff --git a/TAO/tao/UIOP_Transport.cpp b/TAO/tao/UIOP_Transport.cpp index 5dd43f1a86c..3ebcb3165fa 100644 --- a/TAO/tao/UIOP_Transport.cpp +++ b/TAO/tao/UIOP_Transport.cpp @@ -346,10 +346,15 @@ TAO_UIOP_Client_Transport:: 0); break; case 1: - ACE_NEW_RETURN (this->client_mesg_factory_, - TAO_GIOP_Message_Connector_11, - 0); - break; + ACE_NEW_RETURN (this->client_mesg_factory_, + TAO_GIOP_Message_Connector_11, + 0); + break; + case 2: + ACE_NEW_RETURN (this->client_mesg_factory_, + TAO_GIOP_Message_Connector_12, + 0); + break; default: if (TAO_debug_level > 0) { |