00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file DIOP_Connection_Handler.h 00006 * 00007 * $Id: DIOP_Connection_Handler.h 78975 2007-07-20 15:17:19Z vridosh $ 00008 * 00009 * @author Michael Kircher 00010 */ 00011 // =================================================================== 00012 00013 #ifndef TAO_DIOP_CONNECTION_HANDLER_H 00014 #define TAO_DIOP_CONNECTION_HANDLER_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/orbconf.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 #pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0) 00025 00026 #include "tao/Strategies/strategies_export.h" 00027 #include "tao/Wait_Strategy.h" 00028 #include "tao/Connection_Handler.h" 00029 #include "tao/Strategies/DIOP_Transport.h" 00030 #include "ace/SOCK_Dgram.h" 00031 #include "ace/Reactor.h" 00032 #include "ace/Acceptor.h" 00033 00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00035 00036 // **************************************************************** 00037 00038 /** 00039 * @class TAO_DIOP_Connection_Handler 00040 * 00041 * @brief Handles requests on a single connection. 00042 * 00043 * The Connection handler which is common for the Acceptor and 00044 * the Connector 00045 */ 00046 class TAO_Strategies_Export TAO_DIOP_Connection_Handler 00047 : public TAO_DIOP_SVC_HANDLER 00048 , public TAO_Connection_Handler 00049 { 00050 00051 public: 00052 00053 TAO_DIOP_Connection_Handler (ACE_Thread_Manager* t = 0); 00054 00055 /// Constructor. 00056 TAO_DIOP_Connection_Handler (TAO_ORB_Core *orb_core); 00057 00058 /// Destructor. 00059 ~TAO_DIOP_Connection_Handler (void); 00060 00061 /// Called by the <Strategy_Acceptor> when the handler is completely 00062 /// connected. Argument is unused. 00063 virtual int open (void *); 00064 00065 // @@ Frank: Similar to open, but called on server 00066 virtual int open_server (void); 00067 00068 //@{ 00069 /** 00070 * Connection_Handler overloads 00071 */ 00072 virtual int open_handler (void *); 00073 //@} 00074 00075 /// Close called by the Acceptor or Connector when connection 00076 /// establishment fails. 00077 int close (u_long = 0); 00078 00079 //@{ 00080 /** @name Event Handler overloads 00081 */ 00082 virtual int resume_handler (void); 00083 virtual int close_connection (void); 00084 virtual int handle_input (ACE_HANDLE); 00085 virtual int handle_output (ACE_HANDLE); 00086 virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); 00087 virtual int handle_timeout (const ACE_Time_Value ¤t_time, 00088 const void *act = 0); 00089 //@} 00090 00091 /// Add ourselves to Cache. 00092 int add_transport_to_cache (void); 00093 00094 // @@ Frank: Not needed 00095 /* 00096 /// Process the <listen_list> 00097 int process_listen_point_list (DIOP::ListenPointList &listen_list); 00098 */ 00099 00100 // DIOP Additions - Begin 00101 /** 00102 * @name The DIOP Additions 00103 * 00104 */ 00105 //@{ 00106 const ACE_INET_Addr &addr (void); 00107 00108 void addr (const ACE_INET_Addr &addr); 00109 00110 const ACE_INET_Addr &local_addr (void); 00111 00112 void local_addr (const ACE_INET_Addr &addr); 00113 //@} 00114 // DIOP Additions - End 00115 00116 /// Set Diff-Serv codepoint on outgoing packets. 00117 int set_dscp_codepoint (CORBA::Boolean set_network_priority); 00118 int set_dscp_codepoint (CORBA::Long dscp_codepoint); 00119 00120 protected: 00121 00122 //@{ 00123 /** 00124 * @name TAO_Connection Handler overloads 00125 */ 00126 virtual int release_os_resources (void); 00127 //@} 00128 00129 /// Helper method used by the set_dscp_codepoint () methods 00130 int set_tos (int tos); 00131 00132 // DIOP Additions - Begin 00133 /** 00134 * @name The DIOP Additions 00135 * 00136 */ 00137 //@{ 00138 /// This is always the remote address 00139 ACE_INET_Addr addr_; 00140 00141 /// This is always the local address for the connector 00142 ACE_INET_Addr local_addr_; 00143 //@} 00144 // DIOP Additions - End 00145 00146 private: 00147 /// Stores the type of service value. 00148 int dscp_codepoint_; 00149 }; 00150 00151 TAO_END_VERSIONED_NAMESPACE_DECL 00152 00153 #endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */ 00154 00155 #include /**/ "ace/post.h" 00156 00157 #endif /* TAO_DIOP_CONNECTION_HANDLER_H */