00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file UIPMC_Mcast_Connection_Handler.h 00006 * 00007 * $Id: UIPMC_Mcast_Connection_Handler.h 79015 2007-07-24 15:03:04Z vridosh $ 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 // Forward Decls 00037 class TAO_Pluggable_Messaging; 00038 00039 // This connection handler. 00040 typedef ACE_Svc_Handler<ACE_SOCK_DGRAM_MCAST, ACE_NULL_SYNCH> 00041 TAO_UIPMC_MCAST_SVC_HANDLER; 00042 00043 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT 00044 template class TAO_PortableGroup_Export ACE_Svc_Handler<ACE_SOCK_DGRAM_MCAST, ACE_NULL_SYNCH>; 00045 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ 00046 00047 // **************************************************************** 00048 00049 /** 00050 * @class TAO_UIPMC_Mcast_Connection_Handler 00051 * 00052 * @brief Handles requests on a single connection. 00053 * 00054 * Since MIOP is asymmetric then this Connection handler 00055 * is for only use in the Acceptor. 00056 */ 00057 class TAO_PortableGroup_Export TAO_UIPMC_Mcast_Connection_Handler : 00058 public TAO_UIPMC_MCAST_SVC_HANDLER, 00059 public TAO_Connection_Handler 00060 { 00061 00062 public: 00063 00064 TAO_UIPMC_Mcast_Connection_Handler (ACE_Thread_Manager* t = 0); 00065 00066 /// Constructor. <arg> parameter is used by the Acceptor to pass the 00067 /// protocol configuration properties for this connection. 00068 TAO_UIPMC_Mcast_Connection_Handler (TAO_ORB_Core *orb_core); 00069 00070 /// Destructor. 00071 ~TAO_UIPMC_Mcast_Connection_Handler (void); 00072 00073 //@{ 00074 /** @name Connection Handler overloads 00075 */ 00076 virtual int open_handler (void *v); 00077 //@} 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 virtual int open (void *); 00094 //@} 00095 00096 /// Add ourselves to Cache. 00097 int add_transport_to_cache (void); 00098 00099 // UIPMC Additions - Begin 00100 const ACE_INET_Addr &addr (void); 00101 00102 void addr (const ACE_INET_Addr &addr); 00103 00104 const ACE_INET_Addr &local_addr (void); 00105 00106 void local_addr (const ACE_INET_Addr &addr); 00107 00108 /// This is only to be able to use client and server 00109 /// connection handlers in the same way in transport. 00110 ssize_t send (const iovec iov[], 00111 int n, 00112 const ACE_Addr &addr, 00113 int flags = 0) const; 00114 // UIPMC Additions - End 00115 00116 protected: 00117 00118 // UIPMC Additions - Begin 00119 00120 // This is always the remote address 00121 ACE_INET_Addr addr_; 00122 00123 // This is always the local address for the connector 00124 ACE_INET_Addr local_addr_; 00125 00126 // UIPMC Additions - End 00127 00128 //@{ 00129 /** 00130 * @name TAO_Connection Handler overloads 00131 */ 00132 virtual int release_os_resources (void); 00133 //@} 00134 00135 }; 00136 00137 // Transport for this handler. 00138 typedef TAO_UIPMC_Transport<TAO_UIPMC_Mcast_Connection_Handler> 00139 UIPMC_MULTICAST_TRANSPORT; 00140 00141 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT 00142 template class TAO_PortableGroup_Export TAO_UIPMC_Transport<TAO_UIPMC_Mcast_Connection_Handler>; 00143 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ 00144 00145 TAO_END_VERSIONED_NAMESPACE_DECL 00146 00147 #include /**/ "ace/post.h" 00148 #endif /* TAO_UIPMC_MCAST_CONNECTION_HANDLER_H */