#include <UIPMC_Connection_Handler.h>
Inheritance diagram for TAO_UIPMC_Connection_Handler:
Public Member Functions | |
TAO_UIPMC_Connection_Handler (ACE_Thread_Manager *t=0) | |
TAO_UIPMC_Connection_Handler (TAO_ORB_Core *orb_core) | |
~TAO_UIPMC_Connection_Handler (void) | |
Destructor. | |
virtual int | open_server (void) |
int | close (u_long=0) |
int | add_transport_to_cache (void) |
Add ourselves to Cache. | |
ACE_HANDLE | get_handle (void) const |
const ACE_INET_Addr & | addr (void) |
void | addr (const ACE_INET_Addr &addr) |
const ACE_INET_Addr & | local_addr (void) |
void | local_addr (const ACE_INET_Addr &addr) |
const ACE_INET_Addr & | server_addr (void) |
void | server_addr (const ACE_INET_Addr &addr) |
const ACE_SOCK_Dgram & | dgram (void) |
const ACE_SOCK_Dgram_Mcast & | mcast_dgram (void) |
Connection Handler overloads | |
virtual int | open_handler (void *v) |
Event Handler overloads | |
virtual int | resume_handler (void) |
virtual int | close_connection (void) |
virtual int | handle_input (ACE_HANDLE) |
virtual int | handle_output (ACE_HANDLE) |
virtual int | handle_close (ACE_HANDLE, ACE_Reactor_Mask) |
virtual int | handle_timeout (const ACE_Time_Value ¤t_time, const void *act=0) |
virtual int | open (void *) |
Protected Member Functions | |
TAO_Connection Handler overloads | |
virtual int | release_os_resources (void) |
Protected Attributes | |
ACE_SOCK_Dgram | udp_socket_ |
Client side UDP socket (send only). | |
ACE_SOCK_Dgram_Mcast | mcast_socket_ |
Server side Mcast UDP socket (receive only). | |
CORBA::Boolean | using_mcast_ |
Flag that specifies whether multicast is in use or not. | |
ACE_INET_Addr | addr_ |
ACE_INET_Addr | local_addr_ |
The Connection handler which is common for the Acceptor and the Connector
Definition at line 50 of file UIPMC_Connection_Handler.h.
|
Definition at line 28 of file UIPMC_Connection_Handler.cpp. References ACE_ASSERT, and TAO_UIPMC_SVC_HANDLER.
00029 : TAO_UIPMC_SVC_HANDLER (t, 0 , 0), 00030 TAO_Connection_Handler (0), 00031 udp_socket_ (ACE_sap_any_cast (ACE_INET_Addr &)), 00032 mcast_socket_ (), 00033 using_mcast_ (0) 00034 { 00035 // This constructor should *never* get called, it is just here to 00036 // make the compiler happy: the default implementation of the 00037 // Creation_Strategy requires a constructor with that signature, we 00038 // don't use that implementation, but some (most?) compilers 00039 // instantiate it anyway. 00040 ACE_ASSERT (0); 00041 } |
|
Constructor. parameter is used by the Acceptor to pass the protocol configuration properties for this connection. Definition at line 44 of file UIPMC_Connection_Handler.cpp. References ACE_NEW, TAO_UIPMC_SVC_HANDLER, and TAO_Connection_Handler::transport().
00045 : TAO_UIPMC_SVC_HANDLER (orb_core->thr_mgr (), 0, 0), 00046 TAO_Connection_Handler (orb_core), 00047 udp_socket_ (ACE_sap_any_cast (ACE_INET_Addr &)), 00048 mcast_socket_ (), 00049 using_mcast_ (0) 00050 { 00051 TAO_UIPMC_Transport* specific_transport = 0; 00052 ACE_NEW(specific_transport, 00053 TAO_UIPMC_Transport(this, orb_core, 0)); 00054 00055 // store this pointer (indirectly increment ref count) 00056 this->transport (specific_transport); 00057 } |
|
Destructor.
Definition at line 60 of file UIPMC_Connection_Handler.cpp. References ACE_SOCK::close(), mcast_socket_, TAO_Connection_Handler::transport(), udp_socket_, and using_mcast_.
00061 { 00062 if (this->using_mcast_) 00063 { 00064 // Closing a multicast socket automatically unsubscribes us from 00065 // the multicast group. 00066 this->mcast_socket_.close (); 00067 } 00068 else 00069 this->udp_socket_.close (); 00070 00071 delete this->transport (); 00072 } |
|
Add ourselves to Cache.
Definition at line 246 of file UIPMC_Connection_Handler.cpp. References TAO::Transport_Cache_Manager::cache_transport(), TAO_ORB_Core::lane_resources(), TAO_Connection_Handler::orb_core(), and TAO_Thread_Lane_Resources::transport_cache().
00247 { 00248 ACE_INET_Addr addr; 00249 00250 // This function is called by the acceptor to add this 00251 // transport to the transport cache. This is really 00252 // important for proper shutdown. The address used 00253 // is irrelevent, since UIPMC is connectionless. 00254 00255 // Construct a UIPMC_Endpoint object. 00256 TAO_UIPMC_Endpoint endpoint (addr); 00257 00258 // Construct a property object 00259 TAO_Base_Transport_Property prop (&endpoint); 00260 00261 // Add the handler to Cache 00262 return this->orb_core ()->lane_resources () 00263 .transport_cache ().cache_transport (&prop, 00264 this->transport ()); 00265 } |
|
Definition at line 91 of file UIPMC_Connection_Handler.cpp.
00092 { 00093 this->addr_ = addr; 00094 } |
|
Definition at line 84 of file UIPMC_Connection_Handler.cpp. Referenced by TAO_UIPMC_Connector::make_connection(), and TAO_UIPMC_Transport::send().
00085 { 00086 return this->addr_; 00087 } |
|
Close called by the Acceptor or Connector when connection establishment fails. Reimplemented from ACE_Svc_Handler<, >. Definition at line 231 of file UIPMC_Connection_Handler.cpp. References TAO_Transport::remove_reference(), TAO_LF_Event::state_changed(), and TAO_Connection_Handler::transport(). Referenced by handle_timeout().
00232 { 00233 this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED, 00234 this->orb_core ()->leader_follower ()); 00235 this->transport ()->remove_reference (); 00236 return 0; 00237 } |
|
Implements TAO_Connection_Handler. Definition at line 182 of file UIPMC_Connection_Handler.cpp. References TAO_Connection_Handler::close_connection_eh(). Referenced by handle_output().
00183 { 00184 return this->close_connection_eh (this); 00185 } |
|
Definition at line 112 of file UIPMC_Connection_Handler.cpp. References udp_socket_. Referenced by TAO_UIPMC_Transport::send().
00113 { 00114 return this->udp_socket_; 00115 } |
|
Reimplemented from ACE_Svc_Handler<, >. Definition at line 75 of file UIPMC_Connection_Handler.cpp. References ACE_IPC_SAP::get_handle(), mcast_socket_, udp_socket_, and using_mcast_. Referenced by TAO_UIPMC_Connector::make_connection().
00076 { 00077 if (this->using_mcast_) 00078 return this->mcast_socket_.get_handle (); 00079 else 00080 return this->udp_socket_.get_handle (); 00081 } |
|
Reimplemented from ACE_Svc_Handler<, >. Definition at line 219 of file UIPMC_Connection_Handler.cpp.
00221 { 00222 // No asserts here since the handler is registered with the Reactor 00223 // and the handler ownership is given to the Reactor. When the 00224 // Reactor closes, it will call handle_close() on the handler. It 00225 // is however important to overwrite handle_close() to do nothing 00226 // since the base class does too much. 00227 return 0; 00228 } |
|
Implements TAO_Connection_Handler. Definition at line 188 of file UIPMC_Connection_Handler.cpp. References TAO_Connection_Handler::handle_input_eh().
00189 { 00190 return this->handle_input_eh (h, this); 00191 } |
|
Reimplemented from ACE_Event_Handler. Definition at line 194 of file UIPMC_Connection_Handler.cpp. References close_connection(), and TAO_Connection_Handler::handle_output_eh().
00195 { 00196 int result = 00197 this->handle_output_eh (handle, this); 00198 00199 if (result == -1) 00200 { 00201 this->close_connection (); 00202 return 0; 00203 } 00204 00205 return result; 00206 } |
|
Reimplemented from ACE_Svc_Handler<, >. Definition at line 209 of file UIPMC_Connection_Handler.cpp. References close().
00211 { 00212 // We don't use this upcall for I/O. This is only used by the 00213 // Connector to indicate that the connection timedout. Therefore, 00214 // we should call close(). 00215 return this->close (); 00216 } |
|
Definition at line 105 of file UIPMC_Connection_Handler.cpp.
00106 { 00107 local_addr_ = addr; 00108 } |
|
Definition at line 98 of file UIPMC_Connection_Handler.cpp. Referenced by TAO_UIPMC_Connector::make_connection(), and TAO_UIPMC_Acceptor::open_i().
00099 { 00100 return local_addr_; 00101 } |
|
Definition at line 118 of file UIPMC_Connection_Handler.cpp. References mcast_socket_. Referenced by TAO_UIPMC_Transport::recv().
00119 { 00120 return this->mcast_socket_; 00121 } |
|
Reimplemented from ACE_Svc_Handler<, >. Definition at line 131 of file UIPMC_Connection_Handler.cpp. References ACE_DEBUG, ACE_TEXT, ACE_INET_Addr::get_port_number(), LM_DEBUG, ACE_SOCK_Dgram::open(), TAO_Transport::post_open(), TAO_debug_level, TAO_Connection_Handler::transport(), udp_socket_, and using_mcast_. Referenced by TAO_UIPMC_Connector::make_connection(), and open_handler().
00132 { 00133 this->udp_socket_.open (this->local_addr_); 00134 00135 if(TAO_debug_level > 5) 00136 { 00137 ACE_DEBUG ((LM_DEBUG, 00138 ACE_TEXT("TAO (%P|%t) TAO_UIPMC_Connection_Handler::open, ") 00139 ACE_TEXT("listening on: <%s:%u>\n"), 00140 this->local_addr_.get_host_addr (), 00141 this->local_addr_.get_port_number ())); 00142 } 00143 00144 this->using_mcast_ = 0; 00145 00146 // Set that the transport is now connected, if fails we return -1 00147 // Use C-style cast b/c otherwise we get warnings on lots of 00148 // compilers 00149 if (!this->transport ()->post_open ((size_t) this->udp_socket_.get_handle ())) 00150 return -1; 00151 00152 return 0; 00153 } |
|
Implements TAO_Connection_Handler. Definition at line 125 of file UIPMC_Connection_Handler.cpp.
00126 { 00127 return this->open (v); 00128 } |
|
Definition at line 156 of file UIPMC_Connection_Handler.cpp. References ACE_DEBUG, ACE_TEXT, ACE_INET_Addr::get_port_number(), TAO_Transport::id(), ACE_SOCK_Dgram_Mcast::join(), LM_DEBUG, mcast_socket_, TAO_debug_level, TAO_Connection_Handler::transport(), and using_mcast_. Referenced by TAO_UIPMC_Acceptor::open_i().
00157 { 00158 this->mcast_socket_.join (this->local_addr_); 00159 if( TAO_debug_level > 5) 00160 { 00161 ACE_DEBUG ((LM_DEBUG, 00162 ACE_TEXT("TAO (%P|%t) TAO_UIPMC_Connection_Handler::open_server, ") 00163 ACE_TEXT("subcribed to multicast group at %s:%d\n"), 00164 this->local_addr_.get_host_addr (), 00165 this->local_addr_.get_port_number () 00166 )); 00167 } 00168 00169 this->transport ()->id ((size_t) this->mcast_socket_.get_handle ()); 00170 this->using_mcast_ = 1; 00171 00172 return 0; 00173 } |
|
Reimplemented from TAO_Connection_Handler. Definition at line 240 of file UIPMC_Connection_Handler.cpp. References ACE_Svc_Handler<, >::peer().
00241 { 00242 return this->peer().close (); 00243 } |
|
Reimplemented from ACE_Event_Handler. Definition at line 176 of file UIPMC_Connection_Handler.cpp.
00177 { 00178 return ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER; 00179 } |
|
|
|
|
|
Definition at line 130 of file UIPMC_Connection_Handler.h. |
|
Definition at line 133 of file UIPMC_Connection_Handler.h. |
|
Server side Mcast UDP socket (receive only).
Definition at line 124 of file UIPMC_Connection_Handler.h. Referenced by get_handle(), mcast_dgram(), open_server(), and ~TAO_UIPMC_Connection_Handler(). |
|
Client side UDP socket (send only).
Definition at line 121 of file UIPMC_Connection_Handler.h. Referenced by dgram(), get_handle(), open(), and ~TAO_UIPMC_Connection_Handler(). |
|
Flag that specifies whether multicast is in use or not.
Definition at line 127 of file UIPMC_Connection_Handler.h. Referenced by get_handle(), open(), open_server(), and ~TAO_UIPMC_Connection_Handler(). |