00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file UIPMC_Connection_Handler.h 00006 * 00007 * UIPMC_Connection_Handler.h,v 1.13 2006/03/14 06:14:34 jtc Exp 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_Mcast.h" 00032 #include "ace/SOCK_Dgram.h" 00033 00034 00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00036 00037 // Forward Decls 00038 class TAO_Pluggable_Messaging; 00039 00040 // **************************************************************** 00041 00042 /** 00043 * @class TAO_UIPMC_Connection_Handler 00044 * 00045 * @brief Handles requests on a single connection. 00046 * 00047 * The Connection handler which is common for the Acceptor and 00048 * the Connector 00049 */ 00050 class TAO_PortableGroup_Export TAO_UIPMC_Connection_Handler : 00051 public TAO_UIPMC_SVC_HANDLER, 00052 public TAO_Connection_Handler 00053 { 00054 00055 public: 00056 00057 TAO_UIPMC_Connection_Handler (ACE_Thread_Manager* t = 0); 00058 00059 /// Constructor. <arg> parameter is used by the Acceptor to pass the 00060 /// protocol configuration properties for this connection. 00061 TAO_UIPMC_Connection_Handler (TAO_ORB_Core *orb_core); 00062 00063 00064 /// Destructor. 00065 ~TAO_UIPMC_Connection_Handler (void); 00066 00067 //@{ 00068 /** @name Connection Handler overloads 00069 */ 00070 virtual int open_handler (void *v); 00071 //@} 00072 00073 // @@ Frank: Similar to open, but called on server 00074 virtual int open_server (void); 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 ACE_HANDLE get_handle (void) const; 00098 00099 const ACE_INET_Addr &addr (void); 00100 00101 void addr (const ACE_INET_Addr &addr); 00102 00103 const ACE_INET_Addr &local_addr (void); 00104 00105 void local_addr (const ACE_INET_Addr &addr); 00106 00107 const ACE_INET_Addr &server_addr (void); 00108 00109 void server_addr (const ACE_INET_Addr &addr); 00110 00111 const ACE_SOCK_Dgram &dgram (void); 00112 00113 const ACE_SOCK_Dgram_Mcast &mcast_dgram (void); 00114 // UIPMC Additions - End 00115 00116 protected: 00117 00118 // UIPMC Additions - Begin 00119 00120 /// Client side UDP socket (send only). 00121 ACE_SOCK_Dgram udp_socket_; 00122 00123 /// Server side Mcast UDP socket (receive only). 00124 ACE_SOCK_Dgram_Mcast mcast_socket_; 00125 00126 /// Flag that specifies whether multicast is in use or not. 00127 CORBA::Boolean using_mcast_; 00128 00129 // This is always the remote address 00130 ACE_INET_Addr addr_; 00131 00132 // This is always the local address for the connector 00133 ACE_INET_Addr local_addr_; 00134 00135 // UIPMC Additions - End 00136 00137 //@{ 00138 /** 00139 * @name TAO_Connection Handler overloads 00140 */ 00141 virtual int release_os_resources (void); 00142 //@} 00143 00144 }; 00145 00146 TAO_END_VERSIONED_NAMESPACE_DECL 00147 00148 #include /**/ "ace/post.h" 00149 #endif /* TAO_UIPMC_CONNECTION_HANDLER_H */