00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Transport_Mux_Strategy.h 00006 * 00007 * $Id: Transport_Mux_Strategy.h 78997 2007-07-23 12:21:34Z johnnyw $ 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 00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00027 class ACE_Lock; 00028 ACE_END_VERSIONED_NAMESPACE_DECL 00029 00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00031 00032 class TAO_Reply_Dispatcher; 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 and Find methods for the <Request ID, ReplyDispatcher> 00059 // pairs. 00060 00061 /// Bind the dispatcher with the request id. Commonalities in the 00062 /// derived class implementations is kept here. 00063 virtual int bind_dispatcher (CORBA::ULong request_id, 00064 TAO_Reply_Dispatcher *rd) = 0; 00065 00066 /** 00067 * Unbind the dispatcher, the client is no longer waiting for the 00068 * request, for example, because the request timedout. 00069 * The strategy can (must) cleanup any resources associated with the 00070 * request. 00071 * A later reply for that request should be ignored. 00072 */ 00073 virtual int unbind_dispatcher (CORBA::ULong request_id) = 0; 00074 00075 /// Dispatch the reply for <request_id>, cleanup any resources 00076 /// allocated for that request. 00077 virtual int dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) = 0; 00078 00079 /// Request has been just sent, but the reply is not received. Idle 00080 /// the transport now. The return value indicates whether idling was 00081 /// successful or not. 00082 virtual bool idle_after_send (void) = 0; 00083 00084 /// Request is sent and the reply is received. Idle the transport 00085 /// now. The return value indicates whether idling was successful or 00086 /// not. 00087 virtual bool idle_after_reply (void) = 0; 00088 00089 /// The transport object has closed the connection, inform all Reply 00090 /// dispatchers and waiting strategies. 00091 virtual void connection_closed (void) = 0; 00092 00093 protected: 00094 /// Cache the transport reference. 00095 TAO_Transport *transport_; 00096 }; 00097 00098 TAO_END_VERSIONED_NAMESPACE_DECL 00099 00100 #include /**/ "ace/post.h" 00101 00102 #endif /* TRANSPORT_MUX_STRATEGY_H */