From c4073dba4f33a6a9a35c86392d86047e52230c37 Mon Sep 17 00:00:00 2001 From: bala Date: Mon, 14 May 2001 17:43:08 +0000 Subject: *** empty log message *** --- TAO/tao/GIOP_Message_Base.h | 43 +++--- TAO/tao/GIOP_Message_Reactive_Handler.cpp | 36 ++--- TAO/tao/GIOP_Message_Reactive_Handler.h | 2 +- .../Strategies/GIOP_Message_NonReactive_Base.cpp | 115 +++++++++++++++ TAO/tao/Strategies/GIOP_Message_NonReactive_Base.h | 84 +++++++++++ .../Strategies/GIOP_Message_NonReactive_Base.inl | 1 + .../GIOP_Message_NonReactive_Handler.cpp | 157 +++++++++++++++++++++ .../Strategies/GIOP_Message_NonReactive_Handler.h | 84 +++++++++++ .../GIOP_Message_NonReactive_Handler.inl | 7 + TAO/tao/Strategies/TAO_Strategies.dsp | 24 ++++ TAO/tao/TAO.dsp | 18 +-- TAO/tao/Transport.cpp | 25 ++++ TAO/tao/Transport.h | 25 ++++ 13 files changed, 567 insertions(+), 54 deletions(-) create mode 100644 TAO/tao/Strategies/GIOP_Message_NonReactive_Base.cpp create mode 100644 TAO/tao/Strategies/GIOP_Message_NonReactive_Base.h create mode 100644 TAO/tao/Strategies/GIOP_Message_NonReactive_Base.inl create mode 100644 TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.cpp create mode 100644 TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.h create mode 100644 TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.inl diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h index 1bbb09c554f..efbef29e6a2 100644 --- a/TAO/tao/GIOP_Message_Base.h +++ b/TAO/tao/GIOP_Message_Base.h @@ -30,11 +30,12 @@ class TAO_Pluggable_Reply_Params; /** * @class TAO_GIOP_Message_Base * - * @brief Definitions of GIOP specific stuff + * @brief Definitions of the GIOP specific stuff. * * This class will hold the specific details common to all the GIOP * versions. Some of them which are here may be shifted if things - * start changing between versions + * start changing between versions. This class uses the + * TAO_GIOP_Message_Reactive_Handler to read and parse messages. */ class TAO_Export TAO_GIOP_Message_Base : public TAO_Pluggable_Messaging @@ -79,10 +80,7 @@ public: /// This method reads the message on the connection. Returns 0 when /// there is short read on the connection. Returns 1 when the full /// message is read and handled. Returns -1 on errors. If is - /// 1, then reply is read in a blocking manner. indicates the - /// number of bytes that needs to be read from the connection. - /// GIOP uses this read to unmarshall the message details that appear - /// on the connection. + /// 1, then reply is read in a blocking manner. virtual int read_message (TAO_Transport *transport, int block = 0, ACE_Time_Value *max_wait_time = 0); @@ -122,13 +120,7 @@ public: CORBA::Exception &x ); -private: - - /// Writes the GIOP header in to - /// NOTE: If the GIOP header happens to change in the future, we can - /// push this method in to the generator_parser classes. - int write_protocol_header (TAO_GIOP_Message_Type t, - TAO_OutputCDR &msg); +protected: /// Processes the messages int process_request (TAO_Transport *transport, @@ -140,6 +132,19 @@ private: TAO_ORB_Core *orb_core, TAO_InputCDR &input); + /// Set the state + void set_state (CORBA::Octet major, + CORBA::Octet minor); + +private: + + /// Writes the GIOP header in to + /// NOTE: If the GIOP header happens to change in the future, we can + /// push this method in to the generator_parser classes. + int write_protocol_header (TAO_GIOP_Message_Type t, + TAO_OutputCDR &msg); + + /// Make a and hand that over to the transport so /// that it can be sent over the connection. /// NOTE:As on date 1.1 & 1.2 seem to have similar headers. Till an @@ -151,10 +156,6 @@ private: /// Send error messages int send_error (TAO_Transport *transport); - /// Set the state - void set_state (CORBA::Octet major, - CORBA::Octet minor); - /// Close a connection, first sending GIOP::CloseConnection. void send_close_connection (const TAO_GIOP_Version &version, TAO_Transport *transport, @@ -207,11 +208,13 @@ private: /// A buffer that we will use to initialise the CDR stream char repbuf_[ACE_CDR::DEFAULT_BUFSIZE]; - /// The generator and parser state. - TAO_GIOP_Message_Generator_Parser *generator_parser_; - /// All the implementations of GIOP message generator and parsers TAO_GIOP_Message_Generator_Parser_Impl tao_giop_impl_; + +protected: + + /// The generator and parser state. + TAO_GIOP_Message_Generator_Parser *generator_parser_; }; diff --git a/TAO/tao/GIOP_Message_Reactive_Handler.cpp b/TAO/tao/GIOP_Message_Reactive_Handler.cpp index 2c46dd2c474..a8af560081a 100644 --- a/TAO/tao/GIOP_Message_Reactive_Handler.cpp +++ b/TAO/tao/GIOP_Message_Reactive_Handler.cpp @@ -15,8 +15,8 @@ ACE_RCSID(tao, GIOP_Message_Reactive_Handler, "$Id$") TAO_GIOP_Message_Reactive_Handler::TAO_GIOP_Message_Reactive_Handler (TAO_ORB_Core * orb_core, - TAO_GIOP_Message_Base *base, - size_t input_cdr_size) + TAO_GIOP_Message_Base *base, + size_t input_cdr_size) : message_state_ (orb_core), mesg_base_ (base), message_status_ (TAO_GIOP_WAITING_FOR_HEADER), @@ -103,15 +103,15 @@ TAO_GIOP_Message_Reactive_Handler::parse_message_header (void) { size_t len = this->current_buffer_.length (); char *buf = this->current_buffer_.rd_ptr (); - cout << "Buf is " << buf << endl; + if (len > TAO_GIOP_MESSAGE_HEADER_LEN) { // Parse the GIOP header - if (this->parse_message_header_i (buf, - len) == -1) + if (this->parse_message_header_i (buf) == -1) + return -1; - int retval = this->parse_fragment_header (buf, + int retval = this->parse_fragment_header (buf + TAO_GIOP_MESSAGE_HEADER_LEN, len); // Set the pointer read pointer position in the @@ -125,10 +125,9 @@ TAO_GIOP_Message_Reactive_Handler::parse_message_header (void) pos += TAO_GIOP_MESSAGE_FRAGMENT_HEADER; } - cout << "Poa value is " << pos <current_buffer_.rd_ptr (pos); buf = this->current_buffer_.rd_ptr (); - cout << "Buf is " << buf << endl; + // The GIOP header has been parsed. Set the status to wait for // payload this->message_status_ = TAO_GIOP_WAITING_FOR_PAYLOAD; @@ -150,16 +149,12 @@ TAO_GIOP_Message_Reactive_Handler::is_message_ready (void) { if (this->message_status_ == TAO_GIOP_WAITING_FOR_PAYLOAD) { - cout << "Amba " <current_buffer_.length (); char *buf = this->current_buffer_.rd_ptr (); - cout << "Buff 1" << buf <mesg_base_->dump_msg ( @@ -215,8 +210,7 @@ TAO_GIOP_Message_Reactive_Handler::is_message_ready (void) if (len > TAO_GIOP_MESSAGE_HEADER_LEN) { // @@ What about fragment headers??? - this->current_buffer_.copy ( - this->supp_buffer_.rd_ptr (), + this->current_buffer_.copy (this->supp_buffer_.rd_ptr (), TAO_GIOP_MESSAGE_HEADER_LEN); this->supp_buffer_.rd_ptr (TAO_GIOP_MESSAGE_HEADER_LEN); @@ -224,8 +218,8 @@ TAO_GIOP_Message_Reactive_Handler::is_message_ready (void) len = this->current_buffer_.length (); char *buf = this->current_buffer_.rd_ptr (); - if (this->parse_message_header_i (buf, - len) == -1) + if (this->parse_message_header_i (buf) == -1) + return -1; // Set the pointer read pointer position in the @@ -296,8 +290,7 @@ TAO_GIOP_Message_Reactive_Handler::reset (int reset_flag) int -TAO_GIOP_Message_Reactive_Handler::parse_message_header_i (char *buf, - size_t /*length*/) +TAO_GIOP_Message_Reactive_Handler::parse_message_header_i (char *buf) { if (TAO_debug_level > 8) { @@ -374,10 +367,6 @@ TAO_GIOP_Message_Reactive_Handler::parse_message_header_i (char *buf, this->message_state_.message_size)); } - - - - return 1; } @@ -398,7 +387,6 @@ TAO_GIOP_Message_Reactive_Handler::parse_fragment_header (char *buf, // Fragmented message in GIOP 1.2 should have a fragment header // following the GIOP header. Grab the rd_ptr to get that // info. - buf += TAO_GIOP_MESSAGE_HEADER_LEN; this->message_state_.request_id = this->read_ulong (buf); // As we parsed the header @@ -485,7 +473,7 @@ TAO_GIOP_Message_Reactive_Handler::get_payload_size (char *rd_ptr) } // Set the read pointer to the end of the GIOP message - this->current_buffer_.rd_ptr (TAO_GIOP_MESSAGE_HEADER_LEN); + // this->current_buffer_.rd_ptr (TAO_GIOP_MESSAGE_HEADER_LEN); return x; } diff --git a/TAO/tao/GIOP_Message_Reactive_Handler.h b/TAO/tao/GIOP_Message_Reactive_Handler.h index a3293bd8a8e..70213bd53d3 100644 --- a/TAO/tao/GIOP_Message_Reactive_Handler.h +++ b/TAO/tao/GIOP_Message_Reactive_Handler.h @@ -110,7 +110,7 @@ public: protected: /// Actually parses the header information - int parse_message_header_i (char* buf, size_t length); + int parse_message_header_i (char* buf); /// Parses the GIOP FRAGMENT_HEADER information from the incoming /// stream. diff --git a/TAO/tao/Strategies/GIOP_Message_NonReactive_Base.cpp b/TAO/tao/Strategies/GIOP_Message_NonReactive_Base.cpp new file mode 100644 index 00000000000..a8a2fae1bd7 --- /dev/null +++ b/TAO/tao/Strategies/GIOP_Message_NonReactive_Base.cpp @@ -0,0 +1,115 @@ +#include "GIOP_Message_NonReactive_Base.h" +#include "tao/Leader_Follower.h" + +#if !defined (__ACE_INLINE__) +# include "GIOP_Message_NonReactive_Base.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (Strategies, GIOP_Message_NonReactive_Base, "$Id$") + +TAO_GIOP_Message_NonReactive_Base::TAO_GIOP_Message_NonReactive_Base (TAO_ORB_Core *orb_core, + size_t buf_size) + : TAO_GIOP_Message_Base (orb_core, buf_size), + message_handler_ (orb_core, this, buf_size) +{ + +} + + +int +TAO_GIOP_Message_NonReactive_Base::read_message (TAO_Transport *transport, + int /*block*/, + ACE_Time_Value *max_wait_time) +{ + // Call the handler to read and do a simple parse of the header of + // the message. + int retval = + this->message_handler_.read_parse_message (transport, + max_wait_time); + + + // Error in the message that was received + if (retval == -1) + return -1; + + // Get the message state + TAO_GIOP_Message_State &state = + this->message_handler_.message_state (); + + // Set the state internally for parsing and generating messages + this->set_state (state.giop_version.major, + state.giop_version.minor); + + // We return 2, it is ugly. But the reactor semantics has made us to + // limp :( + return 2; +} + + +int +TAO_GIOP_Message_NonReactive_Base::process_request_message (TAO_Transport *transport, + TAO_ORB_Core *orb_core) +{ + // Set the upcall thread + orb_core->leader_follower ().set_upcall_thread (); + + // We know we have some request message. Check whether it is a + // GIOP_REQUEST or GIOP_LOCATE_REQUEST to take action. + + // Once we send the InputCDR stream we need to just forget about + // the stream and never touch that again for anything. We basically + // loose ownership of the data_block. + + switch (this->message_handler_.message_state ().message_type) + { + case TAO_GIOP_REQUEST: + // Should be taken care by the state specific invocations. They + // could raise an exception or write things in the output CDR + // stream + return this->process_request (transport, + orb_core, + this->message_handler_.input_cdr ()); + + case TAO_GIOP_LOCATEREQUEST: + return this->process_locate_request (transport, + orb_core, + this->message_handler_.input_cdr ()); + default: + return -1; + } +} + +int +TAO_GIOP_Message_NonReactive_Base::process_reply_message ( + TAO_Pluggable_Reply_Params ¶ms + ) +{ + // We know we have some reply message. Check whether it is a + // GIOP_REPLY or GIOP_LOCATE_REPLY to take action. + + // Once we send the InputCDR stream we need to just forget about + // the stream and never touch that again for anything. We basically + // loose ownership of the data_block. + + switch (this->message_handler_.message_state ().message_type) + { + case TAO_GIOP_REPLY: + // Should be taken care by the state specific parsing + return this->generator_parser_->parse_reply (this->message_handler_.input_cdr (), + params); + + case TAO_GIOP_LOCATEREPLY: + return this->generator_parser_->parse_locate_reply (this->message_handler_.input_cdr (), + params); + default: + return -1; + } +} + + +int +TAO_GIOP_Message_NonReactive_Base::more_messages (void) +{ + ///@@@ + return 0; +} diff --git a/TAO/tao/Strategies/GIOP_Message_NonReactive_Base.h b/TAO/tao/Strategies/GIOP_Message_NonReactive_Base.h new file mode 100644 index 00000000000..206855db3e5 --- /dev/null +++ b/TAO/tao/Strategies/GIOP_Message_NonReactive_Base.h @@ -0,0 +1,84 @@ +// -*- C++ -*- +// +// =================================================================== +/** + * @file GIOP_Message_NonReactive_Base.h + * + * $Id$ + * + * @author Balachandran Natarajan + */ +// =================================================================== + +#ifndef TAO_GIOP_MESSAGE_NONREACTIVE_BASE_H +#define TAO_GIOP_MESSAGE_NONREACTIVE_BASE_H +#include "ace/pre.h" +#include "strategies_export.h" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "GIOP_Message_NonReactive_Handler.h" +#include "tao/GIOP_Message_Base.h" + + +class TAO_Pluggable_Reply_Params; + +/** + * @class TAO_GIOP_Message_NonReactive_Base + * + * @brief Uses the NonReactive handler class for reading messages. + * + * This class uses the TAO_GIOP_Message_NonReactive_Handler class to + * read and parse messages. This class derives from + * TAO_GIOP_Message_Base. It just redirects most of the functions to + * the base class but just acts as a sort of place holder for the + * NonReactive handler class. + */ + +class TAO_Strategies_Export TAO_GIOP_Message_NonReactive_Base :public TAO_GIOP_Message_Base +{ +public: + /// Constructor + TAO_GIOP_Message_NonReactive_Base (TAO_ORB_Core *orb_core, + size_t cdr_size = ACE_CDR::DEFAULT_BUFSIZE); + + + /// This method reads the message on the connection. Returns 0 when + /// there is short read on the connection. Returns 1 when the full + /// message is read and handled. Returns -1 on errors. is + /// not used. + virtual int read_message (TAO_Transport *transport, + int block = 0, + ACE_Time_Value *max_wait_time = 0); + + + /// Process the request message that we have received on the + /// connection + virtual int process_request_message (TAO_Transport *transport, + TAO_ORB_Core *orb_core); + + /// Parse the reply message that we received and return the reply + /// information though + virtual int process_reply_message ( + TAO_Pluggable_Reply_Params &reply_info + ); + + /// Are there any more pieces that needs to be read to make a full + /// message? + virtual int more_messages (void); + +private: + + /// Thr message handler object that does reading and parsing of the + /// incoming messages + TAO_GIOP_Message_NonReactive_Handler message_handler_; +}; + +#if defined (__ACE_INLINE__) +# include "GIOP_Message_NonReactive_Base.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /*TAO_GIOP_MESSAGE_NONREACTIVE_BASE_H*/ diff --git a/TAO/tao/Strategies/GIOP_Message_NonReactive_Base.inl b/TAO/tao/Strategies/GIOP_Message_NonReactive_Base.inl new file mode 100644 index 00000000000..18ebe00d5af --- /dev/null +++ b/TAO/tao/Strategies/GIOP_Message_NonReactive_Base.inl @@ -0,0 +1 @@ +//$Id$ \ No newline at end of file diff --git a/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.cpp b/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.cpp new file mode 100644 index 00000000000..13752ef6b42 --- /dev/null +++ b/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.cpp @@ -0,0 +1,157 @@ +#include "GIOP_Message_NonReactive_Handler.h" +#include "GIOP_Message_NonReactive_Base.h" +#include "tao/ORB_Core.h" +#include "tao/CDR.h" +#include "tao/debug.h" + + +#if !defined (__ACE_INLINE__) +# include "GIOP_Message_NonReactive_Handler.inl" +#endif /* __ACE_INLINE__ */ + + +ACE_RCSID (tao, GIOP_Message_NonReactive_Handler, "$Id$") + + +TAO_GIOP_Message_NonReactive_Handler::TAO_GIOP_Message_NonReactive_Handler (TAO_ORB_Core *orb_core, + TAO_GIOP_Message_NonReactive_Base *mesg_base, + size_t cdr_size) + : TAO_GIOP_Message_Reactive_Handler (orb_core, + mesg_base, + cdr_size), + input_cdr_ (orb_core->data_block_for_message_block (cdr_size)) +{ +} + +int +TAO_GIOP_Message_NonReactive_Handler::read_parse_message(TAO_Transport *transport, + ACE_Time_Value *max_wait_time) +{ + char *buf = this->input_cdr_.rd_ptr (); + + // This is of the following pieces: + // - We first read the GIOP header and parse the information. We + // also get the size of the incoming message. We grow the size of + // the CDR if needed + // - We read the information/message in toto. + if (this->read_message (transport, + buf, + TAO_GIOP_MESSAGE_HEADER_LEN, + max_wait_time) == -1) + { + if (TAO_debug_level > 1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) : (%N | %l) \n") + ACE_TEXT ("Error during header read \n"))); + return -1; + } + + // Parse the message header + if (this->parse_message_header_i (buf) == -1) + { + if (TAO_debug_level > 2) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) : (%N|%l)\n") + ACE_TEXT ("Error while parsing GIOP header \n"))); + } + return -1; + } + // Reset the byte order now + this->input_cdr_.reset_byte_order (this->message_state_.byte_order); + + // Calculate the message size to grow the CDR + size_t msg_size = + this->message_state_.message_size + + TAO_GIOP_MESSAGE_HEADER_LEN; + + // With GIOP 1.2 we should get a fragment header + if (this->message_state_.more_fragments && + this->message_state_.giop_version.minor == 2) + { + msg_size += TAO_GIOP_MESSAGE_FRAGMENT_HEADER; + } + + // Grow the CDR + if (this->input_cdr_.grow (msg_size) == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Failure to grow the CDR buffers \n") + ACE_TEXT ("(%P|%t) to the right size"))); + return -1; + } + + // Growing the CDR would have reset our read pointer, so set it back + // to the right position + if (this->input_cdr_.skip_bytes (TAO_GIOP_MESSAGE_HEADER_LEN) == 0) + { + if (TAO_debug_level> 3) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Failure to skip the right bytes \n") + ACE_TEXT ("(%P|%t) in the CDR stream"))); + return -1; + } + + // Read the rest of the message + if (this->read_message (transport, + buf, + msg_size, + max_wait_time) == -1) + { + if (TAO_debug_level > 1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) : (%N | %l) \n") + ACE_TEXT ("Error during message read \n"))); + return -1; + } + + // Parse the GIOP fragment header. + if (this->parse_fragment_header (this->input_cdr_.rd_ptr (), + this->input_cdr_.length ())) + { + // We had a GIOP fragment header, so skip few more bytes. + if (this->input_cdr_.skip_bytes (TAO_GIOP_MESSAGE_FRAGMENT_HEADER) == 0) + { + if (TAO_debug_level> 3) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Failure to skip the right bytes \n") + ACE_TEXT ("(%P|%t) in the CDR stream [2]"))); + return -1; + } + } + + // Now we have parsed almost every thing that is part of the GIOP + // header. Return a succes value + + return 0; +} + + +int +TAO_GIOP_Message_NonReactive_Handler::read_message (TAO_Transport *transport, + char *buf, + size_t size, + ACE_Time_Value *max_wait_time) +{ + ssize_t bytes = 0; + + // As this used for transports where things are available in one + // shot this looping should not create any problems. + for (size_t n = size; + n != 0; + n -= bytes) + { + bytes = transport->recv_n (buf, + n, + max_wait_time); + + // @@ Do we need to check for errno != EWOULDBLOCK?? and errno == + // @@ ECONNRESET. Does such things make sense here?? + if (bytes == 0 || + bytes == -1) + return bytes; + buf += bytes; + } + + return 1; +} diff --git a/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.h b/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.h new file mode 100644 index 00000000000..a47f475b63e --- /dev/null +++ b/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.h @@ -0,0 +1,84 @@ +// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- +// =================================================================== +/** + * @file GIOP_Message_Reactive_Handler.h + * + * $Id$ + * + * @author Balachandran Natarajan + **/ +// =================================================================== + +#ifndef TAO_GIOP_MESSAGE_NON_REACTIVE_HANDLER_H +#define TAO_GIOP_MESSAGE_NON_REACTIVE_HANDLER_H +#include "ace/pre.h" + +#include "tao/CDR.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/GIOP_Message_Reactive_Handler.h" + +class TAO_Transport; +class TAO_ORB_Core; +class TAO_GIOP_Message_NonReactive_Base; + + + +/** + * @class TAO_GIOP_Message_NonReactive_Handler + * + * @brief GIOP specific non-reactive message handler class + * + * This class does some of the message handling for GIOP. The class + * is non-reactive, in the sense that the read calls on the socket + * wait till all the data relevant for a GIOP message is read. This + * strategy can be used by protocols which uses the reactor for + * signaling rather than for data arrival. + * + * @todo Need to investigate why this strategy would be required at a + * higher level?? + */ + +class TAO_GIOP_Message_NonReactive_Handler : public TAO_GIOP_Message_Reactive_Handler +{ +public: + + /// Ctor + TAO_GIOP_Message_NonReactive_Handler (TAO_ORB_Core *orb_core, + TAO_GIOP_Message_NonReactive_Base *mesg_base, + size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE); + + /// This call reads the message out of the socket and does parsing + /// of the GIOP header. + int read_parse_message (TAO_Transport *transport, + ACE_Time_Value *max_wait_time = 0); + + /// Return the CDR stream + TAO_InputCDR &input_cdr (void); + +private: + + /// Helper function that reads data from the transport to the buffer + /// pointed by of size . We assume that the transport + /// has been set in the blocking mode for reading. Read is performed + /// as long as we get all the data. + int read_message (TAO_Transport *transport, + char *buf, + size_t size, + ACE_Time_Value *max_wait_time); + +private: + /// The input cdr stream in which the incoming data is stored. + TAO_InputCDR input_cdr_; +}; + +#if defined (__ACE_INLINE__) +# include "GIOP_Message_NonReactive_Handler.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /*TAO_GIOP_MESSAGE_NON_REACTIVE_HANDLER_H*/ diff --git a/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.inl b/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.inl new file mode 100644 index 00000000000..28c0d64393b --- /dev/null +++ b/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.inl @@ -0,0 +1,7 @@ +//$Id$ + +ACE_INLINE TAO_InputCDR & +TAO_GIOP_Message_NonReactive_Handler::input_cdr (void) +{ + return this->input_cdr_; +} diff --git a/TAO/tao/Strategies/TAO_Strategies.dsp b/TAO/tao/Strategies/TAO_Strategies.dsp index cc2ebed5649..5743d911718 100644 --- a/TAO/tao/Strategies/TAO_Strategies.dsp +++ b/TAO/tao/Strategies/TAO_Strategies.dsp @@ -102,6 +102,14 @@ SOURCE=.\Direct_Priority_Mapping.cpp # End Source File # Begin Source File +SOURCE=.\GIOP_Message_NonReactive_Base.cpp +# End Source File +# Begin Source File + +SOURCE=.\GIOP_Message_NonReactive_Handler.cpp +# End Source File +# Begin Source File + SOURCE=.\Linear_Priority_Mapping.cpp # End Source File # Begin Source File @@ -190,6 +198,14 @@ SOURCE=.\Direct_Priority_Mapping.h # End Source File # Begin Source File +SOURCE=.\GIOP_Message_NonReactive_Base.h +# End Source File +# Begin Source File + +SOURCE=.\GIOP_Message_NonReactive_Handler.h +# End Source File +# Begin Source File + SOURCE=.\Linear_Priority_Mapping.h # End Source File # Begin Source File @@ -294,6 +310,14 @@ SOURCE=.\Direct_Priority_Mapping.i # End Source File # Begin Source File +SOURCE=.\GIOP_Message_NonReactive_Base.inl +# End Source File +# Begin Source File + +SOURCE=.\GIOP_Message_NonReactive_Handler.inl +# End Source File +# Begin Source File + SOURCE=.\Linear_Priority_Mapping.i # End Source File # Begin Source File diff --git a/TAO/tao/TAO.dsp b/TAO/tao/TAO.dsp index e1ae786dc73..fe83f21c695 100644 --- a/TAO/tao/TAO.dsp +++ b/TAO/tao/TAO.dsp @@ -399,15 +399,15 @@ SOURCE=.\GIOP_Message_Generator_Parser_Impl.cpp # End Source File # Begin Source File -SOURCE=.\GIOP_Message_Handler.cpp +SOURCE=.\GIOP_Message_Lite.cpp # End Source File # Begin Source File -SOURCE=.\GIOP_Message_Lite.cpp +SOURCE=.\GIOP_Message_Locate_Header.cpp # End Source File # Begin Source File -SOURCE=.\GIOP_Message_Locate_Header.cpp +SOURCE=.\GIOP_Message_Reactive_Handler.cpp # End Source File # Begin Source File @@ -1163,15 +1163,15 @@ SOURCE=.\GIOP_Message_Generator_Parser_Impl.h # End Source File # Begin Source File -SOURCE=.\GIOP_Message_Handler.h +SOURCE=.\GIOP_Message_Lite.h # End Source File # Begin Source File -SOURCE=.\GIOP_Message_Lite.h +SOURCE=.\GIOP_Message_Locate_Header.h # End Source File # Begin Source File -SOURCE=.\GIOP_Message_Locate_Header.h +SOURCE=.\GIOP_Message_Reactive_Handler.h # End Source File # Begin Source File @@ -1923,15 +1923,15 @@ SOURCE=.\GIOP_Message_Generator_Parser_Impl.inl # End Source File # Begin Source File -SOURCE=.\GIOP_Message_Handler.inl +SOURCE=.\GIOP_Message_Lite.i # End Source File # Begin Source File -SOURCE=.\GIOP_Message_Lite.i +SOURCE=.\GIOP_Message_Locate_Header.i # End Source File # Begin Source File -SOURCE=.\GIOP_Message_Locate_Header.i +SOURCE=.\GIOP_Message_Reactive_Handler.inl # End Source File # Begin Source File diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index 3adc1a2c916..bf8f63fb490 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -717,6 +717,31 @@ TAO_Transport::recv (char *buffer, return this->recv_i (buffer, len, timeout); } +ssize_t +TAO_Transport::recv_n (char *buffer, + size_t len, + const ACE_Time_Value *timeout) +{ + ACE_MT (ACE_GUARD_RETURN (ACE_Lock, + guard, + *this->handler_lock_, + -1)); + + if (this->check_event_handler_i ("TAO_Transport::recv") == -1) + return -1; + + // now call the template method + return this->recv_n_i (buffer, len, timeout); +} + +ssize_t +TAO_Transport::recv_n_i (char *buffer, + size_t len, + const ACE_Time_Value *timeout) +{ + +} + int TAO_Transport::generate_locate_request ( TAO_Target_Specification &spec, diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h index 68f674088de..77f7c4b1c40 100644 --- a/TAO/tao/Transport.h +++ b/TAO/tao/Transport.h @@ -330,6 +330,20 @@ public: size_t len, const ACE_Time_Value *timeout = 0); + /// Read len bytes from into buf, by calling recv_n + /** + * This method serializes on handler_lock_, guaranteeing that only + * thread can execute it on the same instance concurrently. + * + * @param buffer ORB allocated buffer where the data should be + * @@ The ACE_Time_Value *s is just a place holder for now. It is + * not clear this this is the best place to specify this. The actual + * timeout values will be kept in the Policies. + */ + ssize_t recv_n (char *buffer, + size_t len, + const ACE_Time_Value *timeout = 0); + /// Return the identifier for this transport instance. /** @@ -420,6 +434,17 @@ protected: size_t len, const ACE_Time_Value *timeout = 0) = 0; + // Read len bytes from into buf, by calling recv_n () + /** + * @param buffer ORB allocated buffer where the data should be + * @@ The ACE_Time_Value *s is just a place holder for now. It is + * not clear this this is the best place to specify this. The actual + * timeout values will be kept in the Policies. + */ + virtual ssize_t recv_n_i (char *buffer, + size_t len, + const ACE_Time_Value *timeout = 0); + public: /// This is a request for the transport object to write a -- cgit v1.2.1