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
|
// -*- C++ -*-
// $Id$
#include "tao/TransportCurrent/IIOP_Transport_Current.h"
#include "tao/SystemException.h"
#if defined (TAO_AS_STATIC_LIBS)
#include "tao/TransportCurrent/IIOP_Current_Loader.h"
// Create an object that will insert the <Current_Loader> into the
// list of statically linked services that the <ACE_Service_Config>
// will initialize at run-time.
ACE_STATIC_SVC_REQUIRE (TAO_Transport_Current_Loader)
ACE_STATIC_SVC_REQUIRE (TAO_Transport_IIOP_Current_Loader)
#endif /* TAO_AS_STATIC_LIBS */
using namespace TAO;
/// Test referencing the TC data outside of the context of an upcall,
/// or a client-side interceptor
int
test_transport_current (CORBA::ORB_ptr orb)
{
// Get the Current object.
CORBA::Object_var tcobject =
orb->resolve_initial_references (ACE_TEXT_ALWAYS_CHAR ("TAO::Transport::IIOP::Current"));
if (TAO_debug_level >= 1)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Tester (%P|%t) Resolved initial reference for IIOP::Current\n")));
Transport::IIOP::Current_var tc =
Transport::IIOP::Current::_narrow (tcobject.in ());
if (TAO_debug_level >= 1)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Tester (%P|%t) Narowed the IIOP Transport Current\n")));
if (CORBA::is_nil (tc.in ()))
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Tester (%P|%t) ERROR: Could not resolve ")
ACE_TEXT ("TAO::Transport::IIOP::Current object.\n")));
throw CORBA::INTERNAL ();
}
::CORBA::String_var rhost (tc->remote_host ());
::CORBA::String_var lhost (tc->local_host ());
::CORBA::Long id = tc->id ();
::TAO::CounterT bs = tc->bytes_sent ();
::TAO::CounterT br = tc->bytes_received ();
::TAO::CounterT rs = tc->messages_sent ();
::TAO::CounterT rr = tc->messages_received ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Tester (%P|%t) Transport [%q] [%s:%d -> %s:%d] ")
ACE_TEXT ("Sent/Received [bytes=%q/%q, messages=%q/%q]\n"),
(ACE_UINT64)id,
rhost.in (), tc->remote_port (),
lhost.in (), tc->local_port (),
(ACE_UINT64)bs,
(ACE_UINT64)br,
(ACE_UINT64)rs,
(ACE_UINT64)rr));
return 0;
}
|