blob: bb4bec3ecc98994681d176b16a69360a4a738b55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
#include "ace/INET_Addr.h"
#include "ace/Truncate.h"
#include "tao/IIOP_Connection_Handler.h"
#include "tao/IIOP_Transport.h"
#include "tao/Transport_Selection_Guard.h"
#include "tao/SystemException.h"
#if TAO_HAS_TRANSPORT_CURRENT == 1
#include "IIOP_Current_Impl.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
namespace TAO
{
namespace Transport
{
/// Obtains the IIOP_Connection_Handler associated with the
/// Transport. Will throw NoContext if the (selected) transport
/// () == 0, or if transport->connection_handler () == 0. Will
/// throw NoContext, if no transport has been selected yet.
TAO_IIOP_Connection_Handler*
IIOP_Current_Impl::handler ()
{
#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
const TAO_Transport* t = this->transport ();
if (t == 0)
throw NoContext ();
TAO_Connection_Handler *ch = const_cast<TAO_Transport*>(t)->connection_handler ();
if (ch == 0)
throw NoContext ();
// Make sure that this connection handler is for IIOP. This
// implementation is not intended to operate under SSLIOP.
TAO_IIOP_Connection_Handler* iiop_ch =
dynamic_cast <TAO_IIOP_Connection_Handler*> (ch);
if (iiop_ch == 0)
throw NoContext ();
return iiop_ch;
#else
throw ::CORBA::NO_IMPLEMENT ();
#endif
}
/// Ctor
IIOP_Current_Impl::IIOP_Current_Impl (TAO_ORB_Core* core, size_t tss_slot_id)
: Current_Impl (core, tss_slot_id)
{
}
/// Dtor
IIOP_Current_Impl::~IIOP_Current_Impl ()
{
}
CORBA::Long
IIOP_Current_Impl::id ()
{
#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
// Need to use cast to pacify windows compilers complaining
// about the implicit HANDLE -> CORBA::Long conversion.
return ACE_Utils::truncate_cast<CORBA::Long> ((intptr_t)this->handler ()->get_handle ());
#else
throw ::CORBA::NO_IMPLEMENT ();
#endif
}
::SSLIOP::Current_ptr
IIOP_Current_Impl::ssliop_current ()
{
throw ::CORBA::NO_IMPLEMENT ();
}
CORBA::Long
IIOP_Current_Impl::remote_port ()
{
#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
TAO_IIOP_Connection_Handler *iiopch =
this->handler ();
ACE_INET_Addr a;
iiopch->peer ().get_remote_addr (a);
return a.get_port_number ();
#else
throw ::CORBA::NO_IMPLEMENT ();
#endif
}
char*
IIOP_Current_Impl::remote_host ()
{
#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
TAO_IIOP_Connection_Handler *iiopch =
this->handler ();
ACE_INET_Addr a;
iiopch->peer ().get_remote_addr (a);
return CORBA::string_dup (a.get_host_addr ());
#else
throw ::CORBA::NO_IMPLEMENT ();
#endif
}
CORBA::Long
IIOP_Current_Impl::local_port ()
{
#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
TAO_IIOP_Connection_Handler *iiopch =
this->handler ();
ACE_INET_Addr a;
iiopch->peer ().get_local_addr (a);
return a.get_port_number ();
#else
throw ::CORBA::NO_IMPLEMENT ();
#endif
}
char*
IIOP_Current_Impl::local_host ()
{
#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
TAO_IIOP_Connection_Handler *iiopch =
this->handler ();
ACE_INET_Addr a;
iiopch->peer ().get_local_addr (a);
return CORBA::string_dup (a.get_host_addr ());
#else
throw ::CORBA::NO_IMPLEMENT ();
#endif
}
}
}
TAO_END_VERSIONED_NAMESPACE_DECL
#endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
|