00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file IIOP_Connection_Handler.h 00006 * 00007 * $Id: IIOP_Connection_Handler.h 85817 2009-06-26 20:44:58Z mitza $ 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 // **************************************************************** 00049 00050 /** 00051 * @class TAO_IIOP_Connection_Handler 00052 * 00053 * @brief Handles requests on a single connection. 00054 * 00055 * The Connection handler which is common for the Acceptor and 00056 * the Connector 00057 */ 00058 class TAO_Export TAO_IIOP_Connection_Handler : public TAO_IIOP_SVC_HANDLER, 00059 public TAO_Connection_Handler 00060 { 00061 00062 public: 00063 00064 #ifdef TAO_LOG_CH_REF_COUNTS 00065 Reference_Count add_reference (void); 00066 Reference_Count remove_reference (void); 00067 #endif 00068 00069 TAO_IIOP_Connection_Handler (ACE_Thread_Manager * = 0); 00070 00071 /// Constructor. 00072 TAO_IIOP_Connection_Handler (TAO_ORB_Core *orb_core); 00073 00074 /// Destructor. 00075 ~TAO_IIOP_Connection_Handler (void); 00076 00077 /// Called by the @c Strategy_Acceptor when the handler is completely 00078 /// connected. Argument is unused. 00079 virtual int open (void *); 00080 00081 /// Close called by the Acceptor or Connector when connection 00082 /// establishment fails. 00083 int close (u_long = 0); 00084 00085 //@{ 00086 /** @name Event Handler overloads 00087 */ 00088 virtual int resume_handler (void); 00089 virtual int close_connection (void); 00090 virtual int handle_input (ACE_HANDLE); 00091 virtual int handle_output (ACE_HANDLE); 00092 virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); 00093 virtual int handle_timeout (const ACE_Time_Value ¤t_time, 00094 const void *act = 0); 00095 //@} 00096 00097 /// Add ourselves to Cache. 00098 int add_transport_to_cache (void); 00099 00100 /// Process the @a listen_list 00101 int process_listen_point_list (IIOP::ListenPointList &listen_list); 00102 00103 /// Check if network priority needs to be enabled 00104 int enable_network_priority (void); 00105 00106 /// Set Diff-Serv codepoint on outgoing packets. 00107 int set_dscp_codepoint (CORBA::Boolean set_network_priority); 00108 int set_dscp_codepoint (CORBA::Long dscp_codepoint); 00109 00110 virtual int open_handler (void *); 00111 00112 /// This is used during a canceled connection attempt. Force the 00113 /// SO_LINGER timeout to 0 so that when the peer is closed, it won't 00114 /// hang around. 00115 void abort (void); 00116 00117 protected: 00118 00119 //@{ 00120 /** 00121 * @name TAO_Connection Handler overloads 00122 */ 00123 virtual int release_os_resources (void); 00124 //@} 00125 00126 virtual int handle_write_ready (const ACE_Time_Value *timeout); 00127 00128 // helper function used by the set_dscp_codepoint () methods to 00129 // set the TOS field in the IP packets. 00130 int set_tos (int tos); 00131 00132 private: 00133 00134 /// Stores the type of service value. 00135 int dscp_codepoint_; 00136 }; 00137 00138 TAO_END_VERSIONED_NAMESPACE_DECL 00139 00140 #endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */ 00141 00142 #include /**/ "ace/post.h" 00143 #endif /* TAO_IIOP_CONNECTION_HANDLER_H */