summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-12-14 16:03:49 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-12-14 16:03:49 +0000
commitbfaba70db6a992daae0aeef971c179622e3cb125 (patch)
tree0ed5f4f4b1c95c245a4cdf7cc2589f3eceedcd07
parent124485ce86061e9a8b2b69085da0c570e15ae211 (diff)
downloadATCD-bfaba70db6a992daae0aeef971c179622e3cb125.tar.gz
This commit was manufactured by cvs2svn to create branch
'unlabeled-1.24.2'.
-rw-r--r--TAO/tao/Pluggable_Messaging.h188
-rw-r--r--TAO/tao/Strategies/SHMIOP_Transport.h129
2 files changed, 317 insertions, 0 deletions
diff --git a/TAO/tao/Pluggable_Messaging.h b/TAO/tao/Pluggable_Messaging.h
new file mode 100644
index 00000000000..8ac38de01e0
--- /dev/null
+++ b/TAO/tao/Pluggable_Messaging.h
@@ -0,0 +1,188 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Pluggable_Messaging.h
+ *
+ * $Id$
+ *
+ * Interface for the TAO pluggable messaging framework.
+ *
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_PLUGGABLE_MESSAGING_H
+#define TAO_PLUGGABLE_MESSAGING_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+namespace CORBA
+{
+ class Exception;
+}
+
+class TAO_Target_Specification;
+class TAO_Pluggable_Reply_Params;
+class TAO_Pluggable_Reply_Params_Base;
+class TAO_Transport;
+class TAO_Operation_Details;
+class TAO_Target_Specification;
+class TAO_OutputCDR;
+class TAO_Queued_Data;
+
+class ACE_Time_Value;
+
+// @@ The more I think I about this class, I feel that this class need
+// not be a ABC as it is now. Instead we have these options
+// (1) Parametrize this class with the "Messaging Object". Then the
+// implementations can just redirect the request to the class
+// that it has been specialised with
+// (2) Use a bridge pattern here ie. the interface exposed by this
+// class will redirect the request to the implementation which
+// would be "right messaging" object.
+// Both of them feasible. If we are not going like templates much, (2)
+// is seems to be a better option.
+// I am going to take a closer look on this after my MS defense -
+// Bala
+
+/**
+ * @class TAO_Pluggable_Messaging
+ *
+ * @brief Generic definitions Messaging class.
+ *
+ * This interface tries to define generic methods that could be
+ * different messaging protocols
+ */
+class TAO_Export TAO_Pluggable_Messaging
+{
+public:
+ /// Dtor
+ virtual ~TAO_Pluggable_Messaging (void);
+
+ /// Write the RequestHeader in to the <cdr> stream. The underlying
+ /// implementation of the mesaging should do the right thing.
+ virtual int generate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr) = 0;
+
+ /// Write the RequestHeader in to the <cdr> stream.
+ virtual int generate_locate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr) = 0;
+
+ /**
+ * Write the reply header
+ * The reply header is a part of any messaging protocol. The
+ * messaging protocol implementation would implement the way the
+ * reply header is written.
+ */
+ virtual int generate_reply_header (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params) = 0;
+
+ /**
+ * Write the locate reply header
+ * The locate reply header is a part of any messaging protocol. The
+ * messaging protocol implementation would implement the way the
+ * locate reply header is written.
+ */
+ virtual int generate_locate_reply_header (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params) = 0;
+
+ /**
+ * 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 <block> is
+ * 1, then reply is read in a blocking manner. <bytes> indicates the
+ * number of bytes that needs to be read from the connection.
+ */
+ virtual int read_message (TAO_Transport *transport,
+ int block = 0,
+ ACE_Time_Value *max_wait_time = 0) = 0;
+
+ /// Format the message in the <cdr>. May not be needed in
+ /// general.
+ virtual int format_message (TAO_OutputCDR &cdr) = 0;
+
+ /// Do any initialisations that may be needed.
+ virtual void init (CORBA::Octet major,
+ CORBA::Octet minor) = 0;
+
+ /// Parse the incoming messages..
+ virtual int parse_incoming_messages (ACE_Message_Block &message_block) = 0;
+
+ /// Calculate the amount of data that is missing in the <incoming>
+ /// message block.
+ virtual ssize_t missing_data (ACE_Message_Block &incoming) = 0;
+
+ /// Get the details of the message parsed through the <qd>.
+ virtual void get_message_data (TAO_Queued_Data *qd) = 0;
+
+ /* Extract the details of the next message from the <incoming>
+ * through <qd>. Returns 1 if there are more messages and returns a
+ * 0 if there are no more messages in <incoming>.
+ */
+ virtual int extract_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data *&qd) = 0;
+
+ /// Check whether the node <qd> needs consolidation from <incoming>
+ virtual int consolidate_node (TAO_Queued_Data *qd,
+ ACE_Message_Block &incoming) = 0;
+
+ /// @@Bala:Docu??
+ virtual int consolidate_fragments (TAO_Queued_Data *dqd,
+ const TAO_Queued_Data *sqd) = 0;
+
+ /// Parse the request message, make an upcall and send the reply back
+ /// to the "request initiator"
+ virtual int process_request_message (TAO_Transport *transport,
+ TAO_Queued_Data *qd) = 0;
+
+
+ /// Parse the reply message that we received and return the reply
+ /// information though <reply_info>
+ virtual int process_reply_message (
+ TAO_Pluggable_Reply_Params &reply_info,
+ TAO_Queued_Data *qd) = 0;
+
+
+ /// Generate a reply message with the exception <ex>.
+ virtual int generate_exception_reply (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params,
+ CORBA::Exception &x) = 0;
+
+ /// Is the messaging object ready for processing BiDirectional
+ /// request/response?
+ virtual int is_ready_for_bidirectional (TAO_OutputCDR &msg) = 0;
+
+ /// Reset the messaging the object
+ virtual void reset (void) = 0;
+
+ /// Header length
+ virtual size_t header_length (void) const = 0;
+
+ /// Accessor for the output CDR stream
+ virtual TAO_OutputCDR &out_stream (void) = 0;
+};
+
+#if defined (__ACE_INLINE__)
+# include "tao/Pluggable_Messaging.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_PLUGGABLE_MESSAGING_H*/
diff --git a/TAO/tao/Strategies/SHMIOP_Transport.h b/TAO/tao/Strategies/SHMIOP_Transport.h
new file mode 100644
index 00000000000..02c67c63116
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Transport.h
@@ -0,0 +1,129 @@
+// This may look like C, but it's really -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file SHMIOP_Transport.h
+ *
+ * $Id$
+ *
+ * @author Originally by Nanbor Wang <nanbor@cs.wustl.edu>
+ * @author Modified by Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_SHMIOP_TRANSPORT_H
+#define TAO_SHMIOP_TRANSPORT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "strategies_export.h"
+#include "ace/Svc_Handler.h"
+#include "ace/MEM_Stream.h"
+#include "tao/Transport.h"
+
+class TAO_SHMIOP_Connection_Handler;
+class TAO_Pluggable_Messaging;
+class TAO_Target_Specification;
+class Tao_Operation_Details;
+
+typedef ACE_Svc_Handler<ACE_MEM_STREAM, ACE_NULL_SYNCH>
+ TAO_SHMIOP_SVC_HANDLER;
+
+#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+template class TAO_Strategies_Export ACE_Svc_Handler<ACE_MEM_STREAM, ACE_NULL_SYNCH>;
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
+
+/**
+ * @class TAO_SHMIOP_Transport
+ *
+ * @brief Specialization of the base TAO_Transport class to handle the
+ * SHMIOP protocol.
+ *
+ */
+
+class TAO_Strategies_Export TAO_SHMIOP_Transport : public TAO_Transport
+{
+public:
+
+ /// Constructor.
+ TAO_SHMIOP_Transport (TAO_SHMIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Default destructor.
+ ~TAO_SHMIOP_Transport (void);
+
+protected:
+ /**
+ * @name Overridden Template Methods
+ *
+ * These are implementations of template methods declared by TAO_Transport.
+ */
+ //@{
+ virtual ACE_Event_Handler * event_handler_i (void);
+ virtual TAO_Connection_Handler *connection_handler_i (void);
+ virtual TAO_Pluggable_Messaging *messaging_object (void);
+
+ /// Write the complete Message_Block chain to the connection.
+ virtual ssize_t send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *timeout = 0);
+
+ /// Read len bytes from into buf.
+ virtual ssize_t recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *s = 0);
+
+ virtual int consolidate_message (ACE_Message_Block &incoming,
+ ssize_t missing_data,
+ TAO_Resume_Handle &rh,
+ ACE_Time_Value *max_wait_time);
+
+ //@}
+
+public:
+ /// @todo These methods IMHO should have more meaningful names.
+ /// The names seem to indicate nothing.
+ virtual int send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time);
+
+ virtual int send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub = 0,
+ int message_semantics = TAO_Transport::TAO_TWOWAY_REQUEST,
+ ACE_Time_Value *max_time_wait = 0);
+
+ /// Initialising the messaging object
+ virtual int messaging_init (CORBA::Octet major,
+ CORBA::Octet minor);
+
+private:
+ /// The connection service handler used for accessing lower layer
+ /// communication protocols.
+ TAO_SHMIOP_Connection_Handler *connection_handler_;
+
+ /// Our messaging object.
+ TAO_Pluggable_Messaging *messaging_object_;
+};
+
+
+
+#if defined (__ACE_INLINE__)
+#include "SHMIOP_Transport.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SHMIOP_TRANSPORT_H */