00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file UIPMC_Mcast_Connection_Handler.h 00006 * 00007 * $Id: UIPMC_Mcast_Connection_Handler.h 85817 2009-06-26 20:44:58Z mitza $ 00008 * 00009 * @author Vadym Ridosh <vridosh@prismtech.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_UIPMC_MCAST_CONNECTION_HANDLER_H 00014 #define TAO_UIPMC_MCAST_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_Mcast.h" 00032 00033 00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00035 00036 // This connection handler. 00037 typedef ACE_Svc_Handler<ACE_SOCK_DGRAM_MCAST, ACE_NULL_SYNCH> 00038 TAO_UIPMC_MCAST_SVC_HANDLER; 00039 00040 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT 00041 template class TAO_PortableGroup_Export ACE_Svc_Handler<ACE_SOCK_DGRAM_MCAST, ACE_NULL_SYNCH>; 00042 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ 00043 00044 // **************************************************************** 00045 00046 /** 00047 * @class TAO_UIPMC_Mcast_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 Acceptor. 00053 */ 00054 class TAO_PortableGroup_Export TAO_UIPMC_Mcast_Connection_Handler : 00055 public TAO_UIPMC_MCAST_SVC_HANDLER, 00056 public TAO_Connection_Handler 00057 { 00058 00059 public: 00060 00061 TAO_UIPMC_Mcast_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_Mcast_Connection_Handler (TAO_ORB_Core *orb_core); 00066 00067 /// Destructor. 00068 ~TAO_UIPMC_Mcast_Connection_Handler (void); 00069 00070 //@{ 00071 /** @name Connection Handler overloads 00072 */ 00073 virtual int open_handler (void *v); 00074 //@} 00075 00076 /// Close called by the Acceptor or Connector when connection 00077 /// establishment fails. 00078 int close (u_long = 0); 00079 00080 //@{ 00081 /** @name Event Handler overloads 00082 */ 00083 virtual int resume_handler (void); 00084 virtual int close_connection (void); 00085 virtual int handle_input (ACE_HANDLE); 00086 virtual int handle_output (ACE_HANDLE); 00087 virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); 00088 virtual int handle_timeout (const ACE_Time_Value ¤t_time, 00089 const void *act = 0); 00090 virtual int open (void *); 00091 //@} 00092 00093 /// Add ourselves to Cache. 00094 int add_transport_to_cache (void); 00095 00096 // UIPMC Additions - Begin 00097 const ACE_INET_Addr &addr (void); 00098 00099 void addr (const ACE_INET_Addr &addr); 00100 00101 const ACE_INET_Addr &local_addr (void); 00102 00103 void local_addr (const ACE_INET_Addr &addr); 00104 00105 /// This is only to be able to use client and server 00106 /// connection handlers in the same way in transport. 00107 ssize_t send (const iovec iov[], 00108 int n, 00109 const ACE_Addr &addr, 00110 int flags = 0) const; 00111 // UIPMC Additions - End 00112 00113 protected: 00114 00115 // UIPMC Additions - Begin 00116 00117 // This is always the remote address 00118 ACE_INET_Addr addr_; 00119 00120 // This is always the local address for the connector 00121 ACE_INET_Addr local_addr_; 00122 00123 // UIPMC Additions - End 00124 00125 //@{ 00126 /** 00127 * @name TAO_Connection Handler overloads 00128 */ 00129 virtual int release_os_resources (void); 00130 virtual int handle_write_ready (const ACE_Time_Value *timeout); 00131 //@} 00132 00133 }; 00134 00135 // Transport for this handler. 00136 typedef TAO_UIPMC_Transport<TAO_UIPMC_Mcast_Connection_Handler> 00137 UIPMC_MULTICAST_TRANSPORT; 00138 00139 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT 00140 template class TAO_PortableGroup_Export TAO_UIPMC_Transport<TAO_UIPMC_Mcast_Connection_Handler>; 00141 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ 00142 00143 TAO_END_VERSIONED_NAMESPACE_DECL 00144 00145 #include /**/ "ace/post.h" 00146 #endif /* TAO_UIPMC_MCAST_CONNECTION_HANDLER_H */