00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file UIPMC_Connection_Handler.h 00006 * 00007 * $Id: UIPMC_Connection_Handler.h 79686 2007-09-21 08:33:21Z johnnyw $ 00008 * 00009 * @author Frank Hunleth <fhunleth@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_UIPMC_CONNECTION_HANDLER_H 00014 #define TAO_UIPMC_CONNECTION_HANDLER_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "orbsvcs/PortableGroup/portablegroup_export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 #pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "orbsvcs/PortableGroup/UIPMC_Transport.h" 00025 00026 #include "tao/Wait_Strategy.h" 00027 #include "tao/Connection_Handler.h" 00028 00029 #include "ace/Acceptor.h" 00030 #include "ace/Reactor.h" 00031 #include "ace/SOCK_Dgram.h" 00032 00033 00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00035 00036 // This connection handler. 00037 typedef ACE_Svc_Handler<ACE_SOCK_DGRAM, ACE_NULL_SYNCH> 00038 TAO_UIPMC_SVC_HANDLER; 00039 00040 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT 00041 template class TAO_PortableGroup_Export ACE_Svc_Handler<ACE_SOCK_DGRAM, ACE_NULL_SYNCH>; 00042 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ 00043 00044 // **************************************************************** 00045 00046 /** 00047 * @class TAO_UIPMC_Connection_Handler 00048 * 00049 * @brief Handles requests on a single connection. 00050 * 00051 * Since MIOP is asymmetric then this Connection handler 00052 * is for only use in the Connector. 00053 */ 00054 class TAO_PortableGroup_Export TAO_UIPMC_Connection_Handler : 00055 public TAO_UIPMC_SVC_HANDLER, 00056 public TAO_Connection_Handler 00057 { 00058 00059 public: 00060 00061 TAO_UIPMC_Connection_Handler (ACE_Thread_Manager* t = 0); 00062 00063 /// Constructor. <arg> parameter is used by the Acceptor to pass the 00064 /// protocol configuration properties for this connection. 00065 TAO_UIPMC_Connection_Handler (TAO_ORB_Core *orb_core); 00066 00067 00068 /// Destructor. 00069 ~TAO_UIPMC_Connection_Handler (void); 00070 00071 //@{ 00072 /** @name Connection Handler overloads 00073 */ 00074 virtual int open_handler (void *v); 00075 //@} 00076 00077 /// Close called by the Acceptor or Connector when connection 00078 /// establishment fails. 00079 int close (u_long = 0); 00080 00081 //@{ 00082 /** @name Event Handler overloads 00083 */ 00084 virtual int resume_handler (void); 00085 virtual int close_connection (void); 00086 virtual int handle_input (ACE_HANDLE); 00087 virtual int handle_output (ACE_HANDLE); 00088 virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); 00089 virtual int handle_timeout (const ACE_Time_Value ¤t_time, 00090 const void *act = 0); 00091 virtual int open (void *); 00092 //@} 00093 00094 /// Add ourselves to Cache. 00095 int add_transport_to_cache (void); 00096 00097 /// Set Diff-Serv codepoint on outgoing packets. 00098 int set_dscp_codepoint (CORBA::Boolean set_network_priority); 00099 int set_dscp_codepoint (CORBA::Long dscp_codepoint); 00100 00101 // UIPMC Additions - Begin 00102 const ACE_INET_Addr &addr (void); 00103 00104 void addr (const ACE_INET_Addr &addr); 00105 00106 const ACE_INET_Addr &local_addr (void); 00107 00108 void local_addr (const ACE_INET_Addr &addr); 00109 00110 /// This is only to be able to use client and server 00111 /// connection handlers in the same way in transport. 00112 ssize_t send (const iovec iov[], 00113 int n, 00114 const ACE_Addr &addr, 00115 int flags = 0) const; 00116 // UIPMC Additions - End 00117 00118 protected: 00119 00120 // UIPMC Additions - Begin 00121 00122 // This is always the remote address 00123 ACE_INET_Addr addr_; 00124 00125 // This is always the local address for the connector 00126 ACE_INET_Addr local_addr_; 00127 00128 // UIPMC Additions - End 00129 00130 //@{ 00131 /** 00132 * @name TAO_Connection Handler overloads 00133 */ 00134 virtual int release_os_resources (void); 00135 //@} 00136 00137 // helper function used by the set_dscp_codepoint () methods to 00138 // set the TOS field in the IP packets. 00139 int set_tos (int tos); 00140 00141 private: 00142 00143 /// Stores the type of service value. 00144 int dscp_codepoint_; 00145 }; 00146 00147 // Transport for this handler. 00148 typedef TAO_UIPMC_Transport<TAO_UIPMC_Connection_Handler> 00149 UIPMC_TRANSPORT; 00150 00151 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT 00152 template class TAO_PortableGroup_Export TAO_UIPMC_Transport<TAO_UIPMC_Connection_Handler>; 00153 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ 00154 00155 TAO_END_VERSIONED_NAMESPACE_DECL 00156 00157 #include /**/ "ace/post.h" 00158 #endif /* TAO_UIPMC_CONNECTION_HANDLER_H */