00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file IIOP_Connection_Handler.h 00006 * 00007 * IIOP_Connection_Handler.h,v 1.33 2006/06/01 09:49:38 jwillemsen Exp 00008 * 00009 * @author Originally by Chris Cleeland as IIOP_Connect.h 00010 * @author Balachandran Natarajan <bala@cs.wustl.edu> 00011 */ 00012 // =================================================================== 00013 00014 #ifndef TAO_IIOP_CONNECTION_HANDLER_H 00015 #define TAO_IIOP_CONNECTION_HANDLER_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "tao/orbconf.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 #pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0) 00026 00027 #include "tao/Connection_Handler.h" 00028 #include "tao/Basic_Types.h" 00029 00030 #include "ace/SOCK_Stream.h" 00031 #include "ace/Svc_Handler.h" 00032 00033 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00034 00035 /// Service Handler for this transport 00036 typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> 00037 TAO_IIOP_SVC_HANDLER; 00038 00039 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT 00040 template class TAO_Export ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; 00041 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ 00042 00043 namespace IIOP 00044 { 00045 class ListenPointList; 00046 } 00047 00048 // Forward Decls 00049 class TAO_Pluggable_Messaging; 00050 00051 // **************************************************************** 00052 00053 /** 00054 * @class TAO_IIOP_Connection_Handler 00055 * 00056 * @brief Handles requests on a single connection. 00057 * 00058 * The Connection handler which is common for the Acceptor and 00059 * the Connector 00060 */ 00061 class TAO_Export TAO_IIOP_Connection_Handler : public TAO_IIOP_SVC_HANDLER, 00062 public TAO_Connection_Handler 00063 { 00064 00065 public: 00066 00067 TAO_IIOP_Connection_Handler (ACE_Thread_Manager * = 0); 00068 00069 /// Constructor. 00070 TAO_IIOP_Connection_Handler (TAO_ORB_Core *orb_core, 00071 CORBA::Boolean flag); 00072 00073 /// Destructor. 00074 ~TAO_IIOP_Connection_Handler (void); 00075 00076 /// Called by the @c Strategy_Acceptor when the handler is completely 00077 /// connected. Argument is unused. 00078 virtual int open (void *); 00079 00080 /// Close called by the Acceptor or Connector when connection 00081 /// establishment fails. 00082 int close (u_long = 0); 00083 00084 //@{ 00085 /** @name Event Handler overloads 00086 */ 00087 virtual int resume_handler (void); 00088 virtual int close_connection (void); 00089 virtual int handle_input (ACE_HANDLE); 00090 virtual int handle_output (ACE_HANDLE); 00091 virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); 00092 virtual int handle_timeout (const ACE_Time_Value ¤t_time, 00093 const void *act = 0); 00094 //@} 00095 00096 /// Add ourselves to Cache. 00097 int add_transport_to_cache (void); 00098 00099 /// Process the @a listen_list 00100 int process_listen_point_list (IIOP::ListenPointList &listen_list); 00101 00102 /// Check if network priority needs to be enabled 00103 int enable_network_priority (void); 00104 00105 /// Set Diff-Serv codepoint on outgoing packets. 00106 int set_dscp_codepoint (CORBA::Boolean set_network_priority); 00107 00108 virtual int open_handler (void *); 00109 00110 /// This is used during a canceled connection attempt. Force the 00111 /// SO_LINGER timeout to 0 so that when the peer is closed, it won't 00112 /// hang around. 00113 void abort (void); 00114 00115 protected: 00116 00117 /// Constructor that could be used by the derived classes. 00118 /** 00119 * Sometimes new pluggable protocols which have similarities with 00120 * IIOP may be tempted to this class for their use. Classical 00121 * example being that of IIOP_SSL_Connection_Handler. This 00122 * constructor just initializes its base class and sets all of its 00123 * contents to the default value, if any 00124 */ 00125 TAO_IIOP_Connection_Handler (TAO_ORB_Core *orb_core); 00126 00127 //@{ 00128 /** 00129 * @name TAO_Connection Handler overloads 00130 */ 00131 virtual int release_os_resources (void); 00132 //@} 00133 00134 private: 00135 00136 /// Stores the type of service value. 00137 int dscp_codepoint_; 00138 }; 00139 00140 TAO_END_VERSIONED_NAMESPACE_DECL 00141 00142 #endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */ 00143 00144 #include /**/ "ace/post.h" 00145 #endif /* TAO_IIOP_CONNECTION_HANDLER_H */