summaryrefslogtreecommitdiff
path: root/TAO/tao/Transport_Mux_Strategy.h
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/Transport_Mux_Strategy.h')
-rw-r--r--TAO/tao/Transport_Mux_Strategy.h137
1 files changed, 116 insertions, 21 deletions
diff --git a/TAO/tao/Transport_Mux_Strategy.h b/TAO/tao/Transport_Mux_Strategy.h
index 8cdb605aec9..6c13a03e73d 100644
--- a/TAO/tao/Transport_Mux_Strategy.h
+++ b/TAO/tao/Transport_Mux_Strategy.h
@@ -1,3 +1,4 @@
+// This may look like C, but it's really -*- C++ -*-
// $Id$
// ============================================================================
@@ -25,6 +26,9 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+#include "ace/Functor.h"
+#include "ace/Hash_Map_Manager.h"
+
class TAO_Reply_Dispatcher;
class TAO_Export TAO_Transport_Mux_Strategy
@@ -37,7 +41,7 @@ class TAO_Export TAO_Transport_Mux_Strategy
//
// = DESCRIPTION
//
-
+
public:
TAO_Transport_Mux_Strategy (void);
// Base class constructor.
@@ -50,13 +54,12 @@ public:
// invocation.
// = Bind and Find methods for the <Request ID, ReplyDispatcher>
- // pairs. The ReplyDispatcher is not the CORBA ReplyDispatcher of
- // the AMI's.
+ // pairs.
virtual int bind_dispatcher (CORBA::ULong request_id,
- TAO_Reply_Dispatcher *rh) = 0;
+ TAO_Reply_Dispatcher *rd) = 0;
// Bind the dispatcher with the request id.
-
+
virtual int dispatch_reply (CORBA::ULong request_id,
CORBA::ULong reply_status,
const TAO_GIOP_Version& version,
@@ -74,78 +77,170 @@ public:
virtual void destroy_message_state (TAO_GIOP_Message_State *) = 0;
// Destroy a CDR stream.
+
+ virtual int idle_after_send (TAO_Transport *) = 0;
+ // Request has been just sent, but the reply is not received. Idle
+ // the transport now.
+
+ virtual int idle_after_reply (TAO_Transport *) = 0;
+ // Request is sent and the reply is received. Idle the transport
+ // now.
+
+ virtual int reply_received (const CORBA::ULong request_id) = 0;
+ // Check whether the reply has been receieved for the request with
+ // <request_id>. Return 0 if no, 1 on yes and -1 if the request_id
+ // is invalid or there are some errors.
};
-class TAO_Export TAO_Muxed_TMS : public TAO_Transport_Mux_Strategy
+// *********************************************************************
+
+class TAO_Export TAO_Exclusive_TMS : public TAO_Transport_Mux_Strategy
{
// = TITLE
//
- // Connection is multiplexed for many requests.
+ // Connection exclusive for the request.
//
// = DESCRIPTION
//
public:
- TAO_Muxed_TMS (void);
+ TAO_Exclusive_TMS (TAO_ORB_Core *orb_core);
// Constructor.
- virtual ~TAO_Muxed_TMS (void);
+ virtual ~TAO_Exclusive_TMS (void);
// Destructor.
- // = The TAO Request Strategy methods...
virtual CORBA::ULong request_id (void);
+ // Generate and return an unique request id for the current
+ // invocation.
+
virtual int bind_dispatcher (CORBA::ULong request_id,
TAO_Reply_Dispatcher *rh);
+ // Bind the dispatcher with the request id.
+
virtual int dispatch_reply (CORBA::ULong request_id,
CORBA::ULong reply_status,
const TAO_GIOP_Version& version,
TAO_GIOP_ServiceContextList& reply_ctx,
TAO_GIOP_Message_State* message_state);
+ // Dispatch the reply for <request_id>, cleanup any resources
+ // allocated for that request.
+
virtual TAO_GIOP_Message_State *get_message_state (void);
+ // Return the pre-allocated message state.
+
virtual void destroy_message_state (TAO_GIOP_Message_State *);
+ // No op in this strategy.
+
+ virtual int idle_after_send (TAO_Transport *transport);
+ // Request has been just sent, but the reply is not received. Idle
+ // the transport now.
+
+ virtual int idle_after_reply (TAO_Transport *transport);
+ // Request is sent and the reply is received. Idle the transport
+ // now.
+
+ virtual int reply_received (const CORBA::ULong request_id);
+ // Check whether the reply has been receieved for the request with
+ // <request_id>. Return 0 if no, 1 on yes and -1 if the request_id
+ // is invalid or there are errors.
protected:
- // @@ HASH TABLE???
+ CORBA::ULong request_id_generator_;
+ // Used to generate a different request_id on each call to
+ // request_id().
+
+ CORBA::ULong request_id_;
+ // Request id for the current request.
+
+ TAO_Reply_Dispatcher *rd_;
+ // Reply Dispatcher corresponding to the request.
+
+ TAO_GIOP_Message_State message_state_;
+ // Message state to read the incoming message.
};
-class TAO_Export TAO_Exclusive_TMS : public TAO_Transport_Mux_Strategy
+// *********************************************************************
+
+class TAO_Export TAO_Muxed_TMS : public TAO_Transport_Mux_Strategy
{
// = TITLE
//
- // Connection exclusive for the request.
+ // Connection is multiplexed for many requests.
//
// = DESCRIPTION
//
public:
- TAO_Exclusive_TMS (void);
+ TAO_Muxed_TMS (TAO_ORB_Core *orb_core);
// Constructor.
- virtual ~TAO_Exclusive_TMS (void);
+ virtual ~TAO_Muxed_TMS (void);
// Destructor.
- // = The TAO Request Strategy methods...
virtual CORBA::ULong request_id (void);
+ // Generate and return an unique request id for the current
+ // invocation.
+
virtual int bind_dispatcher (CORBA::ULong request_id,
TAO_Reply_Dispatcher *rh);
+ // Bind the dispatcher with the request id.
+
virtual int dispatch_reply (CORBA::ULong request_id,
CORBA::ULong reply_status,
const TAO_GIOP_Version& version,
TAO_GIOP_ServiceContextList& reply_ctx,
TAO_GIOP_Message_State* message_state);
+ // Dispatch the reply for <request_id>, cleanup any resources
+ // allocated for that request.
+
virtual TAO_GIOP_Message_State *get_message_state (void);
+ // Return the message state.
+
virtual void destroy_message_state (TAO_GIOP_Message_State *);
+ // No op in this strategy.
+
+ virtual int idle_after_send (TAO_Transport *transport);
+ // Request has been just sent, but the reply is not received. Idle
+ // the transport now.
+
+ virtual int idle_after_reply (TAO_Transport *transport);
+ // Request is sent and the reply is received. Idle the transport
+ // now.
+
+ virtual int reply_received (const CORBA::ULong request_id);
+ // Check whether the reply has been receieved for the request with
+ // <request_id>. Return 0 if no, 1 on yes and -1 if the request_id
+ // is invalid or there are errors.
protected:
CORBA::ULong request_id_generator_;
// Used to generate a different request_id on each call to
- // request_id()
+ // request_id().
- CORBA::ULong request_id_;
- // Request id for the current request.
+ ACE_SYNCH_MUTEX request_id_lock_;
+ // Lock to protect the state of the request id generator.
- TAO_Reply_Dispatcher *rd_;
- // Reply Dispatcher corresponding to the request.
+ typedef ACE_Hash_Map_Manager_Ex <CORBA::ULong,
+ TAO_Reply_Dispatcher *,
+ ACE_Hash <CORBA::ULong>,
+ ACE_Equal_To <CORBA::ULong>,
+ ACE_SYNCH_MUTEX> REQUEST_DISPATCHER_TABLE;
+
+ REQUEST_DISPATCHER_TABLE dispatcher_table_;
+ // Table of <Request ID, Reply Dispatcher> pairs.
+
+ TAO_ORB_Core *orb_core_;
+ // Keep track of the orb core pointer. We need to this to create the
+ // Reply Dispatchers.
+
+ TAO_GIOP_Message_State *message_state_;
+ // Message state where the current input message is being read. This
+ // is created at start of each incoming message. When that message
+ // is read, the message is processed and for the next message a new
+ // message state is created.
};
+// *********************************************************************
+
#endif /* TRANSPORT_MUX_STRATEGY_H */