00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file IIOP_Connection_Handler.h 00006 * 00007 * $Id: IIOP_Connection_Handler.h 78931 2007-07-18 09:59:36Z johnnyw $ 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 00072 /// Destructor. 00073 ~TAO_IIOP_Connection_Handler (void); 00074 00075 /// Called by the @c Strategy_Acceptor when the handler is completely 00076 /// connected. Argument is unused. 00077 virtual int open (void *); 00078 00079 /// Close called by the Acceptor or Connector when connection 00080 /// establishment fails. 00081 int close (u_long = 0); 00082 00083 //@{ 00084 /** @name Event Handler overloads 00085 */ 00086 virtual int resume_handler (void); 00087 virtual int close_connection (void); 00088 virtual int handle_input (ACE_HANDLE); 00089 virtual int handle_output (ACE_HANDLE); 00090 virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); 00091 virtual int handle_timeout (const ACE_Time_Value ¤t_time, 00092 const void *act = 0); 00093 //@} 00094 00095 /// Add ourselves to Cache. 00096 int add_transport_to_cache (void); 00097 00098 /// Process the @a listen_list 00099 int process_listen_point_list (IIOP::ListenPointList &listen_list); 00100 00101 /// Check if network priority needs to be enabled 00102 int enable_network_priority (void); 00103 00104 /// Set Diff-Serv codepoint on outgoing packets. 00105 int set_dscp_codepoint (CORBA::Boolean set_network_priority); 00106 int set_dscp_codepoint (CORBA::Long dscp_codepoint); 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 //@{ 00118 /** 00119 * @name TAO_Connection Handler overloads 00120 */ 00121 virtual int release_os_resources (void); 00122 //@} 00123 00124 // helper function used by the set_dscp_codepoint () methods to 00125 // set the TOS field in the IP packets. 00126 int set_tos (int tos); 00127 00128 private: 00129 00130 /// Stores the type of service value. 00131 int dscp_codepoint_; 00132 }; 00133 00134 TAO_END_VERSIONED_NAMESPACE_DECL 00135 00136 #endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */ 00137 00138 #include /**/ "ace/post.h" 00139 #endif /* TAO_IIOP_CONNECTION_HANDLER_H */