1 #include "ace/INET_Addr.h"
2 #include "ace/Truncate.h"
3 #include "tao/IIOP_Connection_Handler.h"
4 #include "tao/IIOP_Transport.h"
5 #include "tao/Transport_Selection_Guard.h"
6 #include "tao/SystemException.h"
8 #if TAO_HAS_TRANSPORT_CURRENT == 1
10 #include "IIOP_Current_Impl.h"
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
19 /// Obtains the IIOP_Connection_Handler associated with the
20 /// Transport. Will throw NoContext if the (selected) transport
21 /// () == 0, or if transport->connection_handler () == 0. Will
22 /// throw NoContext, if no transport has been selected yet.
24 TAO_IIOP_Connection_Handler
*
25 IIOP_Current_Impl::handler ()
27 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
28 const TAO_Transport
* t
= this->transport ();
32 TAO_Connection_Handler
*ch
= const_cast<TAO_Transport
*>(t
)->connection_handler ();
36 // Make sure that this connection handler is for IIOP. This
37 // implementation is not intended to operate under SSLIOP.
38 TAO_IIOP_Connection_Handler
* iiop_ch
=
39 dynamic_cast <TAO_IIOP_Connection_Handler
*> (ch
);
45 throw ::CORBA::NO_IMPLEMENT ();
52 IIOP_Current_Impl::IIOP_Current_Impl (TAO_ORB_Core
* core
, size_t tss_slot_id
)
53 : Current_Impl (core
, tss_slot_id
)
60 IIOP_Current_Impl::~IIOP_Current_Impl ()
65 IIOP_Current_Impl::id ()
67 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
68 // Need to use cast to pacify windows compilers complaining
69 // about the implicit HANDLE -> CORBA::Long conversion.
70 return ACE_Utils::truncate_cast
<CORBA::Long
> ((intptr_t)this->handler ()->get_handle ());
72 throw ::CORBA::NO_IMPLEMENT ();
77 IIOP_Current_Impl::ssliop_current ()
79 throw ::CORBA::NO_IMPLEMENT ();
84 IIOP_Current_Impl::remote_port ()
86 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
87 TAO_IIOP_Connection_Handler
*iiopch
=
91 iiopch
->peer ().get_remote_addr (a
);
93 return a
.get_port_number ();
95 throw ::CORBA::NO_IMPLEMENT ();
100 IIOP_Current_Impl::remote_host ()
102 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
103 TAO_IIOP_Connection_Handler
*iiopch
=
107 iiopch
->peer ().get_remote_addr (a
);
109 return CORBA::string_dup (a
.get_host_addr ());
111 throw ::CORBA::NO_IMPLEMENT ();
116 IIOP_Current_Impl::local_port ()
118 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
119 TAO_IIOP_Connection_Handler
*iiopch
=
123 iiopch
->peer ().get_local_addr (a
);
125 return a
.get_port_number ();
127 throw ::CORBA::NO_IMPLEMENT ();
132 IIOP_Current_Impl::local_host ()
134 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
135 TAO_IIOP_Connection_Handler
*iiopch
=
139 iiopch
->peer ().get_local_addr (a
);
141 return CORBA::string_dup (a
.get_host_addr ());
143 throw ::CORBA::NO_IMPLEMENT ();
151 TAO_END_VERSIONED_NAMESPACE_DECL
154 #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */