diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-28 22:43:20 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-28 22:43:20 +0000 |
commit | e1b666104644efa60ed55f2ac958a4952be6c476 (patch) | |
tree | 18d9f03ec6062b921772aa343ae57048c5d111f6 | |
parent | 1e7a4df912f4a2b11baf43ae3f10889bd1c872d6 (diff) | |
download | ATCD-e1b666104644efa60ed55f2ac958a4952be6c476.tar.gz |
ChangeLogTag:Tue Mar 28 14:40:54 2000 Carlos O'Ryan <coryan@uci.edu>
34 files changed, 649 insertions, 448 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 1c13e9513f5..ce695eff59d 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,40 @@ +Tue Mar 28 14:40:54 2000 Carlos O'Ryan <coryan@uci.edu> + + * tao/GIOP_Message_Accept_State.h: + * tao/GIOP_Message_Accept_State.i: + * tao/GIOP_Message_Accept_State.cpp: + * tao/GIOP_Message_Acceptors.h: + * tao/GIOP_Message_Acceptors.i: + * tao/GIOP_Message_Acceptors.cpp: + * tao/GIOP_Message_Base.h: + * tao/GIOP_Message_Base.i: + * tao/GIOP_Message_Base.cpp: + * tao/GIOP_Message_Connectors.h: + * tao/GIOP_Message_Connectors.i: + * tao/GIOP_Message_Connectors.cpp: + * tao/GIOP_Message_Headers.h: + * tao/GIOP_Message_Headers.i: + * tao/GIOP_Message_Headers.cpp: + * tao/GIOP_Message_Lite.h: + * tao/GIOP_Message_Lite.i: + * tao/GIOP_Message_Lite.cpp: + * tao/GIOP_Message_State.h: + * tao/GIOP_Message_State.i: + * tao/GIOP_Message_State.cpp: + * tao/GIOP_Server_Request.h: + * tao/GIOP_Server_Request.i: + * tao/GIOP_Server_Request.cpp: + * tao/GIOP_Utils.h: + * tao/GIOP_Utils.cpp: + * tao/Pluggable_Messaging.h: + * tao/Pluggable_Messaging.i: + * tao/Pluggable_Messaging.cpp: + * tao/Pluggable_Messaging_Utils.h: + * tao/target_specification.h: + * tao/target_specification.i: + * tao/target_specification.cpp: + Another pass making a code review for Bala. + Tue Mar 28 14:29:05 2000 Jeff Parsons <parsons@cs.wustl.edu> * TAO_IDL/be/be_visitor_exception/any_op_cs.cpp: diff --git a/TAO/tao/GIOP_Message_Accept_State.cpp b/TAO/tao/GIOP_Message_Accept_State.cpp index 5a86b13603d..5345a6c414a 100644 --- a/TAO/tao/GIOP_Message_Accept_State.cpp +++ b/TAO/tao/GIOP_Message_Accept_State.cpp @@ -6,14 +6,14 @@ #include "tao/GIOP_Server_Request.h" #include "tao/GIOP_Utils.h" -ACE_RCSID(tao, GIOP_Message_Accept_State, "$Id$") +ACE_RCSID(tao, GIOP_Message_Accept_State, "$Id$") #if !defined (__ACE_INLINE__) # include "tao/GIOP_Message_Accept_State.i" #endif /* __ACE_INLINE__ */ //////////////////////////////////////////////////////////////////////////////// -// TAO_GIOP_Message_Accept_State_11 methods +// TAO_GIOP_Message_Accept_State_11 methods //////////////////////////////////////////////////////////////////////////////// int TAO_GIOP_Message_Accept_State_10:: @@ -30,23 +30,23 @@ TAO_GIOP_Message_Accept_State_10:: // Get the input CDR in the request class TAO_InputCDR& input = request.incoming (); - + IOP::ServiceContextList service_info; input >> service_info; - + // This method is going to a copy?? Data copy?? Need to figure out a - // way to avoid this + // way to avoid this request.service_info (service_info); - - + + CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit (); - CORBA::ULong req_id; + CORBA::ULong req_id; // Get the rest of the request header ... hdr_status = hdr_status && input.read_ulong (req_id); - + request.request_id (req_id); - + CORBA::Octet response_flags; hdr_status = hdr_status && input.read_octet (response_flags); request.response_expected ((response_flags != 0)); @@ -100,23 +100,23 @@ TAO_GIOP_Message_Accept_State_10:: operation_name.set (tmp._retn (), 1); request.operation (operation_name); } - + if (hdr_status) { CORBA::Principal_var principal; - + // Beware extra data copying input >> principal.out (); request.requesting_principal (principal.in ()); - + hdr_status = (CORBA::Boolean) input.good_bit (); } // Set the header length info and offset info // request.header_length (this->header_length ()); // request.message_size_offset (this->offset_length ()); - + return hdr_status ? 0 : -1; } @@ -143,23 +143,23 @@ int TAO_GIOP_Message_Accept_State_10:: parse_locate_header (TAO_GIOP_Locate_Request_Header &request) { - // Get the stream + // Get the stream TAO_InputCDR &msg = request.incoming_stream (); CORBA::Boolean hdr_status = 1; - + // Get the request id CORBA::ULong req_id = 0; hdr_status = msg.read_ulong (req_id); - + // 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 (); @@ -175,10 +175,10 @@ 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 + // Make the header for the locate request output.write_ulong (request_id); output.write_ulong (status_info.status); - + if (status_info.status == TAO_GIOP_OBJECT_FORWARD) { CORBA::Object_ptr object_ptr = status_info.forward_location_var.in (); @@ -188,9 +188,9 @@ write_locate_reply_mesg (TAO_OutputCDR &output, ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("TAO (%P|%t|%N|%l) write_locate_reply_mesg-") ASYS_TEXT (" cannot marshal object reference\n"))); - } + } } - + return 1; } @@ -216,4 +216,3 @@ TAO_GIOP_Message_Accept_State_11::minor_version (void) { return 1; } - diff --git a/TAO/tao/GIOP_Message_Accept_State.h b/TAO/tao/GIOP_Message_Accept_State.h index 49d7d71ead3..fdbfe44ff24 100644 --- a/TAO/tao/GIOP_Message_Accept_State.h +++ b/TAO/tao/GIOP_Message_Accept_State.h @@ -9,7 +9,7 @@ // GIOP_Message_Acceptors.h // // = DESCRIPTION -// Interface for the different accept states +// Interface for the different accept states // // = AUTHOR // Balachandran Natarajan <bala@cs.wustl.edu> @@ -34,6 +34,10 @@ // alone. Moreover, most of the protocols like HTTP-NG, HTTP have // this server/client differentiation in their basic // framework. Please let me know if I am wrong. +// @@ OK, but then name the classes properly, 'FooServer' is better +// @@ than 'FooAcceptor' because Acceptor is what we reserve for +// @@ accepting connections, and Connector for establishing +// @@ connections. // Please think about designs that do not require separate state // objects, a good side effect: that should reduce code size... @@ -51,27 +55,27 @@ class TAO_GIOP_Message_Accept_State // Strategy to determine which version of the GIOP request have we // received. This is to aid the server in replying back to the // client in the same version as that of the received request. - // + // public: virtual int parse_request_header (TAO_GIOP_ServerRequest &) = 0; // Parse the Request Header from the incoming stream. This will do a // version specific parsing of the incoming Request header - + virtual CORBA::Boolean write_reply_header (TAO_OutputCDR &output, CORBA::ULong request_id) = 0; // Write the reply header in to <output> - virtual int parse_locate_header (TAO_GIOP_Locate_Request_Header &) = 0; + virtual int parse_locate_header (TAO_GIOP_Locate_Request_Header &) = 0; // Parse the Loacte Request Header from the incoming stream. This will do a // version specific parsing of the incoming Request header - - virtual CORBA::Boolean + + virtual CORBA::Boolean write_locate_reply_mesg (TAO_OutputCDR &output, CORBA::ULong request_id, TAO_GIOP_Locate_Status_Msg &status) = 0; // Writes the locate _reply message in to the <output> - + virtual CORBA::Octet major_version (void) = 0; virtual CORBA::Octet minor_version (void) = 0; // Our versions @@ -80,20 +84,29 @@ public: }; -/*****************************************************************/ +/*****************************************************************/ // @@ Bala: a physical design issue: if the protocol is truly // pluggable then you should be able to (and you should) put the // classes for each protocol in separate files. // @@ Carlos: Only GIOP/GIOPlite is pluggable and not the // implementation details I think. Does that answer your question? - +// @@ I don't think so, are GIOP 1.0, GIOP 1.1, and GIOP 1.2 to be +// different pluggable protocols? If so they should be in separate +// files. Same deal to GIOPlite. You may even have to put the +// shared implementation details in yet another file. The mindset is: +// Can i create a completely separate library for each protocol and +// then just add it to TAO? Can TAO compile without the pluggable +// protocol (except for a couple of lines where the default protocol +// 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 { // = TITLE // TAO_GIOP_Message_Accept_State_10 // = DESCRIPTION - // - + // + public: virtual int parse_request_header (TAO_GIOP_ServerRequest &); // Parse the Request Header from the incoming stream. This will do a @@ -103,23 +116,23 @@ public: virtual CORBA::Boolean write_reply_header (TAO_OutputCDR &output, CORBA::ULong request_id); // Write the version specific reply header in to <output> - + virtual int parse_locate_header (TAO_GIOP_Locate_Request_Header &); // Parse the Loacte Request Header from the incoming stream. This will do a // version specific parsing of the incoming Request header - - virtual CORBA::Boolean + + virtual CORBA::Boolean write_locate_reply_mesg (TAO_OutputCDR &output, CORBA::ULong request_id, TAO_GIOP_Locate_Status_Msg &status); // Writes the locate reply message in to <output> - + virtual CORBA::Octet major_version (void); virtual CORBA::Octet minor_version (void); // Our versions }; -/*****************************************************************/ +/*****************************************************************/ class TAO_GIOP_Message_Accept_State_11: public TAO_GIOP_Message_Accept_State_10 { // = TITLE @@ -129,7 +142,7 @@ public: virtual CORBA::Octet minor_version (void); }; -/*****************************************************************/ +/*****************************************************************/ class TAO_GIOP_Message_Accept_Impl { diff --git a/TAO/tao/GIOP_Message_Accept_State.i b/TAO/tao/GIOP_Message_Accept_State.i index 2832903be82..4e4cdc36938 100644 --- a/TAO/tao/GIOP_Message_Accept_State.i +++ b/TAO/tao/GIOP_Message_Accept_State.i @@ -5,16 +5,19 @@ /////////////////////////////////////////////////////////////// // TAO_GIOP_Message_Accept_Impl methods ////////////////////////////////////////////////////////////// - + ACE_INLINE CORBA::Boolean TAO_GIOP_Message_Accept_Impl::check_revision (CORBA::Octet incoming_major, CORBA::Octet incoming_minor) { // Need a better way to do this. @@Bala + // @@ Bala: could you be more precise? What needs to be better? + // @@ 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) return 0; return 1; } - diff --git a/TAO/tao/GIOP_Message_Acceptors.cpp b/TAO/tao/GIOP_Message_Acceptors.cpp index 4f57b631f39..5bb82a47604 100644 --- a/TAO/tao/GIOP_Message_Acceptors.cpp +++ b/TAO/tao/GIOP_Message_Acceptors.cpp @@ -13,9 +13,9 @@ ACE_RCSID(tao, GIOP_Message_Acceptors, "$Id$") -int +int TAO_GIOP_Message_Acceptors:: - process_client_message (TAO_Transport *transport, + process_client_message (TAO_Transport *transport, TAO_ORB_Core *orb_core, TAO_InputCDR &input, CORBA::Octet message_type) @@ -43,7 +43,7 @@ TAO_GIOP_Message_Acceptors:: default: if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("TAO (%P|%t) Illegal message received by server\n"))); + ASYS_TEXT ("TAO (%P|%t) Illegal message received by server\n"))); return this->send_error (transport); } @@ -52,7 +52,7 @@ TAO_GIOP_Message_Acceptors:: int TAO_GIOP_Message_Acceptors:: - process_client_request (TAO_Transport *transport, + process_client_request (TAO_Transport *transport, TAO_ORB_Core* orb_core, TAO_InputCDR &input) { @@ -60,8 +60,8 @@ TAO_GIOP_Message_Acceptors:: TAO_GIOP_Version version (this->major_version (), this->minor_version ()); - - + + // This will extract the request header, set <response_required> // and <sync_with_server> as appropriate. TAO_GIOP_ServerRequest request (this, @@ -69,9 +69,9 @@ TAO_GIOP_Message_Acceptors:: this->output_, orb_core, version); - + CORBA::Environment &ACE_TRY_ENV = TAO_default_environment (); - + CORBA::ULong request_id = 0; CORBA::Boolean response_required = 0; CORBA::Boolean sync_with_server = 0; @@ -80,10 +80,10 @@ TAO_GIOP_Message_Acceptors:: ACE_TRY { - parse_error = + parse_error = this->accept_state_->parse_request_header (request); - - // Throw an exception if the + + // Throw an exception if the if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO)); @@ -91,11 +91,11 @@ TAO_GIOP_Message_Acceptors:: response_required = request.response_expected (); sync_with_server = request.sync_with_server (); - + #if (TAO_NO_IOR_TABLE == 0) const CORBA::Octet *object_key = request.object_key ().get_buffer (); - + if (ACE_OS::memcmp (object_key, &TAO_POA::objectkey_prefix[0], TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) @@ -105,7 +105,7 @@ TAO_GIOP_Message_Acceptors:: request.object_key ().length (), 0, 0); - + // @@ This debugging output should *NOT* be used since the // object key string is not null terminated, nor can it // be null terminated without copying. No copying should @@ -129,21 +129,21 @@ TAO_GIOP_Message_Acceptors:: // If ObjectID not in table or reference is nil raise // OBJECT_NOT_EXIST. - + if (status == -1 || CORBA::is_nil (object_reference.in ())) ACE_TRY_THROW (CORBA::OBJECT_NOT_EXIST ()); - + // ObjectID present in the table with an associated NON-NULL // reference. Throw a forward request exception. /*CORBA::Object_ptr dup = CORBA::Object::_duplicate (object_reference);*/ - + // @@ We could simply write the response at this point... ACE_TRY_THROW (PortableServer::ForwardRequest (object_reference.in ())); } #endif /* TAO_NO_IOR_TABLE */ - + // Do this before the reply is sent. orb_core->object_adapter ()->dispatch_servant ( request.object_key (), @@ -158,9 +158,9 @@ TAO_GIOP_Message_Acceptors:: ACE_CATCH (PortableServer::ForwardRequest, forward_request) { // Make the GIOP header and Reply header - this->make_reply (request_id, + this->make_reply (request_id, this->output_); - + this->output_.write_ulong (TAO_GIOP_LOCATION_FORWARD); CORBA::Object_ptr object_ptr = @@ -267,9 +267,9 @@ TAO_GIOP_Message_Acceptors:: if ((response_required && !sync_with_server) || (sync_with_server && location_forward)) { - result = this->send_message (transport, + result = this->send_message (transport, this->output_); - + if (result == -1) { if (TAO_debug_level > 0) @@ -295,7 +295,7 @@ TAO_GIOP_Message_Acceptors:: // Get the revision info TAO_GIOP_Version version (this->major_version (), this->minor_version ()); - + // This will extract the request header, set <response_required> as // appropriate. TAO_GIOP_Locate_Request_Header locate_request (input); @@ -310,7 +310,7 @@ TAO_GIOP_Message_Acceptors:: ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - int parse_error = + int parse_error = this->accept_state_->parse_locate_header (locate_request); if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, @@ -319,14 +319,14 @@ TAO_GIOP_Message_Acceptors:: const CORBA::Octet *object_key = locate_request.target_address ().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 = + CORBA::ULong len = locate_request.target_address ().object_key ().length (); - + ACE_CString object_id (ACE_reinterpret_cast (const char *, object_key), len, @@ -335,7 +335,7 @@ TAO_GIOP_Message_Acceptors:: if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("Simple Object key %s. Doing the Table Lookup ...\n"), + ASYS_TEXT ("Simple Object key %s. Doing the Table Lookup ...\n"), object_id.c_str ())); CORBA::Object_ptr object_reference; @@ -379,7 +379,7 @@ TAO_GIOP_Message_Acceptors:: // Set it to an error state parse_error = 1; CORBA::ULong req_id = locate_request.request_id (); - + TAO_GIOP_ServerRequest server_request (this, req_id, response_required, @@ -392,9 +392,9 @@ TAO_GIOP_Message_Acceptors:: if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO)); - + orb_core->object_adapter ()->dispatch_servant - (server_request.object_key (), + (server_request.object_key (), server_request, transport, 0, @@ -492,11 +492,11 @@ TAO_GIOP_Message_Acceptors:: // Make the GIOP & reply header. They are version specific. this->make_reply (request_id, output); - + // A new try/catch block, but if something goes wrong now we have no // hope, just abort. ACE_DECLARE_NEW_CORBA_ENV; - + ACE_TRY { // Write the exception @@ -510,13 +510,13 @@ TAO_GIOP_Message_Acceptors:: // write the reply_status output.write_ulong - (TAO_GIOP_Utils::convert_CORBA_to_GIOP_exception (extype)); + (TAO_GIOP_Utils::convert_CORBA_to_GIOP_exception (extype)); // @@ Any way to implement this without interpretive // marshaling??? x->_tao_encode (output, ACE_TRY_ENV); ACE_TRY_CHECK; - + /*output.encode (except_tc, x, 0, @@ -558,10 +558,10 @@ int TAO_GIOP_Message_Acceptors:: validate_version (TAO_GIOP_Message_State *state) { - char *buf = state->cdr.rd_ptr (); - CORBA::Octet incoming_major = + char *buf = state->cdr.rd_ptr (); + CORBA::Octet incoming_major = buf[TAO_GIOP_VERSION_MAJOR_OFFSET]; - CORBA::Octet incoming_minor = + CORBA::Octet incoming_minor = buf[TAO_GIOP_VERSION_MINOR_OFFSET]; if (this->implementations_.check_revision (incoming_major, @@ -582,7 +582,7 @@ TAO_GIOP_Message_Acceptors:: // Sets the state this->set_state (incoming_major, incoming_minor); - + return 0; } @@ -593,10 +593,10 @@ TAO_GIOP_Message_Acceptors:: TAO_GIOP_Locate_Status_Msg &status_info) { // Note here we are making the Locate reply header which is *QUITE* - // different from the reply header made by the make_reply () call.. + // different from the reply header made by the make_reply () call.. // Make the GIOP message header this->write_protocol_header (TAO_PLUGGABLE_MESSAGE_LOCATEREPLY, - this->output_); + this->output_); // This writes the header & body this->accept_state_->write_locate_reply_mesg (this->output_, @@ -606,7 +606,7 @@ TAO_GIOP_Message_Acceptors:: // Send the message int result = this->send_message (transport, this->output_); - + // Print out message if there is an error if (result == -1) { @@ -616,13 +616,13 @@ TAO_GIOP_Message_Acceptors:: ASYS_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"), ASYS_TEXT ("TAO_GIOP::process_server_message"))); } - } - + } + return result; } //////////////////////////////////////////////////////////// -// Methods that should not be called from the acceptor side +// Methods that should not be called from the acceptor side //////////////////////////////////////////////////////////// CORBA::Boolean @@ -635,7 +635,7 @@ write_request_header (const TAO_Operation_Details & /**/, } CORBA::Boolean -TAO_GIOP_Message_Acceptors:: +TAO_GIOP_Message_Acceptors:: write_locate_request_header (CORBA::ULong /*request_id*/, TAO_Target_Specification & /*spec*/, TAO_OutputCDR & /*msg*/) diff --git a/TAO/tao/GIOP_Message_Acceptors.h b/TAO/tao/GIOP_Message_Acceptors.h index cecf90ffc27..5624a76d017 100644 --- a/TAO/tao/GIOP_Message_Acceptors.h +++ b/TAO/tao/GIOP_Message_Acceptors.h @@ -10,7 +10,7 @@ // GIOP_Message_Acceptors.h // // = DESCRIPTION -// Implementation interface for the Server side of GIOP classes. +// Implementation interface for the Server side of GIOP classes. // // = AUTHOR // Balachandran Natarajan <bala@cs.wustl.edu> @@ -25,6 +25,10 @@ #include "tao/GIOP_Message_Accept_State.h" #include "tao/ORB_Core.h" +// @@ Bala: Again, it is not clear what this class has to do with +// @@ acceptors, it looks more like message parsing for the server +// @@ side (a distinction that will be blurred with bi-directional +// @@ connections). class TAO_Export TAO_GIOP_Message_Acceptors: public TAO_GIOP_Message_Base { @@ -32,8 +36,8 @@ class TAO_Export TAO_GIOP_Message_Acceptors: public TAO_GIOP_Message_Base // TAO_GIOP_Message_Acceptors // = DESCRIPTION // This class provides a comprehensive set of interfaces for the - // server side of the GIOP classes. - + // server side of the GIOP classes. + public: TAO_GIOP_Message_Acceptors (TAO_ORB_Core *orb_core); @@ -48,11 +52,11 @@ public: CORBA::Octet message_type); // Processes the messages from the connectors so that they can be // passed on to the appropriate states. - + int parse_reply (TAO_Message_State_Factory &mesg_state, TAO_Pluggable_Reply_Params ¶ms); private: - + int process_client_request (TAO_Transport *transport, TAO_ORB_Core* orb_core, TAO_InputCDR &input); @@ -76,19 +80,19 @@ private: CORBA::Octet major_version (void); CORBA::Octet minor_version (void); - + CORBA::Boolean make_reply (CORBA::ULong request_id, TAO_OutputCDR &output); // This would prepare a version specific reply to the // messages from the client. The type of reply would be context // sensitive. Only the common stuff for all the replies to be // sent would be handled. - + int make_send_locate_reply (TAO_Transport *transport, TAO_GIOP_Locate_Request_Header &request, TAO_GIOP_Locate_Status_Msg &status); // As on date 1.1 & 1.2 seem to have similar headers. Til an - // unmanageable difference comes let them be implemented here. + // unmanageable difference comes let them be implemented here. int send_reply_exception (TAO_Transport *transport, TAO_ORB_Core* orb_core, @@ -96,21 +100,21 @@ private: CORBA::Exception *x); // We must send a LocateReply through <transport>, this request // resulted in some kind of exception. - + int validate_version (TAO_GIOP_Message_State *state); - + void set_state (CORBA::Octet def_major, CORBA::Octet def_minor); - + TAO_GIOP_Message_Accept_State *accept_state_; // This indicates the strategy that we are using for this request - + TAO_GIOP_Message_Accept_Impl implementations_; // Different strategies that we know - + TAO_OutputCDR output_; // The output CDR stream - + char repbuf_[ACE_CDR::DEFAULT_BUFSIZE]; // A buffer that we will use to initialise the CDR stream @@ -118,14 +122,14 @@ private: // Remember that the same connection could receive multiple // requests concurrently. Currently the ORB cannot do this, but we // want to do it in the future.... - + // The above will not work for the case that Carlos mentions, but // till then we can have it here. This gets us better performance. - + //////////////////////////////////////////////////// - // Inherited methods. Should not be here in the first place? + // Inherited methods. Should not be here in the first place? //////////////////////////////////////////////////// - CORBA::Boolean + CORBA::Boolean write_request_header (const TAO_Operation_Details &opdetails, TAO_Target_Specification &spec, TAO_OutputCDR &msg); diff --git a/TAO/tao/GIOP_Message_Acceptors.i b/TAO/tao/GIOP_Message_Acceptors.i index d8ab0a7dfae..7c07af5c7c2 100644 --- a/TAO/tao/GIOP_Message_Acceptors.i +++ b/TAO/tao/GIOP_Message_Acceptors.i @@ -13,7 +13,7 @@ TAO_GIOP_Message_Acceptors:: orb_core->orb_params ()->cdr_memcpy_tradeoff (), orb_core->to_iso8859 (), orb_core->to_unicode ()) - + { #if defined(ACE_HAS_PURIFY) (void) ACE_OS::memset (this->repbuf_, @@ -27,6 +27,9 @@ ACE_INLINE TAO_GIOP_Message_Acceptors:: ~TAO_GIOP_Message_Acceptors (void) { + // @@ Bala: i'm not sure why is this needed, it may even be my code, + // but that does not explain why the destructor of output_ isn't + // enough, we need a comment here or to zap this line... this->output_.reset (); } @@ -43,9 +46,9 @@ TAO_GIOP_Message_Acceptors:: // Write the reply header this->accept_state_->write_reply_header (output, request_id); - + return 0; - + } @@ -57,6 +60,20 @@ set_state (CORBA::Octet def_major, CORBA::Octet def_minor) { // @@Bala Need to find a better way + // @@ Bala: what about a table: + // Accept_State implementations[] = { + // Version_10, + // Version_11 + // }; + // this->accept_state_ = &implementations[def_minor]; + // @@ of course it requires range checking and the array must be in + // some place where it is not detroyed too soon... + // @@ I'm not sure if this implementations should be dynamically + // loaded. + // @@ BTW, this function is (IMHO) too big to be inlined, but that + // is a matter of personal opinion, and what your experience with + // busted compilers is... + // switch (def_major) { case 1: @@ -76,6 +93,3 @@ set_state (CORBA::Octet def_major, break; } } - - - diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index 65cbbe4a435..781b936ff69 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -1,39 +1,4 @@ //$Id$ -// @(#)giop.cpp 1.10 95/09/21 -// Copyright 1994-1995 by Sun Microsystems Inc. -// All Rights Reserved -// -// -// Note that the Internet IOP is just the TCP-specific mapping of the -// General IOP. Areas where other protocols may map differently -// include use of record streams (TCP has none), orderly disconnect -// (TCP has it), endpoint addressing (TCP uses host + port), security -// (Internet security should be leveraged by IIOP) and more. -// -// NOTE: There are a few places where this code knows that it's really -// talking IIOP instead of GIOP. No rush to fix this so long as we -// are really not running atop multiple connection protocols. -// -// THREADING NOTE: currently, the connection manager eliminates tricky -// threading issues by providing this code with the same programming -// model both in threaded and unthreaded environments. Since the GIOP -// APIs were all designed to be reentrant, this makes threading rather -// simple! -// -// That threading model is that the thread making (or handling) a call -// is given exclusive access to a connection for the duration of a -// call, so that no multiplexing or demultiplexing is needed. That -// is, locking is at the "connection level" rather than "message -// level". -// The down side of this simple threading model is that utilization of -// system resources (mostly connections, but to some extent network -// I/O) in some kinds of environments can be inefficient. However, -// simpler threading models are much easier to get properly debugged, -// and often perform better. Also, such environments haven't been -// seen to be any kind of problem; the model can be changed later if -// needed, it's just an internal implementation detail. Any portable -// ORB client is not allowed to rely on semantic implications of such -// a model. #include "tao/GIOP_Message_Base.h" #include "tao/operation_details.h" @@ -49,12 +14,12 @@ ACE_RCSID(tao, GIOP_Message_Base, "$Id$") TAO_GIOP_Message_Base::TAO_GIOP_Message_Base (void) { - + } TAO_GIOP_Message_Base::~TAO_GIOP_Message_Base (void) { - + } CORBA::Boolean @@ -77,7 +42,7 @@ TAO_GIOP_Message_Base:: // mask the GIOP specificness of the incoming parameter type. Let me // know what you feel. - // First convert the Pluggable type to the GIOP specific type. + // First convert the Pluggable type to the GIOP specific type. switch (t) { case (TAO_PLUGGABLE_MESSAGE_REQUEST): @@ -121,13 +86,13 @@ TAO_GIOP_Message_Base:: msg.write_octet_array (magic, magic_size); msg.write_octet (this->major_version ()); msg.write_octet (this->minor_version ()); - + // We are putting the byte order. But at a later date if we support // fragmentation and when we want to use the other 6 bits in this // octet we can have a virtual function do this for us as the // version info , Bala msg.write_octet (TAO_ENCAP_BYTE_ORDER); - + msg.write_octet ((CORBA::Octet) type); // Write a dummy <size> later it is set to the right value... @@ -148,9 +113,14 @@ TAO_GIOP_Message_Base:: // @@ Bala: Why not do this right, the application should call the // methods below directly! // @@Carlos: The idea was that the application (or the user of this - // method) shouldn't know what is being done. + // method) shouldn't know what is being done. // An afterthought, please see my comments in the file - // Pluggable_Messaging.h + // Pluggable_Messaging.h + // @@ Bala: I think we agree by know that the application knows very + // well if it is creating a request or a locate request, and that + // using an enum for that, instead of calling an operation is just + // more obscure.... Of course, the final implementation can share + // code in some private method that takes the enum as an argument. switch (header_type) { case TAO_PLUGGABLE_MESSAGE_REQUEST_HEADER: @@ -166,13 +136,13 @@ TAO_GIOP_Message_Base:: ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t|%N|%l) Wrong header type \n")), 0); - + } - + return 1; } - + int TAO_GIOP_Message_Base::send_message (TAO_Transport *transport, TAO_OutputCDR &stream, @@ -199,7 +169,7 @@ TAO_GIOP_Message_Base::send_message (TAO_Transport *transport, // encrypt messages (or just the message bodies) if that's needed in // this particular environment and that isn't handled by the // networking infrastructure (e.g., IPSEC). - + CORBA::ULong bodylen = total_len - header_len; #if !defined (ACE_ENABLE_SWAP_ON_WRITE) @@ -241,10 +211,10 @@ TAO_GIOP_Message_Base:: TAO_GIOP_Message_State *state = ACE_dynamic_cast (TAO_GIOP_Message_State *, &mesg_state); - + if (state->header_received () == 0) { - int retval = + int retval = TAO_GIOP_Utils::read_bytes_input (transport, state->cdr, TAO_GIOP_MESSAGE_HEADER_LEN , @@ -256,8 +226,8 @@ TAO_GIOP_Message_Base:: ASYS_TEXT ("TAO_GIOP_Message_Base::handle_input"))); return -1; } - - + + if (this->parse_magic_bytes (state) == -1) { if (TAO_debug_level > 0) @@ -266,7 +236,7 @@ TAO_GIOP_Message_Base:: ASYS_TEXT ("TAO_GIOP_Message_Base::handle_input, parse_magic_bytes \n"))); return -1; } - + // Read the rest of the stuff. That should be read by the // corresponding states if (this->parse_header (state) == -1) @@ -277,7 +247,7 @@ TAO_GIOP_Message_Base:: ASYS_TEXT ("TAO_GIOP_Message_Base::handle_input \n"))); return -1; } - + if (state->cdr.grow (TAO_GIOP_MESSAGE_HEADER_LEN + state->message_size) == -1) { @@ -287,7 +257,7 @@ TAO_GIOP_Message_Base:: ASYS_TEXT ("ACE_CDR::grow"))); return -1; } - + // Growing the buffer may have reset the rd_ptr(), but we want // to leave it just after the GIOP header (that was parsed // already); @@ -296,7 +266,7 @@ TAO_GIOP_Message_Base:: size_t missing_data = state->message_size - state->current_offset; - + ssize_t n = TAO_GIOP_Utils::read_buffer (transport, state->cdr.rd_ptr () + state->current_offset, @@ -321,7 +291,7 @@ TAO_GIOP_Message_Base:: } state->current_offset += n; - + if (state->current_offset == state->message_size) { if (TAO_debug_level >= 4) @@ -359,7 +329,7 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, "MessageError" "Fragment" }; - + if (TAO_debug_level >= 5) { // Message name. @@ -367,14 +337,14 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, u_long slot = ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET]; if (slot < sizeof (names)/sizeof(names[0])) message_name = names [slot]; - + // Byte order. int byte_order = ptr[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & 0x01; // request/reply id. CORBA::ULong tmp = 0; CORBA::ULong *id = &tmp; - + if (ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REQUEST || ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY) { @@ -429,7 +399,7 @@ TAO_GIOP_Message_Base::send_error (TAO_Transport *transport) this->dump_msg ("send_error", (const u_char *) error_message, TAO_GIOP_MESSAGE_HEADER_LEN ); - + ACE_HANDLE which = transport->handle (); int result = transport->send ((const u_char *)error_message, @@ -441,17 +411,17 @@ TAO_GIOP_Message_Base::send_error (TAO_Transport *transport) ASYS_TEXT ("TAO (%N|%l|%P|%t) error sending error to %d\n"), which)); } - + return result; } int -TAO_GIOP_Message_Base::parse_magic_bytes (TAO_GIOP_Message_State *state) +TAO_GIOP_Message_Base::parse_magic_bytes (TAO_GIOP_Message_State *state) { // Grab the read pointer char *buf = state->cdr.rd_ptr (); - + // The values are hard-coded to support non-ASCII platforms. if (!(buf [0] == 0x47 // 'G' && buf [1] == 0x49 // 'I' @@ -461,7 +431,7 @@ TAO_GIOP_Message_Base::parse_magic_bytes (TAO_GIOP_Message_State *state) // For the present... if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("TAO (%P|%t) bad header, magic word [%c%c%c%c]\n"), + ASYS_TEXT ("TAO (%P|%t) bad header, magic word [%c%c%c%c]\n"), buf[0], buf[1], buf[2], @@ -479,7 +449,7 @@ TAO_GIOP_Message_Base::parse_magic_bytes (TAO_GIOP_Message_State *state) return -1; } } - + return 0; } @@ -536,7 +506,7 @@ TAO_GIOP_Message_Base::parse_header (TAO_GIOP_Message_State *state) if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("TAO (%P|%t) Parsed header = <%d,%d,%d,%d,%d>\n"), + ASYS_TEXT ("TAO (%P|%t) Parsed header = <%d,%d,%d,%d,%d>\n"), this->major_version (), this->minor_version (), state->byte_order, @@ -565,14 +535,14 @@ TAO_GIOP_Message_Base::parse_header (TAO_GIOP_Message_State *state) void TAO_GIOP_Message_Base:: - send_close_connection (const TAO_GIOP_Version &version, + send_close_connection (const TAO_GIOP_Version &version, TAO_Transport *transport, void *) { - + // static CORBA::Octet // I hate this in every method. Till the time I figure out a way - // around I will have them here hanging around. + // around I will have them here hanging around. const char close_message [TAO_GIOP_MESSAGE_HEADER_LEN] = { // The following works on non-ASCII platforms, such as MVS (which @@ -597,7 +567,7 @@ TAO_GIOP_Message_Base:: this->dump_msg ("send_close_connection", (const u_char *) close_message, TAO_GIOP_MESSAGE_HEADER_LEN); - + ACE_HANDLE which = transport->handle (); if (which == ACE_INVALID_HANDLE) { @@ -623,5 +593,3 @@ TAO_GIOP_Message_Base:: which)); } - - diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h index eebd18e875c..e3a74cf2af9 100644 --- a/TAO/tao/GIOP_Message_Base.h +++ b/TAO/tao/GIOP_Message_Base.h @@ -38,7 +38,7 @@ class TAO_Export TAO_GIOP_Message_Base : public TAO_Pluggable_Messaging public: TAO_GIOP_Message_Base (void); - + virtual ~TAO_GIOP_Message_Base (void); // Dtor @@ -50,8 +50,8 @@ public: TAO_ORB_Core *orb_core, TAO_Message_State_Factory &mesg_state, ACE_Time_Value *max_time_value = 0); - // Reads input from the transport - + // Reads input from the transport + virtual CORBA::Boolean write_message_header (const TAO_Operation_Details &opdetails, TAO_Pluggable_Header_Type header_type, TAO_Target_Specification &spec, @@ -64,7 +64,7 @@ public: TAO_Stub *stub = 0, int two_way = 1); // Sends the encapsulated stream in <stream> on to the transport - + virtual int parse_reply (TAO_Message_State_Factory &mesg_state, TAO_Pluggable_Reply_Params ¶ms) = 0; // Parse the reply message from the server @@ -90,10 +90,15 @@ protected: // message_type is the 8th byte in the GIOP header. If they // decide to move that to 10th byte for GIOP2.8. Just // thinking ahead, that wouldn't cost anything today. + // @@ If they change it we implement that in the GIOP_2_8 class, of + // course, and BTW, chances that a protocol will be change in such a + // non-backwards compatible way are slim... + // @@ Furthermore, why you have this methods here if they are not + // used? Do you get paid by the line of code (just kidding ;-) size_t header_len (void); // This will give the size of the header for different versions of - // GIOP. + // GIOP. size_t message_size_offset (void); // This will give the message_size offset as specified by different @@ -102,11 +107,11 @@ protected: size_t major_version_offset (void); // This will give the major_version offset as specified by different // versions of GIOP - + size_t minor_version_offset (void); // This will give the minor_version offset as specified by different // versions of GIOP - + size_t flags_offset (void); // This will give the flags offset as specified by different // versions of GIOP @@ -131,20 +136,20 @@ private: virtual CORBA::Octet major_version (void) = 0; virtual CORBA::Octet minor_version (void) = 0; // These virtual methods need will give the major and minor versions - // of the GIOP classes that are active. + // of the GIOP classes that are active. - virtual CORBA::Boolean + virtual CORBA::Boolean write_request_header (const TAO_Operation_Details &opdetails, TAO_Target_Specification &spec, TAO_OutputCDR &msg) = 0; // Write the GIOP request header in to <msg> - - virtual CORBA::Boolean + + virtual CORBA::Boolean write_locate_request_header (CORBA::ULong request_id, TAO_Target_Specification &spec, TAO_OutputCDR &msg) = 0; // Write the GIOP locate request header in to <msg> - + virtual int validate_version (TAO_GIOP_Message_State *state) = 0; // This will do a validation of the versions that arrive in the transport. @@ -160,6 +165,7 @@ private: // Close a connection, first sending GIOP::CloseConnection. }; +// @@ Bala: do you need to put this in the header file? const size_t TAO_GIOP_MESSAGE_HEADER_LEN = 12; const size_t TAO_GIOP_MESSAGE_SIZE_OFFSET = 8; const size_t TAO_GIOP_VERSION_MINOR_OFFSET = 5; @@ -173,4 +179,3 @@ const size_t TAO_GIOP_MESSAGE_TYPE_OFFSET = 7; #include "ace/post.h" #endif /*TAO_GIOP_MESSAGE_BASE_H*/ - diff --git a/TAO/tao/GIOP_Message_Base.i b/TAO/tao/GIOP_Message_Base.i index 7c84acdd5d2..45b18282a10 100644 --- a/TAO/tao/GIOP_Message_Base.i +++ b/TAO/tao/GIOP_Message_Base.i @@ -42,4 +42,3 @@ TAO_GIOP_Message_Base::message_type_offset (void) } #endif /*if 0*/ - diff --git a/TAO/tao/GIOP_Message_Connectors.cpp b/TAO/tao/GIOP_Message_Connectors.cpp index e17ff77b032..85891d5b948 100644 --- a/TAO/tao/GIOP_Message_Connectors.cpp +++ b/TAO/tao/GIOP_Message_Connectors.cpp @@ -36,14 +36,14 @@ TAO_GIOP_Message_Connectors:: // IMHO the right approach is to factor out common functionality // and interfaces 'a posteriori', otherwise we will define // ackward interfaces that will have to be changed anyway! - + // @@ Carlos: I agree. But I see a problem. Other than the transport // classes, we store state information in our Reply despatcers, // Transport Mux Strategy etc. I would only love to have the // Message States local to GIOP or say some other protocol. One // example that spoils this idea is the Mux_Strategies that we // have. I am ready to hear anything you suggest to get around - // this. + // this. // Cast to the GIOP Message state @@ -86,12 +86,12 @@ TAO_GIOP_Message_Connectors:: case TAO_GIOP_NO_EXCEPTION: params.reply_status_ = TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION; break; - + // Request terminated with user exception case TAO_GIOP_USER_EXCEPTION: params.reply_status_ = TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION; break; - // Request terminated with system exception + // Request terminated with system exception case TAO_GIOP_SYSTEM_EXCEPTION: params.reply_status_ = TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION; break; @@ -104,14 +104,14 @@ TAO_GIOP_Message_Connectors:: ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%N|%l) Unknown reply status \n"))); } - + return 0; } int TAO_GIOP_Message_Connectors::validate_version (TAO_GIOP_Message_State *state) - + { // Grab the read pointer char *buf = state->cdr.rd_ptr (); @@ -119,16 +119,16 @@ TAO_GIOP_Message_Connectors::validate_version (TAO_GIOP_Message_State *state) if ((buf[TAO_GIOP_VERSION_MAJOR_OFFSET] != this->major_version ()) || (buf[TAO_GIOP_VERSION_MINOR_OFFSET] != this->minor_version ())) return -1; - + state->giop_version.major = buf[TAO_GIOP_VERSION_MAJOR_OFFSET]; state->giop_version.minor = buf[TAO_GIOP_VERSION_MINOR_OFFSET]; - + return 0; } int TAO_GIOP_Message_Connectors:: -process_client_message (TAO_Transport * /*transport*/, +process_client_message (TAO_Transport * /*transport*/, TAO_ORB_Core * /*orb_core*/, TAO_InputCDR & /*input*/, CORBA::Octet /*message_type*/) @@ -167,13 +167,13 @@ TAO_GIOP_Message_Connector_10:: response_flags == CORBA::Octet (TAO::SYNC_DELAYED_BUFFERING)) // No response required. msg << CORBA::Any::from_octet (0); - + else if (response_flags == CORBA::Octet (TAO::SYNC_WITH_SERVER)) // Return before dispatching servant. We're also setting the high // bit here. This is a temporary fix until the rest of GIOP 1.2 is // implemented in TAO. msg << CORBA::Any::from_octet (129); - + else if (response_flags == CORBA::Octet (TAO::SYNC_WITH_TARGET)) // Return after dispatching servant. msg << CORBA::Any::from_octet (3); @@ -199,9 +199,9 @@ TAO_GIOP_Message_Connector_10:: return 0; } - msg.write_string (opdetails.opname_len (), + msg.write_string (opdetails.opname_len (), opdetails.opname ()); - + // Last element of request header is the principal; no portable way // to get it, we just pass empty principal (convention: indicates // "anybody"). Steps upward in security include passing an @@ -243,7 +243,7 @@ TAO_GIOP_Message_Connector_10:: ASYS_TEXT ("(%N | %l) Unable to handle this request \n"))); return 0; } - + return 1; } @@ -252,7 +252,7 @@ int TAO_GIOP_Message_Connector_10:: 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 *, @@ -273,7 +273,7 @@ TAO_GIOP_Message_Connector_10:: case TAO_GIOP_CLOSECONNECTION: default: ACE_ERROR_RETURN ((LM_ERROR, - ASYS_TEXT ("TAO (%P|%t) %N:%l parse_reply: ") + ASYS_TEXT ("TAO (%P|%t) %N:%l parse_reply: ") ASYS_TEXT ("wrong message.\n")), -1); case TAO_GIOP_LOCATEREPLY: @@ -294,9 +294,9 @@ TAO_GIOP_Message_Connector_10:: // Never happens: why?? break; } - + if (TAO_GIOP_Message_Connectors::parse_reply (*state, - params) + params) == -1) return -1; diff --git a/TAO/tao/GIOP_Message_Connectors.h b/TAO/tao/GIOP_Message_Connectors.h index def8d5adedd..49d30bf96f0 100644 --- a/TAO/tao/GIOP_Message_Connectors.h +++ b/TAO/tao/GIOP_Message_Connectors.h @@ -10,7 +10,7 @@ // GIOP_Message_Connectors.h // // = DESCRIPTION -// Interface for the client side of the GIOP classes +// Interface for the client side of the GIOP classes // // = AUTHOR // Balachandran Natarajan <bala@cs.wustl.edu> @@ -23,6 +23,10 @@ #include "tao/GIOP_Message_Base.h" +// @@ Bala: why are this class called "Connector" does it have +// @@ anything to do with establishing connection? It looks more like +// @@ request parsing or something like that! + class TAO_Export TAO_GIOP_Message_Connectors: public TAO_GIOP_Message_Base { // = TITLE @@ -32,15 +36,15 @@ class TAO_Export TAO_GIOP_Message_Connectors: public TAO_GIOP_Message_Base // This class provides methods and code for the connector specific // functionality of GIOP.The motivation for this class is to hold // common code between different versions of GIOP in a single - // class. - + // class. + protected: int parse_reply (TAO_Message_State_Factory &mesg_state, TAO_Pluggable_Reply_Params ¶ms); // Parse the reply message from the server private: - virtual CORBA::Boolean + virtual CORBA::Boolean write_locate_request_header (CORBA::ULong request_id, TAO_Target_Specification &spec, TAO_OutputCDR &msg) = 0; @@ -48,7 +52,7 @@ private: int validate_version (TAO_GIOP_Message_State *state); - + CORBA::Octet major_version (void) = 0; CORBA::Octet minor_version (void) = 0; // Virtual methods that will be implemented by the version specific @@ -67,7 +71,8 @@ private: // Version specific classes of GIOP ////////////////////////////////////////////////// -/**************************************************************/ +// **************************************************************** + class TAO_Export TAO_GIOP_Message_Connector_10: public TAO_GIOP_Message_Connectors { // = TITLE @@ -79,9 +84,9 @@ public: TAO_GIOP_Message_Connector_10 (void); // Ctor - + protected: - virtual CORBA::Boolean + virtual CORBA::Boolean write_request_header (const TAO_Operation_Details &opdetails, TAO_Target_Specification &spec, TAO_OutputCDR &msg); @@ -92,7 +97,7 @@ protected: TAO_Target_Specification &spec, TAO_OutputCDR &msg); // Write the locate request header in to the <msg> - + int parse_reply (TAO_Message_State_Factory &mesg_state, TAO_Pluggable_Reply_Params ¶ms); // Parse the reply messages from the server @@ -102,8 +107,8 @@ protected: // Our minor and major versions }; +// **************************************************************** -/*************************************************************/ class TAO_Export TAO_GIOP_Message_Connector_11: public TAO_GIOP_Message_Connector_10 { // = TITLE @@ -127,4 +132,3 @@ private: #include "ace/post.h" #endif /*TAO_GIOP_MESSAGE_CONNECTORS_H*/ - diff --git a/TAO/tao/GIOP_Message_Connectors.i b/TAO/tao/GIOP_Message_Connectors.i index 33dc6238b3f..a8f7fc95783 100644 --- a/TAO/tao/GIOP_Message_Connectors.i +++ b/TAO/tao/GIOP_Message_Connectors.i @@ -12,4 +12,3 @@ ACE_INLINE TAO_GIOP_Message_Connector_11::TAO_GIOP_Message_Connector_11 (void) { } - diff --git a/TAO/tao/GIOP_Message_Headers.cpp b/TAO/tao/GIOP_Message_Headers.cpp index 7df2b883c91..f2d9d61d076 100644 --- a/TAO/tao/GIOP_Message_Headers.cpp +++ b/TAO/tao/GIOP_Message_Headers.cpp @@ -5,4 +5,5 @@ # 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. diff --git a/TAO/tao/GIOP_Message_Headers.h b/TAO/tao/GIOP_Message_Headers.h index cec48a857dd..14f1bffc7bf 100644 --- a/TAO/tao/GIOP_Message_Headers.h +++ b/TAO/tao/GIOP_Message_Headers.h @@ -7,6 +7,9 @@ // 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 // // = DESCRIPTION @@ -20,20 +23,25 @@ #ifndef TAO_GIOP_MESSAGE_HEADERS_H #define TAO_GIOP_MESSAGE_HEADERS_H #include "ace/pre.h" + #include "tao/GIOPC.h" +// @@ Bala: what goes in this file? All the message headers? A few of +// @@ them? Only the Locate_Request header?! + +// @@ Bala: the TAO_Export macros are missing here too! class TAO_GIOP_Locate_Request_Header { // = TITLE // Location service support public: - + TAO_GIOP_Locate_Request_Header (TAO_InputCDR &msg); // Constructor void request_id (CORBA::ULong id); // Set the id - + CORBA::ULong request_id (void); // Get the request id @@ -42,7 +50,7 @@ public: CORBA::Short addressing_disposition (void); // Return the addressing disposition - + const GIOP::TargetAddress &target_address (void) const; // Get in read mode @@ -54,15 +62,15 @@ public: TAO_InputCDR &incoming_stream (void); // Get the CDR stream for read/write - + private: CORBA::ULong request_id_; // Request id CORBA::Short addressing_disposition_; // This is the discrminant type for the union encapsulated in - // TargetAddress. - + // TargetAddress. + GIOP::TargetAddress target_address_; // Introduced by GIOP 1.2. Will not cause us any harm if it is there // for other versions. diff --git a/TAO/tao/GIOP_Message_Headers.i b/TAO/tao/GIOP_Message_Headers.i index b23be7551fe..31cf4167810 100644 --- a/TAO/tao/GIOP_Message_Headers.i +++ b/TAO/tao/GIOP_Message_Headers.i @@ -1,6 +1,6 @@ //$Id$ -ACE_INLINE +ACE_INLINE TAO_GIOP_Locate_Request_Header::TAO_GIOP_Locate_Request_Header (TAO_InputCDR &msg) : request_id_ (0), addressing_disposition_ (0), diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp index c38e26a3990..2207a93cea1 100644 --- a/TAO/tao/GIOP_Message_Lite.cpp +++ b/TAO/tao/GIOP_Message_Lite.cpp @@ -31,7 +31,6 @@ TAO_GIOP_Message_Lite::TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core) TAO_GIOP_Message_Lite::~TAO_GIOP_Message_Lite (void) { - //no-op } CORBA::Boolean @@ -39,17 +38,40 @@ TAO_GIOP_Message_Lite:: write_protocol_header (TAO_Pluggable_Message_Type t, TAO_OutputCDR &msg) { - // Reset the message type + // Reset the CDR stream, we are going to generate a completely new + // message. msg.reset (); - + + // @@ Bala: this is something to think harder about: right now we + // leave the space to store the length, and later we set it, but the + // way we do it is CDR specific... Maybe the XXXStream classes + // should support a 'save your current position' method that returns + // a 'Mememto' (check the GoF book), later the CDR stream could be + // restored to that state, and the size written to it. + // @@ Then again, i don't know how would that work with fragments + // (eventually we may want TAO to generate fragments), or protocols + // based on chunking.... + // // Write a dummy <size> later it is set to the right value... @@ - // TODO Maybe we should store the OutputCDR status in CORBA::ULong size = 0; msg.write_ulong (size); - + TAO_GIOP_Message_Type type = TAO_GIOP_MESSAGERROR; - - // First convert the Pluggable type to the GIOP specific type. + + // First convert the Pluggable type to the GIOP specific type. + // @@ Bala: this looks like a such a waste of time. There is no + // reason to have those 'generic' values if they will be transformed + // back an forth. It makes more sense to have several methods: + // + // write_request_header() + // write_reply_header() + // write_..._header() + // + // exposed through the Pluggable_Messaging interface. The + // write_protocol_header() should not be exposed through the generic + // interface, but it may be a private method used to implement the + // methods above.... Then you can use the GIOP types directly. + // switch (t) { case (TAO_PLUGGABLE_MESSAGE_REQUEST): @@ -91,17 +113,25 @@ TAO_GIOP_Message_Lite:: TAO_Message_State_Factory &mesg_state, ACE_Time_Value *max_wait_time) { + // @@ Bala: only the pluggable transport protocols can invoke the + // handle_input() method, but they must know what messaging protocol + // is in place already. In consequence this method should not be + // part of the public interface for Pluggable_Messaging.... + TAO_GIOP_Message_State *state = - ACE_dynamic_cast (TAO_GIOP_Message_State *, - &mesg_state); - + ACE_dynamic_cast (TAO_GIOP_Message_State *, &mesg_state); + + + // @@ Bala: can we eliminate fragments for GIOPLite? I think we can + // and then this code should be significantly simplified. + if (state->header_received () == 0) { - int retval = + int retval = TAO_GIOP_Utils::read_bytes_input (transport, state->cdr, TAO_GIOP_LITE_HEADER_LEN, - max_wait_time); + max_wait_time); if (retval == -1 && TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, @@ -109,10 +139,10 @@ TAO_GIOP_Message_Lite:: ASYS_TEXT ("TAO_GIOP_Message_Lite::handle_input"))); return -1; } - + // After we read, we assume that everything is fine. We dont do // any sanity check of the incoming header. - + // Read the rest of the stuff. That should be read by the // corresponding states if (this->parse_header (state) == -1) @@ -123,7 +153,7 @@ TAO_GIOP_Message_Lite:: "TAO_GIOP_Message_Lite::handle_input")); return -1; } - + if (state->cdr.grow (TAO_GIOP_LITE_HEADER_LEN + state->message_size) == -1) { @@ -133,7 +163,7 @@ TAO_GIOP_Message_Lite:: ASYS_TEXT ("ACE_CDR::grow"))); return -1; } - + // Growing the buffer may have reset the rd_ptr(), but we want // to leave it just after the GIOP header (that was parsed // already); @@ -142,7 +172,7 @@ TAO_GIOP_Message_Lite:: size_t missing_data = state->message_size - state->current_offset; - + ssize_t n = TAO_GIOP_Utils::read_buffer (transport, state->cdr.rd_ptr () + state->current_offset, @@ -153,7 +183,7 @@ TAO_GIOP_Message_Lite:: if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("TAO (%P|%t) - %p\n"), - ASYS_TEXT ("TAO_GIOP_Message_Lite::handle_input, read_buffer[1]"))); + ASYS_TEXT ("TAO_GIOP_Message_Lite::handle_input, read_buffer[1]"))); return -1; } else if (n == 0) @@ -165,9 +195,9 @@ TAO_GIOP_Message_Lite:: return -1; } - + state->current_offset += n; - + if (state->current_offset == state->message_size) { if (TAO_debug_level >= 4) @@ -185,6 +215,7 @@ TAO_GIOP_Message_Lite:: msg_len); } } + return state->is_complete (); } @@ -197,6 +228,11 @@ TAO_GIOP_Message_Lite:: TAO_Target_Specification &spec, TAO_OutputCDR &cdr) { + // @@ Bala: it is better to expose the methods directly, the + // higher level components in the ORB *know* if they want to send a + // request or a locate request. The switch is just a waste of time + // and breaks type safety.... + switch (header_type) { case TAO_PLUGGABLE_MESSAGE_REQUEST_HEADER: @@ -212,9 +248,9 @@ TAO_GIOP_Message_Lite:: ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t|%N|%l) Wrong header type \n")), 0); - + } - + return 1; } @@ -259,17 +295,17 @@ TAO_GIOP_Message_Lite:: &bodylen), buf + offset); #endif /* ACE_ENABLE_SWAP_ON_WRITE */ - + this->dump_msg ("send", ACE_reinterpret_cast (u_char *, buf), stream.length ()); - + return this->transport_message (transport, stream, two_way, stub, - max_wait_time); + max_wait_time); } @@ -279,16 +315,16 @@ TAO_GIOP_Message_Lite:: TAO_Pluggable_Reply_Params ¶ms) { // Cast to the GIOP Message state - TAO_GIOP_Message_State *state = + TAO_GIOP_Message_State *state = ACE_dynamic_cast (TAO_GIOP_Message_State *, &mesg_state); - + switch (state->message_type) { case TAO_GIOP_REQUEST: // In GIOP 1.0 and GIOP 1.1 this is an error, ACE_ERROR_RETURN ((LM_ERROR, - ASYS_TEXT ("TAO (%P|%t) %N:%l TAO_GIOP_Message_Lite::parse_reply: ") + ASYS_TEXT ("TAO (%P|%t) %N:%l TAO_GIOP_Message_Lite::parse_reply: ") ASYS_TEXT ("request.\n")), -1); @@ -319,7 +355,7 @@ TAO_GIOP_Message_Lite:: // Never happens: why?? break; } - + // Read the request id if (!state->cdr.read_ulong (params.request_id_)) { @@ -350,12 +386,12 @@ TAO_GIOP_Message_Lite:: case TAO_GIOP_NO_EXCEPTION: params.reply_status_ = TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION; break; - + // Request terminated with user exception case TAO_GIOP_USER_EXCEPTION: params.reply_status_ = TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION; break; - // Request terminated with system exception + // Request terminated with system exception case TAO_GIOP_SYSTEM_EXCEPTION: params.reply_status_ = TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION; break; @@ -394,7 +430,7 @@ TAO_GIOP_Message_Lite:: this->process_client_locate (transport, orb_core, input); - + break; case TAO_GIOP_MESSAGERROR: case TAO_GIOP_REPLY: @@ -451,7 +487,7 @@ TAO_GIOP_Message_Lite:: // key as the address disposition variable. But we do a sanity check // anyway. const TAO_ObjectKey *key = spec.object_key (); - + if (key) { // Put in the object key @@ -464,12 +500,12 @@ TAO_GIOP_Message_Lite:: ASYS_TEXT ("(%N |%l) Unable to handle this request \n"))); return 0; } - - out_stream.write_string (opdetails.opname_len (), + + out_stream.write_string (opdetails.opname_len (), opdetails.opname ()); return 1; -} +} CORBA::Boolean @@ -504,14 +540,14 @@ TAO_GIOP_Message_Lite:: int TAO_GIOP_Message_Lite:: - process_client_request (TAO_Transport *transport, + process_client_request (TAO_Transport *transport, TAO_ORB_Core* orb_core, TAO_InputCDR &input) { // Get the revision info TAO_GIOP_Version version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR); - + // This will extract the request header, set <response_required> // and <sync_with_server> as appropriate. TAO_GIOP_ServerRequest request (this, @@ -519,21 +555,21 @@ TAO_GIOP_Message_Lite:: this->output_, orb_core, version); - + CORBA::Environment &ACE_TRY_ENV = TAO_default_environment (); - + CORBA::ULong request_id = 0; CORBA::Boolean response_required = 0; CORBA::Boolean sync_with_server = 0; CORBA::Boolean location_forward = 0; int parse_error = 0; - + ACE_TRY { - parse_error = + parse_error = this->parse_request_header (request); - // Throw an exception if the + // Throw an exception if the if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO)); @@ -541,11 +577,11 @@ TAO_GIOP_Message_Lite:: response_required = request.response_expected (); sync_with_server = request.sync_with_server (); - + #if (TAO_NO_IOR_TABLE == 0) const CORBA::Octet *object_key = request.object_key ().get_buffer (); - + if (ACE_OS::memcmp (object_key, &TAO_POA::objectkey_prefix[0], TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) @@ -555,7 +591,7 @@ TAO_GIOP_Message_Lite:: request.object_key ().length (), 0, 0); - + // @@ This debugging output should *NOT* be used since the // object key string is not null terminated, nor can it // be null terminated without copying. No copying should @@ -578,21 +614,21 @@ TAO_GIOP_Message_Lite:: // If ObjectID not in table or reference is nil raise // OBJECT_NOT_EXIST. - + if (status == -1 || CORBA::is_nil (object_reference.in ())) ACE_TRY_THROW (CORBA::OBJECT_NOT_EXIST ()); - + // ObjectID present in the table with an associated NON-NULL // reference. Throw a forward request exception. // CORBA::Object_ptr dup = // CORBA::Object::_duplicate (object_reference); - + // @@ We could simply write the response at this point... ACE_TRY_THROW (PortableServer::ForwardRequest (object_reference.in ())); } #endif /* TAO_NO_IOR_TABLE */ - + // Do this before the reply is sent. orb_core->object_adapter ()->dispatch_servant ( request.object_key (), @@ -609,7 +645,7 @@ TAO_GIOP_Message_Lite:: // Make the GIOP header and Reply header this->make_reply (request_id, this->output_); - + this->output_.write_ulong (TAO_GIOP_LOCATION_FORWARD); CORBA::Object_ptr object_ptr = @@ -718,7 +754,7 @@ TAO_GIOP_Message_Lite:: { result = this->send_message (transport, this->output_); - + if (result == -1) { if (TAO_debug_level > 0) @@ -732,8 +768,8 @@ TAO_GIOP_Message_Lite:: } } - return result; - + return result; + } int @@ -745,7 +781,7 @@ TAO_GIOP_Message_Lite:: // Get the revision info TAO_GIOP_Version version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR); - + // This will extract the request header, set <response_required> as // appropriate. TAO_GIOP_Locate_Request_Header locate_request (input); @@ -760,7 +796,7 @@ TAO_GIOP_Message_Lite:: ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - int parse_error = + int parse_error = this->parse_locate_header (locate_request); if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, @@ -769,14 +805,14 @@ TAO_GIOP_Message_Lite:: const CORBA::Octet *object_key = locate_request.target_address ().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 = + CORBA::ULong len = locate_request.target_address ().object_key ().length (); - + ACE_CString object_id (ACE_reinterpret_cast (const char *, object_key), len, @@ -785,7 +821,7 @@ TAO_GIOP_Message_Lite:: if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("Simple Object key %s. Doing the Table Lookup ...\n"), + ASYS_TEXT ("Simple Object key %s. Doing the Table Lookup ...\n"), object_id.c_str ())); CORBA::Object_ptr object_reference; @@ -830,7 +866,7 @@ TAO_GIOP_Message_Lite:: // Set it to an error state parse_error = 1; CORBA::ULong req_id = locate_request.request_id (); - + TAO_GIOP_ServerRequest server_request (this, req_id, response_required, @@ -843,14 +879,14 @@ TAO_GIOP_Message_Lite:: if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO)); - + orb_core->object_adapter ()->dispatch_servant - (server_request.object_key (), + (server_request.object_key (), server_request, transport, 0, ACE_TRY_ENV); - + ACE_TRY_CHECK; if (server_request.exception_type () == TAO_GIOP_NO_EXCEPTION) @@ -929,16 +965,16 @@ TAO_GIOP_Message_Lite:: { // Get the input CDR in the request class TAO_InputCDR& input = request.incoming (); - + CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit (); - CORBA::ULong req_id; - + CORBA::ULong req_id; + // Get the rest of the request header ... hdr_status = hdr_status && input.read_ulong (req_id); request.request_id (req_id); - + CORBA::Octet response_flags; hdr_status = hdr_status && input.read_octet (response_flags); request.response_expected ((response_flags != 0)); @@ -948,7 +984,7 @@ TAO_GIOP_Message_Lite:: // of GIOP 1.2 is in place. Then we can check the version in the // message header instead. request.sync_with_server ((response_flags == 129)); - + // 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). @@ -994,27 +1030,27 @@ TAO_GIOP_Message_Lite:: } -int +int TAO_GIOP_Message_Lite:: parse_locate_header (TAO_GIOP_Locate_Request_Header &request) { - // Get the stream + // Get the stream TAO_InputCDR &msg = request.incoming_stream (); CORBA::Boolean hdr_status = 1; - + // Get the request id CORBA::ULong req_id = 0; hdr_status = msg.read_ulong (req_id); - + // 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 (); @@ -1053,11 +1089,11 @@ TAO_GIOP_Message_Lite:: // Make the GIOP & reply header. They are version specific. this->make_reply (request_id, output); - + // A new try/catch block, but if something goes wrong now we have no // hope, just abort. ACE_DECLARE_NEW_CORBA_ENV; - + ACE_TRY { // Write the exception @@ -1071,7 +1107,7 @@ TAO_GIOP_Message_Lite:: // write the reply_status output.write_ulong - (TAO_GIOP_Utils::convert_CORBA_to_GIOP_exception (extype)); + (TAO_GIOP_Utils::convert_CORBA_to_GIOP_exception (extype)); x->_tao_encode (output, ACE_TRY_ENV); ACE_TRY_CHECK; @@ -1119,7 +1155,7 @@ TAO_GIOP_Message_Lite:: // Make the header for the locate request output.write_ulong (request.request_id ()); output.write_ulong (status_info.status); - + if (status_info.status == TAO_GIOP_OBJECT_FORWARD) { CORBA::Object_ptr object_ptr = status_info.forward_location_var.in (); @@ -1168,11 +1204,11 @@ TAO_GIOP_Message_Lite::send_error (TAO_Transport *transport) TAO_GIOP_MESSAGERROR, 0, 0, 0, 0 }; - + this->dump_msg ("send_error", (const u_char *) error_message, TAO_GIOP_LITE_HEADER_LEN); - + ACE_HANDLE which = transport->handle (); int result = transport->send ((const u_char *)error_message, @@ -1184,7 +1220,7 @@ TAO_GIOP_Message_Lite::send_error (TAO_Transport *transport) ASYS_TEXT ("TAO (%N|%l|%P|%t) error sending error to %d\n"), which)); } - + return result; } @@ -1204,7 +1240,7 @@ TAO_GIOP_Message_Lite::dump_msg (const char *label, "MessageError" "Fragment" }; - + if (TAO_debug_level >= 5) { // Message name. @@ -1212,21 +1248,21 @@ TAO_GIOP_Message_Lite::dump_msg (const char *label, u_long slot = ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET]; if (slot < sizeof (names)/sizeof(names[0])) message_name = names [slot]; - + // Byte order. int byte_order = TAO_ENCAP_BYTE_ORDER; // request/reply id. CORBA::ULong tmp = 0; CORBA::ULong *id = &tmp; - + if (ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REQUEST || ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY) { // @@ Only works if ServiceContextList is empty.... id = ACE_reinterpret_cast (CORBA::ULong *, (char * ) (ptr)); - + } // Print. @@ -1240,5 +1276,3 @@ TAO_GIOP_Message_Lite::dump_msg (const char *label, *id)); } } - - diff --git a/TAO/tao/GIOP_Message_Lite.h b/TAO/tao/GIOP_Message_Lite.h index 7c800615d72..7acb0bc486f 100644 --- a/TAO/tao/GIOP_Message_Lite.h +++ b/TAO/tao/GIOP_Message_Lite.h @@ -31,10 +31,19 @@ class TAO_Export TAO_GIOP_Message_Lite : public TAO_Pluggable_Messaging // Definitions got the GIOP lite // // = DESCRIPTION + // @@ Bala: please be precise when writing comments, and avoid + // colloquial expressions like 'quite a', you are writing + // technical documentation, not a novel... + // @@ Bala: wouldn't this be a better description of this class: + // Implement the GIOP lite pluggable messaging protocol. Very + // similar to the GIOP protocol, but several fields are removed to + // reduce overhead on homogenous systems. + // // The interface is quite a replica of the GIOP Base // interface. Implmenetation may not vary much too. But we are // having a seperate interface to have seperation of concerns. -public: + // +public: TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core); //Ctor @@ -50,8 +59,8 @@ public: TAO_Message_State_Factory &mesg_state, ACE_Time_Value *max_time_value = 0); // Reads input from the transport layer to the cdr stream in <mesg_state> - - virtual CORBA::Boolean + + virtual CORBA::Boolean write_message_header (const TAO_Operation_Details &opdetails, TAO_Pluggable_Header_Type header_type, TAO_Target_Specification &spec, @@ -63,12 +72,12 @@ public: ACE_Time_Value *max_wait_time = 0, TAO_Stub *stub = 0, int two_way = 1); - // Sends the encapsulated stream in <stream> on to the transport - + // Sends the encapsulated stream in <stream> on to the transport + int parse_reply (TAO_Message_State_Factory &mesg_state, TAO_Pluggable_Reply_Params ¶ms); // Parse the reply message from the server - + int process_client_message (TAO_Transport *transport, TAO_ORB_Core *orb_core, TAO_InputCDR &input, @@ -76,22 +85,22 @@ public: // Processes the messages from the connectors so that they can be // passed on to the appropriate states. private: - CORBA::Boolean + CORBA::Boolean write_request_header (const TAO_Operation_Details &details, TAO_Target_Specification &spec, TAO_OutputCDR &msg); // Write the GIOP lite request header in to <msg> - - CORBA::Boolean + + CORBA::Boolean write_locate_request_header (CORBA::ULong request_id, TAO_Target_Specification &spec, TAO_OutputCDR &msg); // Write the GIOP lite locate request header in to <msg> - + int parse_header (TAO_GIOP_Message_State *state); // Parse the header - + int process_client_request (TAO_Transport *transport, TAO_ORB_Core* orb_core, TAO_InputCDR &input); @@ -114,11 +123,11 @@ private: // message processing. int parse_request_header (TAO_GIOP_ServerRequest &request); - // Parse the Request Message header + // Parse the Request Message header int parse_locate_header (TAO_GIOP_Locate_Request_Header &request); // Parse the Locate Request header - + CORBA::Boolean make_reply (CORBA::ULong request_id, TAO_OutputCDR &output); // Make a reply message including the protocol header @@ -135,10 +144,10 @@ private: TAO_GIOP_Locate_Request_Header &request, TAO_GIOP_Locate_Status_Msg &status_info); // Making replies for LocateRequest messages. - + int send_error (TAO_Transport *transport); // Send error messages - + void dump_msg (const char *label, const u_char *ptr, size_t len); @@ -146,12 +155,12 @@ private: TAO_OutputCDR output_; // The output cdr for the GIOP lite message - + char repbuf_[ACE_CDR::DEFAULT_BUFSIZE]; // Char array to initialise our Output CDR class }; - +// @@ Bala: Do you really need to define these in the header file? // The IIOP Lite header length and the offset of the message size // field in it. const size_t TAO_GIOP_LITE_HEADER_LEN = 5; diff --git a/TAO/tao/GIOP_Message_Lite.i b/TAO/tao/GIOP_Message_Lite.i index 251906c72e1..0815bf79756 100644 --- a/TAO/tao/GIOP_Message_Lite.i +++ b/TAO/tao/GIOP_Message_Lite.i @@ -1,19 +1,24 @@ //$Id$ - ACE_INLINE int TAO_GIOP_Message_Lite::parse_header (TAO_GIOP_Message_State *state) { // Get the read pointer char *buf = state->cdr.rd_ptr (); - + + // @@ Bala: i added the following comment, does it make sense? + // In GIOPLite the version, byte order info, etc. are hardcoded, and + // not transmitted over the wire. state->byte_order = TAO_ENCAP_BYTE_ORDER; state->giop_version.major = TAO_DEF_GIOP_MAJOR; state->giop_version.minor = TAO_DEF_GIOP_MINOR; + + // Get the message type. state->message_type = buf[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET]; - + state->cdr.reset_byte_order (state->byte_order); + // The first bytes are the length of the message. state->cdr.read_ulong (state->message_size); return 0; @@ -25,19 +30,21 @@ TAO_GIOP_Message_Lite:: TAO_OutputCDR &output) { // Write the GIOP header first + // @@ Bala: i still believe it is a bad idea to have those generic + // enums for all the message types.... this->write_protocol_header (TAO_PLUGGABLE_MESSAGE_REPLY, output); - + // create and write a dummy context // We dont really need this. But for some reason the reply is not // parsable on the receiving side? - // @@Bala, look in to this + // @@ Bala, look in to this IOP::ServiceContextList resp_ctx; resp_ctx.length (0); output << resp_ctx; // Write the request ID output.write_ulong (request_id); - + return 0; } diff --git a/TAO/tao/GIOP_Message_State.cpp b/TAO/tao/GIOP_Message_State.cpp index 768d85ef39b..fa5abe73c41 100644 --- a/TAO/tao/GIOP_Message_State.cpp +++ b/TAO/tao/GIOP_Message_State.cpp @@ -10,8 +10,8 @@ # include "tao/GIOP_Message_State.i" #endif /* __ACE_INLINE__ */ +ACE_RCSID(tao, GIOP_Message_State, "$Id$") -ACE_RCSID(tao, GIOP_Message_State, "$Id$") TAO_GIOP_Message_State::TAO_GIOP_Message_State (TAO_ORB_Core* orb_core) : byte_order (TAO_ENCAP_BYTE_ORDER), more_fragments (0), @@ -30,6 +30,7 @@ TAO_GIOP_Message_State::TAO_GIOP_Message_State (TAO_ORB_Core* orb_core) TAO_GIOP_Message_State::~TAO_GIOP_Message_State (void) { + // @@ Bala: this is not a very useful comment, is it? //no-op } @@ -73,7 +74,7 @@ TAO_GIOP_Message_State::is_complete () ACE_Message_Block::release (this->fragments_begin); this->fragments_begin = 0; this->fragments_end = 0; - + this->byte_order = this->first_fragment_byte_order; this->giop_version = this->first_fragment_giop_version; this->message_type = this->first_fragment_message_type; @@ -101,6 +102,10 @@ TAO_GIOP_Message_State::append_fragment (ACE_Message_Block* current) || this->first_fragment_giop_version.minor != this->giop_version.minor) { // Yes, print it out in all debug levels! + // @@ Bala: i know this code is mine, but could you check out + // the spec and the latest CORBA 2.4 draft (ptc/00-03-02) to + // verify if this is actually an error or not? If so, could you + // please site the right section of the spec? ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) incompatible fragments:\n" " Different GIOP versions or byte order\n")); diff --git a/TAO/tao/GIOP_Message_State.h b/TAO/tao/GIOP_Message_State.h index cce2bbf6962..eb5de7d3751 100644 --- a/TAO/tao/GIOP_Message_State.h +++ b/TAO/tao/GIOP_Message_State.h @@ -15,7 +15,7 @@ // = AUTHOR // Chris Cleeland <cleeland@cs.wustl.edu> // Carlos O' Ryan <coryan@uci.edu> -// +// // ============================================================================ #ifndef TAO_GIOP_MESSAGE_STATE_H @@ -24,6 +24,8 @@ #include "tao/Pluggable_Messaging.h" +// @@ Bala more missing #pragma once + class TAO_Export TAO_GIOP_Version { // = TITLE @@ -56,15 +58,23 @@ public: // Equality operator }; -class TAO_Export TAO_GIOP_Message_State: public TAO_Message_State_Factory +// @@ Bala: do you see how these names are inconsistent! It is a +// @@ message state factory for GIOP or is it a message state? +class TAO_Export TAO_GIOP_Message_State : public TAO_Message_State_Factory { // = TITLE - // Generic definitions for Message States. + // Generic definitions for Message States. // // = DESCRIPTION - // This would represnt the state of the incoming message states. + // @@ Bala: please don't write comments in conditional form. + // @@ Don't say what the class could or would do, say what it + // @@ *does* + // @@ Bala: i remain unconvinced as to whether the base class here + // @@ is any useful. + // + // This would represent the state of the incoming message states. // As the ORB processes incoming messages it need to keep track of - // how much of the message has been read. if there are any + // how much of the message has been read, if there are any // fragments following this message etc. This class attempts to // give a generic interface to all the messaging protocols message // states so that the Transport layer does not really know with @@ -75,11 +85,11 @@ public: ~TAO_GIOP_Message_State (void); // Dtor - + void reset (int reset_contents = 1); //Reset the message header state and prepare it to receive the next // event. - + CORBA::Boolean header_received (void) const; // Has the header been received? @@ -87,19 +97,19 @@ public: // Check if the current message is complete, adjusting the fragments // if required... - TAO_GIOP_Version giop_version; + TAO_GIOP_Version giop_version; // Version info - CORBA::Octet byte_order; + CORBA::Octet byte_order; // 0 = big, 1 = little - - CORBA::Octet more_fragments; + + CORBA::Octet more_fragments; // (Requests and Replys) - - CORBA::Octet message_type; + + CORBA::Octet message_type; // MsgType above - - CORBA::ULong message_size; + + CORBA::ULong message_size; // in byte_order! CORBA::ULong current_offset; @@ -134,8 +144,8 @@ public: // the *complete* message (remember that the last message will be // fragment and the upper level needs to know if it is a request, // locate request or what). - - + + private: int append_fragment (ACE_Message_Block* current); // Append <current> to the list of fragments diff --git a/TAO/tao/GIOP_Message_State.i b/TAO/tao/GIOP_Message_State.i index bc0612b1f6f..90fc3299dea 100644 --- a/TAO/tao/GIOP_Message_State.i +++ b/TAO/tao/GIOP_Message_State.i @@ -3,7 +3,11 @@ //$Id$ // -// Inlined methods for TAO_GIOP_Version +// @@ Bala: is this comment useful at all? I mean, everybody can read +// C++, it is *OBVIOUS* that they are inlined methods, and what class +// they belong to, right? +// +// Inlined methods for TAO_GIOP_Version // ACE_INLINE @@ -56,7 +60,10 @@ TAO_GIOP_Version::operator!= (const TAO_GIOP_Version &src) return !(*this == src); } -// +// **************************************************************** +// @@ Bala: we use the stars to separate classes in ACE+TAO + +// // Inlined methods for TAO_GIOP_Message_State // diff --git a/TAO/tao/GIOP_Server_Request.cpp b/TAO/tao/GIOP_Server_Request.cpp index eb60d279140..fa01529e33a 100644 --- a/TAO/tao/GIOP_Server_Request.cpp +++ b/TAO/tao/GIOP_Server_Request.cpp @@ -1,6 +1,5 @@ // $Id$ - // Implementation of the Dynamic Server Skeleton Interface (for GIOP) #include "tao/GIOP_Server_Request.h" diff --git a/TAO/tao/GIOP_Server_Request.h b/TAO/tao/GIOP_Server_Request.h index 40083431ff1..495cc63c13c 100644 --- a/TAO/tao/GIOP_Server_Request.h +++ b/TAO/tao/GIOP_Server_Request.h @@ -24,8 +24,6 @@ #include "tao/corbafwd.h" - - #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ @@ -39,6 +37,10 @@ class TAO_Export TAO_GIOP_ServerRequest : public CORBA_ServerRequest { // = TITLE // Class representing an GIOP ServerRequest object. + // + // @@ This class should go away, there is no reason to provide a + // per-protocol server request class. + // public: // = Initialization and termination methods. TAO_GIOP_ServerRequest (TAO_Pluggable_Messaging *mesg_base, diff --git a/TAO/tao/GIOP_Server_Request.i b/TAO/tao/GIOP_Server_Request.i index 29da92ded95..c52b5d333a1 100644 --- a/TAO/tao/GIOP_Server_Request.i +++ b/TAO/tao/GIOP_Server_Request.i @@ -113,7 +113,7 @@ TAO_GIOP_ServerRequest::service_info (void) ACE_INLINE void TAO_GIOP_ServerRequest:: -service_info (IOP::ServiceContextList &service_info) +service_info (IOP::ServiceContextList &service_info) { this->service_info_ = service_info; } @@ -142,7 +142,7 @@ TAO_GIOP_ServerRequest::requesting_principal (CORBA_Principal_ptr //{ // this->header_len_ = len; //} -// +// //ACE_INLINE void //TAO_GIOP_ServerRequest::message_size_offset (size_t len) //{ diff --git a/TAO/tao/GIOP_Utils.cpp b/TAO/tao/GIOP_Utils.cpp index ab7b52869a6..bf1ec604990 100644 --- a/TAO/tao/GIOP_Utils.cpp +++ b/TAO/tao/GIOP_Utils.cpp @@ -8,6 +8,7 @@ # include "tao/GIOP_Utils.i" #endif /* __ACE_INLINE__ */ +// @@ Bala: what happened to the RCSID macro? int TAO_GIOP_Utils:: @@ -19,7 +20,7 @@ TAO_GIOP_Utils:: // Grow the size of CDR stream if (input.grow (read_size) == -1) return -1; - + // Read until all the header is received. There should be no // problems with locking, the header is only a few bytes so they // should all be available on the socket, otherwise there is a @@ -27,7 +28,7 @@ TAO_GIOP_Utils:: // problems than just this small loop. char *buf = input.rd_ptr (); ssize_t n = 0; - + for (int t = read_size; t != 0; t -= n) @@ -80,7 +81,7 @@ TAO_GIOP_Utils::read_buffer (TAO_Transport *transport, TAO_GIOP_Reply_Status_Type TAO_GIOP_Utils:: - convert_CORBA_to_GIOP_exception (CORBA::exception_type corba_type) + convert_CORBA_to_GIOP_exception (CORBA::exception_type corba_type) { switch (corba_type) diff --git a/TAO/tao/GIOP_Utils.h b/TAO/tao/GIOP_Utils.h index 2079a3badb9..20f8f7cbab5 100644 --- a/TAO/tao/GIOP_Utils.h +++ b/TAO/tao/GIOP_Utils.h @@ -15,15 +15,17 @@ // = AUTHOR // Chris Cleeland <cleeland@cs.wustl.edu> // Carlos O' Ryan <coryan@uci.edu> -// +// // ============================================================================ #ifndef TAO_GIOP_UTILS_H #define TAO_GIOP_UTILS_H #include "ace/pre.h" + #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... typedef enum GIOP_Messages { @@ -31,7 +33,7 @@ typedef enum GIOP_Messages // All GIOP messages include a header and message type. Not // really a message type, but needed to bring that information // back somehow. - + // = GIOP message types. TAO_GIOP_REQUEST = 0, // sent by client. TAO_GIOP_REPLY = 1, // by server. @@ -54,7 +56,9 @@ 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 { @@ -65,13 +69,13 @@ class TAO_GIOP_Locate_Status_Msg // This class is there to hold the relevant info for different // types of locate status messages. As on date we dont know much // about other mesg types other than OBJECT_FORWARD. This clss can - // be clearly defined as time progresses. - // + // be clearly defined as time progresses. + // public: CORBA::Object_var forward_location_var; // The value will need to be used when the Message type is - // TAO_GIOP_OBJECT_FORWARD - + // TAO_GIOP_OBJECT_FORWARD + TAO_GIOP_Locate_Status_Type status; // Stype of Locate status message //@@ Other mesg types. @@ -91,15 +95,16 @@ typedef enum GIOP_ReplyStatusType TAO_GIOP_LOCATION_FORWARD, // Reply is a location forward type - + TAO_GIOP_LOCATION_FORWARD_PERM, // GIOP 1.2, Reply is a location forward perm type.. NEEDS_ADDRESSING_MODE - // GIOP1.2, - + // GIOP1.2, + } TAO_GIOP_Reply_Status_Type; +// @@ Bala: more missing TAO_Export macros. class TAO_GIOP_ReplyHeader { @@ -115,30 +120,27 @@ public: TAO_GIOP_Reply_Status_Type reply_status; // Status of the reply (see above enum). - }; - - class TAO_Export TAO_GIOP_Utils { // = TITLE // Utility class that has some commonly used methods for both GIOP // Base & GIOP lite - + // = DESCRIPTION public: static int read_bytes_input (TAO_Transport *transport, TAO_InputCDR &cdr, CORBA::ULong buf_size, ACE_Time_Value *value = 0); - + static ssize_t read_buffer (TAO_Transport *transport, char *buf, size_t len, ACE_Time_Value *max_wait_time = 0); - - static TAO_GIOP_Reply_Status_Type + + static TAO_GIOP_Reply_Status_Type convert_CORBA_to_GIOP_exception (CORBA::exception_type corba_type); // Convert the exception type from CORBA to GIOP }; diff --git a/TAO/tao/Pluggable_Messaging.cpp b/TAO/tao/Pluggable_Messaging.cpp index 45d41b20894..1544877aac1 100644 --- a/TAO/tao/Pluggable_Messaging.cpp +++ b/TAO/tao/Pluggable_Messaging.cpp @@ -46,7 +46,7 @@ TAO_Pluggable_Messaging:: transport_message (TAO_Transport *transport, return -1; } - + // EOF. if (n == 0) { diff --git a/TAO/tao/Pluggable_Messaging.h b/TAO/tao/Pluggable_Messaging.h index 727b3f89756..11db7702397 100644 --- a/TAO/tao/Pluggable_Messaging.h +++ b/TAO/tao/Pluggable_Messaging.h @@ -34,7 +34,7 @@ class TAO_OutputCDR; class TAO_Export TAO_Pluggable_Messaging { // = TITLE - // Generic definitions Messaging class. + // Generic definitions Messaging class. // // = DESCRIPTION // This interface tries to define generic methods that could be @@ -43,7 +43,11 @@ class TAO_Export TAO_Pluggable_Messaging public: virtual ~TAO_Pluggable_Messaging (void); // Dtor - + + // @@ Bala: only the pluggable transport protocols can invoke the + // handle_input() method, but they must know what messaging protocol + // is in place already. In consequence this method should not be + // part of the public interface for Pluggable_Messaging.... virtual int handle_input (TAO_Transport *transport, TAO_ORB_Core *orb_core, TAO_Message_State_Factory &mesg_state, @@ -77,11 +81,28 @@ public: // implementor of the messaging layer to decide his own // implementation by wading through a minimal set of interface. I // probably dont like the way we have things in TAO_Transport - // class. + // class. // An after thought. I looked at your comments in the - // Pluggable_Messaging_utils.h and I feel that we can start exposing + // Pluggable_Messaging_utils.h and I feel that we can start exposing // methods the way you have suggested. I will start that too. - virtual CORBA::Boolean + // + // @@ Bala: another way to say the same thing: what services are + // provided by a pluggable message protocol: + // - Generate request messages + // - Generate locate request messages + // - Send a full message + // - Receive a full message + // - Parse a full message into + // - Request + // - Locate + // - Reply + // - LocateReply + // + // @@ Other messages, like Fragment could be hidden from the higher + // level components of the ORB, because they don't care. What do + // you think? + // + virtual CORBA::Boolean write_message_header (const TAO_Operation_Details &opdetails, TAO_Pluggable_Header_Type header_type, TAO_Target_Specification &spec, @@ -95,7 +116,7 @@ public: // @@ Carlos: The same comment that you gave above. They have to // return an error. virtual CORBA::Boolean write_protocol_header (TAO_Pluggable_Message_Type t, - TAO_OutputCDR &msg) = 0; + TAO_OutputCDR &msg) = 0; // This is a generic method that is used to write the protocol // header in to the Output CDR stream. This may not be really // necessary, but our Invocation classes seesm to be looking for @@ -104,14 +125,48 @@ public: virtual int parse_reply (TAO_Message_State_Factory &state, TAO_Pluggable_Reply_Params ¶ms) = 0; - // Parse the reply.. - + // Parse the reply.. + + // @@ Bala: it seems to me this is a counter-intuitive name. + // Furthermore, why should the caller know that there are certain + // messages that the server should not receive? + // @@ Bala: this is the same principle that we applied before, we + // need to think about what services is the Pluggable_Messaging + // layer going to provide to the rest of the ORB. IMHO what it + // should provide is the ability to: + // 1 Prepare and send requests. + // 2 Prepare and send locate request messages + // 3 Upcall to 'something' when a reply has arrived + // 4 Upcall to 'something' when a request has arrived + // + // @@ (1) and (2) imply a transfer syntax, for the time beign we + // will hardcode it to CDR, but we must think in more generic + // terms. + // @@ Notice that sending and receiving are provided as part of a + // single service, you must keep in mind that certain protocols + // (even GIOP) could send the message in multiple fragments, so + // while the higher level components in the ORB believe that they + // are just preparing a message, in fact parts of it may have been + // sent already. The application may request a flush() operation or + // 'message_complete()' or something like that.... + // @@ Also notice that the replies are requests are upcalls, that + // is how we organized the transport layer, and it cleaned up a + // bunch of stuff. For example, there would be no need to expose + // 'parse' operations, the parsing would be done by the pluggable + // messaging layer, and only when completed it will upcall and pass + // the resulting reply (or request) to the upper ORB layer. + // @@ In my mind, all this stuff should be provided by the + // transport layer, 'pluggable messaging' makes no sense because + // you cannot plug a messaging protocol and use transport classes + // created for another protocol (except in the GIOP / GIOPLite + // case, which is purely an accident). + // virtual int process_client_message (TAO_Transport *transport, TAO_ORB_Core *orb_core, TAO_InputCDR &input, CORBA::Octet message_type) = 0; // Process messages from the clients. This is the heart of the - // server side processing + // server side processing protected: // @@ Bala: is this a good name? Why not just "send mesage", or @@ -130,10 +185,12 @@ protected: // **************************************************************** +// @@ Bala: if this is a *factory* why is it that it does not create +// *anything*? Wouldn't TAO_Message_State be a much better name? class TAO_Export TAO_Message_State_Factory { // = TITLE - // Generic definitions for Message States. + // Generic definitions for Message States. // // = DESCRIPTION // This would represent the state of the incoming message. @@ -162,17 +219,27 @@ class TAO_Export TAO_Message_State_Factory // that they are using GIOP. Under such circumstances, we may // want to give them an interface through which they can access // data that they need and leave the rest to the Transport - // classes. - // + // classes. + // public: virtual ~TAO_Message_State_Factory (void); // Dtor - + virtual void reset (int reset_contents = 1) = 0; // Reset the message header state and prepare it to receive the next // event. + // @@ Bala: I fail to see how a class with just a meak interface is + // reusable. In all instances where i seen it used it was + // downcasted, usually the flow was something like: + // - In context A we have a concrete Message_State, we decide to + // forget its real type and pass it down to context B as a generic + // Message_State_Factory + // - In context B we downcast from the generic + // Message_State_Factory to the concrete message state, because it + // is the only way to do something useful... + // IMHO this abstraction is not giving you anything. }; diff --git a/TAO/tao/Pluggable_Messaging.i b/TAO/tao/Pluggable_Messaging.i index 0b95eae291b..d770714e772 100644 --- a/TAO/tao/Pluggable_Messaging.i +++ b/TAO/tao/Pluggable_Messaging.i @@ -1,5 +1,3 @@ // -*- C++ -*- //$Id$ - - diff --git a/TAO/tao/Pluggable_Messaging_Utils.h b/TAO/tao/Pluggable_Messaging_Utils.h index 219bdf25f94..b99f3e653f0 100644 --- a/TAO/tao/Pluggable_Messaging_Utils.h +++ b/TAO/tao/Pluggable_Messaging_Utils.h @@ -33,7 +33,7 @@ // places. That would help us when we do the next iteration to attack // these places. IMHO, your idea of internal table to map request_ids // to different request tokens can be extended to other data in the -// class. +// class. class TAO_Export TAO_Pluggable_Reply_Params { // = TITLE @@ -41,7 +41,7 @@ class TAO_Export TAO_Pluggable_Reply_Params // // = DESCRIPTION // This represents a set of data that would be received by the - // connector from the acceptor. + // connector from the acceptor. public: TAO_Pluggable_Reply_Params (void); // Ctor @@ -50,7 +50,7 @@ public: // The IOP service context list CORBA::ULong request_id_; - // The request id for which the reply we (connector) has received + // The request id for which the reply we (connector) has received // @@ Bala: this is (again) an GIOPism (to coin a word). Other // protocol may choose to send different *messages* instead. @@ -74,7 +74,7 @@ enum TAO_Pluggable_Header_Type { // = TITLE // = DESCRIPTION - // + // TAO_PLUGGABLE_MESSAGE_REQUEST_HEADER = 0, TAO_PLUGGABLE_MESSAGE_LOCATE_REQUEST_HEADER }; @@ -93,16 +93,16 @@ enum TAO_Pluggable_Message_Type // messaging framework to denote existing message types. This has // an inspiration from GIOP. So if anybody wants to add more message // types you are welcome but please do not change the numbering - // scheme as this would affect GIOP. - + // scheme as this would affect GIOP. + TAO_PLUGGABLE_MESSAGE_REQUEST = 0, // sent by client. TAO_PLUGGABLE_MESSAGE_REPLY = 1, // by server. TAO_PLUGGABLE_MESSAGE_CANCELREQUEST = 2, // by client. TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST = 3, // by client. TAO_PLUGGABLE_MESSAGE_LOCATEREPLY = 4, - TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION = 5, - TAO_PLUGGABLE_MESSAGE_MESSAGERROR = 6, - TAO_PLUGGABLE_MESSAGE_FRAGMENT = 7 + TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION = 5, + TAO_PLUGGABLE_MESSAGE_MESSAGERROR = 6, + TAO_PLUGGABLE_MESSAGE_FRAGMENT = 7 }; // @@ Bala: This is a hopeless GIOPism. @@ -115,7 +115,7 @@ enum TAO_Pluggable_Message_Exception_Type // messaging framework to denote existing Exception types. This has // an inspiration from GIOP. So if anybody wants to add more message // types you are welcome but please do not change the numbering - // scheme as this would affect GIOP. + // scheme as this would affect GIOP. TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION = 0, // Request completed successfully @@ -127,12 +127,12 @@ enum TAO_Pluggable_Message_Exception_Type TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD, // Reply is a location forward type - + TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM, // PLUGGABLE_MESSAGE 1.2, Reply is a location forward perm type.. TAO_PLUGABLE_MESSAGE_NEEDS_ADDRESSING_MODE - // GIOP1.2, + // GIOP1.2, }; #if defined (__ACE_INLINE__) @@ -141,4 +141,3 @@ enum TAO_Pluggable_Message_Exception_Type #include "ace/post.h" #endif /*TAO_PLUGGABLE_MESSAGING_UTILS_H*/ - diff --git a/TAO/tao/target_specification.cpp b/TAO/tao/target_specification.cpp index 602668745c4..f1993c56496 100644 --- a/TAO/tao/target_specification.cpp +++ b/TAO/tao/target_specification.cpp @@ -8,4 +8,3 @@ #endif /* !defined INLINE */ ACE_RCSID(tao, target_specification, "$Id$") - diff --git a/TAO/tao/target_specification.h b/TAO/tao/target_specification.h index 59b1268fee0..2e07be74abd 100644 --- a/TAO/tao/target_specification.h +++ b/TAO/tao/target_specification.h @@ -11,8 +11,8 @@ // // = DESCRIPTION // A class that encapsulates the target identification details. -// -// +// +// // = AUTHOR // Balachandran Natarajan <bala@cs.wustl.edu> // ============================================================================ @@ -32,12 +32,12 @@ class TAO_Target_Specification // // = DESCRIPTION // @@ Bala: do we have examples of how other protocols map object - // keys? + // keys? // @@ Carlos: The way HTTP-NG does is not quite intuitive. But // they too have a sequnce of Octet which more or less fits this // model. You are also allowed to specify is a Cache Index (14 // bits). I think that can also be worked out and shouldn't be - // a big deal. + // a big deal. // @@ Bala:What if they pass something around that does not fit // this model? // @@ Carlos:As long as we dont know it is ok. But then if we get @@ -48,7 +48,12 @@ class TAO_Target_Specification // I can look ahead possibily a couple of days but not a life // time :-) But you have a good question though. Please sont // remove these discussions. It could be useful for someone - // someday. + // someday. + + // @@ Bala: i hate to be picky on these matters, but you are not + // writing a novel or your memoirs, 'I foresee' does not look like + // the right kind of comment in a class description. + // // The motivation behind this is GIOP 1.2 althought I foresee // other messaging protocols doing something similar. // The Invocation classes (client side) were @@ -59,9 +64,9 @@ class TAO_Target_Specification // key. They can send send the IOP::TaggedProfile or IOP::IOR // profile. So I am putting these possibilites in this class and // pass it to the messaging layer. It would extract what is - // required. + // required. public: - + TAO_Target_Specification (void); // Ctor enum TAO_Target_Address @@ -74,7 +79,7 @@ public: // Note: Please do not pass in a identifiers that is allocated on // stack. These methods does not make a copy but holds the pointer - // passed in. + // passed in. void target_specifier (const TAO_ObjectKey &key); // Set the target specification by giving the object key. @@ -82,7 +87,7 @@ public: void target_specifier (IOP::TaggedProfile *profile); // Set the target specification by passing in an IOP::TaggedProfile. - void target_specifier (IOP::IOR *ior, + void target_specifier (IOP::IOR *ior, CORBA::ULong prof_index); // Specify the target by passing in the IOP::IOR with a profile // index. Please see the header file IOPC.h on why a profile index @@ -93,21 +98,21 @@ public: // Returns the object key after a check of the stored specifier. If // the stored specifier is not of the right type then this would // return a NULL - + const IOP::TaggedProfile *profile (void); // Returns the IOP::TaggedProfile after a check of the stored specifier. If // the stored specifier is not of the right type then this would // return a NULL - + CORBA::ULong iop_ior (IOP::IOR *&ior); // Returns a pointer to IOP::IOR through the parameters and the // index of the selected profile as a return parameter after a check // of the stored specifier. If the stored specifier is not of the - // right type then this would return a NULL. - + // right type then this would return a NULL. + TAO_Target_Address specifier (void); // Access the TArget_Address specifier - + private: union { @@ -116,7 +121,7 @@ private: IOP::IOR *ior_; } u_; // The union of all the possibilities - + TAO_Target_Address specifier_; // The enum identifier diff --git a/TAO/tao/target_specification.i b/TAO/tao/target_specification.i index f794c3469a5..f2bccbace2d 100644 --- a/TAO/tao/target_specification.i +++ b/TAO/tao/target_specification.i @@ -10,7 +10,7 @@ TAO_Target_Specification::TAO_Target_Specification (void) //no-op } -ACE_INLINE void +ACE_INLINE void TAO_Target_Specification::target_specifier (const TAO_ObjectKey &key) { this->specifier_ = TAO_Target_Specification::Key_Addr; @@ -18,12 +18,16 @@ TAO_Target_Specification::target_specifier (const TAO_ObjectKey &key) // the stack or is otherwise destroyed then you are in big // trouble. // @@ Carlos: As suggested by you I have documented that in the - // headerfile. + // headerfile. + // @@ Bala: beware, documentation is good, code that works in + // general is better.... but you are probably right in this case, i + // suspect this stuff goes right in the critical path, right? So + // making a copy of the object key would be too expensive.. this->u_.object_key_ = ACE_const_cast (TAO_ObjectKey *, &key); } -ACE_INLINE void +ACE_INLINE void TAO_Target_Specification::target_specifier (IOP::TaggedProfile *profile) { @@ -35,7 +39,7 @@ TAO_Target_Specification::target_specifier (IOP::TaggedProfile *profile) } ACE_INLINE void -TAO_Target_Specification::target_specifier (IOP::IOR *ior, +TAO_Target_Specification::target_specifier (IOP::IOR *ior, CORBA::ULong prof_index) { if (ior) { @@ -45,12 +49,12 @@ TAO_Target_Specification::target_specifier (IOP::IOR *ior, } } -ACE_INLINE const TAO_ObjectKey* +ACE_INLINE const TAO_ObjectKey* TAO_Target_Specification::object_key (void) { if (this->specifier_ == TAO_Target_Specification::Key_Addr) return this->u_.object_key_; - + return 0; } @@ -63,7 +67,7 @@ TAO_Target_Specification::profile (void) return 0; } -ACE_INLINE CORBA::ULong +ACE_INLINE CORBA::ULong TAO_Target_Specification::iop_ior (IOP::IOR *& ior) { if (this->specifier_ == TAO_Target_Specification::Reference_Addr) @@ -76,9 +80,8 @@ TAO_Target_Specification::iop_ior (IOP::IOR *& ior) return 0; } -ACE_INLINE TAO_Target_Specification::TAO_Target_Address +ACE_INLINE TAO_Target_Specification::TAO_Target_Address TAO_Target_Specification::specifier (void) { return this->specifier_; } - |