00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Transport_Mux_Strategy.h 00006 * 00007 * $Id: Transport_Mux_Strategy.h 85001 2009-03-31 10:06:45Z msmit $ 00008 * 00009 * @author Alexander Babu Arulanthu <alex@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_TRANSPORT_MUX_STRATEGY_H 00014 #define TAO_TRANSPORT_MUX_STRATEGY_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include /**/ "tao/TAO_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/Basic_Types.h" 00025 #include "tao/Reply_Dispatcher.h" 00026 00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00028 class ACE_Lock; 00029 ACE_END_VERSIONED_NAMESPACE_DECL 00030 00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 class TAO_Transport; 00034 class TAO_Pluggable_Reply_Params; 00035 00036 /** 00037 * @class TAO_Transport_Mux_Strategy 00038 * 00039 * @brief Strategy to determine whether the connection should be 00040 * multiplexed for multiple requests or it is exclusive for a 00041 * single request at a time. 00042 * 00043 */ 00044 class TAO_Export TAO_Transport_Mux_Strategy 00045 { 00046 00047 public: 00048 /// Base class constructor. 00049 TAO_Transport_Mux_Strategy (TAO_Transport *transport); 00050 00051 /// Base class destructor. 00052 virtual ~TAO_Transport_Mux_Strategy (void); 00053 00054 /// Generate and return an unique request id for the current 00055 /// invocation. 00056 virtual CORBA::ULong request_id (void) = 0; 00057 00058 /// Bind the dispatcher with the request id. Commonalities in the 00059 /// derived class implementations is kept here. 00060 virtual int bind_dispatcher (CORBA::ULong request_id, 00061 ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd) = 0; 00062 00063 /** 00064 * Unbind the dispatcher, the client is no longer waiting for the 00065 * request, for example, because the request timedout. 00066 * The strategy can (must) cleanup any resources associated with the 00067 * request. 00068 * A later reply for that request should be ignored. 00069 */ 00070 virtual int unbind_dispatcher (CORBA::ULong request_id) = 0; 00071 00072 /** 00073 * Dispatch a reply timeout for request @a request_id 00074 **/ 00075 virtual int reply_timed_out (CORBA::ULong request_id) = 0; 00076 00077 /// Dispatch the reply for request_id, cleanup any resources 00078 /// allocated for that request. 00079 virtual int dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) = 0; 00080 00081 /// Request has been just sent, but the reply is not received. Idle 00082 /// the transport now. The return value indicates whether idling was 00083 /// successful or not. 00084 virtual bool idle_after_send (void) = 0; 00085 00086 /// Request is sent and the reply is received. Idle the transport 00087 /// now. The return value indicates whether idling was successful or 00088 /// not. 00089 virtual bool idle_after_reply (void) = 0; 00090 00091 /// The transport object has closed the connection, inform all Reply 00092 /// dispatchers and waiting strategies. 00093 virtual void connection_closed (void) = 0; 00094 00095 /// Do we have a request pending 00096 virtual bool has_request (void) = 0; 00097 00098 protected: 00099 /// Cache the transport reference. 00100 TAO_Transport *transport_; 00101 }; 00102 00103 TAO_END_VERSIONED_NAMESPACE_DECL 00104 00105 #include /**/ "ace/post.h" 00106 00107 #endif /* TRANSPORT_MUX_STRATEGY_H */