summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-10-27 17:00:51 +0000
committeriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-10-27 17:00:51 +0000
commit8ed2736af78b8e98ef1e01eeb7cddf384c57d1cc (patch)
tree57feb32afce17e2a8dac4ee8de7d8a4a05b011c7
parentcf662a37817a285b5a8c29669aeb545c537417e3 (diff)
downloadATCD-8ed2736af78b8e98ef1e01eeb7cddf384c57d1cc.tar.gz
Importing HEAD changes
-rw-r--r--ChangeLog173
-rw-r--r--TAO/docs/transport_current/index.html488
-rw-r--r--TAO/docs/transport_current/transport_current.css31
-rw-r--r--TAO/orbsvcs/Transport_Current/Current_Impl.cpp106
-rw-r--r--TAO/orbsvcs/Transport_Current/Current_Impl.h123
-rw-r--r--TAO/orbsvcs/Transport_Current/Current_Loader.cpp156
-rw-r--r--TAO/orbsvcs/Transport_Current/Current_Loader.h91
-rw-r--r--TAO/orbsvcs/Transport_Current/Current_ORBInitializer.cpp56
-rw-r--r--TAO/orbsvcs/Transport_Current/Current_ORBInitializer.h70
-rw-r--r--TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.cpp76
-rw-r--r--TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.h69
-rw-r--r--TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.cpp124
-rw-r--r--TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.h108
-rw-r--r--TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.cpp95
-rw-r--r--TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.h68
-rw-r--r--TAO/orbsvcs/Transport_Current/IIOP_Transport_Current.h17
-rw-r--r--TAO/orbsvcs/Transport_Current/TC.idl57
-rw-r--r--TAO/orbsvcs/Transport_Current/TC.mpc33
-rw-r--r--TAO/orbsvcs/Transport_Current/TC_IIOP.idl56
-rw-r--r--TAO/orbsvcs/Transport_Current/TC_IIOP.mpc27
-rw-r--r--TAO/orbsvcs/Transport_Current/Transport_Current.h16
-rw-r--r--TAO/orbsvcs/Transport_Current/Transport_Current_Export.h54
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.cpp182
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.h144
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test.idl34
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.cpp169
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.h80
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Framework.mpc27
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/ORBInitializer_T.h62
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/README22
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Server_Main.cpp23
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.cpp164
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.h138
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/Tester.cpp70
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/client-static.conf1
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/client.conf1
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/client.cpp287
-rwxr-xr-xTAO/orbsvcs/tests/Transport_Current/Framework/run_test.pl59
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/server-static.conf1
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/server.conf1
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/server.cpp240
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/Framework/simple.cpp86
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/Current_Test_Impl.cpp139
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP.mpc42
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Main.cpp23
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.cpp323
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.h162
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Tester.cpp81
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/README25
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/client_dynamic.conf3
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/client_static.conf3
-rwxr-xr-xTAO/orbsvcs/tests/Transport_Current/IIOP/run_test.pl71
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/server_dynamic.conf2
-rw-r--r--TAO/orbsvcs/tests/Transport_Current/IIOP/server_static.conf2
-rw-r--r--TAO/tao/Transport_Selection_Guard.cpp81
-rw-r--r--TAO/tao/Transport_Selection_Guard.h108
-rw-r--r--ace/ACE.cpp4
-rw-r--r--ace/ACE.h4
-rw-r--r--ace/Auto_Ptr.h106
-rw-r--r--ace/Configuration_Import_Export.cpp2
-rw-r--r--ace/FILE.cpp8
-rw-r--r--ace/File_Lock.h18
-rw-r--r--ace/File_Lock.inl18
-rw-r--r--ace/Filecache.cpp9
-rw-r--r--ace/Filecache.h10
-rw-r--r--ace/Hash_Map_Manager_T.inl2
-rw-r--r--ace/Local_Memory_Pool.cpp2
-rw-r--r--ace/MEM_Acceptor.h2
-rw-r--r--ace/MEM_Acceptor.inl2
-rw-r--r--ace/MEM_IO.cpp8
-rw-r--r--ace/MEM_IO.h2
-rw-r--r--ace/MEM_IO.inl2
-rw-r--r--ace/MMAP_Memory_Pool.cpp88
-rw-r--r--ace/MMAP_Memory_Pool.h30
-rw-r--r--ace/Mem_Map.cpp44
-rw-r--r--ace/Mem_Map.h43
-rw-r--r--ace/Mem_Map.inl43
-rw-r--r--ace/OS_NS_macros.h40
-rw-r--r--ace/OS_NS_stdio.cpp52
-rw-r--r--ace/OS_NS_stdio.h33
-rw-r--r--ace/OS_NS_stdio.inl211
-rw-r--r--ace/OS_NS_sys_mman.h2
-rw-r--r--ace/OS_NS_sys_mman.inl13
-rw-r--r--ace/OS_NS_sys_stat.h4
-rw-r--r--ace/OS_NS_sys_stat.inl24
-rw-r--r--ace/OS_NS_unistd.cpp76
-rw-r--r--ace/OS_NS_unistd.h14
-rw-r--r--ace/OS_NS_unistd.inl75
-rw-r--r--ace/Pagefile_Memory_Pool.inl2
-rw-r--r--ace/Shared_Memory_MM.cpp4
-rw-r--r--ace/Shared_Memory_MM.h8
-rw-r--r--ace/Shared_Memory_MM.inl4
-rw-r--r--ace/Shared_Memory_Pool.cpp28
-rw-r--r--ace/Shared_Memory_Pool.h21
-rw-r--r--ace/Truncate.h119
-rw-r--r--ace/config-lynxos.h20
-rw-r--r--ace/config-posix.h7
-rw-r--r--ace/config-rtems.h2
-rw-r--r--ace/config-vxworks5.x.h1
-rw-r--r--ace/os_include/os_unistd.h12
-rw-r--r--ace/os_include/sys/os_stat.h2
-rw-r--r--ace/os_include/sys/os_types.h6
-rw-r--r--bin/MakeProjectCreator/config/tc.mpb7
-rw-r--r--bin/tao_other_tests.lst1
-rw-r--r--examples/IPC_SAP/FILE_SAP/client.cpp2
-rw-r--r--examples/Web_Crawler/Iterators.cpp2
-rw-r--r--examples/Web_Crawler/Mem_Map_Stream.cpp8
-rw-r--r--examples/Web_Crawler/Mem_Map_Stream.h2
-rwxr-xr-xtests/Integer_Truncate_Test.cpp377
109 files changed, 6060 insertions, 516 deletions
diff --git a/ChangeLog b/ChangeLog
index eb8191b3fc9..93dd270a8bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,161 @@
+Fri Oct 27 09:25:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/Configuration_Import_Export.cpp:
+ Explicitly initialise pointer to 0 to silence warning in
+ gcc cygwi build
+
+Fri Oct 27 01:58:09 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ From Russell Mora <russell_mora at symantec dot com>
+ * ace/ACE.cpp:
+ * ace/ACE.h:
+ * ace/FILE.cpp:
+ * ace/File_Lock.h:
+ * ace/File_Lock.inl:
+ * ace/Filecache.cpp:
+ * ace/Filecache.h:
+ * ace/Local_Memory_Pool.cpp:
+ * ace/MEM_Acceptor.h:
+ * ace/MEM_Acceptor.inl:
+ * ace/MEM_IO.cpp:
+ * ace/MEM_IO.inl:
+ * ace/MEM_IO.h:
+ * ace/MMAP_Memory_Pool.cpp:
+ * ace/MMAP_Memory_Pool.h:
+ * ace/Mem_Map.cpp:
+ * ace/Mem_Map.h:
+ * ace/Mem_Map.inl:
+ * ace/OS_NS_macros.h:
+ * ace/OS_NS_stdio.cpp:
+ * ace/OS_NS_stdio.inl:
+ * ace/OS_NS_stdio.h:
+ * ace/OS_NS_sys_mman.h:
+ * ace/OS_NS_sys_mman.inl:
+ * ace/OS_NS_sys_stat.h:
+ * ace/OS_NS_sys_stat.inl:
+ * ace/OS_NS_unistd.cpp:
+ * ace/OS_NS_unistd.inl:
+ * ace/OS_NS_unistd.h:
+ * ace/Pagefile_Memory_Pool.inl:
+ * ace/Shared_Memory_MM.cpp:
+ * ace/Shared_Memory_MM.h:
+ * ace/Shared_Memory_MM.inl:
+ * ace/Shared_Memory_Pool.cpp:
+ * ace/Shared_Memory_Pool.h:
+ * ace/os_include/sys/os_types.h:
+ * ace/os_include/sys/os_stat.h:
+ * ace/os_include/os_unistd.h:
+ * examples/Web_Crawler/Iterators.cpp:
+ * examples/Web_Crawler/Mem_Map_Stream.cpp:
+ * examples/Web_Crawler/Mem_Map_Stream.h:
+ * examples/IPC_SAP/FILE_SAP/client.cpp:
+
+ Added support for 64-bit file offsets on 32-bit platforms that
+ support the _FILE_OFFSET_BITS preprocessor symbol, as well as
+ Windows. Enable by defining the _FILE_OFFSET_BITS=64
+ preprocessor symbol. ACE provides the necessary support on
+ Windows when it is defined with the assistance of a new
+ ACE_OFF_T typedef.
+
+Thu Oct 26 24:44:55 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Truncate.h (Truncator):
+
+ Removed ACE_Export macros in the Borland case. They shouldn't
+ be necessary.
+
+Thu Oct 26 14:05:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * bin/tao_other_tests.lst:
+ Added orbsvcs/tests/Event/UDP test which tests the rtec
+ udp federation
+
+Thu Oct 26 11:19:45 UTC 2006 Olli Savia <ops@iki.fi>
+
+ * ace/config-lynxos.h:
+ Added include "ace/config-posix.h" and removed defines
+ that are already defined by config-posix.h.
+
+Thu Oct 26 10:29:49 UTC 2006 Olli Savia <ops@iki.fi>
+
+ * ace/config-posix.h:
+ Removed duplicate check of _POSIX_MESSAGE_PASSING.
+
+Thu Oct 26 07:48:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/Truncate.h:
+
+ Added partial specialization for when types are the same, fixes
+ compile problems in the ACE lib with Borland
+
+Thu Oct 26 07:01:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/config-vxworks5.x.h:
+ Added ACE_LACKS_INTPTR_T, VxWorks 5.5.x seems not to deliver this
+ type
+
+Thu Oct 26 00:31:56 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Auto_Ptr.h:
+
+ Added missing "element_type" typedef.
+
+ (ACE_auto_ptr_reset):
+
+ Introduced this new function template to simplify the
+ ACE_AUTO_PTR_RESET macro implementation, to support
+ ACE's other auto_ptr-like class templates
+ (e.g. ACE_Auto_Array_Ptr<>), and to make auto_ptr
+ reset() operations convenient and easy for those needing the
+ ACE_AUTO_PTR_RESET functionality to. Users now need only
+ perform a call like:
+
+ ACE_auto_ptr_reset (my_auto_ptr_instance, new foo);
+
+ Note that ACE_AUTO_PTR_RESET support for ACE's other
+ auto_ptr-like classes isn't strictly necessary since they all
+ support the reset() method.
+
+ Addresses build failures on platforms that define
+ ACE_LACKS_AUTO_PTR_RESET and in code that expects to use
+ ACE_AUTO_PTR_RESET on ACE_Auto_{Basic_}_Array<> instances.
+
+Wed Oct 25 22:42:03 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * tests/Integer_Truncate_Test.cpp:
+
+ Remove "const" qualifiers from types used in
+ ACE_Utils::Truncate<>() function template parameters that are
+ deduced using argument dependent lookup. Borland appears to get
+ confused, and can't find the non-const template parameter
+ Truncate<>() specializations.
+
+Wed Oct 25 20:17:13 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Hash_Map_Manager_T.inl (ACE_Hash_Map_Iterator_Base_Ex):
+
+ Removed commented ACE_TRACE macro entirely. Fuzz parses
+ commented out code, and still incorrectly reports an ACE_TRACE
+ mismatch.
+
+ * ace/Truncate.h:
+
+ Yet another attempt at placating Borland C++. Removed the
+ partial specialization for truncating values of the same type.
+ Typedefed the underlying Truncator structure template to further
+ simplify the function call.
+
+Wed Oct 25 18:31:47 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * examples/C++NPv1/Reactive_Logging_Server.h:
+ * examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp:
+
+ Include "ace/Basic_Types.h" to pull in intptr_t typedef.
+
+Wed Oct 25 15:05:42 UTC 2006 Steve Huston <shuston@riverace.com>
+
+ * ace/OS_NS_stdlib.inl (atop): s/intptr/intptr_t/ in ACE_WIN64 case.
+
Wed Oct 25 09:47:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
* ace/SOCK_Dgram.cpp:
@@ -742,23 +900,8 @@ Thu Oct 19 11:48:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
Thu Oct 19 08:27:12 UTC 2006 Martin Corino <mcorino@remedy.nl>
-<<<<<<< .working
-<<<<<<< .working
-<<<<<<< .working
- * include/makeinclude/platform_openvms.GNU:
- Small change to create hardlinks for produced executables.
-=======
- * include/makeinclude/platform_openvms.GNU:
- Small change to create hardlinks for produced executables.
->>>>>>> .merge-right.r75022
-=======
- * include/makeinclude/platform_openvms.GNU:
- Small change to create hardlinks for produced executables.
->>>>>>> .merge-right.r74993
-=======
* include/makeinclude/platform_openvms.GNU:
Small change to create hardlinks for produced executables.
->>>>>>> .merge-right.r74951
Wed Oct 18 16:19:38 UTC 2006 Shanshan Jiang <shanshan.jiang@vanderbilt.edu>
diff --git a/TAO/docs/transport_current/index.html b/TAO/docs/transport_current/index.html
index c3ee4bbc847..72f9aaee44d 100644
--- a/TAO/docs/transport_current/index.html
+++ b/TAO/docs/transport_current/index.html
@@ -1,5 +1,493 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- $Id:$ -->
+
+<HTML>
+<HEAD>
+<TITLE>Using the TAO::Transport::Current Feature</TITLE>
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="transport_current.css">
+
+</HEAD>
+
+<BODY TEXT = "#000000" LINK="#000fff" VLINK="#ff0f0f" BGCOLOR="#ffffff">
+
+<P>
+
+<H1 ALIGN="CENTER">Using the TAO::Transport::Current Feature</H1>
+
+
+<P ALIGN="CENTER">
+Object Computing Inc.<BR>
+St.Louis, Missouri
+</P>
+
+<P ALIGN="CENTER">
+<SMALL><STRONG>
+<A HREF="mailto:iliyan@ociweb.com">Iliyan Jeliazkov</A>
+<A HREF="mailto:mesnier_p@ociweb.com">Phil Mesnier</A>
+ and <A HREF="mailto:<john_c@ociweb.com">Ciju John</A>
+</STRONG></SMALL>
+</P>
+
+<HR>
+
+<P>
+<H3>Scope and Context</H3><P>
+
+<P>In TAO, it is just too hard to obtain statistical or pretty much any operational information about the network transport which the ORB is using. While this is a direct corollary of the CORBA's design paradigm which mandates hiding all this hairy stuff behind non-transparent abstractions, it also precludes effective ORB and network monitoring.
+</P>
+
+<P>
+The Transport::Current feature intends to fill this gap by defining a
+framework for developing a wide range of solutions to this problem. It also provides a basic implementation for the most common case - the IIOP transport.
+</P>
+
+<P>
+By definition, transport-specific information is available in
+contexts where the ORB has selected a Transport:</P>
+
+<UL>
+ <LI>Within Client-side interception points;</LI>
+ <LI>Within Server-side interception points;</LI>
+ <LI>Inside a Servant up-call</LI>
+</UL>
+
+<P>
+The implementation is based on a generic service-oriented
+framework, implementing the TAO::Transport::Current interface. It is
+an optional service, which can be dynamically loaded. This service makes
+the Transport::Current interface available through
+orb->resolve_initial_references() . The basic idea is that whenever a Transport is
+chosen by the ORB, the Transport::Current (or a derivative) will have access
+to that instance and be able to provide some useful information.
+</P>
+
+<BR><HR>
+
+
+<P>
+<H3>
+Programmer's Reference
+</H3>
+
+<P>
+Consider the following IDL interface, describing a Factory for
+producing TAO::Transport::Traits instance, which represents
+transport-specific data.
+</P>
+
+<PRE>
+#include <IOP.pidl>
+#include <TimeBase.pidl>
+
+module TAO
+{
+ /// A type used to represent counters
+ typedef unsigned long long CounterT;
+
+ module Transport
+ {
+ /// Used to signal that a call was made within improper invocation
+ /// context. Also, this exception is thrown if no Transport has
+ /// been selected for the current thread, for example in a
+ /// collocated invocation.
+
+ exception NoContext
+ {
+ };
+
+ // The primary interface, providing access to Transport
+ // information, available to the current thread.
+
+ local interface Current
+ {
+ /// Transport ID, unique within the process.
+ readonly attribute long id raises (NoContext);
+
+ /// Bytes sent/received through the transport.
+ readonly attribute CounterT bytes_sent raises (NoContext);
+ readonly attribute CounterT bytes_received raises (NoContext);
+
+ /// Messages (requests and replies) sent/received using the current
+ /// protocol.
+ readonly attribute CounterT messages_sent raises (NoContext);
+ readonly attribute CounterT messages_received raises (NoContext);
+
+ /// The absolute time (miliseconds) since the transport has been
+ /// open.
+ readonly attribute TimeBase::TimeT open_since raises (NoContext);
+ };
+ };
+};
+</PRE>
+
+<P>
+As an example of a specialized Transport::Current is the Transport::IIOP::Current, which derives from Transport::Current and has an interface, described in the following IDL:
+</P>
+
+<PRE>
+#include "TC.idl"
+
+/// Provide a forward reference for the SSLIOP::Current
+module SSLIOP
+{
+ interface Current;
+};
+
+
+module TAO
+{
+ module Transport
+ {
+ module IIOP
+ {
+ // The primary interface, providing access to IIOP-specific
+ // transport information, if it is indeed an IIOP (-like) transport
+ // that has been selected.
+
+ local interface Current : TAO::Transport::Current
+ {
+ /// Remote host
+ readonly attribute string remote_host raises (NoContext);
+
+ /// Remote port Using long (signed) type to better accomodate
+ /// the Java mapping, which has no support for unsigned values
+ readonly attribute long remote_port raises (NoContext);
+
+ /// Local host
+ readonly attribute string local_host raises (NoContext);
+
+ /// Local port
+ readonly attribute long local_port raises (NoContext);
+
+ /// If this is a "secure" transport, this method will give you
+ /// the corresponding SSLIOP::Current
+ readonly attribute ::SSLIOP::Current ssliop_current raises (NoContext);
+ };
+ };
+ };
+};
+</PRE>
+
+
+<P>
+<H3>
+User's Guide
+</H3>
+
+<P>
+The TAO::Transport::Current can be used as a base interface for a more specialized TAO::Transport::X::Current. It is not required, however that a more specialized Current inherits from it.
+</P>
+
+<P>
+Typical, generic usage is shown in the
+$TAO_ROOT/orbsvcs/tests/Transport_Current/Framework test:
+</P>
+
+<PRE>
+...
+ // Get the Current object.
+ ::CORBA::Object_var tcobject =
+ orb->resolve_initial_references ("TAO::Transport::Current"
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ ::TAO::Transport::Current_var tc =
+ ::TAO::Transport::Current::_narrow (tcobject.in ()
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (tc.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) client - ERROR: Could not resolve ")
+ ACE_TEXT ("TAO::Transport::Current object.\n")));
+
+ ACE_TRY_THROW (CORBA::INTERNAL ());
+ }
+...
+</PRE>
+
+<P>
+Another example is available from the $TAO_ROOT/orbsvcs/tests/Transport_Current/IIOP test. This fragment shows how to obtain transport-specific information:
+</P>
+
+<PRE>
+...
+ // Get the specific Current object.
+ CORBA::Object_var tcobject =
+ orb->resolve_initial_references (ACE_TEXT_ALWAYS_CHAR ("TAO::Transport::IIOP::Current")
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+
+ Transport::IIOP::Current_var tc =
+ Transport::IIOP::Current::_narrow (tcobject.in ()
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (tc.in ()))
+ ACE_TRY_THROW (CORBA::INTERNAL ());
+
+ ::CORBA::String_var rhost (tc->remote_host (ACE_ENV_SINGLE_ARG_PARAMETER));
+ ACE_TRY_CHECK;
+
+ ::CORBA::String_var lhost (tc->local_host (ACE_ENV_SINGLE_ARG_PARAMETER));
+ ACE_TRY_CHECK;
+
+ ::CORBA::Long id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT bs = tc->bytes_sent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT br = tc->bytes_received (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT rs = tc->messages_sent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT rr = tc->messages_received (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+...
+</PRE>
+
+
+
+<P>
+<H3>
+Configuration, Bootstrap, Initialization and Operation
+</H3>
+
+<P>
+To use the Transport Current features the framework must be loaded
+through the Service Configuration framework. For example, using
+something like this:
+</P>
+
+<PRE>
+dynamic TAO_Transport_Current_Loader Service_Object * libTAO_Transport_Current.so:_make_TAO_Transport_Current_Loader() ""
+</PRE>
+
+<P>
+The Transport_Current_Loader service uses an ORB initializer to register the "TAO::Transport::Current" name in a way that allows it to be resolved via orb->resolve_initial_references(). The implementation is the TAO::Transport::Current_Impl class.
+</P>
+
+<P>
+A transport-specific Traits_Factory objects are loaded like this:
+</P>
+
+<PRE>
+...
+dynamic TAO_Transport_IIOP_Current_Loader Service_Object * TAO_TC_IIOP:_make_TAO_Transport_IIOP_Current_Loader() ""
+...
+</PRE>
+
+<P>
+Note that any number of transport-specific Current interfaces may be available at any one time.
+</P>
+
+<P>
+Whenever a Transport::Current method is invoked, a pointer to the currently selected Transport instance must be accessible through Thread Specific Storage (TSS). For each thread, this is managed by modifying the TAO classes, instances of which are created on the stack during request/response processing.
+</P>
+
+<P>
+<H3>
+Implementation and Required Changes
+</H3>
+
+<P>
+The primary implementation is predicated upon usage of thread specific
+storage (TSS) and the guarantees C++ provides for calling the
+constructor and the destructor of automatic (stack-based)
+objects. Some existing objects, used in TAO will have to be modified
+and the necessary changes, both for client and the server side are
+detailed below.
+</P>
+
+<H4>
+Client Side: Sending Requests or Replies
+</H4>
+
+
+<P>
+The Profile_Transport_Resolver instance contains the reference to the
+Transport, which is the TAO implementation structure that is needed to extract
+any protocol-specific information. An
+instance of Profile_Transport_Resolver lives on the stack, starting
+inside a call to Invocation_Adapter::invoke_remote_i(), or
+LocateRequest_Invocation_Adapter::invoke(). In the case of collocated
+invocations no such object is created.
+</P>
+
+<P>
+It is then passed around the calls that follow, except for the calls
+to the following Invocation_Base methods: send_request_interception(),
+receive_other_interception(), receive_reply_interception(),
+handle_any_exception(), handle_all_exception();
+</P>
+
+<P>
+Note that these in turn call the client-side interception points and
+that is where information about the transport will be needed. In order
+to make the transport information accessible inside those methods, we
+changed Profile_Transport_Resolver and the TAO_ServerRequest classes to
+ incorporate an additional member:
+</P>
+
+<PRE>
+...
+TAO::Transport_Selection_Guard transport_;
+...
+</PRE>
+
+
+<P>
+This guard automatically keeps track of the currenty selected Transport from within its constructor and destructor. The rest of the TC framework makes sure this pointer is stored in a thread-specific storage, by adding an additional member to TSS_Resources:
+</P>
+
+<PRE>
+...
+TAO::Transport_Selection_Guard* tsg_;
+...
+</PRE>
+
+<P>
+The idea is to keep a pointer to the last guard on the current thread. Each guard keeps a pointer to the previous, effectively creating a stack of transport selection guards. The stack structure ensures both that the selection/deselection of a Transport will be correctly handled. It also ensures that, in case the current thread temporarily changes the Transport, the previous “current” transport will be preserved, no matter how many times such change occurs. A good example for this is a nested up-call scenario.
+</P>
+
+<P>
+Inside an interceptor, one can use the methods from Transport Current to obtain information on the currently selected transport. The implementation simply looks up the TAO_Transport pointer via TSS_Resources::tsg_ and obtains the requested data.
+</P>
+
+
+
+<H4>
+Server Side: Request Processing
+</H4>
+
+
+<P>
+On the server side, the TAO_ServerRequest instance already has a
+Transport pointer. The TAO_ServerRequest lives on the stack, starting
+its life inside a call to TAO_GIOP_Message_Base::process_request().
+</P>
+
+<P>
+Similarly to the client-side, we changed the TAO_ServerRequest
+to add a field:
+</P>
+
+<PRE>
+...
+TAO::Transport_Selection_Guard transport_;
+...
+</PRE>
+
+<P>
+Operation is similar to the client-side case. In the collocated case there may not be a
+transport available, so the TSS slot will be null.
+</P>
+
+<P>
+Inside an interceptor then, one can use an RIR-resolved
+TransportCurrent to create a specialization of TransportInfo, based on
+the kind of Transport used. Then they would _downcast() it to the
+specific type.
+</P>
+
+<H3>
+Structural and Footprint Impact
+</H3>
+
+<P>
+As the IIOP implementation of the Transport Current functionality requires additional
+data to be kept about the Transport, we added a new field to TAO_Transport:
+</P>
+
+<PRE>
+...
+ /// Transport statistics
+ TAO::Transport::Stats* stats_
+...
+</PRE>
+
+<P>
+TAO::Transport::Stats is a simple structure, which keeps track of useful statistical
+information about how a transport is used:
+</P>
+
+<PRE>
+...
+ class TAO_Export Stats
+ {
+ public:
+ Stats ();
+
+ void messages_sent (size_t message_length);
+ CORBA::LongLong messages_sent (void) const;
+ CORBA::LongLong bytes_sent (void) const;
+
+ void messages_received (size_t message_length);
+ CORBA::LongLong messages_received (void) const;
+ CORBA::LongLong bytes_received (void) const;
+
+ void opened_since (const ACE_Time_Value& tv);
+ const ACE_Time_Value& opened_since (void) const;
+
+ private:
+ CORBA::LongLong messages_rcvd_; // 32bits not enough (?)
+ CORBA::LongLong messages_sent_; // 32bits not enough (?)
+
+ ACE_Basic_Stats bytes_rcvd_;
+ ACE_Basic_Stats bytes_sent_;
+
+ ACE_Time_Value opened_since_;
+ };
+...
+</PRE>
+
+<P>
+To gather the statistics the TAO_Transport::send_message_shared() and TAO_Transport::process_parsed_messages() must be modified. These are non-virtual methods and are being called as part of request and reply processing regardless of what the most derived Transport type is. This property ensures that any specific Transport will have access to these statistics.
+</P>
+
+<H3>
+Performance Impact
+</H3>
+
+<P>
+As the implementation of the Transport Current functionality
+necessitates some additional processing on the critical path of an
+invocation, we are expecting a performance impact when the
+functionality is being used.
+</P>
+
+<P>
+It is possible at build time, to
+disable the functionality, so that applications only incur the penalty
+if they require it. The ORB, by default will not support the Transport Current functionality.
+Use the following #define (in your config.h file) to enable it:
+</P>
+
+<PRE>
+#define TAO_HAS_TRANSPORT_CURRENT 1
+</PRE>
+
+<H3>
+Example Code
+</H3>
+
+<P>
+Look at $TAO_ROOT/orbsvcs/tests/Transport_Current for code which illustrates and tests this feature.
+</P>
+</BODY>
+</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
<!-- $Id$ -->
<HTML>
diff --git a/TAO/docs/transport_current/transport_current.css b/TAO/docs/transport_current/transport_current.css
index 1993b851311..9ee49423607 100644
--- a/TAO/docs/transport_current/transport_current.css
+++ b/TAO/docs/transport_current/transport_current.css
@@ -29,3 +29,34 @@ TD.eqno { } /* equation-number cells */
/* document-specific styles come next */
+
+/* Century Schoolbook font is very similar to Computer Modern Math: cmmi */
+.MATH { font-family: "Century Schoolbook", serif; }
+.MATH I { font-family: "Century Schoolbook", serif; font-shape: italic }
+.BOLDMATH { font-family: "Century Schoolbook", serif; font-weight: bold }
+
+/* implement both fixed-size and relative sizes */
+SMALL.XTINY { font-size : xx-small }
+SMALL.TINY { font-size : x-small }
+SMALL.SCRIPTSIZE { font-size : smaller }
+SMALL.FOOTNOTESIZE { font-size : small }
+SMALL.SMALL { }
+BIG.LARGE { }
+BIG.XLARGE { font-size : large }
+BIG.XXLARGE { font-size : x-large }
+BIG.HUGE { font-size : larger }
+BIG.XHUGE { font-size : xx-large }
+
+/* heading styles */
+H1 { }
+H2 { }
+H3 { }
+H4 { }
+H5 { }
+
+/* mathematics styles */
+DIV.displaymath { } /* math displays */
+TD.eqno { } /* equation-number cells */
+
+
+/* document-specific styles come next */
diff --git a/TAO/orbsvcs/Transport_Current/Current_Impl.cpp b/TAO/orbsvcs/Transport_Current/Current_Impl.cpp
index 1cb391fefef..4cb91101d04 100644
--- a/TAO/orbsvcs/Transport_Current/Current_Impl.cpp
+++ b/TAO/orbsvcs/Transport_Current/Current_Impl.cpp
@@ -104,3 +104,109 @@ namespace TAO
TAO_END_VERSIONED_NAMESPACE_DECL
+// $Id$
+
+#include "tao/Transport.h"
+#include "tao/Transport_Selection_Guard.h"
+
+#include "orbsvcs/Transport_Current/Current_Loader.h"
+#include "orbsvcs/Transport_Current/Current_Impl.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Transport
+ {
+
+ /// ctor
+ Current_Impl::Current_Impl (TAO_ORB_Core* core, size_t tss_slot_id)
+ : core_ (core)
+ , tss_slot_id_ (tss_slot_id)
+ {
+ }
+
+ /// dtor
+ Current_Impl::~Current_Impl (void)
+ {
+ }
+
+ /// Obtains the current transport. Throws a NoContext exception
+ /// if, there was no "current" transport selected on the current
+ /// thread.
+ const TAO_Transport*
+ Current_Impl::transport (ACE_ENV_SINGLE_ARG_DECL) const
+ ACE_THROW_SPEC ((NoContext))
+ {
+ Transport_Selection_Guard* topguard =
+ Transport_Selection_Guard::current (this->core_, this->tss_slot_id_);
+
+ if (topguard == 0)
+ ACE_THROW (NoContext());
+ ACE_CHECK;
+
+ return topguard->get ();
+ }
+
+ /// Obtains the current transport's stats
+ const TAO::Transport::Stats*
+ Current_Impl::transport_stats (ACE_ENV_SINGLE_ARG_DECL) const
+ ACE_THROW_SPEC ((NoContext))
+ {
+ static const TAO::Transport::Stats dummy;
+
+ const TAO_Transport* t =
+ this->transport (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return (t==0 || t->stats () == 0) ? &dummy : t->stats ();
+ }
+
+ CORBA::Long Current_Impl::id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ const TAO_Transport* t =
+ this->transport (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return (t==0) ? 0 : t->id ();
+ }
+
+ CounterT Current_Impl::bytes_sent (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ return transport_stats ()->bytes_sent ();
+ }
+
+ CounterT Current_Impl::bytes_received (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ return transport_stats ()->bytes_received ();
+ }
+
+ CounterT Current_Impl::messages_sent (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ return transport_stats ()->messages_sent ();
+ }
+
+ CounterT Current_Impl::messages_received (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ return transport_stats ()->messages_received ();
+ }
+
+ TimeBase::TimeT Current_Impl::open_since (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ TimeBase::TimeT msecs = 0;
+ transport_stats ()->opened_since ().msec (msecs);
+ return msecs;
+ }
+
+ };
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
diff --git a/TAO/orbsvcs/Transport_Current/Current_Impl.h b/TAO/orbsvcs/Transport_Current/Current_Impl.h
index d08af35efc5..c4f423b1a7f 100644
--- a/TAO/orbsvcs/Transport_Current/Current_Impl.h
+++ b/TAO/orbsvcs/Transport_Current/Current_Impl.h
@@ -121,3 +121,126 @@ TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* CURRENT_IMPL_H */
+// $Id$
+
+#ifndef CURRENT_IMPL_H
+#define CURRENT_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/Transport_Current/TCC.h"
+#include "tao/LocalObject.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+
+namespace TAO
+{
+ namespace Transport
+ {
+
+ // Forward decl
+ class Stats;
+
+ /**
+ * @class Current_impl
+ *
+ * @brief Implementation of the TAO::Transport::Current
+ * interface.
+ *
+ * Current_Impl is useful for obtaining information about the
+ * Transport, associated with the calling thread.
+ */
+ class TAO_Transport_Current_Export Current_Impl
+ : public virtual Current
+ , public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+
+ /// Constructor.
+ Current_Impl (TAO_ORB_Core* core, size_t tss_slot_id);
+
+ /**
+ * These are methods exposed by the
+ * PortableInterceptor::Current interface.
+ */
+ //@{
+ virtual CORBA::Long id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual CounterT bytes_sent (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual CounterT bytes_received (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual CounterT messages_sent (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual CounterT messages_received (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual ::TimeBase::TimeT open_since (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+ //@}
+
+ protected:
+
+ /**
+ * Some helper methods
+ */
+ //@{
+ /// A (strategy) method used to obtain the transport ptr
+ const TAO_Transport* transport (ACE_ENV_SINGLE_ARG_DECL) const
+ ACE_THROW_SPEC ((NoContext));
+
+ /// A Stats instance. If protocol is unavailable (0) or the
+ /// TAO_HAS_TRANSPORT_CURRENT macro is defined as anything but
+ /// 1, a single static instance will be used.
+ const TAO::Transport::Stats* transport_stats (ACE_ENV_SINGLE_ARG_DECL) const
+ ACE_THROW_SPEC ((NoContext));
+ //@}
+
+ /// Destructor is protected to enforce the fact this class is
+ /// reference counted, and should not be destroyed using
+ /// delete() by anything other than the reference counting
+ /// mechanism.
+ virtual ~Current_Impl (void);
+
+ private:
+
+ /// Prevent copying through the copy constructor and the
+ /// assignment operator.
+ //@{
+ Current_Impl (const Current_Impl &);
+ void operator= (const Current_Impl &);
+ //@}
+
+ private:
+
+ // The ORB (core) that owes us.
+ TAO_ORB_Core* core_;
+
+ // The ORB's TSS slot id for the Transport ptr
+ size_t tss_slot_id_;
+
+ };
+
+ };
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+/* #if defined (__ACE_INLINE__) */
+/* # include "Current_Impl.inl" */
+/* #endif /\* __ACE_INLINE__ *\/ */
+
+#include /**/ "ace/post.h"
+
+#endif /* CURRENT_IMPL_H */
diff --git a/TAO/orbsvcs/Transport_Current/Current_Loader.cpp b/TAO/orbsvcs/Transport_Current/Current_Loader.cpp
index c0fb7e73ac1..ea0cb0fb3f7 100644
--- a/TAO/orbsvcs/Transport_Current/Current_Loader.cpp
+++ b/TAO/orbsvcs/Transport_Current/Current_Loader.cpp
@@ -154,3 +154,159 @@ ACE_STATIC_SVC_DEFINE (TAO_Transport_Current_Loader,
ACE_FACTORY_NAMESPACE_DEFINE (TAO_Transport_Current,
TAO_Transport_Current_Loader,
TAO::Transport::Current_Loader)
+/* -*- C++ -*- */
+
+// =================================================================
+/**
+ * @file Current_Loader.cpp
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ *
+ */
+// =================================================================
+
+
+#include "ace/Service_Config.h"
+
+#include "tao/ORB_Constants.h"
+#include "tao/ORBInitializer_Registry.h"
+
+#include "tao/PI/PI.h"
+
+#include "orbsvcs/Transport_Current/Current_ORBInitializer.h"
+#include "orbsvcs/Transport_Current/Current_Loader.h"
+#include "orbsvcs/Transport_Current/Current_Impl.h"
+//#include "orbsvcs/Transport_Current/TCC.h"
+
+ACE_RCSID (Transport_Current,
+ Current_Loader,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Transport
+ {
+
+ /// A helper method for obtaining access to the the Transport
+ /// Factory Manager instance.
+
+ Current_Loader*
+ Current_Loader::instance (void)
+ {
+ Current_Loader *cl =
+ ACE_Dynamic_Service <Current_Loader>::instance (ACE_TEXT ("TAO_Transport_Current_Loader"));
+
+ if (cl == 0)
+#if defined (TAO_AS_STATIC_LIBS)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Unable to obtain Current::Loader instance: %m\n")),
+ 0);
+ return 0;
+ }
+#else
+ {
+ // In case we build shared, try to load the appropriate library.
+ ACE_Service_Config::process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("TAO_Transport_Current_Loader",
+ "TAO_TC",
+ "_make_TAO_Transport_Current_Loader",
+ ""));
+ cl = ACE_Dynamic_Service<Current_Loader>::instance (ACE_TEXT ("TAO_Transport_Current_Loader"));
+ }
+#endif /* TAO_AS_STATIC_LIBS */
+
+ if (cl != 0)
+ return cl;
+
+ if (TAO_debug_level > 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Unable to obtain Current::Loader instance: %m\n")),
+ 0);
+ return 0;
+ }
+
+
+ /// dtor
+
+ Current_Loader::~Current_Loader (void)
+ {
+ }
+
+
+
+ /// Initializes object when dynamic linking occurs.
+
+ int
+ Current_Loader::init (int, ACE_TCHAR *[])
+ {
+ PortableInterceptor::ORBInitializer_ptr tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ Current_ORBInitializer<Current_Impl>
+ (ACE_TEXT ("TAO::Transport::Current")),
+ CORBA::NO_MEMORY
+ (CORBA::SystemException::_tao_minor_code (TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ PortableInterceptor::ORBInitializer_var initializer (tmp);
+
+ PortableInterceptor::register_orb_initializer (initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ return 0;
+ }
+
+ } /* namespace Transport */
+
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+
+
+
+#if defined (TAO_AS_STATIC_LIBS)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_REQUIRE (TAO_Transport_Current_Loader);
+
+namespace TAO
+{
+ namespace Transport
+ {
+ int current_static_initializer (void)
+ {
+ ACE_STATIC_SVC_REGISTER (TAO_Transport_Current_Loader);
+ return 0;
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* defined (TAO_AS_STATIC_LIBS) */
+
+
+
+
+ACE_STATIC_SVC_DEFINE (TAO_Transport_Current_Loader,
+ ACE_TEXT ("TAO_Transport_Current_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Transport_Current_Loader),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (TAO_Transport_Current,
+ TAO_Transport_Current_Loader,
+ TAO::Transport::Current_Loader)
diff --git a/TAO/orbsvcs/Transport_Current/Current_Loader.h b/TAO/orbsvcs/Transport_Current/Current_Loader.h
index 9b2794b057c..4c20a22971a 100644
--- a/TAO/orbsvcs/Transport_Current/Current_Loader.h
+++ b/TAO/orbsvcs/Transport_Current/Current_Loader.h
@@ -89,3 +89,94 @@ ACE_FACTORY_DECLARE (TAO_Transport_Current,
#include /**/ "ace/post.h"
#endif /* TAO_TRANSPORT_CURRENT_LOADER_H */
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file Current_Loader.h
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_TRANSPORT_CURRENT_LOADER_H
+#define TAO_TRANSPORT_CURRENT_LOADER_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Object.h"
+#include "tao/Versioned_Namespace.h"
+#include "orbsvcs/Transport_Current/Transport_Current_Export.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class ORBInitializer_Registry_Adapter;
+
+ namespace Transport
+ {
+
+ class TAO_Transport_Current_Export Current_Loader
+ : public ACE_Service_Object
+ {
+ public:
+
+ /// A helper method for obtaining access to the the Transport
+ /// Factory Manager instance.
+ static Current_Loader* instance (void);
+
+ public:
+
+ /// Initializes object when dynamic linking occurs.
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+
+ protected:
+
+ // Protected destructor to enforce reference counting discipline
+ virtual ~Current_Loader (void);
+
+ ORBInitializer_Registry_Adapter* orbinitializer_registry (void);
+
+ private:
+
+ /// A cache for the registry pointer
+ ORBInitializer_Registry_Adapter* oir_;
+ };
+
+ };
+};
+
+
+#if defined (TAO_AS_STATIC_LIBS)
+namespace TAO
+{
+ namespace Transport
+ {
+ int current_static_initializer (void);
+ };
+};
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* defined (TAO_AS_STATIC_LIBS) */
+
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Transport_Current,
+ TAO_Transport_Current_Loader)
+
+ACE_FACTORY_DECLARE (TAO_Transport_Current,
+ TAO_Transport_Current_Loader)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TRANSPORT_CURRENT_LOADER_H */
diff --git a/TAO/orbsvcs/Transport_Current/Current_ORBInitializer.cpp b/TAO/orbsvcs/Transport_Current/Current_ORBInitializer.cpp
index 75cdf77d803..5934098926b 100644
--- a/TAO/orbsvcs/Transport_Current/Current_ORBInitializer.cpp
+++ b/TAO/orbsvcs/Transport_Current/Current_ORBInitializer.cpp
@@ -54,3 +54,59 @@ TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* CURRENT_ORBINITIALIZER_CPP */
+// $Id$
+
+#ifndef CURRENT_ORBINITIALIZER_CPP
+#define CURRENT_ORBINITIALIZER_CPP
+
+#include "tao/ORB_Constants.h"
+
+#include "orbsvcs/Transport_Current/Current_ORBInitializer.h"
+
+// #if defined (__ACE_INLINE__)
+// #include "orbsvcs/Transport_Current/Current_ORBInitializer.inl"
+// #endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Transport
+ {
+
+ template <typename Impl>
+ Current_ORBInitializer<Impl>::Current_ORBInitializer(const ACE_TCHAR* id)
+ : Current_ORBInitializer_Base (id)
+ {
+ }
+
+
+ template <typename Impl>
+ TAO::Transport::Current_ptr
+ Current_ORBInitializer<Impl>::make_current_instance (TAO_ORB_Core* core,
+ size_t tss_slot_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ // Create the Current
+ Current_ptr tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ Impl (core, tss_slot_id),
+ CORBA::NO_MEMORY
+ (CORBA::SystemException::_tao_minor_code (TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ return tmp;
+ }
+
+ }
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* CURRENT_ORBINITIALIZER_CPP */
diff --git a/TAO/orbsvcs/Transport_Current/Current_ORBInitializer.h b/TAO/orbsvcs/Transport_Current/Current_ORBInitializer.h
index fbee3bec382..6fc292895a6 100644
--- a/TAO/orbsvcs/Transport_Current/Current_ORBInitializer.h
+++ b/TAO/orbsvcs/Transport_Current/Current_ORBInitializer.h
@@ -68,3 +68,73 @@ TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* CURRENT_ORBINITIALIZER_H */
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file Current_ORBInitializer.h
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef CURRENT_ORBINITIALIZER_H
+#define CURRENT_ORBINITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "orbsvcs/Transport_Current/Current_ORBInitializer_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Transport
+ {
+
+ template <typename Impl>
+ class TAO_Transport_Current_Export Current_ORBInitializer
+ //class Current_ORBInitializer
+ : public Current_ORBInitializer_Base
+ {
+ public:
+ Current_ORBInitializer (const ACE_TCHAR* id);
+
+
+ protected:
+ virtual TAO::Transport::Current_ptr
+ make_current_instance (TAO_ORB_Core* c,
+ size_t s
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ };
+
+ };
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+// #if defined (__ACE_INLINE__)
+// #include "orbsvcs/Transport_Current/Current_ORBInitializer.inl"
+// #endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "orbsvcs/Transport_Current/Current_ORBInitializer.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("orbsvcs/Transport_Current/Current_ORBInitializer.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* CURRENT_ORBINITIALIZER_H */
diff --git a/TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.cpp b/TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.cpp
index 81451724e5f..874f77f7230 100644
--- a/TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.cpp
+++ b/TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.cpp
@@ -74,3 +74,79 @@ namespace TAO
TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
+// $Id$
+
+#include "tao/PI/ORBInitInfo.h"
+
+#include "orbsvcs/Transport_Current/Current_ORBInitializer_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Transport
+ {
+
+ Current_ORBInitializer_Base::Current_ORBInitializer_Base(const ACE_TCHAR* id)
+ : id_ (id)
+ {
+ }
+
+ Current_ORBInitializer_Base::~Current_ORBInitializer_Base(void)
+ {
+ }
+
+
+
+ void
+ Current_ORBInitializer_Base::pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_NOT_USED )
+ ACE_THROW_SPEC( (CORBA::SystemException) )
+ {
+ // Narrow to a TAO_ORBInitInfo object to get access to the
+ // allocate_tss_slot_id() TAO extension.
+ TAO_ORBInitInfo_var tao_info =
+ TAO_ORBInitInfo::_narrow (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (tao_info.in ()))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) TAO::Transport::ORBInitializer::pre_init - "
+ "Panic: unable to narrow the ORBInitInfo_ptr\n"));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ // Reserve a TSS slot in the ORB core internal TSS resources for the
+ // thread-specific portion of the Current object.
+ size_t tss_slot = tao_info->allocate_tss_slot_id (0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create the Current
+ Current_var current (this->make_current_instance (tao_info->orb_core (),
+ tss_slot
+ ACE_ENV_ARG_PARAMETER));
+
+ info->register_initial_reference (ACE_TEXT_ALWAYS_CHAR (this->id_.fast_rep ()),
+ current.in ());
+
+ }
+
+ void
+ Current_ORBInitializer_Base::post_init (PortableInterceptor::ORBInitInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED )
+ ACE_THROW_SPEC( (CORBA::SystemException) )
+ {
+ }
+
+ }
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
diff --git a/TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.h b/TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.h
index 95e2e08fd71..423eca25949 100644
--- a/TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.h
+++ b/TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.h
@@ -67,3 +67,72 @@ TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* CURRENT_ORBINITIALIZER_BASE_H */
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file Current_ORBInitializer_Base.h
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef CURRENT_ORBINITIALIZER_BASE_H
+#define CURRENT_ORBINITIALIZER_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/SString.h"
+#include "tao/PI/PI.h"
+
+#include "orbsvcs/Transport_Current/Transport_Current_Export.h"
+#include "orbsvcs/Transport_Current/TCC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Transport
+ {
+
+ class TAO_Transport_Current_Export Current_ORBInitializer_Base :
+ public PortableInterceptor::ORBInitializer
+ {
+ public:
+ Current_ORBInitializer_Base (const ACE_TCHAR* id);
+ virtual ~Current_ORBInitializer_Base (void);
+
+ virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED )
+ ACE_THROW_SPEC( (CORBA::SystemException) );
+
+ virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_NOT_USED )
+ ACE_THROW_SPEC( (CORBA::SystemException) );
+
+ protected:
+ virtual TAO::Transport::Current_ptr
+ make_current_instance (TAO_ORB_Core* core,
+ size_t tss_slot_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ protected:
+ const ACE_TString id_;
+ };
+
+ };
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* CURRENT_ORBINITIALIZER_BASE_H */
diff --git a/TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.cpp b/TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.cpp
index 649cb6258ed..c3f765a7a58 100644
--- a/TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.cpp
+++ b/TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.cpp
@@ -122,3 +122,127 @@ namespace TAO
TAO_END_VERSIONED_NAMESPACE_DECL
+// $Id$
+
+#include "ace/INET_Addr.h"
+#include "tao/IIOP_Connection_Handler.h"
+#include "tao/IIOP_Transport.h"
+#include "tao/Transport_Selection_Guard.h"
+
+#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 NO_IMPLEMENT 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 (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ const TAO_Transport* t = this->transport ();
+ if (t == 0)
+ ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);
+
+ TAO_Connection_Handler *ch = const_cast<TAO_Transport*>(t)->connection_handler ();
+ if (ch == 0)
+ ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);
+
+ return static_cast <TAO_IIOP_Connection_Handler*> (ch);
+ }
+
+
+ /// 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 (void)
+ {
+ }
+
+ CORBA::Long
+ IIOP_Current_Impl::id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ return this->handler ()->get_handle ();
+ }
+
+ ::SSLIOP::Current_ptr
+ IIOP_Current_Impl::ssliop_current (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);
+ }
+
+
+ CORBA::Long
+ IIOP_Current_Impl::remote_port (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ TAO_IIOP_Connection_Handler *iiopch =
+ this->handler ();
+
+ ACE_INET_Addr a;
+ iiopch->peer ().get_remote_addr (a);
+
+ return a.get_port_number ();
+ }
+
+ char*
+ IIOP_Current_Impl::remote_host (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ 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 ());
+ }
+
+ CORBA::Long
+ IIOP_Current_Impl::local_port (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ TAO_IIOP_Connection_Handler *iiopch =
+ this->handler ();
+
+ ACE_INET_Addr a;
+ iiopch->peer ().get_local_addr (a);
+
+ return a.get_port_number ();
+ }
+
+ char*
+ IIOP_Current_Impl::local_host (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext))
+ {
+ 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 ());
+ }
+
+ }
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.h b/TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.h
index 53bb9bfe592..4005249a461 100644
--- a/TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.h
+++ b/TAO/orbsvcs/Transport_Current/IIOP_Current_Impl.h
@@ -106,3 +106,111 @@ TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* IIOP_CURRENT_IMPL_H */
+/**
+ * @file IIOP_Current_Impl.h
+ *
+ * @brief Provide implementation for the IIOPTraits interface
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+
+#ifndef IIOP_CURRENT_IMPL_H
+#define IIOP_CURRENT_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/Transport_Current/TC_IIOPC.h"
+#include "orbsvcs/Transport_Current/Current_Impl.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+class TAO_IIOP_Connection_Handler;
+
+namespace TAO
+{
+ namespace Transport
+ {
+
+ /**
+ * @class IIOP_Current_Impl
+ *
+ * @brief Implementation of the TAO::Transport::IIOPCurrent
+ * interface.
+ *
+ * IIOP_Current_Impl is useful for obtaining information about the
+ * IIOP Transport, associated with the calling thread.
+ */
+ class TAO_Transport_Current_Export IIOP_Current_Impl
+ : public virtual IIOP::Current
+ , public virtual Current_Impl
+ {
+ public:
+
+ /// Constructor.
+ IIOP_Current_Impl (TAO_ORB_Core* core, size_t tss_slot_id);
+
+ //@{
+ virtual ::CORBA::Long id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual ::SSLIOP::Current_ptr ssliop_current (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual ::CORBA::Long remote_port (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual char* remote_host (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual ::CORBA::Long local_port (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ virtual char* local_host (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+ //@}
+
+
+ protected:
+
+ /// Destructor
+ /**
+ * Protected destructor to enforce the fact this class is reference
+ * counted, and should not be destroyed using delete() by anything
+ * other than the reference counting mechanism.
+ */
+ virtual ~IIOP_Current_Impl (void);
+
+ private:
+
+ /// Returns the IIOP connection handler associated with the
+ /// Transport. Will throw NO_IMPLEMENT 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* handler (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((::CORBA::SystemException, NoContext));
+
+ private:
+
+ /// Prevent copying through the copy constructor and
+ /// assignment operator.
+ //@{
+ IIOP_Current_Impl (const IIOP_Current_Impl &);
+ void operator= (const IIOP_Current_Impl &);
+ //@}
+
+ };
+ };
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* IIOP_CURRENT_IMPL_H */
diff --git a/TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.cpp b/TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.cpp
index 707702de20d..559014bd081 100644
--- a/TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.cpp
+++ b/TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.cpp
@@ -93,3 +93,98 @@ ACE_STATIC_SVC_DEFINE (TAO_Transport_IIOP_Current_Loader,
ACE_FACTORY_NAMESPACE_DEFINE (TAO_Transport_Current,
TAO_Transport_IIOP_Current_Loader,
TAO::Transport::IIOP::Current_Loader)
+/* -*- C++ -*- */
+
+// =================================================================
+/**
+ * @file IIOP_Current_Loader.cpp
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ *
+ */
+// =================================================================
+
+
+#include "ace/Service_Config.h"
+
+#include "tao/ORBInitializer_Registry.h"
+#include "tao/ORB_Constants.h"
+
+#include "tao/PI/PI.h"
+
+#include "orbsvcs/Transport_Current/Current_ORBInitializer.h"
+#include "orbsvcs/Transport_Current/IIOP_Current_Loader.h"
+#include "orbsvcs/Transport_Current/IIOP_Current_Impl.h"
+
+ACE_RCSID (Transport_Current,
+ IIOP_Current_Loader,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Transport
+ {
+ namespace IIOP
+ {
+ /// Initializes object when dynamic linking occurs.
+ int
+ Current_Loader::init (int, ACE_TCHAR *[])
+ {
+ PortableInterceptor::ORBInitializer_ptr tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ Current_ORBInitializer<IIOP_Current_Impl> (ACE_TEXT ("TAO::Transport::IIOP::Current")),
+ CORBA::NO_MEMORY (CORBA::SystemException::_tao_minor_code (TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ PortableInterceptor::ORBInitializer_var initializer (tmp);
+
+ PortableInterceptor::register_orb_initializer (initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ return 0;
+ }
+ }
+
+ }
+}
+
+
+#if defined (TAO_AS_STATIC_LIBS)
+ACE_STATIC_SVC_REQUIRE (TAO_Transport_IIOP_Current_Loader);
+
+namespace TAO
+{
+ namespace Transport
+ {
+ namespace IIOP
+ {
+ int current_static_initializer (void)
+ {
+ ACE_STATIC_SVC_REGISTER (TAO_Transport_IIOP_Current_Loader);
+ return 0;
+ }
+ }
+ }
+}
+#endif /* defined (TAO_AS_STATIC_LIBS) */
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_Transport_IIOP_Current_Loader,
+ ACE_TEXT ("TAO_Transport_IIOP_Current_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Transport_IIOP_Current_Loader),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (TAO_Transport_Current,
+ TAO_Transport_IIOP_Current_Loader,
+ TAO::Transport::IIOP::Current_Loader)
diff --git a/TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.h b/TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.h
index 4afa5573392..41b30729608 100644
--- a/TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.h
+++ b/TAO/orbsvcs/Transport_Current/IIOP_Current_Loader.h
@@ -66,3 +66,71 @@ ACE_FACTORY_DECLARE (TAO_Transport_Current,
TAO_Transport_IIOP_Current_Loader)
#endif /* TAO_TRANSPORT_IIOP_TRAITS_LOADER_H */
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file IIOP_Current_Loader.h
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_TRANSPORT_IIOP_TRAITS_LOADER_H
+#define TAO_TRANSPORT_IIOP_TRAITS_LOADER_H
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/Transport_Current/Current_Loader.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ namespace Transport
+ {
+
+ namespace IIOP
+ {
+ class TAO_Transport_Current_Export Current_Loader
+ : public TAO::Transport::Current_Loader
+ {
+ public:
+ /// Initializes object when dynamic linking occurs.
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ };
+ }
+ }
+}
+
+
+
+#if defined (TAO_AS_STATIC_LIBS)
+namespace TAO
+{
+ namespace Transport
+ {
+ namespace IIOP
+ {
+ int current_static_initializer (void);
+ }
+ }
+}
+
+#endif /* defined (TAO_AS_STATIC_LIBS) */
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Transport_Current,
+ TAO_Transport_IIOP_Current_Loader)
+
+ACE_FACTORY_DECLARE (TAO_Transport_Current,
+ TAO_Transport_IIOP_Current_Loader)
+
+#endif /* TAO_TRANSPORT_IIOP_TRAITS_LOADER_H */
diff --git a/TAO/orbsvcs/Transport_Current/IIOP_Transport_Current.h b/TAO/orbsvcs/Transport_Current/IIOP_Transport_Current.h
index fb05eddf901..bf6315ce6bc 100644
--- a/TAO/orbsvcs/Transport_Current/IIOP_Transport_Current.h
+++ b/TAO/orbsvcs/Transport_Current/IIOP_Transport_Current.h
@@ -15,3 +15,20 @@ static int tao_iiop_transport_current_initializer_called =
#endif /* TAO_AS_STATIC_LIBS */
+// -*- C++ -*-
+// $Id$
+
+
+#include "orbsvcs/Transport_Current/TCC.h"
+#include "orbsvcs/Transport_Current/TC_IIOPC.h"
+#include "orbsvcs/Transport_Current/IIOP_Current_Loader.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+
+// Only do this for static builds. It causes a circular dependency for
+// dynamic builds.
+static int tao_iiop_transport_current_initializer_called =
+ TAO::Transport::IIOP::current_static_initializer ();
+
+#endif /* TAO_AS_STATIC_LIBS */
+
diff --git a/TAO/orbsvcs/Transport_Current/TC.idl b/TAO/orbsvcs/Transport_Current/TC.idl
index 6f6b5684790..55464973668 100644
--- a/TAO/orbsvcs/Transport_Current/TC.idl
+++ b/TAO/orbsvcs/Transport_Current/TC.idl
@@ -55,3 +55,60 @@ module TAO
};
#endif /* TAO_TRANSPORT_CURRENT_IDL */
+/**
+ * @file TC.idl
+ *
+ * @brief Defines the TAO::Transport::Current interface
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+
+#ifndef TAO_TRANSPORT_CURRENT_IDL
+#define TAO_TRANSPORT_CURRENT_IDL
+
+#include <IOP.pidl>
+#include <TimeBase.pidl>
+
+module TAO
+{
+ /// A type used to represent counters
+ typedef unsigned long long CounterT;
+
+ module Transport
+ {
+ /// Used to signal that a call was made within improper invocation
+ /// context. Also, this exception is thrown if no Transport has
+ /// been selected for the current thread, for example in a
+ /// collocated invocation.
+
+ exception NoContext
+ {
+ };
+
+ // The primary interface, providing access to Transport
+ // information, available to the current thread.
+
+ local interface Current
+ {
+ /// Transport ID, unique within the process.
+ readonly attribute long id raises (NoContext);
+
+ /// Bytes sent/received through the transport.
+ readonly attribute CounterT bytes_sent raises (NoContext);
+ readonly attribute CounterT bytes_received raises (NoContext);
+
+ /// Messages (requests and replies) sent/received using the current
+ /// protocol.
+ readonly attribute CounterT messages_sent raises (NoContext);
+ readonly attribute CounterT messages_received raises (NoContext);
+
+ /// The absolute time (miliseconds) since the transport has been
+ /// open.
+ readonly attribute TimeBase::TimeT open_since raises (NoContext);
+ };
+ };
+};
+
+#endif /* TAO_TRANSPORT_CURRENT_IDL */
diff --git a/TAO/orbsvcs/Transport_Current/TC.mpc b/TAO/orbsvcs/Transport_Current/TC.mpc
index 7acd7bd87d3..ef9d4780503 100644
--- a/TAO/orbsvcs/Transport_Current/TC.mpc
+++ b/TAO/orbsvcs/Transport_Current/TC.mpc
@@ -31,3 +31,36 @@ project(*) : taolib_with_idl, tao_versioning_idl_defaults, core, interceptors, p
}
}
+//$Id$
+
+project(*) : taolib_with_idl, tao_versioning_idl_defaults, core, interceptors, pi {
+
+ sharedname = TAO_TC
+ dynamicflags = TAO_TRANSPORT_CURRENT_BUILD_DLL
+
+ Source_Files {
+ Current_Impl.cpp
+ Current_Loader.cpp
+ Current_ORBInitializer_Base.cpp
+ }
+
+ Header_Files {
+ Current_Impl.h
+ Current_Loader.h
+ Current_ORBInitializer.h
+ Current_ORBInitializer_Base.h
+ Transport_Current.h
+ }
+
+ Template_Files {
+ Current_ORBInitializer.cpp
+ }
+
+ idlflags += -Wb,export_include=orbsvcs/Transport_Current/Transport_Current_Export.h
+ idlflags += -Wb,export_macro=TAO_Transport_Current_Export
+
+ IDL_Files {
+ TC.idl
+ }
+}
+
diff --git a/TAO/orbsvcs/Transport_Current/TC_IIOP.idl b/TAO/orbsvcs/Transport_Current/TC_IIOP.idl
index 2a4ef3bd732..d167e2f5b80 100644
--- a/TAO/orbsvcs/Transport_Current/TC_IIOP.idl
+++ b/TAO/orbsvcs/Transport_Current/TC_IIOP.idl
@@ -54,3 +54,59 @@ module TAO
};
#endif /* TAO_TRANSPORT_IIOP_CURRENT_IDL */
+/**
+ * @file TC_IIOP.idl
+ *
+ * @brief Defines the TAO::Transport::IIOP::Current interface
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+
+#ifndef TAO_TRANSPORT_IIOP_CURRENT_IDL
+#define TAO_TRANSPORT_IIOP_CURRENT_IDL
+
+#include "TC.idl"
+
+/// Provide a forward reference for the SSLIOP::Current
+module SSLIOP
+{
+ interface Current;
+};
+
+
+module TAO
+{
+ module Transport
+ {
+ module IIOP
+ {
+ // The primary interface, providing access to IIOP-specific
+ // transport information, if it is indeed an IIOP (-like) transport
+ // that has been selected.
+
+ local interface Current : TAO::Transport::Current
+ {
+ /// Remote host
+ readonly attribute string remote_host raises (NoContext);
+
+ /// Remote port Using long (signed) type to better accomodate
+ /// the Java mapping, which has no support for unsigned values
+ readonly attribute long remote_port raises (NoContext);
+
+ /// Local host
+ readonly attribute string local_host raises (NoContext);
+
+ /// Local port
+ readonly attribute long local_port raises (NoContext);
+
+ /// If this is a "secure" transport, this method will give you
+ /// the corresponding SSLIOP::Current
+ readonly attribute ::SSLIOP::Current ssliop_current raises (NoContext);
+ };
+ };
+ };
+};
+
+#endif /* TAO_TRANSPORT_IIOP_CURRENT_IDL */
diff --git a/TAO/orbsvcs/Transport_Current/TC_IIOP.mpc b/TAO/orbsvcs/Transport_Current/TC_IIOP.mpc
index 4f87324296d..c72b1f4d866 100644
--- a/TAO/orbsvcs/Transport_Current/TC_IIOP.mpc
+++ b/TAO/orbsvcs/Transport_Current/TC_IIOP.mpc
@@ -25,3 +25,30 @@ project(*) : taolib_with_idl, tao_versioning_idl_defaults, core, interceptors, p
TC_IIOP.idl
}
}
+//$Id$
+
+project(*) : taolib_with_idl, tao_versioning_idl_defaults, core, interceptors, pi, tc {
+
+ sharedname = TAO_TC_IIOP
+
+ dynamicflags = TAO_TRANSPORT_CURRENT_BUILD_DLL
+ libs += TAO_TC
+
+ Source_Files {
+ IIOP_Current_Impl.cpp
+ IIOP_Current_Loader.cpp
+ }
+
+ Header_Files {
+ IIOP_Current_Impl.h
+ IIOP_Current_Loader.h
+ IIOP_Transport_Current.h
+ }
+
+ idlflags += -Wb,export_include=orbsvcs/Transport_Current/Transport_Current_Export.h
+ idlflags += -Wb,export_macro=TAO_Transport_Current_Export
+
+ IDL_Files {
+ TC_IIOP.idl
+ }
+}
diff --git a/TAO/orbsvcs/Transport_Current/Transport_Current.h b/TAO/orbsvcs/Transport_Current/Transport_Current.h
index 2a6ebdfceca..0ed49c895d8 100644
--- a/TAO/orbsvcs/Transport_Current/Transport_Current.h
+++ b/TAO/orbsvcs/Transport_Current/Transport_Current.h
@@ -14,3 +14,19 @@ static int tao_transport_current_initializer_called =
#endif /* TAO_AS_STATIC_LIBS */
+// -*- C++ -*-
+// $Id$
+
+
+#include "orbsvcs/Transport_Current/TCC.h"
+#include "orbsvcs/Transport_Current/Current_Loader.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+
+// Only do this for static builds. It causes a circular dependency for
+// dynamic builds.
+static int tao_transport_current_initializer_called =
+ TAO::Transport::current_static_initializer ();
+
+#endif /* TAO_AS_STATIC_LIBS */
+
diff --git a/TAO/orbsvcs/Transport_Current/Transport_Current_Export.h b/TAO/orbsvcs/Transport_Current/Transport_Current_Export.h
index ce01b4dc2f1..91d1a8b24fc 100644
--- a/TAO/orbsvcs/Transport_Current/Transport_Current_Export.h
+++ b/TAO/orbsvcs/Transport_Current/Transport_Current_Export.h
@@ -52,3 +52,57 @@
#endif /* TAO_TRANSPORT_CURRENT_EXPORT_H */
// End of auto generated file.
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -d TAO_Transport_Current
+// ------------------------------
+#ifndef TAO_TRANSPORT_CURRENT_EXPORT_H
+#define TAO_TRANSPORT_CURRENT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (TAO_TRANSPORT_CURRENT_HAS_DLL)
+# define TAO_TRANSPORT_CURRENT_HAS_DLL 1
+#endif /* ! TAO_TRANSPORT_CURRENT_HAS_DLL */
+
+#if defined (TAO_TRANSPORT_CURRENT_HAS_DLL) && (TAO_TRANSPORT_CURRENT_HAS_DLL == 1)
+# if defined (TAO_TRANSPORT_CURRENT_BUILD_DLL)
+# define TAO_Transport_Current_Export ACE_Proper_Export_Flag
+# define TAO_TRANSPORT_CURRENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_TRANSPORT_CURRENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_TRANSPORT_CURRENT_BUILD_DLL */
+# define TAO_Transport_Current_Export ACE_Proper_Import_Flag
+# define TAO_TRANSPORT_CURRENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_TRANSPORT_CURRENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_TRANSPORT_CURRENT_BUILD_DLL */
+#else /* TAO_TRANSPORT_CURRENT_HAS_DLL == 1 */
+# define TAO_Transport_Current_Export
+# define TAO_TRANSPORT_CURRENT_SINGLETON_DECLARATION(T)
+# define TAO_TRANSPORT_CURRENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_TRANSPORT_CURRENT_HAS_DLL == 1 */
+
+// Set TAO_TRANSPORT_CURRENT_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_TRANSPORT_CURRENT_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_TRANSPORT_CURRENT_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_TRANSPORT_CURRENT_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_TRANSPORT_CURRENT_NTRACE */
+
+#if (TAO_TRANSPORT_CURRENT_NTRACE == 1)
+# define TAO_TRANSPORT_CURRENT_TRACE(X)
+#else /* (TAO_TRANSPORT_CURRENT_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_TRANSPORT_CURRENT_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_TRANSPORT_CURRENT_NTRACE == 1) */
+
+#endif /* TAO_TRANSPORT_CURRENT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.cpp b/TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.cpp
index 51e7fa04b31..05190ee9efa 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.cpp
@@ -180,3 +180,185 @@ namespace Test
}
}
+// -*- C++ -*-
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (ForwardRequest,
+ Client_Request_Interceptor,
+ "$Id$")
+
+#include "Current_TestC.h"
+#include "Client_Request_Interceptor.h"
+#include "ORBInitializer_T.h"
+
+// // A specialization to handle client-side interceptors
+// template <>
+// void ORBInitializer<PortableInterceptor::ClientRequestInterceptor>::post_init
+// (PortableInterceptor::ORBInitInfo* oii ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+// ACE_THROW_SPEC ((CORBA::SystemException));
+
+
+namespace Test
+{
+
+ using namespace TAO;
+
+ // A specialization to handle client-side interceptors
+ template <>
+ void
+ ORBInitializer<PortableInterceptor::ClientRequestInterceptor>::post_init (PortableInterceptor::ORBInitInfo* oii
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ oii->add_client_request_interceptor (this->interceptor_.in ());
+ };
+
+ Client_Request_Interceptor::Client_Request_Interceptor (const char *orb_id,
+ TEST test)
+ : orb_id_ (CORBA::string_dup (orb_id))
+ , request_count_ (0)
+ , requestID_ (1)
+ , test_ (test)
+ {
+ }
+
+ CORBA::Long
+ Client_Request_Interceptor::interceptions (void)
+ {
+ return this->request_count_;
+ }
+
+ char *
+ Client_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return CORBA::string_dup ("Client_Request_Interceptor");
+ }
+
+ void
+ Client_Request_Interceptor::test_transport_current (const ACE_TCHAR* amethod
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::UserException))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("CRI (%P|%t) Test accessing Transport Current from %s\n"),
+ amethod));
+
+ ++this->request_count_;
+
+ int tmp = 0;
+ CORBA::ORB_var orb = CORBA::ORB_init (tmp,
+ 0,
+ orb_id_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+
+ (*this->test_) (orb.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("CRI (%P|%t) Successfully tested Transport Current from %s\n"),
+ amethod));
+ }
+
+ void
+ Client_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ }
+
+ void
+ Client_Request_Interceptor::send_request (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+ //Test TC
+
+ test_transport_current ("send_request"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Boolean response_expected =
+ ri->response_expected (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Oneway?
+ if (response_expected)
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("CRI (%P|%t) Sending a two-way\n")));
+ else
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("CRI (%P|%t) Sending a one-way\n")));
+
+ // Make the context to send the context to the target
+
+ IOP::ServiceContext sc;
+ sc.context_id = TAO::Transport::CurrentTest::ContextTag;
+
+ char temp[100];
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, monitor, this->lock_);
+
+ ACE_OS::sprintf (temp, "%d", this->requestID_);
+ this->requestID_++;
+ }
+
+ CORBA::ULong string_len = ACE_OS::strlen (temp) + 1;
+ CORBA::Octet *buf = CORBA::OctetSeq::allocbuf (string_len);
+ ACE_OS::strcpy (ACE_reinterpret_cast (char *, buf), temp);
+
+ sc.context_data.replace (string_len, string_len, buf, 1);
+
+ // Add this context to the service context list.
+ ri->add_request_service_context (sc, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ }
+
+ void
+ Client_Request_Interceptor::send_poll (PortableInterceptor::ClientRequestInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ test_transport_current ("send_poll"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ Client_Request_Interceptor::receive_reply (PortableInterceptor::ClientRequestInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ test_transport_current ("receive_reply"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ Client_Request_Interceptor::receive_exception (PortableInterceptor::ClientRequestInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+ test_transport_current ("receive_exception"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ Client_Request_Interceptor::receive_other (PortableInterceptor::ClientRequestInfo_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+
+ test_transport_current ("receive_other"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ }
+
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.h b/TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.h
index 4c35f70aba6..bbda0f5f7a2 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.h
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Client_Request_Interceptor.h
@@ -142,3 +142,147 @@ namespace Test
#endif /* _MSC_VER */
#endif /* CLIENT_REQUEST_INTERCEPTOR_H */
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Client_Request_Interceptor.h
+ *
+ * $Id$
+ *
+ * Implementation header for the client request interceptor for the
+ * Transport::Current test.
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+#ifndef CLIENT_REQUEST_INTERCEPTOR_H
+#define CLIENT_REQUEST_INTERCEPTOR_H
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/PortableInterceptorC.h"
+#include "tao/LocalObject.h"
+#include "tao/ORB.h"
+#include "tao/CORBA_String.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+
+namespace Test
+{
+
+ /// A metod doing the actual testing, so we could change it for the
+ /// different traits implementations
+
+ typedef int (*TEST) (CORBA::ORB_ptr ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+
+ /**
+ * @class Client_Request_Interceptor
+ *
+ * @brief Client request interceptor that exercises
+ * Transport::Current support.
+ *
+ * This client request interceptor forwards a request to a secondary
+ * object by throwing the PortableInterceptor::ForwardRequest
+ * exception from within the send_request() interception point. It
+ * only forwards the initial request. See the README file for
+ * details.
+ */
+ class Client_Request_Interceptor
+ : public virtual PortableInterceptor::ClientRequestInterceptor,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+
+ /// Constructor.
+ Client_Request_Interceptor (const char *orb_id,
+ TEST test);
+ /**
+ * @name Methods Required by the Client Request Interceptor
+ * Interface
+ *
+ * These are methods that must be implemented since they are pure
+ * virtual in the abstract base class. They are the canonical
+ * methods required for all client request interceptors.
+ */
+ //@{
+ /// Return the name of this ClientRequestinterceptor.
+ virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+ //@}
+
+ CORBA::Long interceptions (void);
+
+ private:
+ void test_transport_current (const ACE_TCHAR* amethod ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException, CORBA::UserException));
+
+ private:
+ ///The ID of the ORB this interceptor is registered with.
+ CORBA::String_var orb_id_;
+
+ /// Pseudo-reference to the ORB this interceptor is registered
+ /// with.
+ CORBA::ORB_var orb_;
+
+ /// The number of requests intercepted by this interceptor.
+ CORBA::ULong request_count_;
+
+ /// Stringified reference to the object the initial request will be
+ /// forwarded to by this interceptor.
+ CORBA::String_var forward_str_;
+
+ /// Synchronize internal state...
+ TAO_SYNCH_MUTEX lock_;
+
+ /// Unique request ID
+ unsigned long requestID_;
+
+ /// Test function
+ TEST test_;
+ };
+
+}; // namespace Test
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* CLIENT_REQUEST_INTERCEPTOR_H */
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test.idl b/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test.idl
index 419be426991..b53806bcda4 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test.idl
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test.idl
@@ -32,3 +32,37 @@ module TAO
};
};
};
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file test.idl
+ *
+ * $Id$
+ *
+ * Simple IDL file to test TAO::TranspotCurrent
+ * support.
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+//=============================================================================
+
+module TAO
+{
+ module Transport
+ {
+ interface CurrentTest
+ {
+
+ const unsigned long ContextTag = 0xabcdef;
+
+ void invoked_by_client ();
+
+ void invoked_during_upcall ();
+
+ long self_test ();
+
+ oneway void shutdown ();
+ };
+ };
+};
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.cpp b/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.cpp
index 8b44743f3df..ab9d7039073 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.cpp
@@ -167,3 +167,172 @@ Current_Test_Impl::shutdown (ACE_ENV_SINGLE_ARG_DECL)
this->orb_->shutdown (0
ACE_ENV_ARG_PARAMETER);
}
+// -*- C++ -*-
+
+#include "orbsvcs/Transport_Current/TCC.h"
+
+#include "Current_Test_Impl.h"
+
+ACE_RCSID (Transport_Current,
+ Current_Test_Impl,
+ "$Id$")
+
+ Current_Test_Impl::Current_Test_Impl (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ int do_collocated_calls)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+ , poa_ (PortableServer::POA::_duplicate (poa))
+ , do_collocated_calls_ (do_collocated_calls)
+{
+}
+
+Current_Test_Impl::~Current_Test_Impl (void)
+{
+}
+
+::CORBA::Long
+Current_Test_Impl::self_test (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((::CORBA::SystemException))
+{
+ return 0;
+}
+
+void
+Current_Test_Impl::test_transport_current (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 2) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Testing access to Transport Current ...\n")));
+ }
+
+ CORBA::Object_var tcobject =
+ orb_->resolve_initial_references ("TAO::Transport::Current"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO::Transport::Current_var tc =
+ TAO::Transport::Current::_narrow (tcobject.in ()
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ if (TAO_debug_level >= 1)
+ {
+ ::CORBA::Long id = tc->id (ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT bs = tc->bytes_sent (ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT br = tc->bytes_received (ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT rs = tc->messages_sent (ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT rr = tc->messages_received (ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Current_Test_Impl (%P|%t) Transport [%q] - Sent/Received [bytes=%q/%q, messages=%q/%q]\n"),
+ (ACE_UINT64)id,
+ (ACE_UINT64)bs,
+ (ACE_UINT64)br,
+ (ACE_UINT64)rs,
+ (ACE_UINT64)rr));
+ }
+
+ if (TAO_debug_level > 2) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Successfully accessed Transport Current\n")));
+ }
+}
+
+void
+Current_Test_Impl::invoked_by_client (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_TRY
+ {
+ this->invoked_by_client_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (TAO::Transport::NoContext, ex)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) server - Caught a Transport::NoContext exception\n")));
+ }
+ ACE_CATCH (CORBA::SystemException, ex1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) server - Caught a CORBA::SystemException exception\n")));
+ }
+ ACE_ENDTRY;
+}
+
+void
+Current_Test_Impl::invoked_by_client_i (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException, TAO::Transport::NoContext))
+{
+ if (TAO_debug_level > 2) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Testing inside an upcall\n")));
+ }
+
+ this->test_transport_current (ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ if (this->do_collocated_calls_)
+ {
+ CORBA::Object_var selfobject =
+ poa_->servant_to_reference (this
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ TAO::Transport::CurrentTest_var self =
+ TAO::Transport::CurrentTest::_narrow (selfobject.in ()
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ if (TAO_debug_level >= 1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Testing a collocated call\n")));
+ }
+ self->invoked_during_upcall (ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ if (TAO_debug_level >= 1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Skipping the collocated call test\n")));
+ }
+ }
+}
+
+void
+Current_Test_Impl::invoked_during_upcall (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 2) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Test method invoked ")
+ ACE_TEXT ("by the server during upcall.\n")));
+ }
+
+}
+
+void
+Current_Test_Impl::shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 2) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - shutting down.\n")));
+ }
+
+ this->orb_->shutdown (0
+ ACE_ENV_ARG_PARAMETER);
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.h b/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.h
index 62f28554fcc..dd73bc04c11 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.h
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Current_Test_Impl.h
@@ -78,3 +78,83 @@ private:
};
#endif /* CURRENT_TEST_IMPL_H */
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Current_Test_Impl.h
+ *
+ * $Id$
+ *
+ * Implementation header for the "test" IDL interface for the
+ * TAO::TransportCurrent test.
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef CURRENT_TEST_IMPL_H
+#define CURRENT_TEST_IMPL_H
+
+#include "Current_TestS.h"
+#include "orbsvcs/Transport_Current/TCC.h"
+
+/**
+ * @class Current_Test_Impl
+ *
+ * @brief Simple test class.
+ *
+ * This class implements the "test" interface used in this test.
+ */
+class Current_Test_Impl : public virtual POA_TAO::Transport::CurrentTest
+{
+public:
+
+ /// Constructor.
+ Current_Test_Impl (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, int do_collocated_calls = 1);
+
+ /// Destructor.
+ ~Current_Test_Impl (void);
+
+ /// Main servant test method.
+ virtual void invoked_by_client (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// No-op method used so that a client request interceptor will be
+ /// invoked when invoking this method from the above invoke_me()
+ /// method. Say that 10 times fast. :-)
+ virtual void invoked_during_upcall (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Shutdown the ORB.
+ virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::CORBA::Long self_test (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((::CORBA::SystemException));
+
+public:
+ /// Reports if unexpected errors have been encountered for the
+ /// lifetime of the instance
+ bool is_successful (void) const;
+
+private:
+ void test_transport_current (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Main servant test method.
+ void invoked_by_client_i (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((::CORBA::SystemException, TAO::Transport::NoContext));
+
+private:
+ /// Pseudo-reference to the ORB.
+ CORBA::ORB_var orb_;
+
+ /// Pseudo-reference to the POA (cache)
+ PortableServer::POA_var poa_;
+
+ ///
+ int do_collocated_calls_;
+};
+
+#endif /* CURRENT_TEST_IMPL_H */
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Framework.mpc b/TAO/orbsvcs/tests/Transport_Current/Framework/Framework.mpc
index 74ca4a0d856..4dc6c02369a 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Framework.mpc
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Framework.mpc
@@ -25,3 +25,30 @@ project(*Client): taoclient, tc, pi, dynamicinterface {
Current_Test.idl
}
}
+// -*- MPC -*-
+// $Id$
+
+project(*Server): taoserver, tc, pi_server {
+ Source_Files {
+ server.cpp
+ Current_Test_Impl.cpp
+ Server_Request_Interceptor.cpp
+ Tester.cpp
+ Server_Main.cpp
+ }
+ IDL_Files {
+ Current_Test.idl
+ }
+}
+
+project(*Client): taoclient, tc, pi, dynamicinterface {
+ after += *Server
+ Source_Files {
+ Client_Request_Interceptor.cpp
+ client.cpp
+ Tester.cpp
+ }
+ IDL_Files {
+ Current_Test.idl
+ }
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/ORBInitializer_T.h b/TAO/orbsvcs/tests/Transport_Current/Framework/ORBInitializer_T.h
index c62e53fefb9..7faa5e3d024 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/ORBInitializer_T.h
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/ORBInitializer_T.h
@@ -60,3 +60,65 @@ namespace Test
#endif /* ORBINITIALIZER_T_H */
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORBInitializer_T.h
+ *
+ * $Id$
+ *
+ * @author Iliyan jeliazkov <iliyan@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef ORBINITIALIZER_T_H
+#define ORBINITIALIZER_T_H
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/PortableInterceptorC.h"
+/* #include "tao/LocalObject.h" */
+/* #include "tao/ORB.h" */
+/* #include "tao/CORBA_String.h" */
+
+namespace Test
+{
+ // A template class for ORBInitializer, which registers
+ // interceptors. Partial specializations exist to handle client and
+ // server request interceptors.
+ template <typename Interceptor>
+ class ORBInitializer : public PortableInterceptor::ORBInitializer
+ {
+ public:
+ ORBInitializer (typename Interceptor::_ptr_type interceptor)
+ : interceptor_ (Interceptor::_duplicate (interceptor))
+ {
+ };
+
+ ~ORBInitializer (void)
+ {
+ };
+
+ virtual void pre_init(PortableInterceptor::ORBInitInfo* ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ };
+
+ virtual void post_init(PortableInterceptor::ORBInitInfo* ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ private:
+ typename Interceptor::_var_type interceptor_;
+ };
+
+};
+
+#endif /* ORBINITIALIZER_T_H */
+
+
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/README b/TAO/orbsvcs/tests/Transport_Current/Framework/README
index 4ca496c01a5..4ffb7eaea5e 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/README
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/README
@@ -20,3 +20,25 @@ By default, the client and server will each have only one thread. Use
"-t N" parameter to override that. The "-n N" client-side parameter
determines how many times a particular client thread will call the
server. The default is 1.
+This test intents to show the usage and the expected behavior of the
+Transport Current framework. The topology is the same as in the basic
+Hello test: a client invokes a method on the server and then shuts it
+down and exits. The special features of the test is that it attempts
+to obtain Transport Traits information, using the Transport Current.
+
+There are four basic contexts in which a Transport information can be
+requested, by definition:
+
+ * on the client side, outside client-side interceptor;
+ * client side, inside an interceptor;
+ * server side, inside an up-call;
+ * server side, inside an interceptor;
+
+The test implements the client and the server side interceptors that
+simply call a test method when invoked. A simple interception count
+serves to validate the expected behavior.
+
+By default, the client and server will each have only one thread. Use
+"-t N" parameter to override that. The "-n N" client-side parameter
+determines how many times a particular client thread will call the
+server. The default is 1.
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Main.cpp b/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Main.cpp
index 21c1227fbf3..55a17b65719 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Main.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Main.cpp
@@ -21,3 +21,26 @@ ACE_TMAIN (int argc,
Test::Server_Request_Interceptor cri ("test_orb", test_transport_current);
return server_main (argc, argv, &cri);
}
+// -*- C++ -*-
+
+// $Id$
+
+#include "Server_Request_Interceptor.h"
+
+/// Prototype
+int server_main (int argc,
+ ACE_TCHAR *argv[],
+ Test::Server_Request_Interceptor *cri);
+
+int
+test_transport_current (CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::UserException));
+
+int
+ACE_TMAIN (int argc,
+ ACE_TCHAR *argv[])
+{
+ Test::Server_Request_Interceptor cri ("test_orb", test_transport_current);
+ return server_main (argc, argv, &cri);
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.cpp b/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.cpp
index 26062f02c97..b10de1d4804 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.cpp
@@ -162,3 +162,167 @@ namespace Test {
}
} /* namespace Test */
+// -*- C++ -*-
+
+#include "ace/Log_Msg.h"
+//#include "ace/Global_Macros.h"
+#include "tao/ORB_Constants.h"
+
+
+ACE_RCSID (ForwardRequest,
+ Server_Request_Interceptor,
+ "$Id$")
+
+#include "Server_Request_Interceptor.h"
+
+namespace Test {
+
+ using namespace TAO;
+
+ // A specialization to handle server-side interceptors
+ template <>
+ void
+ ORBInitializer<PortableInterceptor::ServerRequestInterceptor>::post_init (PortableInterceptor::ORBInitInfo* oii
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ oii->add_server_request_interceptor (this->interceptor_.in ());
+ }
+
+
+
+ Server_Request_Interceptor::Server_Request_Interceptor (const char* orbid, TEST test)
+ : request_count_ (0)
+ , orb_id_ (::CORBA::string_dup (orbid))
+ , test_ (test)
+ {
+ }
+
+ Server_Request_Interceptor::~Server_Request_Interceptor (void)
+ {
+ }
+
+ void
+ Server_Request_Interceptor::test_transport_current (const ACE_TCHAR* amethod
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ CORBA::String_var name (this->name ());
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%s (%P|%t) Test accessing Transport Current from %s\n"),
+ name.in (),
+ amethod));
+
+ ++this->request_count_;
+
+ if (TAO_debug_level >=1)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%s (%P|%t) Getting the ORB\n"),
+ name.in ()));
+
+ int tmpargc = 0;
+ CORBA::ORB_var orb = CORBA::ORB_init (tmpargc,
+ 0,
+ this->orb_id_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level >=1)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%s (%P|%t) Resolving the TC\n"),
+ name.in ()));
+
+ CORBA::Object_var tcobject =
+ orb->resolve_initial_references ("TAO::Transport::Current"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ (*this->test_) (orb.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%s (%P|%t) Success - Transport Current from %s\n"),
+ name.in (),
+ amethod));
+ }
+
+ /// queries the status of the test
+ bool
+ Server_Request_Interceptor::self_test () const
+ {
+ return true;
+ }
+
+
+ char *
+ Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return CORBA::string_dup ("SRI ");
+ }
+
+ void
+ Server_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ }
+
+ void
+ Server_Request_Interceptor::receive_request_service_contexts (PortableInterceptor::ServerRequestInfo_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+ test_transport_current ("receive_request_service_contexts"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ }
+
+ void
+ Server_Request_Interceptor::receive_request (PortableInterceptor::ServerRequestInfo_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+ test_transport_current ("receive_request"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ }
+
+ void
+ Server_Request_Interceptor::send_reply (PortableInterceptor::ServerRequestInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ test_transport_current ("send_reply"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ Server_Request_Interceptor::send_exception (PortableInterceptor::ServerRequestInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+ test_transport_current ("send_exception"
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+ }
+
+ void
+ Server_Request_Interceptor::send_other (PortableInterceptor::ServerRequestInfo_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+ test_transport_current ("send_other"
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+ }
+
+} /* namespace Test */
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.h b/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.h
index 2f9ca890dac..14dac8f484c 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.h
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Server_Request_Interceptor.h
@@ -136,3 +136,141 @@ namespace Test
#endif /* _MSC_VER */
#endif /* SERVER_REQUEST_INTERCEPTOR_H */
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Server_Request_Interceptor.h
+ *
+ * $Id$
+ *
+ * Implementation header for the server request interceptor for the
+ * PortableInterceptor::ForwardRequest test.
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+#ifndef SERVER_REQUEST_INTERCEPTOR_H
+#define SERVER_REQUEST_INTERCEPTOR_H
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Current_TestC.h"
+
+#include "orbsvcs/Transport_Current/TCC.h"
+#include "tao/PortableInterceptorC.h"
+#include "tao/LocalObject.h"
+#include "tao/PI_Server/PI_Server.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#include "ORBInitializer_T.h"
+
+namespace Test
+{
+
+ /// A metod doing the actual testing, so we could change it for the
+ /// different traits implementations
+
+ typedef int (*TEST) (CORBA::ORB_ptr ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * @class Server_Request_Interceptor
+ *
+ * @brief Simple concrete server request interceptor.
+ *
+ */
+ class Server_Request_Interceptor
+ : public virtual PortableInterceptor::ServerRequestInterceptor,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+
+ /// Constructor.
+ Server_Request_Interceptor (const char*orb_id, TEST test);
+
+ /// Destructor.
+ virtual ~Server_Request_Interceptor (void);
+
+ virtual void test_transport_current (const char* amethod
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual bool self_test (void) const;
+
+ /**
+ * @name Methods Required by the Server Request Interceptor
+ * Interface
+ *
+ * These are methods that must be implemented since they are pure
+ * virtual in the abstract base class. They are the canonical
+ * methods required for all server request interceptors.
+ */
+ //@{
+ /// Return the name of this ServerRequestinterceptor.
+ virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void receive_request_service_contexts (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void receive_request (
+ PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void send_reply (
+ PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void send_exception (
+ PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void send_other (
+ PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+ //@}
+
+ protected:
+
+ /// The number of requests intercepted by this interceptor.
+ CORBA::ULong request_count_;
+
+ CORBA::String_var orb_id_;
+
+ TEST test_;
+
+ };
+
+ // A specialization to handle server-side interceptor registration
+ template <>
+ void ORBInitializer<PortableInterceptor::ServerRequestInterceptor>::post_init
+ (PortableInterceptor::ORBInitInfo* oii ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* SERVER_REQUEST_INTERCEPTOR_H */
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/Tester.cpp b/TAO/orbsvcs/tests/Transport_Current/Framework/Tester.cpp
index 4b3b1ed632d..78cc2b73702 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/Tester.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/Tester.cpp
@@ -68,3 +68,73 @@ test_transport_current (CORBA::ORB_ptr orb
return test_transport_current (tc.in ());
}
+// $Id$
+
+#include "orbsvcs/Transport_Current/Transport_Current.h"
+
+using namespace TAO;
+
+
+/// Test referencing the TC data outside of the context of an upcall,
+/// or a client-side interceptor
+
+int
+test_transport_current (Transport::Current_ptr tc
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::UserException))
+{
+ CORBA::Long id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO::CounterT bs = tc->bytes_sent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO::CounterT br = tc->bytes_received (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO::CounterT rs = tc->messages_sent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO::CounterT rr = tc->messages_received (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Tester (%P|%t) Transport [%q] - Sent/Received [bytes=%q/%q, messages=%q/%q]\n"),
+ (ACE_UINT64)id,
+ (ACE_UINT64)bs,
+ (ACE_UINT64)br,
+ (ACE_UINT64)rs,
+ (ACE_UINT64)rr));
+
+ return 0;
+}
+
+int
+test_transport_current (CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::UserException))
+{
+ // Get the Current object.
+ CORBA::Object_var tcobject =
+ orb->resolve_initial_references ("TAO::Transport::Current"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ Transport::Current_var tc =
+ Transport::Current::_narrow (tcobject.in ()
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (tc.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) client - ERROR: Could not resolve ")
+ ACE_TEXT ("TAOTransportCurrent object.\n")));
+
+ ACE_TRY_THROW (CORBA::INTERNAL ());
+ }
+
+ return test_transport_current (tc.in ());
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/client-static.conf b/TAO/orbsvcs/tests/Transport_Current/Framework/client-static.conf
index 0f63cfe7965..4b547610207 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/client-static.conf
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/client-static.conf
@@ -1 +1,2 @@
static TAO_Transport_Current_Loader ""
+static TAO_Transport_Current_Loader ""
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/client.conf b/TAO/orbsvcs/tests/Transport_Current/Framework/client.conf
index aecb1923f83..5effabfb371 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/client.conf
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/client.conf
@@ -1 +1,2 @@
dynamic TAO_Transport_Current_Loader Service_Object * TAO_TC:_make_TAO_Transport_Current_Loader() ""
+dynamic TAO_Transport_Current_Loader Service_Object * TAO_TC:_make_TAO_Transport_Current_Loader() ""
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/client.cpp b/TAO/orbsvcs/tests/Transport_Current/Framework/client.cpp
index 3631e5f2562..da8eeeede14 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/client.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/client.cpp
@@ -285,3 +285,290 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
}
ACE_ENDTRY;
}
+// -*- C++ -*-
+
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+
+#include "tao/DynamicInterface/Request.h"
+#include "tao/ORBInitializer_Registry.h"
+
+#include "orbsvcs/Transport_Current/Transport_Current.h"
+
+#include "Client_Request_Interceptor.h"
+#include "Current_TestC.h"
+
+#include "ORBInitializer_T.h"
+
+ACE_RCSID (PICurrent,
+ client,
+ "$Id$")
+
+// Prototype
+
+int
+test_transport_current (CORBA::ORB_ptr
+ ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::UserException));
+
+using namespace TAO;
+
+const ACE_TCHAR* CLIENT_ORB_ID = ACE_TEXT ("client orb");
+const ACE_TCHAR* ior = "file://server.ior";
+
+int nthreads = 1;
+int niterations = 1;
+int use_dii = 1;
+
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "yt:n:k:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'y':
+ use_dii = 0; // Do not use DII
+ break;
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+ case 't':
+ nthreads = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ case 'n':
+ niterations = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Usage: %s "
+ "-k IOR "
+ "-t threads "
+ "-n iterations "
+ "-y "
+ "\n",
+ argv[0]),
+ -1);
+ }
+ return 0;
+}
+
+
+/// A helper class to encapsulate a task
+
+class Worker : public ACE_Task_Base
+{
+public:
+ Worker (TAO::Transport::CurrentTest_ptr server, int niterations, int use_dii_too);
+ virtual int svc (void);
+
+private:
+ // The server.
+ TAO::Transport::CurrentTest_var server_;
+
+ // The number of iterations on each client thread.
+ int niterations_;
+
+ // Whether to use DII in addition to SII
+ int use_dii_too_;
+};
+
+
+/// Ctor
+
+Worker::Worker (TAO::Transport::CurrentTest_ptr server,
+ int niterations,
+ int use_dii_too)
+ : server_ (TAO::Transport::CurrentTest::_duplicate (server))
+ , niterations_ (niterations)
+ , use_dii_too_ (use_dii_too)
+{
+}
+
+
+/// Test referencing the TC data *inside* the context of a client-side
+/// interceptor
+
+int
+Worker::svc (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+
+ for (int i = 0; i < this->niterations_; ++i)
+ {
+
+ if (this->use_dii_too_)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Client (%P|%t) Invoking server->invoked_by_client() via DII\n")));
+
+ CORBA::Request_var request =
+ this->server_->_request ("invoked_by_client"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ request->set_return_type (CORBA::_tc_void);
+
+ request->invoke (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Client (%P|%t) Invoking server->invoked_by_client() via SII\n")));
+
+ this->server_->invoked_by_client (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (TAO_debug_level > 0 && i % 100 == 0)
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Iteration = %d\n"),
+ i));
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Client: exception raised");
+ }
+ ACE_ENDTRY;
+ return 0;
+}
+
+
+/// The main driver
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ Test::Client_Request_Interceptor cri (CLIENT_ORB_ID, test_transport_current);
+
+ PortableInterceptor::ORBInitializer_ptr temp_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+
+ ACE_NEW_RETURN (temp_initializer,
+ Test::ORBInitializer<PortableInterceptor::ClientRequestInterceptor> (&cri),
+ -1);
+
+ PortableInterceptor::ORBInitializer_var orb_initializer =
+ temp_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc,
+ argv,
+ CLIENT_ORB_ID
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Client (%P|%t) Failure to parse the command line.\n"),
+ ior),
+ -1);
+
+
+ ACE_TRY
+ {
+ test_transport_current (orb.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Client (%P|%t) ERROR: ")
+ ACE_TEXT ("TC invocation, outside of ")
+ ACE_TEXT ("interceptor context is undefined.")
+ ACE_TEXT (" Expected exception was not thrown\n")),
+ -1);
+ }
+ ACE_CATCH (Transport::NoContext, ex)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Client (%P|%t) Expected exception occured when trying ")
+ ACE_TEXT ("to access traits outside the ")
+ ACE_TEXT ("interceptor or upcall context.\n")));
+ }
+ ACE_ENDTRY;
+
+ // Resolve the target object
+ CORBA::Object_var obj = orb->string_to_object (ior ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ Transport::CurrentTest_var server =
+ Transport::CurrentTest::_narrow (obj.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (server.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Client (%P|%t) The server object reference <%s> is nil.\n"),
+ ior),
+ -1);
+
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Spawning %d threads\n"), nthreads));
+
+ // Spawn a number of clients doing the same thing for a
+ // predetermined number of times
+ Worker client (server.in (), niterations, use_dii);
+ if (client.activate (THR_NEW_LWP | THR_JOINABLE,
+ nthreads) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Client (%P|%t) Cannot activate the threads\n")),
+ -1);
+ client.thr_mgr ()->wait ();
+
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Collected all threads\n")));
+
+ CORBA::Long result = 0;
+
+ // Verify enough interception points have been triggered
+ if (cri.interceptions () != 2 * // request & response
+ niterations * // iterations
+ nthreads * // threads
+ (2*use_dii)) // sii and dii, if needed
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Client (%P|%t) Expected %d client-side interceptions, but detected %d\n"),
+ 2 * niterations * nthreads * (2*use_dii),
+ cri.interceptions ()));
+ }
+ else
+ {
+
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Invoking server->self_test()\n")));
+
+ // Self-test the server side
+ result = server->self_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (result != 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Client (%P|%t) Server self-test reported failure\n")));
+ }
+
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Invoking oneway server->shutdown()\n")));
+
+ server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("Client (%P|%t) Completed %s\n"),
+ ((result == 0) ? ACE_TEXT ("successfuly") : ACE_TEXT ("with failure"))));
+ return result;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ ACE_TEXT ("Client: Transport Current test (client-side) failed:"));
+ return -1;
+ }
+ ACE_ENDTRY;
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/run_test.pl b/TAO/orbsvcs/tests/Transport_Current/Framework/run_test.pl
index 2f50e0f7609..8e01498fbb7 100755
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/run_test.pl
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/run_test.pl
@@ -57,3 +57,62 @@ if ($server != 0) {
unlink $iorfile;
exit $status;
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::Run_Test;
+
+$status = 0;
+
+#$confmod = "-static";
+
+$iorfile = PerlACE::LocalFile ("server.ior");
+$confserver = PerlACE::LocalFile ("server$confmod.conf");
+$confclient = PerlACE::LocalFile ("client$confmod.conf");
+unlink $iorfile;
+
+if (PerlACE::is_vxworks_test()) {
+ $SV = new PerlACE::ProcessVX ("server",
+ "@ARGV -ORBSvcConf server.conf -o server.ior");
+}
+else {
+ $SV = new PerlACE::Process ("server",
+ "@ARGV -ORBSvcConf $confserver -o $iorfile");
+}
+
+$CL = new PerlACE::Process ("client",
+ "@ARGV -n 1 -ORBSvcConf $confclient -k file://$iorfile");
+
+print STDERR $SV->CommandLine()."\n";
+$SV->Spawn ();
+
+if (PerlACE::waitforfile_timed ($iorfile,
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "$0: ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+print STDERR $CL->CommandLine()."\n";
+$client = $CL->SpawnWaitKill (300);
+
+if ($client != 0) {
+ print STDERR "$0: ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$server = $SV->WaitKill (10);
+
+if ($server != 0) {
+ print STDERR "$0: ERROR: server returned $server\n";
+ $status = 1;
+}
+
+unlink $iorfile;
+
+exit $status;
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/server-static.conf b/TAO/orbsvcs/tests/Transport_Current/Framework/server-static.conf
index 0f63cfe7965..4b547610207 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/server-static.conf
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/server-static.conf
@@ -1 +1,2 @@
static TAO_Transport_Current_Loader ""
+static TAO_Transport_Current_Loader ""
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/server.conf b/TAO/orbsvcs/tests/Transport_Current/Framework/server.conf
index aecb1923f83..5effabfb371 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/server.conf
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/server.conf
@@ -1 +1,2 @@
dynamic TAO_Transport_Current_Loader Service_Object * TAO_TC:_make_TAO_Transport_Current_Loader() ""
+dynamic TAO_Transport_Current_Loader Service_Object * TAO_TC:_make_TAO_Transport_Current_Loader() ""
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/server.cpp b/TAO/orbsvcs/tests/Transport_Current/Framework/server.cpp
index 93bfcae4ac0..7421465160a 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/server.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/server.cpp
@@ -238,3 +238,243 @@ server_main (int argc,
ACE_DEBUG ((LM_INFO, ACE_TEXT ("Server (%P|%t) Completed successfuly.\n")));
return 0;
}
+// -*- C++ -*-
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/Task.h"
+
+#include "tao/ORBInitializer_Registry.h"
+
+#include "Current_Test_Impl.h"
+#include "Server_Request_Interceptor.h"
+
+ACE_RCSID (Transport_Current,
+ server,
+ "$Id$")
+
+#if defined (TAO_AS_STATIC_LIBS)
+
+// 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.
+#include "orbsvcs/Transport_Current/Current_Loader.h"
+ACE_STATIC_SVC_REQUIRE (TAO_Transport_Current_Loader);
+#endif
+
+const char *ior_output_file = "server.ior";
+int nthreads = 1;
+int use_collocated_call = 1;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "t:o:n:c:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'c':
+ use_collocated_call = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+ case 't':
+ nthreads = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ case 'n': // Does nothing. Added just for symetry with the client.
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Usage: %s "
+ "-o <iorfile>"
+ "-t threads "
+ "-n n (ignored, if provided) "
+ "-c make_collocated_calls "
+ "\n",
+ argv[0]),
+ -1);
+ }
+
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+
+
+/// A helper class to encapsulate a task
+
+class Worker : public ACE_Task_Base
+{
+public:
+ Worker (CORBA::ORB_ptr);
+ virtual int svc (void);
+
+private:
+ // The ORB
+ CORBA::ORB_var orb_;
+};
+
+
+/// Ctor
+
+Worker::Worker (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+{
+}
+
+
+/// Test referencing the TC data *inside* the context of a client-side
+/// interceptor
+
+int
+Worker::svc (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+ this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Server: exception raised");
+ }
+ ACE_ENDTRY;
+ return 0;
+}
+
+
+
+/// Main driver
+
+int
+server_main (int argc,
+ ACE_TCHAR *argv[],
+ Test::Server_Request_Interceptor *cri)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ PortableInterceptor::ORBInitializer_ptr temp_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+
+ ACE_NEW_RETURN (temp_initializer,
+ Test::ORBInitializer <PortableInterceptor::ServerRequestInterceptor> (cri),
+ -1); // No exceptions yet!
+
+ PortableInterceptor::ORBInitializer_var orb_initializer =
+ temp_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+
+ CORBA::ORB_var orb = CORBA::ORB_init (argc,
+ argv,
+ ACE_TEXT ("test_orb")
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var obj =
+ orb->resolve_initial_references ("RootPOA"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (root_poa.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Server (%P|%t) Unable to obtain")
+ ACE_TEXT (" RootPOA reference.\n")),
+ -1);
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return -1;
+
+ Current_Test_Impl server_impl (orb.in (),
+ root_poa.in (),
+ use_collocated_call);
+
+ obj = server_impl._this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO::Transport::CurrentTest_var server =
+ TAO::Transport::CurrentTest::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (server.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Server (%P|%t) Unable to obtain ")
+ ACE_TEXT ("reference to CurrentTest object.\n")),
+ -1);
+
+ CORBA::String_var ior =
+ orb->object_to_string (server.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // If the ior_output_file exists, output the IOR to it.
+ if (ior_output_file != 0)
+ {
+ FILE *output_file = ACE_OS::fopen (ior_output_file, "w");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Server (%P|%t) Cannot write "
+ "IOR: %s - %m",
+ ior_output_file),
+ -1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+ }
+
+ // Spawn a number of clients doing the same thing for a
+ // predetermined number of times
+ Worker worker (orb.in ());
+ if (worker.activate (THR_NEW_LWP | THR_JOINABLE,
+ nthreads) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Server (%P|%t) Cannot activate %d server threads\n"),
+ nthreads),
+ -1);
+ worker.thr_mgr ()->wait ();
+
+ if (TAO_debug_level >= 1)
+ ACE_DEBUG ((LM_INFO, ACE_TEXT ("Server (%P|%t) Event loop finished.\n")));
+
+ if (!cri->self_test ())
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Server (%P|%t) Interceptor self_test failed\n")));
+
+ server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ ACE_TEXT ("Server (%P|%t) ERROR: "));
+
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ ACE_DEBUG ((LM_INFO, ACE_TEXT ("Server (%P|%t) Completed successfuly.\n")));
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/Framework/simple.cpp b/TAO/orbsvcs/tests/Transport_Current/Framework/simple.cpp
index d301278536d..05243f8af20 100644
--- a/TAO/orbsvcs/tests/Transport_Current/Framework/simple.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/Framework/simple.cpp
@@ -84,3 +84,89 @@ main (int argc, char *argv[])
return testCurrentLoader (argc, argv)
|| testCurrentORBInitializer (argc, argv);
}
+// -*- C++ -*-
+
+#include "tao/ORB.h"
+#include "tao/Object.h"
+
+#include "ace/Service_Config.h"
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (Transport_Current,
+ simple,
+ "$Id$")
+
+int
+testCurrentORBInitializer (int argc, char *argv[])
+{
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ if (orb.in () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to create orb\n")), -1);
+
+ CORBA::Object_var obj =
+ orb->resolve_initial_references ("TAO::Transport::Current"
+ ACE_ENV_ARG_PARAMETER);
+
+ if (obj.in () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to get the Transport Current\n")), -1);
+
+
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testCurrentORBInitializer: OK\n")));
+ return 0;
+}
+
+
+int
+testCurrentLoader (int, char *[])
+{
+
+ ACE_Service_Object *factory = 0;
+
+ factory = ACE_Dynamic_Service<ACE_Service_Object>::instance
+ (ACE_TEXT ("TAO_Transport_Current_Loader"));
+
+ int done =
+#if defined (TAO_AS_STATIC_LIBS)
+ true;
+#else
+ (factory != 0);
+#endif /* TAO_AS_STATIC_LIBS */
+
+ if (factory == 0)
+ {
+ if (done)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Unable to instantiate TAO::Transport::Current_Factory\n")),
+ -1);
+ else
+ {
+
+#if !defined (TAO_AS_STATIC_LIBS)
+ int ret = ACE_Service_Config::process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("TAO_Transport_Current_Loader",
+ "TAO_Transport_Current",
+ "_make_TAO_Transport_Current_Loader",
+ ""));
+ ACE_ASSERT (ret == 0);
+
+ factory = ACE_Dynamic_Service<ACE_Service_Object>::instance
+ (ACE_TEXT ("TAO_Transport_Current_Loader"));
+
+#endif /* !TAO_AS_STATIC_LIBS */
+ }
+ }
+
+ // ACE_ASSERT (factory != 0);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testCurrentLoader: OK\n")));
+ return 0;
+
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ return testCurrentLoader (argc, argv)
+ || testCurrentORBInitializer (argc, argv);
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/Current_Test_Impl.cpp b/TAO/orbsvcs/tests/Transport_Current/IIOP/Current_Test_Impl.cpp
index 6b69d7bba9e..84be62c3e9d 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/Current_Test_Impl.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/Current_Test_Impl.cpp
@@ -7,6 +7,145 @@
ACE_RCSID (Transport_Current,
Current_Test_Impl,
+ "$Id:$")
+
+
+Current_Test_Impl::Current_Test_Impl (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ int do_collocated_calls)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+ , poa_ (PortableServer::POA::_duplicate (poa))
+ , do_collocated_calls_ (do_collocated_calls)
+{
+}
+
+Current_Test_Impl::~Current_Test_Impl (void)
+{
+}
+
+::CORBA::Long
+Current_Test_Impl::self_test (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((::CORBA::SystemException))
+{
+ return 0;
+}
+
+void
+Current_Test_Impl::test_transport_current (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 2) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Testing access to IIOP Transport Current ...\n")));
+ }
+
+ CORBA::Object_var tcobject =
+ this->orb_->resolve_initial_references ("TAO::Transport::IIOP::Current"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO::Transport::IIOP::Current_var tc =
+ TAO::Transport::IIOP::Current::_narrow (tcobject.in ()
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (tc.in()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Unable to narrow down to TAO::Transport::IIOP::Current\n")));
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ CORBA::String_var rhost (tc->remote_host ());
+ CORBA::String_var lhost (tc->local_host ());
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - [%s:%d] -> [%s:%d]\n"),
+ rhost.in (), tc->remote_port (),
+ lhost.in (), tc->local_port ()));
+
+ if (TAO_debug_level > 2) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Successfully accessed IIOP Transport Current\n")));
+ }
+}
+
+
+
+void
+Current_Test_Impl::invoked_by_client (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level >= 1) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Test method invoked by client.\n")));
+ }
+
+ this->test_transport_current (ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ if (this->do_collocated_calls_)
+ {
+ CORBA::Object_var selfobject =
+ poa_->servant_to_reference (this
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ TAO::Transport::CurrentTest_var self =
+ TAO::Transport::CurrentTest::_narrow (selfobject.in ()
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ if (TAO_debug_level >= 1) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Making a collocated invocation to invoked_during_upcall().\n")));
+ }
+ self->invoked_during_upcall (ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ if (TAO_debug_level >= 1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - skipping collocated calls\n")));
+ }
+
+ }
+
+}
+
+void
+Current_Test_Impl::invoked_during_upcall (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 2) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - Test method invoked ")
+ ACE_TEXT ("by the server during upcall.\n")));
+ }
+}
+
+void
+Current_Test_Impl::shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 2) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server - shutting down.\n")));
+ }
+
+ this->orb_->shutdown (0
+ ACE_ENV_ARG_PARAMETER);
+}
+// -*- C++ -*-
+
+#include "Current_Test_Impl.h"
+
+#include "orbsvcs/Transport_Current/TC_IIOPC.h"
+#include "orbsvcs/Transport_Current/TCC.h"
+
+ACE_RCSID (Transport_Current,
+ Current_Test_Impl,
"$Id$")
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP.mpc b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP.mpc
index ea9d41d5b07..271c07bfdaf 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP.mpc
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP.mpc
@@ -40,3 +40,45 @@ project(*Client): taoclient, tc, pi, dynamicinterface {
../Framework/Current_Test.idl
}
}
+// -*- MPC -*-
+// $Id$
+
+project(*Server): taoserver, tc, pi_server {
+
+ idlflags += -o ../Framework
+
+ libs += TAO_TC_IIOP
+ includes += ../Framework
+
+ Source_Files {
+ ../Framework/server.cpp
+ ../Framework/Server_Request_Interceptor.cpp
+ Current_Test_Impl.cpp
+ IIOP_Server_Request_Interceptor.cpp
+ IIOP_Server_Main.cpp
+ IIOP_Tester.cpp
+ }
+
+ IDL_Files {
+ ../Framework/Current_Test.idl
+ }
+}
+
+project(*Client): taoclient, tc, pi, dynamicinterface {
+
+ after += *Server*
+
+ includes += ../Framework
+ libs += TAO_TC_IIOP
+
+ idlflags += -o ../Framework
+
+ Source_Files {
+ ../Framework/Client_Request_Interceptor.cpp
+ ../Framework/client.cpp
+ IIOP_Tester.cpp
+ }
+ IDL_Files {
+ ../Framework/Current_Test.idl
+ }
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Main.cpp b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Main.cpp
index cce444d8662..3bd1b2bb12e 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Main.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Main.cpp
@@ -21,3 +21,26 @@ ACE_TMAIN (int argc,
Test::IIOP_Server_Request_Interceptor cri ("test_orb", test_transport_current);
return server_main (argc, argv, &cri);
}
+// -*- C++ -*-
+
+// $Id$
+
+#include "IIOP_Server_Request_Interceptor.h"
+
+/// Prototype
+int server_main (int argc,
+ ACE_TCHAR *argv[],
+ Test::Server_Request_Interceptor *cri);
+
+int
+test_transport_current (CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::UserException));
+
+int
+ACE_TMAIN (int argc,
+ ACE_TCHAR *argv[])
+{
+ Test::IIOP_Server_Request_Interceptor cri ("test_orb", test_transport_current);
+ return server_main (argc, argv, &cri);
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.cpp b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.cpp
index 92950ce0b7f..bbc77e6b8f0 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.cpp
@@ -321,3 +321,326 @@ namespace Test {
}
}
+// -*- C++ -*-
+
+#include "ace/Log_Msg.h"
+#include "tao/ORB_Constants.h"
+#include "orbsvcs/Transport_Current/TC_IIOPC.h"
+
+ACE_RCSID (ForwardRequest,
+ Server_Request_Interceptor,
+ "$Id$")
+
+#include "IIOP_Server_Request_Interceptor.h"
+
+namespace Test {
+
+ using namespace TAO;
+
+ IIOP_Server_Request_Interceptor::IIOP_Server_Request_Interceptor (const char* orbid, TEST test)
+ : Server_Request_Interceptor (orbid, test)
+ , iiop_test_successful_ (true)
+ , mult_thr_test_successful_ (true)
+ {
+ }
+
+ IIOP_Server_Request_Interceptor::~IIOP_Server_Request_Interceptor (void)
+ {
+ }
+
+ char *
+ IIOP_Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return CORBA::string_dup ("II SRI");
+ }
+
+ ///
+ TAO::Transport::IIOP::Current_ptr
+ IIOP_Server_Request_Interceptor::resolve_iiop_transport_current (const char* orbid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ CORBA::String_var name (this->name ());
+
+ int tmpargc = 0;
+ CORBA::ORB_var orb = CORBA::ORB_init (tmpargc,
+ 0,
+ orbid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Object_var tcobject =
+ orb->resolve_initial_references (ACE_TEXT_ALWAYS_CHAR ("TAO::Transport::IIOP::Current")
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ return TAO::Transport::IIOP::Current::_narrow (tcobject.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ /// On every request, a client-supplied (via the context) id is used
+ /// as index in an array, where we store the endpoint
+ void
+ IIOP_Server_Request_Interceptor::push_request_info (size_t requestID
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ CORBA::String_var name (this->name ());
+
+ TAO::Transport::IIOP::Current_var tc =
+ resolve_iiop_transport_current (this->orb_id_.in ()
+ ACE_ENV_ARG_PARAMETER);
+
+ CORBA::String_var host (tc->remote_host());
+ EndPoint ep (tc->remote_port(), host.in ());
+
+ if (requestID < sizeof (endPoints_))
+ endPoints_[requestID] = ep;
+ else
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%s (%P|%t) ")
+ ACE_TEXT ("push_request_info: Can't track that many requests %d\n"),
+ name.in (),
+ requestID));
+
+ }
+
+ void
+ IIOP_Server_Request_Interceptor::pop_request_info (size_t requestID)
+ {
+ static EndPoint dummy;
+ CORBA::String_var name (this->name ());
+
+ if (requestID >= sizeof (endPoints_))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%s (%P|%t) ")
+ ACE_TEXT ("pop_request_info: Can't track that many requests %d\n"),
+ name.in (),
+ requestID));
+ return;
+ }
+
+ TAO::Transport::IIOP::Current_var tc =
+ resolve_iiop_transport_current (this->orb_id_.in ()
+ ACE_ENV_ARG_PARAMETER);
+
+ CORBA::String_var host (tc->remote_host());
+ EndPoint ep (tc->remote_port(), host.in ());
+
+ if (ep != endPoints_[requestID])
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%s (%P|%t) ")
+ ACE_TEXT ("pop_request_info: The expected host and port don't match for request %d\n"),
+ name.in (),
+ requestID));
+ return;
+ }
+
+ endPoints_[requestID] = dummy;
+ }
+
+
+ /// Checks if all the endpoints, encountered on the way in have been
+ /// cleaned on the way out of the interception point
+ bool
+ IIOP_Server_Request_Interceptor::self_test (void)
+ {
+ CORBA::String_var name (this->name ());
+ bool has_remaining_endpoints = false;
+ for (size_t count = 0;
+ count < sizeof (endPoints_);
+ count ++)
+ {
+ if (endPoints_[count].port_ != 0)
+ {
+ has_remaining_endpoints = true;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%s (%S|%t) Endpoint at ")
+ ACE_TEXT ("index=%d is not been removed yet\n"),
+ name.in ()));
+ }
+ }
+
+ return Server_Request_Interceptor::self_test ()
+ && iiop_test_successful_
+ && !has_remaining_endpoints;
+ }
+
+
+
+ void
+ IIOP_Server_Request_Interceptor::inbound_process_context (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ CORBA::String_var name (this->name ());
+ CORBA::String_var op (ri->operation(ACE_ENV_ARG_PARAMETER));
+ ACE_CHECK;
+
+ if (TAO_debug_level >=1)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("%s (%P|%t) Intercepted operation %s ()\n"),
+ name.in (),
+ op.in ()));
+
+ ACE_TRY
+ {
+ IOP::ServiceId id = Transport::CurrentTest::ContextTag;
+ IOP::ServiceContext_var sc =
+ ri->get_request_service_context (id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ const char *buf =
+ ACE_reinterpret_cast (const char *, sc->context_data.get_buffer ());
+
+ long requestID = ACE_OS::atoi (buf);
+
+ this->push_request_info (requestID);
+ }
+ ACE_CATCHANY
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%s (%P|%t) Service context")
+ ACE_TEXT (" is unavailable when invoking %s (). ")
+ ACE_TEXT ("A colocated invocation would have ")
+ ACE_TEXT ("no service context.\n"),
+ name.in (),
+ op.in ()));
+ }
+ ACE_ENDTRY;
+
+ }
+
+ void
+ IIOP_Server_Request_Interceptor::outbound_process_context (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ IOP::ServiceId id = Transport::CurrentTest::ContextTag;
+
+ IOP::ServiceContext_var sc =
+ ri->get_request_service_context (id ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ const char *buf =
+ ACE_reinterpret_cast (const char *, sc->context_data.get_buffer ());
+
+ this->pop_request_info (ACE_OS::atoi (buf));
+ }
+
+
+
+
+
+
+ void
+ IIOP_Server_Request_Interceptor::receive_request_service_contexts (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+ ACE_TRY
+ {
+ inbound_process_context (ri ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ CORBA::String_var name (this->name ());
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("%s (%P|%t) Inbound_process_context failed in ")
+ ACE_TEXT(" receive_request_service_contexts.\n"),
+ name.in ()));
+ }
+ ACE_ENDTRY;
+
+ Server_Request_Interceptor::receive_request_service_contexts (ri ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ }
+
+
+ void
+ IIOP_Server_Request_Interceptor::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_TRY
+ {
+ outbound_process_context (ri ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ CORBA::String_var name (this->name ());
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("%s (%P|%t) Outbound_process_context failed in ")
+ ACE_TEXT("send_reply.\n"),
+ name.in ()));
+ }
+ ACE_ENDTRY;
+
+ Server_Request_Interceptor::send_reply (ri ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ }
+
+ void
+ IIOP_Server_Request_Interceptor::send_exception (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+ ACE_TRY
+ {
+ outbound_process_context (ri ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+
+ }
+ ACE_CATCHANY
+ {
+ CORBA::String_var name (this->name ());
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("%s (%P|%t) Outbound_process_context failed in ")
+ ACE_TEXT("send_exception.\n"),
+ name.in ()));
+
+ }
+ ACE_ENDTRY;
+
+ Server_Request_Interceptor::send_exception (ri ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ IIOP_Server_Request_Interceptor::send_other (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+ {
+ ACE_TRY
+ {
+ outbound_process_context (ri ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ CORBA::String_var name (this->name ());
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("%s (%P|%t) Outbound_process_context failed in ")
+ ACE_TEXT("send_other.\n"),
+ name.in ()));
+ }
+ ACE_ENDTRY;
+
+ Server_Request_Interceptor::send_other (ri ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+}
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.h b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.h
index 4b0b33a5cd7..00b45f19ee6 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.h
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Server_Request_Interceptor.h
@@ -160,3 +160,165 @@ namespace Test
#endif /* _MSC_VER */
#endif /* ISERVER_REQUEST_INTERCEPTOR_H */
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IIOP_Server_Request_Interceptor.h
+ *
+ * $Id$
+ *
+ * Implementation header for the server request interceptor for the
+ * IIOP_Threading test.
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ * @author Ciju John <johnc@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef ISERVER_REQUEST_INTERCEPTOR_H
+#define ISERVER_REQUEST_INTERCEPTOR_H
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Server_Request_Interceptor.h"
+#include "orbsvcs/Transport_Current/IIOP_Transport_Current.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+namespace Test
+{
+
+ class IIOP_Server_Request_Interceptor
+ : public virtual Test::Server_Request_Interceptor
+ , public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+
+ /// Constructor.
+ IIOP_Server_Request_Interceptor (const char* orbid, TEST test);
+
+ /// Destructor.
+ virtual ~IIOP_Server_Request_Interceptor ();
+
+ /// queries the status of the test
+ bool self_test ();
+
+ /**
+ * @name Methods Required by the Server Request Interceptor
+ * Interface
+ *
+ * These are methods that must be implemented since they are pure
+ * virtual in the abstract base class. They are the canonical
+ * methods required for all server request interceptors.
+ */
+ //@{
+ /// Return the name of this ServerRequestinterceptor.
+ virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// incomming interception point
+ virtual void receive_request_service_contexts (PortableInterceptor::ServerRequestInfo_ptr
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ /// outgoing interception point
+ virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// outgoing interception point
+ virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ /// outgoing interception point
+ virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+ //@}
+
+ protected:
+
+ /// process incomming requests context
+ void inbound_process_context
+ (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// process outgoing requests context
+ void outbound_process_context
+ (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// saves the incomming request info
+ void push_request_info (size_t requestID
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// clears the outgoing request info
+ void pop_request_info (size_t requestID);
+
+ TAO::Transport::IIOP::Current_ptr resolve_iiop_transport_current (const char* orbid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ private:
+
+ /// transport ID dtata structure
+ typedef struct EP {
+ CORBA::UShort port_;
+ CORBA::String_var host_;
+
+ EP ()
+ : port_(0)
+ , host_ ()
+ {};
+
+ EP (CORBA::UShort port, const char* host)
+ : port_(port)
+ , host_ (host)
+ {};
+
+ bool operator== (const struct EP &ep) const
+ {
+ return (this->port_ == ep.port_) &&
+ (strcmp (this->host_.in (), ep.host_.in ()) == 0);
+ };
+ bool operator!= (const struct EP &ep) const
+ {
+ return !(this->operator== (ep));
+ };
+
+ } EndPoint;
+
+ private:
+
+ /// IIOPTraits test status
+ bool iiop_test_successful_;
+
+ /// Multi-threaded test status
+ bool mult_thr_test_successful_;
+
+ /// Endpoints hash table
+ EndPoint endPoints_[1001];
+ };
+
+}; /* namespace Test */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* ISERVER_REQUEST_INTERCEPTOR_H */
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Tester.cpp b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Tester.cpp
index 2b87ba0e285..ec76e46eee5 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Tester.cpp
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/IIOP_Tester.cpp
@@ -79,3 +79,84 @@ test_transport_current (CORBA::ORB_ptr orb
return 0;
}
+// -*- C++ -*-
+
+// $Id$
+
+#include "orbsvcs/Transport_Current/IIOP_Transport_Current.h"
+
+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
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::UserException))
+{
+ // Get the Current object.
+ CORBA::Object_var tcobject =
+ orb->resolve_initial_references (ACE_TEXT_ALWAYS_CHAR ("TAO::Transport::IIOP::Current")
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+
+ 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 ()
+ ACE_ENV_SINGLE_ARG_DECL);
+ ACE_TRY_CHECK;
+
+ 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")));
+
+ ACE_TRY_THROW (CORBA::INTERNAL ());
+ }
+
+ ::CORBA::String_var rhost (tc->remote_host (ACE_ENV_SINGLE_ARG_PARAMETER));
+ ACE_TRY_CHECK;
+
+ ::CORBA::String_var lhost (tc->local_host (ACE_ENV_SINGLE_ARG_PARAMETER));
+ ACE_TRY_CHECK;
+
+ ::CORBA::Long id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT bs = tc->bytes_sent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT br = tc->bytes_received (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT rs = tc->messages_sent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ::TAO::CounterT rr = tc->messages_received (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ 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 (ACE_ENV_SINGLE_ARG_PARAMETER),
+ lhost.in (), tc->local_port (ACE_ENV_SINGLE_ARG_PARAMETER),
+ (ACE_UINT64)bs,
+ (ACE_UINT64)br,
+ (ACE_UINT64)rs,
+ (ACE_UINT64)rr));
+ return 0;
+}
+
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/README b/TAO/orbsvcs/tests/Transport_Current/IIOP/README
index b340cfcab02..0d1ea8db316 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/README
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/README
@@ -23,3 +23,28 @@ creation (as it did in lab conditions).
See ../Framework/README for more detail on how and what contexts are
tested.
+This test has two parts, which run automatically:
+
+Part 1:
+
+IIOP_Transport_Current test: Demonstrates how in the application the
+user can resolve the IIOP_Transport_Current and use it to obtain
+IIOP-related transport properties for the current Transport.
+
+Part 2:
+
+Multi threading test: In this test the server has a Thread Pool. Using
+Interceptors, the test tracks the transports that are used in the
+individual invocations at various stage of the up-call. This validates
+that the TC framework accurately tracks the correct transport for an
+invocation, no matter what stage of the up-call in a multi-threaded
+environment.
+
+We force creation of multiple transport by using the: static
+Client_Strategy_Factory "-ORBTransportMuxStrategy exclusive"
+directive. While this isn't 100% guaranteed, having multiple client
+threads and making simultaneous invocations should trigger new transport
+creation (as it did in lab conditions).
+
+See ../Framework/README for more detail on how and what contexts are
+tested.
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/client_dynamic.conf b/TAO/orbsvcs/tests/Transport_Current/IIOP/client_dynamic.conf
index 56ff8d9c269..21ba9549422 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/client_dynamic.conf
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/client_dynamic.conf
@@ -1,3 +1,6 @@
static Client_Strategy_Factory "-ORBTransportMuxStrategy exclusive"
dynamic TAO_Transport_Current_Loader Service_Object * TAO_TC:_make_TAO_Transport_Current_Loader() ""
dynamic TAO_Transport_IIOP_Current_Loader Service_Object * TAO_TC_IIOP:_make_TAO_Transport_IIOP_Current_Loader() ""
+static Client_Strategy_Factory "-ORBTransportMuxStrategy exclusive"
+dynamic TAO_Transport_Current_Loader Service_Object * TAO_TC:_make_TAO_Transport_Current_Loader() ""
+dynamic TAO_Transport_IIOP_Current_Loader Service_Object * TAO_TC_IIOP:_make_TAO_Transport_IIOP_Current_Loader() ""
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/client_static.conf b/TAO/orbsvcs/tests/Transport_Current/IIOP/client_static.conf
index 42fd412dfca..0a2ca3b3151 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/client_static.conf
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/client_static.conf
@@ -1,3 +1,6 @@
#static TAO_Transport_Current_Loader ""
#static TAO_Transport_IIOP_Current_Loader ""
static Client_Strategy_Factory "-ORBTransportMuxStrategy exclusive"
+#static TAO_Transport_Current_Loader ""
+#static TAO_Transport_IIOP_Current_Loader ""
+static Client_Strategy_Factory "-ORBTransportMuxStrategy exclusive"
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/run_test.pl b/TAO/orbsvcs/tests/Transport_Current/IIOP/run_test.pl
index 5daa7f993e2..cbb4b0a6e7d 100755
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/run_test.pl
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/run_test.pl
@@ -69,3 +69,74 @@ if ($server != 0) {
unlink $iorfile;
exit $status;
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::Run_Test;
+
+$status = 0;
+
+$client = PerlACE::LocalFile ("client");
+
+$mode = shift (@ARGV);
+if ( $mode =~ /-dynamic/) {
+ $client_conf_file = PerlACE::LocalFile ("client_dynamic.conf");
+ $server_conf_file = PerlACE::LocalFile ("server_dynamic.conf");
+}
+elsif ( $mode =~ /-static/) {
+ $client_conf_file = PerlACE::LocalFile ("client_static.conf");
+ $server_conf_file = PerlACE::LocalFile ("server_static.conf");
+}
+else {
+ print STDERR "Unknown $mode. Specify -static or -dynamic\n";
+ exit 1;
+}
+
+$iorfile = PerlACE::LocalFile ("server.ior");
+unlink $iorfile;
+
+if (PerlACE::is_vxworks_test()) {
+ $SV = new PerlACE::ProcessVX ("server",
+ "@ARGV -c 0 -ORBSvcConf $server_conf_file -o server.ior");
+}
+else {
+ $SV = new PerlACE::Process ("server",
+ "@ARGV -c 0 -ORBSvcConf $server_conf_file -o $iorfile");
+}
+
+$CL = new PerlACE::Process ($client,
+ "@ARGV -n 1 -ORBSvcConf $client_conf_file -k file://$iorfile");
+
+print STDERR $SV->CommandLine()."\n";
+$SV->Spawn ();
+
+if (PerlACE::waitforfile_timed ($iorfile,
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "$0: ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+print STDERR $CL->CommandLine()."\n";
+$client = $CL->SpawnWaitKill (300);
+
+if ($client != 0) {
+ print STDERR "$0: ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$server = $SV->WaitKill (10);
+
+if ($server != 0) {
+ print STDERR "$0: ERROR: server returned $server\n";
+ $status = 1;
+}
+
+unlink $iorfile;
+
+exit $status;
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/server_dynamic.conf b/TAO/orbsvcs/tests/Transport_Current/IIOP/server_dynamic.conf
index df5758abd32..ac6f857d827 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/server_dynamic.conf
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/server_dynamic.conf
@@ -1,2 +1,4 @@
dynamic TAO_Transport_Current_Loader Service_Object * TAO_TC:_make_TAO_Transport_Current_Loader() ""
dynamic TAO_Transport_IIOP_Current_Loader Service_Object * TAO_TC_IIOP:_make_TAO_Transport_IIOP_Current_Loader() ""
+dynamic TAO_Transport_Current_Loader Service_Object * TAO_TC:_make_TAO_Transport_Current_Loader() ""
+dynamic TAO_Transport_IIOP_Current_Loader Service_Object * TAO_TC_IIOP:_make_TAO_Transport_IIOP_Current_Loader() ""
diff --git a/TAO/orbsvcs/tests/Transport_Current/IIOP/server_static.conf b/TAO/orbsvcs/tests/Transport_Current/IIOP/server_static.conf
index a3bca724d53..2649683408d 100644
--- a/TAO/orbsvcs/tests/Transport_Current/IIOP/server_static.conf
+++ b/TAO/orbsvcs/tests/Transport_Current/IIOP/server_static.conf
@@ -1,2 +1,4 @@
static TAO_Transport_Current_Loader ""
static TAO_Transport_IIOP_Current_Loader ""
+static TAO_Transport_Current_Loader ""
+static TAO_Transport_IIOP_Current_Loader ""
diff --git a/TAO/tao/Transport_Selection_Guard.cpp b/TAO/tao/Transport_Selection_Guard.cpp
index bd1164131df..d5dfa0c6613 100644
--- a/TAO/tao/Transport_Selection_Guard.cpp
+++ b/TAO/tao/Transport_Selection_Guard.cpp
@@ -79,3 +79,84 @@ namespace TAO
} /* namespace TAO */
TAO_END_VERSIONED_NAMESPACE_DECL
+// $Id$
+
+#include "tao/Transport_Selection_Guard.h"
+#include "tao/TSS_Resources.h"
+
+ACE_RCSID (tao,
+ Transport_Selection_Guard.cpp,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ Transport_Selection_Guard*
+ Transport_Selection_Guard::current (TAO_ORB_Core* core, size_t tss_slot_id)
+ {
+ // @NOTE: (Iliyan) Started making this method aware of the core
+ // and the tss slot that correspond to the "current" transport,
+ // influenced by a general design preference to keep things
+ // local. The idea was to make the current TSG part of the TSS
+ // storage for a specific ORB Core, as opposed to using the global
+ // TSS Resources. However, it really doesn't offer any benefit to
+ // store a Transport pointer locally, for each ORB. There is
+ // always only one current Transport per thread. Period. The
+ // number of ORB Core instances in existence does not change that
+ // fact, so keeping a separate pointer would have been an
+ // over-kill.
+ ACE_UNUSED_ARG (core);
+ ACE_UNUSED_ARG (tss_slot_id);
+
+#if TAO_HAS_TRANSPORT_CURRENT == 1
+
+ return TAO_TSS_Resources::instance ()->tsg_;
+
+#else /* TAO_HAS_TRANSPORT_CURRENT != 1 */
+
+ return 0;
+
+#endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
+ };
+
+
+
+ /// Ctor
+ Transport_Selection_Guard::Transport_Selection_Guard (TAO_Transport* t)
+ :
+#if TAO_HAS_TRANSPORT_CURRENT == 1
+
+ prev_ (TAO_TSS_Resources::instance ()->tsg_)
+ ,
+
+#endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
+ curr_ (t)
+ {
+#if TAO_HAS_TRANSPORT_CURRENT == 1
+
+ TAO_TSS_Resources::instance ()->tsg_ = this;
+
+#endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
+
+ };
+
+
+
+ /// Dtor
+ Transport_Selection_Guard::~Transport_Selection_Guard (void)
+ {
+
+#if TAO_HAS_TRANSPORT_CURRENT == 1
+
+ TAO_TSS_Resources::instance ()->tsg_ = prev_;
+ this->prev_ = 0;
+
+#endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
+ this->curr_ = 0;
+ };
+
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Selection_Guard.h b/TAO/tao/Transport_Selection_Guard.h
index 37abb9257a2..f96b8c35d54 100644
--- a/TAO/tao/Transport_Selection_Guard.h
+++ b/TAO/tao/Transport_Selection_Guard.h
@@ -106,3 +106,111 @@ TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* TAO_TRANSPORT_SELECTION_GUARD_H */
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Transport_Selection_Guard.h
+ *
+ * $Id$
+ *
+ * @author Iliyan Jeliazkov <iliyan@ociweb.com>
+ */
+// ===================================================================
+
+#ifndef TAO_TRANSPORT_SELECTION_GUARD_H
+#define TAO_TRANSPORT_SELECTION_GUARD_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Environment.h"
+
+/* #include "tao/Policy_Current_Impl.h" */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations
+class TAO_Transport;
+
+namespace TAO
+{
+ /**
+ * Whenever a Transport is selected, during an upcall or prior to a
+ * client invocation, an instance of this class is created [on the
+ * stack, or as a member of another class] to keep track of the said
+ * Transport. The class implements the RAII idiom, which makes it
+ * possible to build a stack of these instances as the thread is
+ * doing nested upcalls or client invocations.
+ */
+ class TAO_Export Transport_Selection_Guard
+ {
+ public:
+
+ static Transport_Selection_Guard* current (TAO_ORB_Core* core, size_t tss_slot_id);
+
+ public:
+
+ /// Ctor
+ Transport_Selection_Guard (TAO_Transport* t);
+
+ /// Dtor
+ ~Transport_Selection_Guard (void);
+
+ /// getter
+ TAO_Transport* operator-> (void) const
+ {
+ return this->get ();
+ };
+
+ /// getter
+ TAO_Transport& operator* (void) const
+ {
+ return *this->get ();
+ };
+
+ /// Getter
+ TAO_Transport* get (void) const
+ {
+ return this->curr_;
+ };
+
+ /// Setter
+ Transport_Selection_Guard& set (TAO_Transport* t)
+ {
+ this->curr_ = t;
+ return *this;
+ };
+
+ private:
+ ACE_UNIMPLEMENTED_FUNC (Transport_Selection_Guard (const Transport_Selection_Guard&))
+ ACE_UNIMPLEMENTED_FUNC (Transport_Selection_Guard& operator=(const Transport_Selection_Guard&))
+
+#if TAO_HAS_TRANSPORT_CURRENT == 1
+
+ /// This is pointing to the guard that was active prior to
+ /// instantiating us.
+
+ Transport_Selection_Guard* prev_;
+
+#endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */
+
+ /// The "real" Transport, i.e. the one selected at present
+ TAO_Transport* curr_;
+ };
+
+} /* namespace TAO */
+
+
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TRANSPORT_SELECTION_GUARD_H */
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 771cac93886..bfc8a867d6c 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -2552,7 +2552,7 @@ ACE::timestamp (ACE_TCHAR date_and_time[],
// This function rounds the request to a multiple of the page size.
size_t
-ACE::round_to_pagesize (off_t len)
+ACE::round_to_pagesize (size_t len)
{
ACE_TRACE ("ACE::round_to_pagesize");
@@ -2563,7 +2563,7 @@ ACE::round_to_pagesize (off_t len)
}
size_t
-ACE::round_to_allocation_granularity (off_t len)
+ACE::round_to_allocation_granularity (size_t len)
{
ACE_TRACE ("ACE::round_to_allocation_granularity");
diff --git a/ace/ACE.h b/ace/ACE.h
index 0c2abd32ff3..fe48ac4803b 100644
--- a/ace/ACE.h
+++ b/ace/ACE.h
@@ -519,10 +519,10 @@ namespace ACE
// = Miscellaneous functions.
/// Rounds the request to a multiple of the page size.
- extern ACE_Export size_t round_to_pagesize (off_t len);
+ extern ACE_Export size_t round_to_pagesize (size_t len);
/// Rounds the request to a multiple of the allocation granularity.
- extern ACE_Export size_t round_to_allocation_granularity (off_t len);
+ extern ACE_Export size_t round_to_allocation_granularity (size_t len);
// @@ UNICODE what about buffer?
/// Format buffer into printable format. This is useful for
diff --git a/ace/Auto_Ptr.h b/ace/Auto_Ptr.h
index 3047079691e..c23cde8b826 100644
--- a/ace/Auto_Ptr.h
+++ b/ace/Auto_Ptr.h
@@ -41,22 +41,24 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
* @brief Implements the draft C++ standard auto_ptr abstraction.
* This class allows one to work on non-object (basic) types
*/
-template <class X>
+template <typename X>
class ACE_Auto_Basic_Ptr
{
public:
+ typedef X element_type;
+
// = Initialization and termination methods
- explicit ACE_Auto_Basic_Ptr (X *p = 0) : p_ (p) {}
+ explicit ACE_Auto_Basic_Ptr (X * p = 0) : p_ (p) {}
- ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> &ap);
- ACE_Auto_Basic_Ptr<X> &operator= (ACE_Auto_Basic_Ptr<X> &rhs);
+ ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> & ap);
+ ACE_Auto_Basic_Ptr<X> &operator= (ACE_Auto_Basic_Ptr<X> & rhs);
~ACE_Auto_Basic_Ptr (void);
// = Accessor methods.
X &operator *() const;
X *get (void) const;
X *release (void);
- void reset (X *p = 0);
+ void reset (X * p = 0);
/// Dump the state of an object.
void dump (void) const;
@@ -85,13 +87,15 @@ using std::auto_ptr;
*
* @brief Implements the draft C++ standard auto_ptr abstraction.
*/
-template <class X>
-class auto_ptr : public ACE_Auto_Basic_Ptr <X>
+template <typename X>
+class auto_ptr : public ACE_Auto_Basic_Ptr<X>
{
public:
+ typedef X element_type;
+
// = Initialization and termination methods
- explicit auto_ptr (X *p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
- auto_ptr (auto_ptr<X> &ap) : ACE_Auto_Basic_Ptr<X> (ap.release()) {}
+ explicit auto_ptr (X * p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
+ auto_ptr (auto_ptr<X> & ap) : ACE_Auto_Basic_Ptr<X> (ap.release ()) {}
X *operator-> () const;
};
@@ -106,12 +110,14 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
* the need for the ACE_AUTO_PTR_RESET macro on platforms like
* VC6 where the auto_ptr<T> is broken.
*/
-template <class X>
+template <typename X>
class ACE_Auto_Ptr : public ACE_Auto_Basic_Ptr <X>
{
public:
+ typedef X element_type;
+
// = Initialization and termination methods
- explicit ACE_Auto_Ptr (X *p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
+ explicit ACE_Auto_Ptr (X * p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
X *operator-> () const;
};
@@ -124,23 +130,25 @@ public:
* (basic) types that must be treated as an array, e.g.,
* deallocated via "delete [] foo".
*/
-template<class X>
+template<typename X>
class ACE_Auto_Basic_Array_Ptr
{
public:
+ typedef X element_type;
+
// = Initialization and termination methods.
- explicit ACE_Auto_Basic_Array_Ptr (X *p = 0) : p_ (p) {}
+ explicit ACE_Auto_Basic_Array_Ptr (X * p = 0) : p_ (p) {}
- ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr<X> &ap);
- ACE_Auto_Basic_Array_Ptr<X> &operator= (ACE_Auto_Basic_Array_Ptr<X> &rhs);
+ ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr<X> & ap);
+ ACE_Auto_Basic_Array_Ptr<X> &operator= (ACE_Auto_Basic_Array_Ptr<X> & rhs);
~ACE_Auto_Basic_Array_Ptr (void);
// = Accessor methods.
- X &operator* () const;
- X &operator[] (int i) const;
- X *get (void) const;
- X *release (void);
- void reset (X *p = 0);
+ X & operator* () const;
+ X & operator[] (int i) const;
+ X * get (void) const;
+ X * release (void);
+ void reset (X * p = 0);
/// Dump the state of an object.
void dump (void) const;
@@ -149,7 +157,7 @@ public:
ACE_ALLOC_HOOK_DECLARE;
protected:
- X *p_;
+ X * p_;
};
/**
@@ -158,10 +166,12 @@ protected:
* @brief Implements an extension to the draft C++ standard auto_ptr
* abstraction.
*/
-template<class X>
+template<typename X>
class ACE_Auto_Array_Ptr : public ACE_Auto_Basic_Array_Ptr<X>
{
public:
+ typedef X element_type;
+
// = Initialization and termination methods.
explicit ACE_Auto_Array_Ptr (X *p = 0)
: ACE_Auto_Basic_Array_Ptr<X> (p) {}
@@ -169,6 +179,33 @@ public:
X *operator-> () const;
};
+
+/**
+ * @function
+ *
+ * @brief
+ *
+ * Some platforms have an older version of auto_ptr support, which
+ * lacks reset, and cannot be disabled easily. Portability to these
+ * platforms requires use of this function template. This function
+ * template also works for the @c ACE_Auto_{Basic_}Array_Ptr class
+ * template, as well.
+ */
+template<typename AUTO_PTR_TYPE>
+inline void
+ACE_auto_ptr_reset (AUTO_PTR_TYPE & ap,
+ typename AUTO_PTR_TYPE::element_type * p)
+{
+#if defined (ACE_AUTO_PTR_LACKS_RESET)
+ if (p != ap.get ())
+ {
+ ap = AUTO_PTR_TYPE (p);
+ }
+#else
+ ap.reset (p);
+#endif /* ACE_AUTO_PTR_LACKS_RESET */
+}
+
ACE_END_VERSIONED_NAMESPACE_DECL
// Some platforms have an older version of auto_ptr
@@ -176,25 +213,12 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// easily. Portability to these platforms requires
// use of the following ACE_AUTO_PTR_RESET macro.
//
-// Note that this macro correctly handles the case where NEWPTR may be
-// a call to operator new(), e.g. "new foo", by making sure it is only
-// evaluated once.
-# if defined (ACE_AUTO_PTR_LACKS_RESET)
-# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \
- do { \
- TYPE * tmp_ptr = NEWPTR; \
- if (tmp_ptr != AUTOPTR.get ()) \
- { \
- delete AUTOPTR.release (); \
- AUTOPTR = auto_ptr<TYPE> (tmp_ptr); \
- } \
- } while (0)
-# else /* ! ACE_AUTO_PTR_LACKS_RESET */
-# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \
- do { \
- AUTOPTR.reset (NEWPTR); \
- } while (0)
-# endif /* ACE_AUTO_PTR_LACKS_RESET */
+// The TYPE macro parameter is no longer necessary but we leave it
+// around for backward compatibility. This is also the reason why the
+// ACE_auto_ptr_reset function template is not called
+// ACE_AUTO_PTR_RESET.
+# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \
+ ACE_auto_ptr_reset (AUTOPTR, NEWPTR);
#if defined (__ACE_INLINE__)
#include "ace/Auto_Ptr.inl"
diff --git a/ace/Configuration_Import_Export.cpp b/ace/Configuration_Import_Export.cpp
index 7c5ee7fb03c..335be965247 100644
--- a/ace/Configuration_Import_Export.cpp
+++ b/ace/Configuration_Import_Export.cpp
@@ -42,7 +42,7 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
u_int buffer_size = 4096;
u_int read_pos = 0;
- ACE_TCHAR *buffer;
+ ACE_TCHAR *buffer = 0;
ACE_NEW_NORETURN (buffer, ACE_TCHAR[buffer_size]);
if (!buffer)
{
diff --git a/ace/FILE.cpp b/ace/FILE.cpp
index 57aa52b839f..91ed5511e08 100644
--- a/ace/FILE.cpp
+++ b/ace/FILE.cpp
@@ -79,21 +79,21 @@ ACE_FILE::get_info (ACE_FILE_Info &finfo)
}
int
-ACE_FILE::truncate (off_t length)
+ACE_FILE::truncate (ACE_OFF_T length)
{
ACE_TRACE ("ACE_FILE::truncate");
return ACE_OS::ftruncate (this->get_handle(), length);
}
-off_t
-ACE_FILE::seek (off_t offset, int startpos)
+ACE_OFF_T
+ACE_FILE::seek (ACE_OFF_T offset, int startpos)
{
return ACE_OS::lseek (this->get_handle (),
offset,
startpos);
}
-off_t
+ACE_OFF_T
ACE_FILE::tell (void)
{
ACE_TRACE ("ACE_FILE::tell");
diff --git a/ace/File_Lock.h b/ace/File_Lock.h
index b45d3347b00..4a6beab51f1 100644
--- a/ace/File_Lock.h
+++ b/ace/File_Lock.h
@@ -72,7 +72,7 @@ public:
* wrappers we include the <acquire> method. This is implemented as
* a write-lock to be on the safe-side...
*/
- int acquire (short whence = 0, off_t start = 0, off_t len = 1);
+ int acquire (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
/**
* Note, for interface uniformity with other synchronization
@@ -81,21 +81,21 @@ public:
* If we "failed" because someone else already had the lock, <errno>
* is set to <EBUSY>.
*/
- int tryacquire (short whence = 0, off_t start = 0, off_t len = 1);
+ int tryacquire (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
/// Unlock a readers/writer lock.
- int release (short whence = 0, off_t start = 0, off_t len = 1);
+ int release (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
/// Acquire a write lock, but block if any readers or a
/// writer hold the lock.
- int acquire_write (short whence = 0, off_t start = 0, off_t len = 1);
+ int acquire_write (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
/**
* Conditionally acquire a write lock (i.e., won't block). Returns
* -1 on failure. If we "failed" because someone else already had
* the lock, <errno> is set to <EBUSY>.
*/
- int tryacquire_write (short whence = 0, off_t start = 0, off_t len = 1);
+ int tryacquire_write (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
/**
* Conditionally upgrade to a write lock (i.e., won't block). Returns
@@ -103,22 +103,22 @@ public:
* the lock, <errno> is set to <EBUSY>.
*/
int tryacquire_write_upgrade (short whence = 0,
- off_t start = 0,
- off_t len = 1);
+ ACE_OFF_T start = 0,
+ ACE_OFF_T len = 1);
/**
* Acquire a read lock, but block if a writer hold the lock.
* Returns -1 on failure. If we "failed" because someone else
* already had the lock, <errno> is set to <EBUSY>.
*/
- int acquire_read (short whence = 0, off_t start = 0, off_t len = 1);
+ int acquire_read (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
/**
* Conditionally acquire a read lock (i.e., won't block). Returns
* -1 on failure. If we "failed" because someone else already had
* the lock, <errno> is set to <EBUSY>.
*/
- int tryacquire_read (short whence = 0, off_t start = 0, off_t len = 1);
+ int tryacquire_read (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1);
/// Get underlying ACE_HANDLE for the file.
ACE_HANDLE get_handle (void) const;
diff --git a/ace/File_Lock.inl b/ace/File_Lock.inl
index be9c149b8d8..bef9de9d063 100644
--- a/ace/File_Lock.inl
+++ b/ace/File_Lock.inl
@@ -5,56 +5,58 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE int
-ACE_File_Lock::acquire_read (short whence, off_t start, off_t len)
+ACE_File_Lock::acquire_read (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::acquire_read");
return ACE_OS::flock_rdlock (&this->lock_, whence, start, len);
}
ACE_INLINE int
-ACE_File_Lock::tryacquire_read (short whence, off_t start, off_t len)
+ACE_File_Lock::tryacquire_read (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::tryacquire_read");
return ACE_OS::flock_tryrdlock (&this->lock_, whence, start, len);
}
ACE_INLINE int
-ACE_File_Lock::tryacquire_write (short whence, off_t start, off_t len)
+ACE_File_Lock::tryacquire_write (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::tryacquire_write");
return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len);
}
ACE_INLINE int
-ACE_File_Lock::tryacquire_write_upgrade (short whence, off_t start, off_t len)
+ACE_File_Lock::tryacquire_write_upgrade (short whence,
+ ACE_OFF_T start,
+ ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::tryacquire_write_upgrade");
return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len);
}
ACE_INLINE int
-ACE_File_Lock::tryacquire (short whence, off_t start, off_t len)
+ACE_File_Lock::tryacquire (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::tryacquire");
return this->tryacquire_write (whence, start, len);
}
ACE_INLINE int
-ACE_File_Lock::acquire_write (short whence, off_t start, off_t len)
+ACE_File_Lock::acquire_write (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::acquire_write");
return ACE_OS::flock_wrlock (&this->lock_, whence, start, len);
}
ACE_INLINE int
-ACE_File_Lock::acquire (short whence, off_t start, off_t len)
+ACE_File_Lock::acquire (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::acquire");
return this->acquire_write (whence, start, len);
}
ACE_INLINE int
-ACE_File_Lock::release (short whence, off_t start, off_t len)
+ACE_File_Lock::release (short whence, ACE_OFF_T start, ACE_OFF_T len)
{
// ACE_TRACE ("ACE_File_Lock::release");
return ACE_OS::flock_unlock (&this->lock_, whence, start, len);
diff --git a/ace/Filecache.cpp b/ace/Filecache.cpp
index 57239e7391d..1057328762a 100644
--- a/ace/Filecache.cpp
+++ b/ace/Filecache.cpp
@@ -9,6 +9,7 @@
#include "ace/OS_NS_time.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_fcntl.h"
+#include "ace/Truncate.h"
ACE_RCSID (ace,
Filecache,
@@ -130,7 +131,7 @@ ACE_Filecache_Handle::error (void) const
return this->file_->error ();
}
-ACE_LOFF_T
+ACE_OFF_T
ACE_Filecache_Handle::size (void) const
{
if (this->file_ == 0)
@@ -523,7 +524,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
return;
}
- this->size_ = this->stat_.st_size;
+ this->size_ = ACE_Utils::Truncate<ACE_OFF_T> (this->stat_.st_size);
this->tempname_ = this->filename_;
// Can we open the file?
@@ -555,7 +556,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
}
ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
- off_t size,
+ ACE_OFF_T size,
ACE_SYNCH_RW_MUTEX &lock,
LPSECURITY_ATTRIBUTES sa)
: stale_ (0),
@@ -706,7 +707,7 @@ ACE_Filecache_Object::filename (void) const
return this->filename_;
}
-ACE_LOFF_T
+ACE_OFF_T
ACE_Filecache_Object::size (void) const
{
// The existence of the object means a read lock is being held.
diff --git a/ace/Filecache.h b/ace/Filecache.h
index d0cfd0556cc..24c220b4f24 100644
--- a/ace/Filecache.h
+++ b/ace/Filecache.h
@@ -117,7 +117,7 @@ public:
int error (void) const;
/// The size of the file.
- ACE_LOFF_T size (void) const;
+ ACE_OFF_T size (void) const;
protected:
/// Default do nothing constructor. Prevent it from being called.
@@ -215,7 +215,7 @@ protected:
ACE_Filecache (void);
private:
- int size_;
+ ACE_OFF_T size_;
/// The hash table
ACE_Filecache_Hash hash_;
@@ -249,7 +249,7 @@ public:
/// Creates a file for writing.
ACE_Filecache_Object (const ACE_TCHAR *filename,
- off_t size,
+ ACE_OFF_T size,
ACE_SYNCH_RW_MUTEX &lock,
LPSECURITY_ATTRIBUTES sa = 0);
@@ -277,7 +277,7 @@ public:
void *address (void) const;
/// size_ accessor.
- ACE_LOFF_T size (void) const;
+ ACE_OFF_T size (void) const;
/// True if file on disk is newer than cached file.
int update (void) const;
@@ -327,7 +327,7 @@ private:
/// Used to compare against the real file to test if an update is needed.
ACE_stat stat_;
- ACE_LOFF_T size_;
+ ACE_OFF_T size_;
/// Status indicators.
int action_;
diff --git a/ace/Hash_Map_Manager_T.inl b/ace/Hash_Map_Manager_T.inl
index dbb68c7781a..bd14bd25c26 100644
--- a/ace/Hash_Map_Manager_T.inl
+++ b/ace/Hash_Map_Manager_T.inl
@@ -498,8 +498,6 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID,
index_ (head ? -1 : (ssize_t) mm.total_size_),
next_ (0)
{
-// ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex");
-
if (mm.table_ != 0)
this->next_ = &mm.table_[head ? 0 : mm.total_size_ - 1];
}
diff --git a/ace/Local_Memory_Pool.cpp b/ace/Local_Memory_Pool.cpp
index 96a647ed6fd..10692afde86 100644
--- a/ace/Local_Memory_Pool.cpp
+++ b/ace/Local_Memory_Pool.cpp
@@ -138,7 +138,7 @@ size_t
ACE_Local_Memory_Pool::round_up (size_t nbytes)
{
ACE_TRACE ("ACE_Local_Memory_Pool::round_up");
- return ACE::round_to_pagesize (static_cast<off_t> (nbytes));
+ return ACE::round_to_pagesize (nbytes);
}
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/MEM_Acceptor.h b/ace/MEM_Acceptor.h
index 87b90f2da92..4a57b7528ff 100644
--- a/ace/MEM_Acceptor.h
+++ b/ace/MEM_Acceptor.h
@@ -108,7 +108,7 @@ public:
* Change the initial MMAP buffer size (in bytes) of the MEM_Stream
* this MEM_Acceptor creates.
*/
- void init_buffer_size (off_t bytes);
+ void init_buffer_size (ACE_OFF_T bytes);
/// Get the preferred signaling strategy.
ACE_MEM_IO::Signal_Strategy preferred_strategy (void) const;
diff --git a/ace/MEM_Acceptor.inl b/ace/MEM_Acceptor.inl
index 388e1541cdf..c06cdaaee4a 100644
--- a/ace/MEM_Acceptor.inl
+++ b/ace/MEM_Acceptor.inl
@@ -86,7 +86,7 @@ ACE_MEM_Acceptor::preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy)
}
ACE_INLINE void
-ACE_MEM_Acceptor::init_buffer_size (off_t bytes)
+ACE_MEM_Acceptor::init_buffer_size (ACE_OFF_T bytes)
{
this->malloc_options_.minimum_bytes_ = bytes;
}
diff --git a/ace/MEM_IO.cpp b/ace/MEM_IO.cpp
index 7a9616f5220..96001b954c0 100644
--- a/ace/MEM_IO.cpp
+++ b/ace/MEM_IO.cpp
@@ -41,10 +41,10 @@ ACE_Reactive_MEM_IO::recv_buf (ACE_MEM_SAP_Node *&buf,
if (this->shm_malloc_ == 0 || this->handle_ == ACE_INVALID_HANDLE)
return -1;
- off_t new_offset = 0;
+ ACE_OFF_T new_offset = 0;
ssize_t retv = ACE::recv (this->handle_,
(char *) &new_offset,
- sizeof (off_t),
+ sizeof (ACE_OFF_T),
flags,
timeout);
@@ -54,7 +54,7 @@ ACE_Reactive_MEM_IO::recv_buf (ACE_MEM_SAP_Node *&buf,
buf = 0;
return 0;
}
- else if (retv != sizeof (off_t))
+ else if (retv != sizeof (ACE_OFF_T))
{
// Nothing available or we are really screwed.
buf = 0;
@@ -74,7 +74,7 @@ ACE_Reactive_MEM_IO::send_buf (ACE_MEM_SAP_Node *buf,
if (this->shm_malloc_ == 0 || this->handle_ == ACE_INVALID_HANDLE)
return -1;
- off_t offset = reinterpret_cast<char *> (buf) -
+ ACE_OFF_T offset = reinterpret_cast<char *> (buf) -
static_cast<char *> (this->shm_malloc_->base_addr ()); // the offset.
// Send the offset value over the socket.
if (ACE::send (this->handle_,
diff --git a/ace/MEM_IO.h b/ace/MEM_IO.h
index 2b1ae570261..f294de2a94d 100644
--- a/ace/MEM_IO.h
+++ b/ace/MEM_IO.h
@@ -71,7 +71,7 @@ public:
* Return the size of valid information containing in the <buf>,
* -1 if <shm_malloc_> is not initialized.
*/
- ssize_t get_buf_len (const off_t off, ACE_MEM_SAP_Node *&buf);
+ ssize_t get_buf_len (const ACE_OFF_T off, ACE_MEM_SAP_Node *&buf);
};
#if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM)
diff --git a/ace/MEM_IO.inl b/ace/MEM_IO.inl
index 07f13764e94..505c90c628c 100644
--- a/ace/MEM_IO.inl
+++ b/ace/MEM_IO.inl
@@ -48,7 +48,7 @@ ACE_MT_MEM_IO::Simple_Queue::init (MQ_Struct *mq,
#endif /* ACE_WIN32 || !_ACE_USE_SV_SEM */
ACE_INLINE ssize_t
-ACE_Reactive_MEM_IO::get_buf_len (const off_t off, ACE_MEM_SAP_Node *&buf)
+ACE_Reactive_MEM_IO::get_buf_len (const ACE_OFF_T off, ACE_MEM_SAP_Node *&buf)
{
#if !defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
ACE_TRACE ("ACE_Reactive_MEM_IO::get_buf_len");
diff --git a/ace/MMAP_Memory_Pool.cpp b/ace/MMAP_Memory_Pool.cpp
index a33097e7403..2be726393e4 100644
--- a/ace/MMAP_Memory_Pool.cpp
+++ b/ace/MMAP_Memory_Pool.cpp
@@ -7,6 +7,7 @@
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_stat.h"
#include "ace/Log_Msg.h"
+#include "ace/Truncate.h"
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
#include "ace/Based_Pointer_T.h"
@@ -50,12 +51,20 @@ ACE_MMAP_Memory_Pool::release (int destroy)
}
int
-ACE_MMAP_Memory_Pool::sync (ssize_t len, int flags)
+ACE_MMAP_Memory_Pool::sync (size_t len, int flags)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::sync");
- if (len < 0)
- len = ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END);
+ return this->mmap_.sync (len, flags);
+}
+
+int
+ACE_MMAP_Memory_Pool::sync (int flags)
+{
+ ACE_TRACE ("ACE_MMAP_Memory_Pool::sync");
+
+ size_t const len = ACE_Utils::Truncate<size_t> (
+ ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END));
return this->mmap_.sync (len, flags);
}
@@ -71,20 +80,29 @@ ACE_MMAP_Memory_Pool::sync (void *addr, size_t len, int flags)
}
// Change the protection of the pages of the mapped region to <prot>
-// starting at <this->base_addr_> up to <len> bytes. If <len> == -1
-// then change protection of all pages in the mapped region.
+// starting at <this->base_addr_> up to <len> bytes.
+// Change protection of all pages in the mapped region.
int
-ACE_MMAP_Memory_Pool::protect (ssize_t len, int prot)
+ACE_MMAP_Memory_Pool::protect (size_t len, int prot)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::protect");
- if (len < 0)
- len = ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END);
+ return this->mmap_.protect (len, prot);
+}
+
+int
+ACE_MMAP_Memory_Pool::protect (int prot)
+{
+ ACE_TRACE ("ACE_MMAP_Memory_Pool::protect");
+
+ size_t const len = ACE_Utils::Truncate<size_t> (
+ ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END));
return this->mmap_.protect (len, prot);
}
+
// Change the protection of the pages of the mapped region to <prot>
// starting at <addr> up to <len> bytes.
@@ -188,7 +206,7 @@ ACE_MMAP_Memory_Pool::~ACE_MMAP_Memory_Pool (void)
// memory.
int
ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
- ACE_LOFF_T &map_size)
+ size_t & map_size)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::commit_backing_store_name");
@@ -210,11 +228,13 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
cur_block < rounded_bytes;
cur_block += seek_len)
{
- map_size = ACE_OS::lseek (this->mmap_.handle (),
- static_cast<off_t> (seek_len - 1),
- SEEK_END);
+ map_size =
+ ACE_Utils::Truncate<size_t> (
+ ACE_OS::lseek (this->mmap_.handle (),
+ static_cast<ACE_OFF_T> (seek_len - 1),
+ SEEK_END));
- if (map_size == -1
+ if (map_size == static_cast<size_t> (-1)
|| ACE_OS::write (this->mmap_.handle (),
"",
1) == -1)
@@ -237,7 +257,7 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
// Memory map the file up to <map_size> bytes.
int
-ACE_MMAP_Memory_Pool::map_file (ACE_LOFF_T map_size)
+ACE_MMAP_Memory_Pool::map_file (size_t map_size)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::map_file");
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
@@ -303,7 +323,7 @@ ACE_MMAP_Memory_Pool::acquire (size_t nbytes,
// ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquiring more chunks, nbytes =
// %d, rounded_bytes = %d\n", nbytes, rounded_bytes));
- ACE_LOFF_T map_size;
+ size_t map_size;
if (this->commit_backing_store_name (rounded_bytes,
map_size) == -1)
@@ -345,7 +365,7 @@ ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes,
errno = 0;
// Reopen file *without* using O_EXCL...
if (this->mmap_.map (this->backing_store_name_,
- -1,
+ static_cast<size_t> (-1),
O_RDWR,
this->file_mode_,
PROT_RDWR,
@@ -397,7 +417,8 @@ ACE_MMAP_Memory_Pool::remap (void *addr)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::remap");
// ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("Remapping with fault address at: %X\n"), addr));
- off_t const current_map_size = ACE_OS::filesize (this->mmap_.handle ());
+ size_t const current_map_size =
+ ACE_Utils::Truncate<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
// ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END);
if (!(addr < (void *) ((char *) this->mmap_.addr () + current_map_size)
@@ -408,15 +429,16 @@ ACE_MMAP_Memory_Pool::remap (void *addr)
return this->map_file (current_map_size);
}
-ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options (const void *base_addr,
- int use_fixed_addr,
- int write_each_page,
- ACE_LOFF_T minimum_bytes,
- u_int flags,
- int guess_on_fault,
- LPSECURITY_ATTRIBUTES sa,
- mode_t file_mode,
- bool unique)
+ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options (
+ const void *base_addr,
+ int use_fixed_addr,
+ int write_each_page,
+ size_t minimum_bytes,
+ u_int flags,
+ int guess_on_fault,
+ LPSECURITY_ATTRIBUTES sa,
+ mode_t file_mode,
+ bool unique)
: base_addr_ (base_addr),
use_fixed_addr_ (use_fixed_addr),
write_each_page_ (write_each_page),
@@ -478,7 +500,8 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
if (guess_on_fault_)
{
// Check if the current mapping is up to date.
- ACE_LOFF_T const current_map_size = ACE_OS::filesize (this->mmap_.handle ());
+ size_t const current_map_size =
+ ACE_Utils::Truncate<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
if (static_cast<size_t> (current_map_size) == this->mmap_.size ())
{
@@ -508,7 +531,7 @@ size_t
ACE_MMAP_Memory_Pool::round_up (size_t nbytes)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::round_up");
- return ACE::round_to_pagesize (static_cast<off_t> (nbytes));
+ return ACE::round_to_pagesize (nbytes);
}
ACE_ALLOC_HOOK_DEFINE(ACE_Lite_MMAP_Memory_Pool)
@@ -525,7 +548,14 @@ ACE_Lite_MMAP_Memory_Pool::~ACE_Lite_MMAP_Memory_Pool (void)
}
int
-ACE_Lite_MMAP_Memory_Pool::sync (ssize_t, int)
+ACE_Lite_MMAP_Memory_Pool::sync (size_t, int)
+{
+ ACE_TRACE ("ACE_Lite_MMAP_Memory_Pool::sync");
+ return 0;
+}
+
+int
+ACE_Lite_MMAP_Memory_Pool::sync (int)
{
ACE_TRACE ("ACE_Lite_MMAP_Memory_Pool::sync");
return 0;
diff --git a/ace/MMAP_Memory_Pool.h b/ace/MMAP_Memory_Pool.h
index 0b8dffcc83c..5b9cc3f3186 100644
--- a/ace/MMAP_Memory_Pool.h
+++ b/ace/MMAP_Memory_Pool.h
@@ -67,7 +67,7 @@ public:
ACE_MMAP_Memory_Pool_Options (const void *base_addr = ACE_DEFAULT_BASE_ADDR,
int use_fixed_addr = ALWAYS_FIXED,
int write_each_page = 1,
- ACE_LOFF_T minimum_bytes = 0,
+ size_t minimum_bytes = 0,
u_int flags = 0,
int guess_on_fault = 1,
LPSECURITY_ATTRIBUTES sa = 0,
@@ -96,7 +96,7 @@ public:
int write_each_page_;
/// What the minimim bytes of the initial segment should be.
- ACE_LOFF_T minimum_bytes_;
+ size_t minimum_bytes_;
/// Any special flags that need to be used for @c mmap.
u_int flags_;
@@ -162,8 +162,13 @@ public:
/// Sync the memory region to the backing store starting at
/// @c this->base_addr_.
- virtual int sync (ssize_t len = -1, int flags = MS_SYNC);
+ virtual int sync (size_t len, int flags = MS_SYNC);
+ /// Sync the memory region to the backing store starting at
+ /// @c this->base_addr_. Will sync as much as the backing file
+ /// allows.
+ virtual int sync (int flags = MS_SYNC);
+
/// Sync the memory region to the backing store starting at @a addr.
virtual int sync (void *addr, size_t len, int flags = MS_SYNC);
@@ -172,7 +177,13 @@ public:
* starting at <this->base_addr_> up to <len> bytes. If <len> == -1
* then change protection of all pages in the mapped region.
*/
- virtual int protect (ssize_t len = -1, int prot = PROT_RDWR);
+ virtual int protect (size_t len, int prot = PROT_RDWR);
+
+ /**
+ * Change the protection of all the pages of the mapped region to <prot>
+ * starting at <this->base_addr_>.
+ */
+ virtual int protect (int prot = PROT_RDWR);
/// Change the protection of the pages of the mapped region to @a prot
/// starting at @a addr up to @a len bytes.
@@ -222,10 +233,10 @@ protected:
/// Compute the new @a map_size of the backing store and commit the
/// memory.
virtual int commit_backing_store_name (size_t rounded_bytes,
- ACE_LOFF_T &map_size);
+ size_t & map_size);
/// Memory map the file up to @a map_size bytes.
- virtual int map_file (ACE_LOFF_T map_size);
+ virtual int map_file (size_t map_size);
/// Handle SIGSEGV and SIGBUS signals to remap shared memory
/// properly.
@@ -255,7 +266,7 @@ protected:
int write_each_page_;
/// What the minimum bytes of the initial segment should be.
- ACE_LOFF_T minimum_bytes_;
+ size_t minimum_bytes_;
/// Name of the backing store where the shared memory pool is kept.
ACE_TCHAR backing_store_name_[MAXPATHLEN + 1];
@@ -297,7 +308,10 @@ public:
virtual ~ACE_Lite_MMAP_Memory_Pool (void);
/// Overwrite the default sync behavior with no-op
- virtual int sync (ssize_t len = -1, int flags = MS_SYNC);
+ virtual int sync (size_t len, int flags = MS_SYNC);
+
+ /// Overwrite the default sync behavior with no-op
+ virtual int sync (int flags = MS_SYNC);
/// Overwrite the default sync behavior with no-op
virtual int sync (void *addr, size_t len, int flags = MS_SYNC);
diff --git a/ace/Mem_Map.cpp b/ace/Mem_Map.cpp
index f22f7279bf5..d2bc4102ce6 100644
--- a/ace/Mem_Map.cpp
+++ b/ace/Mem_Map.cpp
@@ -11,6 +11,7 @@
#include "ace/OS_NS_fcntl.h"
#include "ace/OS_NS_string.h"
#include "ace/Log_Msg.h"
+#include "ace/Truncate.h"
#if defined (ACE_WIN32) \
&& (!defined(ACE_HAS_WINNT4) || (ACE_HAS_WINNT4 == 0))
@@ -95,11 +96,11 @@ ACE_Mem_Map::~ACE_Mem_Map (void)
int
ACE_Mem_Map::map_it (ACE_HANDLE handle,
- ssize_t length_request,
+ size_t length_request,
int prot,
int share,
void *addr,
- off_t offset,
+ ACE_OFF_T offset,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::map_it");
@@ -115,25 +116,31 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
this->base_addr_ = addr;
this->handle_ = handle;
- ACE_LOFF_T const result = ACE_OS::filesize (this->handle_);
+ ACE_OFF_T const result = ACE_OS::filesize (this->handle_);
// At this point we know <result> is not negative...
- size_t const current_file_length = static_cast<size_t> (result);
+ ACE_OFF_T const current_file_length = result;
// Flag to indicate if we need to extend the back store
bool extend_backing_store = false;
// File length requested by user
- size_t requested_file_length = 0;
+ ACE_OFF_T requested_file_length = 0;
// Check <length_request>
- if (length_request == -1)
- // Set length to file_request.
- this->length_ = current_file_length - offset;
+ if (length_request == static_cast<size_t> (-1))
+ // Set length to file_request or size_t max.
+ this->length_ = ACE_Utils::Truncate<size_t> (current_file_length - offset);
else
- {
+ {
+ // Make sure that we have not been asked to do the impossible.
+ if (static_cast<ACE_UINT64> (length_request)
+ + static_cast<ACE_UINT64> (offset)
+ > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_OFF_T>::max ()))
+ return -1;
+
// File length implicitly requested by user
- requested_file_length = length_request + offset;
+ requested_file_length = static_cast<ACE_OFF_T> (length_request) + offset;
// Check to see if we need to extend the backing store
if (requested_file_length > current_file_length)
@@ -156,11 +163,10 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
if (extend_backing_store)
{
// Remember than write increases the size by one.
- off_t null_byte_position;
+ ACE_OFF_T null_byte_position;
if (requested_file_length > 0)
// This will make the file size <requested_file_length>
- null_byte_position =
- static_cast<off_t> (requested_file_length - 1);
+ null_byte_position = requested_file_length - 1;
else
// This will make the file size 1
null_byte_position = 0;
@@ -240,13 +246,13 @@ ACE_Mem_Map::open (const ACE_TCHAR *file_name,
int
ACE_Mem_Map::map (const ACE_TCHAR *file_name,
- ssize_t len,
+ size_t len,
int flags,
int mode,
int prot,
int share,
void *addr,
- off_t offset,
+ ACE_OFF_T offset,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::map");
@@ -281,13 +287,13 @@ ACE_Mem_Map::ACE_Mem_Map (void)
// Map a file specified by FILE_NAME.
ACE_Mem_Map::ACE_Mem_Map (const ACE_TCHAR *file_name,
- ssize_t len,
+ size_t len,
int flags,
int mode,
int prot,
int share,
void *addr,
- off_t offset,
+ ACE_OFF_T offset,
LPSECURITY_ATTRIBUTES sa)
: base_addr_ (MAP_FAILED),
length_ (0),
@@ -314,11 +320,11 @@ ACE_Mem_Map::ACE_Mem_Map (const ACE_TCHAR *file_name,
// lookup the length of the file if it is not given.
ACE_Mem_Map::ACE_Mem_Map (ACE_HANDLE handle,
- ssize_t len,
+ size_t len,
int prot,
int share,
void *addr,
- off_t offset,
+ ACE_OFF_T offset,
LPSECURITY_ATTRIBUTES sa)
: base_addr_ (MAP_FAILED),
length_ (0),
diff --git a/ace/Mem_Map.h b/ace/Mem_Map.h
index e817a1dde5e..847568fb53e 100644
--- a/ace/Mem_Map.h
+++ b/ace/Mem_Map.h
@@ -48,51 +48,51 @@ public:
/// Map a file from an open file descriptor @a handle. This function
/// will lookup the length of the file if it is not given.
ACE_Mem_Map (ACE_HANDLE handle,
- ssize_t length = -1,
+ size_t length = static_cast<size_t> (-1),
int prot = PROT_RDWR,
int share = ACE_MAP_PRIVATE,
void *addr = 0,
- off_t offset = 0,
+ ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
/// Map a file specified by @a file_name.
ACE_Mem_Map (const ACE_TCHAR *filename,
- ssize_t length = -1,
+ size_t length = static_cast<size_t> (-1),
int flags = O_RDWR | O_CREAT,
int mode = ACE_DEFAULT_FILE_PERMS,
int prot = PROT_RDWR,
int share = ACE_MAP_PRIVATE,
void *addr = 0,
- off_t offset = 0,
+ ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
/// Map a file from an open file descriptor @a handle. This function
/// will lookup the length of the file if it is not given.
int map (ACE_HANDLE handle,
- ssize_t length = -1,
+ size_t length = static_cast<size_t> (-1),
int prot = PROT_RDWR,
int share = ACE_MAP_PRIVATE,
void *addr = 0,
- off_t offset = 0,
+ ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
/// Remap the file associated with <handle_>.
- int map (ssize_t length = -1,
+ int map (size_t length = static_cast<size_t> (-1),
int prot = PROT_RDWR,
int share = ACE_MAP_PRIVATE,
void *addr = 0,
- off_t offset = 0,
+ ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
/// Map a file specified by <filename>.
int map (const ACE_TCHAR *filename,
- ssize_t length = -1,
+ size_t length = static_cast<size_t> (-1),
int flags = O_RDWR | O_CREAT,
int mode = ACE_DEFAULT_FILE_PERMS,
int prot = PROT_RDWR,
int share = ACE_MAP_PRIVATE,
void *addr = 0,
- off_t offset = 0,
+ ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
/// Destructor.
@@ -139,7 +139,13 @@ public:
* starting at <base_addr_>. If <len> == -1 then sync the whole
* region.
*/
- int sync (ssize_t len = -1, int flags = MS_SYNC);
+ int sync (size_t len, int flags = MS_SYNC);
+
+ /**
+ * Sync the whole memory region to the backing store
+ * starting at <base_addr_>.
+ */
+ int sync (int flags = MS_SYNC);
/// Sync <len> bytes of the memory region to the backing store
/// starting at <addr_>.
@@ -147,10 +153,15 @@ public:
/**
* Change the protection of the pages of the mapped region to <prot>
- * starting at <base_addr_> up to <len> bytes. If <len> == -1 then
- * change protection of all pages in the mapped region.
+ * starting at <base_addr_> up to <len> bytes.
+ */
+ int protect (size_t len, int prot = PROT_RDWR);
+
+ /**
+ * Change the protection of all the pages of the mapped region to <prot>
+ * starting at <base_addr_>.
*/
- int protect (ssize_t len = -1, int prot = PROT_RDWR);
+ int protect (int prot = PROT_RDWR);
/// Change the protection of the pages of the mapped region to <prot>
/// starting at <addr> up to <len> bytes.
@@ -179,11 +190,11 @@ private:
/// This method does the dirty work of actually calling ::mmap to map
/// the file into memory.
int map_it (ACE_HANDLE handle,
- ssize_t len = -1,
+ size_t len = static_cast<size_t> (-1),
int prot = PROT_RDWR,
int share = MAP_SHARED,
void *addr = 0,
- off_t offset = 0,
+ ACE_OFF_T offset = 0,
LPSECURITY_ATTRIBUTES sa = 0);
// = Disallow copying and assignment.
diff --git a/ace/Mem_Map.inl b/ace/Mem_Map.inl
index b1889f8baf2..78a99646a88 100644
--- a/ace/Mem_Map.inl
+++ b/ace/Mem_Map.inl
@@ -25,11 +25,11 @@ ACE_Mem_Map::filename (void) const
ACE_INLINE int
ACE_Mem_Map::map (ACE_HANDLE handle,
- ssize_t length,
+ size_t length,
int prot,
int share,
void *addr,
- off_t offset,
+ ACE_OFF_T offset,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::map");
@@ -39,11 +39,11 @@ ACE_Mem_Map::map (ACE_HANDLE handle,
// Remap the file associated with <this->handle_>.
ACE_INLINE int
-ACE_Mem_Map::map (ssize_t length,
+ACE_Mem_Map::map (size_t length,
int prot,
int share,
void *addr,
- off_t offset,
+ ACE_OFF_T offset,
LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::map");
@@ -144,15 +144,24 @@ ACE_Mem_Map::unmap (void *addr, ssize_t len)
}
// Sync <len> bytes of the memory region to the backing store starting
-// at <this->base_addr_>. If <len> == -1 then sync the whole mapped
-// region.
+// at <this->base_addr_>.
ACE_INLINE int
-ACE_Mem_Map::sync (ssize_t len, int flags)
+ACE_Mem_Map::sync (size_t len, int flags)
{
ACE_TRACE ("ACE_Mem_Map::sync");
return ACE_OS::msync (this->base_addr_,
- len < 0 ? this->length_ : len,
+ len,
+ flags);
+}
+
+// Sync the whole mapped region.
+ACE_INLINE int
+ACE_Mem_Map::sync (int flags)
+{
+ ACE_TRACE ("ACE_Mem_Map::sync");
+ return ACE_OS::msync (this->base_addr_,
+ this->length_,
flags);
}
@@ -167,18 +176,26 @@ ACE_Mem_Map::sync (void *addr, size_t len, int flags)
}
// Change the protection of the pages of the mapped region to <prot>
-// starting at <this->base_addr_> up to <len> bytes. If <len> == -1
-// then change protection of all pages in the mapped region.
+// starting at <this->base_addr_> up to <len> bytes.
ACE_INLINE int
-ACE_Mem_Map::protect (ssize_t len, int prot)
+ACE_Mem_Map::protect (size_t len, int prot)
{
ACE_TRACE ("ACE_Mem_Map::protect");
- if (len < 0)
- len = this->length_;
return ACE_OS::mprotect (this->base_addr_, len, prot);
}
+
+// Change the protection of all the pages of the mapped region to <prot>
+// starting at <this->base_addr_>.
+
+ACE_INLINE int
+ACE_Mem_Map::protect (int prot)
+{
+ ACE_TRACE ("ACE_Mem_Map::protect");
+ return ACE_OS::mprotect (this->base_addr_, this->length_, prot);
+}
+
// Change the protection of the pages of the mapped region to <prot>
// starting at <addr> up to <len> bytes.
diff --git a/ace/OS_NS_macros.h b/ace/OS_NS_macros.h
index 02a4aa334bd..8f47d150679 100644
--- a/ace/OS_NS_macros.h
+++ b/ace/OS_NS_macros.h
@@ -69,6 +69,46 @@
#endif /* !ACE_WIN32 */
+// Helper functions to split large intergers into smaller high-order
+// and low-order parts, and reconstitute them again. These are
+// required primarily for supporting _FILE_OFFSET_BITS==64 on windows.
+
+#if defined(ACE_WIN32)
+# if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS==64)
+# include "ace/Basic_Types.h"
+
+# define ACE_LOW_PART(X) static_cast<DWORD>(X)
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+LONG
+inline ACE_High_Part (ACE_OFF_T value)
+{
+ LARGE_INTEGER new_value;
+ new_value.QuadPart = value;
+ return new_value.HighPart;
+}
+# define ACE_HIGH_PART(X) ACE_High_Part(X)
+
+LONGLONG
+inline ACE_Combine_Parts (LONG high, DWORD low)
+{
+ LARGE_INTEGER value;
+ value.LowPart = low; // DWORD
+ value.HighPart = high; // LONG
+ return value.QuadPart;
+}
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+# define ACE_COMBINE_PARTS(X,Y) ACE_Combine_Parts(X,Y)
+# else /* _FILE_OFFSET_BITS==64 */
+# define ACE_LOW_PART(X) X
+# define ACE_HIGH_PART(X) 0
+# define ACE_COMBINE_PARTS(X,Y) X
+# endif /* _FILE_OFFSET_BITS==64 */
+#endif /* ACE_WIN32 */
+
+
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_MACROS_H */
diff --git a/ace/OS_NS_stdio.cpp b/ace/OS_NS_stdio.cpp
index df92196644b..c428ab2f762 100644
--- a/ace/OS_NS_stdio.cpp
+++ b/ace/OS_NS_stdio.cpp
@@ -112,6 +112,54 @@ void ACE_OS::checkUnicodeFormat (FILE* fp)
#endif // ACE_USES_WCHAR
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
+namespace
+{
+ /// Translate fopen's mode char to open's mode. This helper function
+ /// is here to avoid maintaining several pieces of identical code.
+ void
+ fopen_mode_to_open_mode_converter (ACE_TCHAR x, int & hmode)
+ {
+ switch (x)
+ {
+ case ACE_LIB_TEXT ('r'):
+ if (ACE_BIT_DISABLED (hmode, _O_RDWR))
+ {
+ ACE_CLR_BITS (hmode, _O_WRONLY);
+ ACE_SET_BITS (hmode, _O_RDONLY);
+ }
+ break;
+ case ACE_LIB_TEXT ('w'):
+ if (ACE_BIT_DISABLED (hmode, _O_RDWR))
+ {
+ ACE_CLR_BITS (hmode, _O_RDONLY);
+ ACE_SET_BITS (hmode, _O_WRONLY);
+ }
+ ACE_SET_BITS (hmode, _O_CREAT | _O_TRUNC);
+ break;
+ case ACE_LIB_TEXT ('a'):
+ if (ACE_BIT_DISABLED (hmode, _O_RDWR))
+ {
+ ACE_CLR_BITS (hmode, _O_RDONLY);
+ ACE_SET_BITS (hmode, _O_WRONLY);
+ }
+ ACE_SET_BITS (hmode, _O_CREAT | _O_APPEND);
+ break;
+ case ACE_LIB_TEXT ('+'):
+ ACE_CLR_BITS (hmode, _O_RDONLY | _O_WRONLY);
+ ACE_SET_BITS (hmode, _O_RDWR);
+ break;
+ case ACE_LIB_TEXT ('t'):
+ ACE_CLR_BITS (hmode, _O_BINARY);
+ ACE_SET_BITS (hmode, _O_TEXT);
+ break;
+ case ACE_LIB_TEXT ('b'):
+ ACE_CLR_BITS (hmode, _O_TEXT);
+ ACE_SET_BITS (hmode, _O_BINARY);
+ break;
+ }
+ }
+} // Close anonymous namespace
+
FILE *
ACE_OS::fopen (const char *filename,
const ACE_TCHAR *mode)
@@ -127,7 +175,7 @@ ACE_OS::fopen (const char *filename,
mode = empty_mode;
for (ACE_TCHAR const* mode_ptr = mode; *mode_ptr != 0; ++mode_ptr)
- ACE_OS::fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
+ fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
ACE_HANDLE const handle = ACE_OS::open (filename, hmode);
if (handle != ACE_INVALID_HANDLE)
@@ -171,7 +219,7 @@ ACE_OS::fopen (const wchar_t *filename,
int hmode = _O_TEXT;
for (const ACE_TCHAR *mode_ptr = mode; *mode_ptr != 0; mode_ptr++)
- ACE_OS::fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
+ fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
ACE_HANDLE handle = ACE_OS::open (filename, hmode);
if (handle != ACE_INVALID_HANDLE)
diff --git a/ace/OS_NS_stdio.h b/ace/OS_NS_stdio.h
index 86366e0948f..bc3e5569fcf 100644
--- a/ace/OS_NS_stdio.h
+++ b/ace/OS_NS_stdio.h
@@ -86,8 +86,8 @@ struct flock
{
short l_type;
short l_whence;
- off_t l_start;
- off_t l_len; /* len == 0 means until end of file */
+ ACE_OFF_T l_start;
+ ACE_OFF_T l_len; /* len == 0 means until end of file */
long l_sysid;
pid_t l_pid;
long l_pad[4]; /* reserve area */
@@ -187,8 +187,8 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
void flock_adjust_params (ace_flock_t *lock,
short whence,
- off_t &start,
- off_t &len);
+ ACE_OFF_T &start,
+ ACE_OFF_T &len);
# endif /* ACE_WIN32 */
ACE_NAMESPACE_INLINE_FUNCTION
@@ -204,32 +204,32 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
int flock_rdlock (ace_flock_t *lock,
short whence = 0,
- off_t start = 0,
- off_t len = 0);
+ ACE_OFF_T start = 0,
+ ACE_OFF_T len = 0);
ACE_NAMESPACE_INLINE_FUNCTION
int flock_tryrdlock (ace_flock_t *lock,
short whence = 0,
- off_t start = 0,
- off_t len = 0);
+ ACE_OFF_T start = 0,
+ ACE_OFF_T len = 0);
ACE_NAMESPACE_INLINE_FUNCTION
int flock_trywrlock (ace_flock_t *lock,
short whence = 0,
- off_t start = 0,
- off_t len = 0);
+ ACE_OFF_T start = 0,
+ ACE_OFF_T len = 0);
ACE_NAMESPACE_INLINE_FUNCTION
int flock_unlock (ace_flock_t *lock,
short whence = 0,
- off_t start = 0,
- off_t len = 0);
+ ACE_OFF_T start = 0,
+ ACE_OFF_T len = 0);
ACE_NAMESPACE_INLINE_FUNCTION
int flock_wrlock (ace_flock_t *lock,
short whence = 0,
- off_t start = 0,
- off_t len = 0);
+ ACE_OFF_T start = 0,
+ ACE_OFF_T len = 0);
//@}
@@ -276,11 +276,6 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
void set_win32_resource_module (HINSTANCE);
- /// Translate fopen's mode char to open's mode. This helper function
- /// is here to avoid maintaining several pieces of identical code.
- ACE_NAMESPACE_INLINE_FUNCTION
- void fopen_mode_to_open_mode_converter (ACE_TCHAR x, int &hmode);
-
extern ACE_Export ACE_TEXT_OSVERSIONINFO win32_versioninfo_;
extern ACE_Export HINSTANCE win32_resource_module_;
diff --git a/ace/OS_NS_stdio.inl b/ace/OS_NS_stdio.inl
index 3a4beb62f65..a2dcf06997e 100644
--- a/ace/OS_NS_stdio.inl
+++ b/ace/OS_NS_stdio.inl
@@ -9,6 +9,7 @@
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_pwd.h"
#include "ace/OS_NS_macros.h"
+#include "ace/OS_NS_sys_stat.h"
#include "ace/OS_Memory.h"
#if defined (ACE_HAS_CHARPTR_SPRINTF)
@@ -25,24 +26,57 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE void
ACE_OS::flock_adjust_params (ACE_OS::ace_flock_t *lock,
short whence,
- off_t &start,
- off_t &len)
+ ACE_OFF_T &start,
+ ACE_OFF_T &len)
{
switch (whence)
{
case SEEK_SET:
break;
case SEEK_CUR:
- start += SetFilePointer (lock->handle_, 0, 0, FILE_CURRENT);
+ {
+# if defined (_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
+ LARGE_INTEGER distance, offset;
+ distance.QuadPart = 0;
+ if (!::SetFilePointerEx (lock->handle_,
+ distance,
+ &offset,
+ FILE_CURRENT))
+ {
+ ACE_OS::set_errno_to_last_error ();
+ return;
+ }
+ start += offset.QuadPart;
+# else
+ ACE_OFF_T const offset =
+ ::SetFilePointer (lock->handle_, 0, 0, FILE_CURRENT);
+ if (offset == INVALID_SET_FILE_POINTER)
+ {
+ ACE_OS::set_errno_to_last_error ();
+ return;
+ }
+ start += offset;
+# endif /* _FILE_OFFSET_BITS == 64 */
+ }
break;
case SEEK_END:
- start += ::GetFileSize (lock->handle_, 0);
+ {
+ ACE_OFF_T const size = ACE_OS::filesize (lock->handle_);
+ if (size == -1)
+ return;
+
+ start += size;
+ }
break;
}
- lock->overlapped_.Offset = start;
+ lock->overlapped_.Offset = ACE_LOW_PART (start);
+ lock->overlapped_.OffsetHigh = ACE_HIGH_PART (start);
if (len == 0)
- len = ::GetFileSize (lock->handle_,
- 0) - start;
+ {
+ ACE_OFF_T const tlen = ACE_OS::filesize (lock->handle_);
+ if (tlen != -1)
+ len = tlen - start;
+ }
}
#endif /* ACE_WIN32 */
@@ -80,18 +114,21 @@ ACE_OS::flock_init (ACE_OS::ace_flock_t *lock,
ACE_INLINE int
ACE_OS::flock_unlock (ACE_OS::ace_flock_t *lock,
short whence,
- off_t start,
- off_t len)
+ ACE_OFF_T start,
+ ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::flock_unlock");
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
ACE_OS::flock_adjust_params (lock, whence, start, len);
- ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::UnlockFile (lock->handle_,
- lock->overlapped_.Offset,
- 0,
- len,
- 0),
- ace_result_), int, -1);
+ DWORD low_len = ACE_LOW_PART (len);
+ DWORD high_len = ACE_HIGH_PART (len);
+ ACE_WIN32CALL_RETURN (
+ ACE_ADAPT_RETVAL (::UnlockFile (lock->handle_,
+ lock->overlapped_.Offset,
+ lock->overlapped_.OffsetHigh,
+ low_len,
+ high_len),
+ ace_result_), int, -1);
#elif defined (ACE_LACKS_FILELOCKS)
ACE_UNUSED_ARG (lock);
ACE_UNUSED_ARG (whence);
@@ -137,27 +174,30 @@ ACE_OS::flock_destroy (ACE_OS::ace_flock_t *lock,
ACE_INLINE int
ACE_OS::flock_rdlock (ACE_OS::ace_flock_t *lock,
short whence,
- off_t start,
- off_t len)
+ ACE_OFF_T start,
+ ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::flock_rdlock");
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
ACE_OS::flock_adjust_params (lock, whence, start, len);
+ DWORD low_len = ACE_LOW_PART (len);
+ DWORD high_len = ACE_HIGH_PART (len);
# if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
0,
0,
- len,
- 0,
+ low_len,
+ high_len,
&lock->overlapped_),
ace_result_), int, -1);
# else /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
- ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFile (lock->handle_,
- lock->overlapped_.Offset,
- 0,
- len,
- 0),
- ace_result_), int, -1);
+ ACE_WIN32CALL_RETURN (
+ ACE_ADAPT_RETVAL (::LockFile (lock->handle_,
+ lock->overlapped_.Offset,
+ lock->overlapped_.OffsetHigh,
+ low_len,
+ high_len),
+ ace_result_), int, -1);
# endif /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
#elif defined (ACE_LACKS_FILELOCKS)
ACE_UNUSED_ARG (lock);
@@ -180,20 +220,23 @@ ACE_OS::flock_rdlock (ACE_OS::ace_flock_t *lock,
ACE_INLINE int
ACE_OS::flock_tryrdlock (ACE_OS::ace_flock_t *lock,
short whence,
- off_t start,
- off_t len)
+ ACE_OFF_T start,
+ ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::ace_flock_tryrdlock");
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
# if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
ACE_OS::flock_adjust_params (lock, whence, start, len);
- ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
- LOCKFILE_FAIL_IMMEDIATELY,
- 0,
- len,
- 0,
- &lock->overlapped_),
- ace_result_), int, -1);
+ DWORD low_len = ACE_LOW_PART (len);
+ DWORD high_len = ACE_HIGH_PART (len);
+ ACE_WIN32CALL_RETURN (
+ ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
+ LOCKFILE_FAIL_IMMEDIATELY,
+ 0,
+ low_len,
+ high_len,
+ &lock->overlapped_),
+ ace_result_), int, -1);
# else /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
ACE_UNUSED_ARG (lock);
ACE_UNUSED_ARG (whence);
@@ -229,20 +272,23 @@ ACE_OS::flock_tryrdlock (ACE_OS::ace_flock_t *lock,
ACE_INLINE int
ACE_OS::flock_trywrlock (ACE_OS::ace_flock_t *lock,
short whence,
- off_t start,
- off_t len)
+ ACE_OFF_T start,
+ ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::ace_flock_trywrlock");
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
# if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
ACE_OS::flock_adjust_params (lock, whence, start, len);
- ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
- LOCKFILE_FAIL_IMMEDIATELY | LOCKFILE_EXCLUSIVE_LOCK,
- 0,
- len,
- 0,
- &lock->overlapped_),
- ace_result_), int, -1);
+ DWORD low_len = ACE_LOW_PART (len);
+ DWORD high_len = ACE_HIGH_PART (len);
+ ACE_WIN32CALL_RETURN (
+ ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
+ LOCKFILE_FAIL_IMMEDIATELY | LOCKFILE_EXCLUSIVE_LOCK,
+ 0,
+ low_len,
+ high_len,
+ &lock->overlapped_),
+ ace_result_), int, -1);
# else /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
ACE_UNUSED_ARG (lock);
ACE_UNUSED_ARG (whence);
@@ -279,27 +325,31 @@ ACE_OS::flock_trywrlock (ACE_OS::ace_flock_t *lock,
ACE_INLINE int
ACE_OS::flock_wrlock (ACE_OS::ace_flock_t *lock,
short whence,
- off_t start,
- off_t len)
+ ACE_OFF_T start,
+ ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::flock_wrlock");
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
ACE_OS::flock_adjust_params (lock, whence, start, len);
+ DWORD low_len = ACE_LOW_PART (len);
+ DWORD high_len = ACE_HIGH_PART (len);
# if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
- ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
- LOCKFILE_EXCLUSIVE_LOCK,
- 0,
- len,
- 0,
- &lock->overlapped_),
- ace_result_), int, -1);
+ ACE_WIN32CALL_RETURN (
+ ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
+ LOCKFILE_EXCLUSIVE_LOCK,
+ 0,
+ low_len,
+ high_len,
+ &lock->overlapped_),
+ ace_result_), int, -1);
# else /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
- ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFile (lock->handle_,
- lock->overlapped_.Offset,
- 0,
- len,
- 0),
- ace_result_), int, -1);
+ ACE_WIN32CALL_RETURN (
+ ACE_ADAPT_RETVAL (::LockFile (lock->handle_,
+ lock->overlapped_.Offset,
+ lock->overlapped_.OffsetHigh,
+ low_len,
+ high_len),
+ ace_result_), int, -1);
# endif /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
#elif defined (ACE_LACKS_FILELOCKS)
ACE_UNUSED_ARG (lock);
@@ -319,51 +369,6 @@ ACE_OS::flock_wrlock (ACE_OS::ace_flock_t *lock,
#endif /* ACE_WIN32 */
}
-#if defined (ACE_WIN32)
-ACE_INLINE void
-ACE_OS::fopen_mode_to_open_mode_converter (ACE_TCHAR x, int &hmode)
-{
- switch (x)
- {
- case ACE_LIB_TEXT ('r'):
- if (ACE_BIT_DISABLED (hmode, _O_RDWR))
- {
- ACE_CLR_BITS (hmode, _O_WRONLY);
- ACE_SET_BITS (hmode, _O_RDONLY);
- }
- break;
- case ACE_LIB_TEXT ('w'):
- if (ACE_BIT_DISABLED (hmode, _O_RDWR))
- {
- ACE_CLR_BITS (hmode, _O_RDONLY);
- ACE_SET_BITS (hmode, _O_WRONLY);
- }
- ACE_SET_BITS (hmode, _O_CREAT | _O_TRUNC);
- break;
- case ACE_LIB_TEXT ('a'):
- if (ACE_BIT_DISABLED (hmode, _O_RDWR))
- {
- ACE_CLR_BITS (hmode, _O_RDONLY);
- ACE_SET_BITS (hmode, _O_WRONLY);
- }
- ACE_SET_BITS (hmode, _O_CREAT | _O_APPEND);
- break;
- case ACE_LIB_TEXT ('+'):
- ACE_CLR_BITS (hmode, _O_RDONLY | _O_WRONLY);
- ACE_SET_BITS (hmode, _O_RDWR);
- break;
- case ACE_LIB_TEXT ('t'):
- ACE_CLR_BITS (hmode, _O_BINARY);
- ACE_SET_BITS (hmode, _O_TEXT);
- break;
- case ACE_LIB_TEXT ('b'):
- ACE_CLR_BITS (hmode, _O_TEXT);
- ACE_SET_BITS (hmode, _O_BINARY);
- break;
- }
-}
-#endif /* ACE_WIN32 */
-
#if !defined (ACE_LACKS_CLEARERR)
ACE_INLINE void
ACE_OS::clearerr (FILE* fp)
diff --git a/ace/OS_NS_sys_mman.h b/ace/OS_NS_sys_mman.h
index 0a6f57a5038..ba2d4661eb3 100644
--- a/ace/OS_NS_sys_mman.h
+++ b/ace/OS_NS_sys_mman.h
@@ -52,7 +52,7 @@ namespace ACE_OS
int prot,
int flags,
ACE_HANDLE handle,
- off_t off = 0,
+ ACE_OFF_T off = 0,
ACE_HANDLE *file_mapping = 0,
LPSECURITY_ATTRIBUTES sa = 0,
const ACE_TCHAR *file_mapping_name = 0);
diff --git a/ace/OS_NS_sys_mman.inl b/ace/OS_NS_sys_mman.inl
index 3f1a69de2bb..422d07e9c35 100644
--- a/ace/OS_NS_sys_mman.inl
+++ b/ace/OS_NS_sys_mman.inl
@@ -37,7 +37,7 @@ ACE_OS::mmap (void *addr,
int prot,
int flags,
ACE_HANDLE file_handle,
- off_t off,
+ ACE_OFF_T off,
ACE_HANDLE *file_mapping,
LPSECURITY_ATTRIBUTES sa,
const ACE_TCHAR *file_mapping_name)
@@ -135,18 +135,21 @@ ACE_OS::mmap (void *addr,
nt_flags |= ACE_OS_EXTRA_MMAP_FLAGS;
# endif /* ACE_OS_EXTRA_MMAP_FLAGS */
+ DWORD low_off = ACE_LOW_PART (off);
+ DWORD high_off = ACE_HIGH_PART (off);
+
# if !defined (ACE_HAS_WINCE)
void *addr_mapping = ::MapViewOfFileEx (*file_mapping,
nt_flags,
- 0,
- off,
+ high_off,
+ low_off,
len,
addr);
# else
void *addr_mapping = ::MapViewOfFile (*file_mapping,
nt_flags,
- 0,
- off,
+ high_off,
+ low_off,
len);
# endif /* ! ACE_HAS_WINCE */
diff --git a/ace/OS_NS_sys_stat.h b/ace/OS_NS_sys_stat.h
index 6e4ea6d209e..9cb017263aa 100644
--- a/ace/OS_NS_sys_stat.h
+++ b/ace/OS_NS_sys_stat.h
@@ -61,10 +61,10 @@ namespace ACE_OS
// non-standard
ACE_NAMESPACE_INLINE_FUNCTION
- ACE_LOFF_T filesize (ACE_HANDLE handle);
+ ACE_OFF_T filesize (ACE_HANDLE handle);
ACE_NAMESPACE_INLINE_FUNCTION
- ACE_LOFF_T filesize (const ACE_TCHAR *handle);
+ ACE_OFF_T filesize (const ACE_TCHAR *handle);
//@}
ACE_NAMESPACE_INLINE_FUNCTION
diff --git a/ace/OS_NS_sys_stat.inl b/ace/OS_NS_sys_stat.inl
index 88085ddb84e..63cab76ce22 100644
--- a/ace/OS_NS_sys_stat.inl
+++ b/ace/OS_NS_sys_stat.inl
@@ -95,23 +95,39 @@ namespace ACE_OS
// This function returns the number of bytes in the file referenced by
// FD.
- ACE_INLINE ACE_LOFF_T
+ ACE_INLINE ACE_OFF_T
filesize (ACE_HANDLE handle)
{
ACE_OS_TRACE ("ACE_OS::filesize");
+#if defined (ACE_WIN32)
+# if defined (_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
+ LARGE_INTEGER size;
+ return
+ (::GetFileSizeEx (handle, &size)
+ ? size.QuadPart
+ : (ACE_OS::set_errno_to_last_error (), -1));
+# else
+ ACE_OFF_T const size = ::GetFileSize (handle, 0);
+ return
+ (size != INVALID_FILE_SIZE
+ ? size
+ : (ACE_OS::set_errno_to_last_error (), -1));
+# endif /* _FILE_OFFSET_BITS == 64 */
+#else /* !ACE_WIN32 */
ACE_stat sb;
return ACE_OS::fstat (handle, &sb) == -1 ? -1 : sb.st_size;
+#endif
}
- ACE_INLINE ACE_LOFF_T
+ ACE_INLINE ACE_OFF_T
filesize (const ACE_TCHAR *filename)
{
ACE_OS_TRACE ("ACE_OS::filesize");
- ACE_HANDLE h = ACE_OS::open (filename, O_RDONLY);
+ ACE_HANDLE const h = ACE_OS::open (filename, O_RDONLY);
if (h != ACE_INVALID_HANDLE)
{
- ACE_LOFF_T size = ACE_OS::filesize (h);
+ ACE_OFF_T size = ACE_OS::filesize (h);
ACE_OS::close (h);
return size;
}
diff --git a/ace/OS_NS_unistd.cpp b/ace/OS_NS_unistd.cpp
index ac1c21e8993..4fd4401c3d9 100644
--- a/ace/OS_NS_unistd.cpp
+++ b/ace/OS_NS_unistd.cpp
@@ -374,7 +374,7 @@ ssize_t
ACE_OS::pread (ACE_HANDLE handle,
void *buf,
size_t nbytes,
- off_t offset)
+ ACE_OFF_T offset)
{
# if defined (ACE_HAS_P_READ_WRITE)
# if defined (ACE_WIN32)
@@ -382,20 +382,25 @@ ACE_OS::pread (ACE_HANDLE handle,
ACE_OS_GUARD
// Remember the original file pointer position
- DWORD original_position = ::SetFilePointer (handle,
- 0,
- 0,
- FILE_CURRENT);
-
- if (original_position == 0xFFFFFFFF)
+ LONG original_high_position = 0;
+ DWORD original_low_position = ::SetFilePointer (handle,
+ 0,
+ &original_high_position,
+ FILE_CURRENT);
+
+ if (original_low_position == INVALID_SET_FILE_POINTER
+ && GetLastError() != NO_ERROR)
return -1;
// Go to the correct position
+ LONG low_offset = ACE_LOW_PART (offset);
+ LONG high_offset = ACE_HIGH_PART (offset);
DWORD altered_position = ::SetFilePointer (handle,
- offset,
- 0,
+ low_offset,
+ &high_offset,
FILE_BEGIN);
- if (altered_position == 0xFFFFFFFF)
+ if (altered_position == INVALID_SET_FILE_POINTER
+ && GetLastError() != NO_ERROR)
return -1;
DWORD bytes_read;
@@ -405,8 +410,8 @@ ACE_OS::pread (ACE_HANDLE handle,
OVERLAPPED overlapped;
overlapped.Internal = 0;
overlapped.InternalHigh = 0;
- overlapped.Offset = offset;
- overlapped.OffsetHigh = 0;
+ overlapped.Offset = low_offset;
+ overlapped.OffsetHigh = high_offset;
overlapped.hEvent = 0;
BOOL result = ::ReadFile (handle,
@@ -445,9 +450,10 @@ ACE_OS::pread (ACE_HANDLE handle,
// Reset the original file pointer position
if (::SetFilePointer (handle,
- original_position,
- 0,
- FILE_BEGIN) == 0xFFFFFFFF)
+ original_low_position,
+ &original_high_position,
+ FILE_BEGIN) == INVALID_SET_FILE_POINTER
+ && GetLastError() != NO_ERROR)
return -1;
return (ssize_t) bytes_read;
@@ -463,17 +469,17 @@ ACE_OS::pread (ACE_HANDLE handle,
ACE_OS_GUARD
// Remember the original file pointer position
- off_t original_position = ACE_OS::lseek (handle,
- 0,
- SEEK_CUR);
+ ACE_OFF_T original_position = ACE_OS::lseek (handle,
+ 0,
+ SEEK_CUR);
if (original_position == -1)
return -1;
// Go to the correct position
- off_t altered_position = ACE_OS::lseek (handle,
- offset,
- SEEK_SET);
+ ACE_OFF_T altered_position = ACE_OS::lseek (handle,
+ offset,
+ SEEK_SET);
if (altered_position == -1)
return -1;
@@ -499,7 +505,7 @@ ssize_t
ACE_OS::pwrite (ACE_HANDLE handle,
const void *buf,
size_t nbytes,
- ACE_LOFF_T offset)
+ ACE_OFF_T offset)
{
# if defined (ACE_HAS_P_READ_WRITE)
# if defined (ACE_WIN32)
@@ -513,8 +519,8 @@ ACE_OS::pwrite (ACE_HANDLE handle,
0,
&orig_position.HighPart,
FILE_CURRENT);
- if (orig_position.LowPart == INVALID_SET_FILE_POINTER &&
- GetLastError () != NO_ERROR)
+ if (orig_position.LowPart == INVALID_SET_FILE_POINTER
+ && GetLastError () != NO_ERROR)
return -1;
DWORD bytes_written;
@@ -552,8 +558,11 @@ ACE_OS::pwrite (ACE_HANDLE handle,
# else /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
// Go to the correct position
- if (0 != ::SetFilePointerEx (handle, loffset, 0, FILE_BEGIN))
- return -1;
+ if (! ::SetFilePointerEx (handle, loffset, 0, FILE_BEGIN))
+ {
+ ACE_OS::set_errno_to_last_error ();
+ return -1;
+ }
BOOL result = ::WriteFile (handle,
buf,
@@ -569,7 +578,8 @@ ACE_OS::pwrite (ACE_HANDLE handle,
if (::SetFilePointer (handle,
orig_position.LowPart,
&orig_position.HighPart,
- FILE_BEGIN) == INVALID_SET_FILE_POINTER)
+ FILE_BEGIN) == INVALID_SET_FILE_POINTER
+ && GetLastError () != NO_ERROR)
return -1;
return (ssize_t) bytes_written;
@@ -583,16 +593,16 @@ ACE_OS::pwrite (ACE_HANDLE handle,
ACE_OS_GUARD
// Remember the original file pointer position
- off_t original_position = ACE_OS::lseek (handle,
- 0,
- SEEK_CUR);
+ ACE_OFF_T original_position = ACE_OS::lseek (handle,
+ 0,
+ SEEK_CUR);
if (original_position == -1)
return -1;
// Go to the correct position
- off_t altered_position = ACE_OS::lseek (handle,
- offset,
- SEEK_SET);
+ ACE_OFF_T altered_position = ACE_OS::lseek (handle,
+ offset,
+ SEEK_SET);
if (altered_position == -1)
return -1;
diff --git a/ace/OS_NS_unistd.h b/ace/OS_NS_unistd.h
index 1af07d98924..3f51db36c3f 100644
--- a/ace/OS_NS_unistd.h
+++ b/ace/OS_NS_unistd.h
@@ -139,7 +139,7 @@ namespace ACE_OS
ACE_NAMESPACE_INLINE_FUNCTION
int ftruncate (ACE_HANDLE,
- ACE_LOFF_T);
+ ACE_OFF_T);
ACE_NAMESPACE_INLINE_FUNCTION
char *getcwd (char *, size_t);
@@ -198,9 +198,9 @@ namespace ACE_OS
#endif /* ACE_WIN32 */
ACE_NAMESPACE_INLINE_FUNCTION
- off_t lseek (ACE_HANDLE handle,
- off_t offset,
- int whence);
+ ACE_OFF_T lseek (ACE_HANDLE handle,
+ ACE_OFF_T offset,
+ int whence);
#if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64)
ACE_NAMESPACE_INLINE_FUNCTION
@@ -224,13 +224,13 @@ namespace ACE_OS
ssize_t pread (ACE_HANDLE handle,
void *buf,
size_t nbyte,
- off_t offset);
+ ACE_OFF_T offset);
extern ACE_Export
ssize_t pwrite (ACE_HANDLE handle,
const void *buf,
size_t nbyte,
- ACE_LOFF_T offset);
+ ACE_OFF_T offset);
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t read (ACE_HANDLE handle,
@@ -315,7 +315,7 @@ namespace ACE_OS
long count);
ACE_NAMESPACE_INLINE_FUNCTION
- int truncate (const ACE_TCHAR *filename, ACE_LOFF_T length);
+ int truncate (const ACE_TCHAR *filename, ACE_OFF_T length);
ACE_NAMESPACE_INLINE_FUNCTION
useconds_t ualarm (useconds_t usecs,
diff --git a/ace/OS_NS_unistd.inl b/ace/OS_NS_unistd.inl
index c1cd0fba4ac..35aedac07ec 100644
--- a/ace/OS_NS_unistd.inl
+++ b/ace/OS_NS_unistd.inl
@@ -351,7 +351,7 @@ ACE_OS::fsync (ACE_HANDLE handle)
}
ACE_INLINE int
-ACE_OS::ftruncate (ACE_HANDLE handle, ACE_LOFF_T offset)
+ACE_OS::ftruncate (ACE_HANDLE handle, ACE_OFF_T offset)
{
ACE_OS_TRACE ("ACE_OS::ftruncate");
#if defined (ACE_WIN32)
@@ -360,7 +360,10 @@ ACE_OS::ftruncate (ACE_HANDLE handle, ACE_LOFF_T offset)
loff.QuadPart = offset;
if (::SetFilePointerEx (handle, loff, 0, FILE_BEGIN))
# else
- if (::SetFilePointer (handle, offset, 0, FILE_BEGIN) != (unsigned) -1)
+ if (::SetFilePointer (handle,
+ offset,
+ 0,
+ FILE_BEGIN) != INVALID_SET_FILE_POINTER)
# endif
ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::SetEndOfFile (handle), ace_result_), int, -1);
else
@@ -605,8 +608,8 @@ ACE_OS::isatty (ACE_HANDLE handle)
#endif /* ACE_WIN32 */
-ACE_INLINE off_t
-ACE_OS::lseek (ACE_HANDLE handle, off_t offset, int whence)
+ACE_INLINE ACE_OFF_T
+ACE_OS::lseek (ACE_HANDLE handle, ACE_OFF_T offset, int whence)
{
ACE_OS_TRACE ("ACE_OS::lseek");
#if defined (ACE_WIN32)
@@ -625,16 +628,19 @@ ACE_OS::lseek (ACE_HANDLE handle, off_t offset, int whence)
break;
default:
errno = EINVAL;
- return static_cast<off_t> (-1); // rather safe than sorry
+ return static_cast<ACE_OFF_T> (-1); // rather safe than sorry
}
# endif /* SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END */
- DWORD result = ::SetFilePointer (handle, offset, 0, whence);
- if (result == ACE_SYSCALL_FAILED)
- ACE_FAIL_RETURN (static_cast<off_t> (-1));
+ LONG low_offset = ACE_LOW_PART(offset);
+ LONG high_offset = ACE_HIGH_PART(offset);
+ DWORD const result =
+ ::SetFilePointer (handle, low_offset, &high_offset, whence);
+ if (result == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
+ ACE_FAIL_RETURN (static_cast<ACE_OFF_T> (-1));
else
return result;
#else
- ACE_OSCALL_RETURN (::lseek (handle, offset, whence), off_t, -1);
+ ACE_OSCALL_RETURN (::lseek (handle, offset, whence), ACE_OFF_T, -1);
#endif /* ACE_WIN32 */
}
@@ -652,16 +658,33 @@ ACE_OS::llseek (ACE_HANDLE handle, ACE_LOFF_T offset, int whence)
#elif defined (ACE_HAS_LSEEK64)
ACE_OSCALL_RETURN (::lseek64 (handle, offset, whence), ACE_LOFF_T, -1);
#elif defined (ACE_HAS_LLSEEK)
- # if defined (ACE_WIN32)
- LARGE_INTEGER li;
- li.QuadPart = offset;
- li.LowPart = ::SetFilePointer (handle, li.LowPart, &li.HighPart, whence);
- if (li.LowPart == 0xFFFFFFFF && GetLastError() != NO_ERROR)
- li.QuadPart = -1;
- return li.QuadPart;
- # else
+# if defined (ACE_WIN32)
+# ifndef ACE_LACKS_SETFILEPOINTEREX
+ LARGE_INTEGER distance, new_file_pointer;
+
+ distance.QuadPart = offset;
+
+ return
+ (::SetFilePointerEx (handle, distance, &new_file_pointer, whence)
+ ? new_file_pointer.QuadPart
+ : static_cast<ACE_LOFF_T> (-1));
+# else
+ LONG low_offset = ACE_LOW_PART(offset);
+ LONG high_offset = ACE_HIGH_PART(offset);
+
+ ACE_OFF_T const result = ::SetFilePointer (handle,
+ low_offset,
+ &high_offset,
+ whence);
+
+ return
+ ((result != INVALID_SET_FILE_POINTER || GetLastError () == NO_ERROR)
+ ? result
+ : static_cast<ACE_LOFF_T> (-1));
+# endif /* ACE_LACKS_SETFILEPOINTEREX */
+# else
ACE_OSCALL_RETURN (::llseek (handle, offset, whence), ACE_LOFF_T, -1);
- # endif /* WIN32 */
+# endif /* WIN32 */
#endif
}
#endif /* ACE_HAS_LLSEEK || ACE_HAS_LSEEK64 */
@@ -975,7 +998,7 @@ ACE_OS::sysinfo (int cmd, char *buf, long count)
ACE_INLINE int
ACE_OS::truncate (const ACE_TCHAR *filename,
- ACE_LOFF_T offset)
+ ACE_OFF_T offset)
{
ACE_OS_TRACE ("ACE_OS::truncate");
#if defined (ACE_WIN32)
@@ -983,10 +1006,17 @@ ACE_OS::truncate (const ACE_TCHAR *filename,
O_WRONLY,
ACE_DEFAULT_FILE_PERMS);
+# if !defined (ACE_LACKS_SETFILEPOINTEREX)
LARGE_INTEGER loffset;
loffset.QuadPart = offset;
+#else
+ LONG low_offset = ACE_LOW_PART(offset);
+ LONG high_offset = ACE_HIGH_PART(offset);
+#endif
+
if (handle == ACE_INVALID_HANDLE)
ACE_FAIL_RETURN (-1);
+
# if !defined (ACE_LACKS_SETFILEPOINTEREX)
else if (::SetFilePointerEx (handle,
loffset,
@@ -994,9 +1024,10 @@ ACE_OS::truncate (const ACE_TCHAR *filename,
FILE_BEGIN))
# else
else if (::SetFilePointer (handle,
- offset,
- 0,
- FILE_BEGIN) != (unsigned) -1)
+ low_offset,
+ &high_offset,
+ FILE_BEGIN) != INVALID_SET_FILE_POINTER
+ || GetLastError () == NO_ERROR)
# endif
{
BOOL result = ::SetEndOfFile (handle);
diff --git a/ace/Pagefile_Memory_Pool.inl b/ace/Pagefile_Memory_Pool.inl
index cf54da23f29..dd8eeb61220 100644
--- a/ace/Pagefile_Memory_Pool.inl
+++ b/ace/Pagefile_Memory_Pool.inl
@@ -16,7 +16,7 @@ ACE_Pagefile_Memory_Pool::round_to_chunk_size (size_t nbytes)
ACE_INLINE size_t
ACE_Pagefile_Memory_Pool::round_to_page_size (size_t nbytes)
{
- return ACE::round_to_pagesize (static_cast<off_t> (nbytes));
+ return ACE::round_to_pagesize (nbytes);
}
ACE_INLINE int
diff --git a/ace/Shared_Memory_MM.cpp b/ace/Shared_Memory_MM.cpp
index 945cb345b20..0662e7525bd 100644
--- a/ace/Shared_Memory_MM.cpp
+++ b/ace/Shared_Memory_MM.cpp
@@ -30,7 +30,7 @@ ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (ACE_HANDLE handle,
int prot,
int share,
char *addr,
- off_t pos)
+ ACE_OFF_T pos)
: shared_memory_ (handle, length, prot, share, addr, pos)
{
ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM");
@@ -43,7 +43,7 @@ ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (const ACE_TCHAR *file_name,
int prot,
int share,
char *addr,
- off_t pos)
+ ACE_OFF_T pos)
: shared_memory_ (file_name, len, flags, mode,
prot, share, addr, pos)
{
diff --git a/ace/Shared_Memory_MM.h b/ace/Shared_Memory_MM.h
index 5a8bd83eed1..ff0d066120d 100644
--- a/ace/Shared_Memory_MM.h
+++ b/ace/Shared_Memory_MM.h
@@ -47,7 +47,7 @@ public:
int prot = PROT_RDWR,
int share = ACE_MAP_PRIVATE,
char *addr = 0,
- off_t pos = 0);
+ ACE_OFF_T pos = 0);
/// Constructor.
ACE_Shared_Memory_MM (const ACE_TCHAR *file_name,
@@ -56,7 +56,7 @@ public:
int mode = ACE_DEFAULT_FILE_PERMS,
int prot = PROT_RDWR,
int share = ACE_MAP_SHARED,
- char *addr = 0, off_t pos = 0);
+ char *addr = 0, ACE_OFF_T pos = 0);
/// Open method.
int open (ACE_HANDLE handle,
@@ -64,7 +64,7 @@ public:
int prot = PROT_RDWR,
int share = ACE_MAP_PRIVATE,
char *addr = 0,
- off_t pos = 0);
+ ACE_OFF_T pos = 0);
/// Open method.
int open (const ACE_TCHAR *file_name,
@@ -74,7 +74,7 @@ public:
int prot = PROT_RDWR,
int share = ACE_MAP_SHARED,
char *addr = 0,
- off_t pos = 0);
+ ACE_OFF_T pos = 0);
/// Return the name of file that is mapped (if any).
const ACE_TCHAR *filename (void) const;
diff --git a/ace/Shared_Memory_MM.inl b/ace/Shared_Memory_MM.inl
index 96d865b667b..6d1e653cc17 100644
--- a/ace/Shared_Memory_MM.inl
+++ b/ace/Shared_Memory_MM.inl
@@ -18,7 +18,7 @@ ACE_Shared_Memory_MM::open (ACE_HANDLE handle,
int prot,
int share,
char *addr,
- off_t pos)
+ ACE_OFF_T pos)
{
ACE_TRACE ("ACE_Shared_Memory_MM::open");
return shared_memory_.map (handle, length, prot, share, addr, pos);
@@ -32,7 +32,7 @@ ACE_Shared_Memory_MM::open (const ACE_TCHAR *file_name,
int prot,
int share,
char *addr,
- off_t pos)
+ ACE_OFF_T pos)
{
ACE_TRACE ("ACE_Shared_Memory_MM::open");
return shared_memory_.map (file_name, len, flags, mode,
diff --git a/ace/Shared_Memory_Pool.cpp b/ace/Shared_Memory_Pool.cpp
index c61334485b7..007f1c73ab5 100644
--- a/ace/Shared_Memory_Pool.cpp
+++ b/ace/Shared_Memory_Pool.cpp
@@ -13,11 +13,12 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_Pool)
-ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options (const char *base_addr,
- size_t max_segments,
- size_t file_perms,
- off_t minimum_bytes,
- size_t segment_size)
+ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options (
+ const char *base_addr,
+ size_t max_segments,
+ size_t file_perms,
+ ACE_OFF_T minimum_bytes,
+ size_t segment_size)
: base_addr_ (base_addr),
max_segments_ (max_segments),
minimum_bytes_ (minimum_bytes),
@@ -36,7 +37,7 @@ ACE_Shared_Memory_Pool::dump (void) const
}
int
-ACE_Shared_Memory_Pool::in_use (off_t &offset,
+ACE_Shared_Memory_Pool::in_use (ACE_OFF_T &offset,
size_t &counter)
{
offset = 0;
@@ -61,7 +62,7 @@ ACE_Shared_Memory_Pool::in_use (off_t &offset,
int
ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr,
- off_t &offset,
+ ACE_OFF_T &offset,
size_t &counter)
{
offset = 0;
@@ -97,7 +98,7 @@ ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr,
int
ACE_Shared_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
- off_t &offset)
+ ACE_OFF_T &offset)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::commit_backing_store_name");
@@ -155,7 +156,7 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
// it does not define SEGV_MAPERR.
#if defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR) && \
(defined (SEGV_MAPERR) || defined (SEGV_MEMERR))
- off_t offset;
+ ACE_OFF_T offset;
// Make sure that the pointer causing the problem is within the
// range of the backing store.
@@ -224,8 +225,9 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
return 0;
}
-ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (const ACE_TCHAR *backing_store_name,
- const OPTIONS *options)
+ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (
+ const ACE_TCHAR *backing_store_name,
+ const OPTIONS *options)
: base_addr_ (0),
file_perms_ (ACE_DEFAULT_FILE_PERMS),
max_segments_ (ACE_DEFAULT_MAX_SEGMENTS),
@@ -293,7 +295,7 @@ ACE_Shared_Memory_Pool::acquire (size_t nbytes,
// ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%P|%t) acquiring more chunks, nbytes = %d, rounded_bytes = %d\n"), nbytes, rounded_bytes));
- off_t offset;
+ ACE_OFF_T offset;
if (this->commit_backing_store_name (rounded_bytes, offset) == -1)
return 0;
@@ -311,7 +313,7 @@ ACE_Shared_Memory_Pool::init_acquire (size_t nbytes,
{
ACE_TRACE ("ACE_Shared_Memory_Pool::init_acquire");
- off_t shm_table_offset = ACE::round_to_pagesize (sizeof (SHM_TABLE));
+ ACE_OFF_T shm_table_offset = ACE::round_to_pagesize (sizeof (SHM_TABLE));
rounded_bytes = this->round_up (nbytes > (size_t) this->minimum_bytes_
? nbytes
: (size_t) this->minimum_bytes_);
diff --git a/ace/Shared_Memory_Pool.h b/ace/Shared_Memory_Pool.h
index 2803d3c0d6b..a54ef63da58 100644
--- a/ace/Shared_Memory_Pool.h
+++ b/ace/Shared_Memory_Pool.h
@@ -43,11 +43,12 @@ class ACE_Export ACE_Shared_Memory_Pool_Options
{
public:
/// Initialization method.
- ACE_Shared_Memory_Pool_Options (const char *base_addr = ACE_DEFAULT_BASE_ADDR,
- size_t max_segments = ACE_DEFAULT_MAX_SEGMENTS,
- size_t file_perms = ACE_DEFAULT_FILE_PERMS,
- off_t minimum_bytes = 0,
- size_t segment_size = ACE_DEFAULT_SEGMENT_SIZE);
+ ACE_Shared_Memory_Pool_Options (
+ const char *base_addr = ACE_DEFAULT_BASE_ADDR,
+ size_t max_segments = ACE_DEFAULT_MAX_SEGMENTS,
+ size_t file_perms = ACE_DEFAULT_FILE_PERMS,
+ ACE_OFF_T minimum_bytes = 0,
+ size_t segment_size = ACE_DEFAULT_SEGMENT_SIZE);
/// Base address of the memory-mapped backing store.
const char *base_addr_;
@@ -56,7 +57,7 @@ public:
size_t max_segments_;
/// What the minimum bytes of the initial segment should be.
- off_t minimum_bytes_;
+ ACE_OFF_T minimum_bytes_;
/// File permissions to use when creating/opening a segment.
size_t file_perms_;
@@ -145,7 +146,7 @@ protected:
* the backing store.
*/
virtual int commit_backing_store_name (size_t rounded_bytes,
- off_t &offset);
+ ACE_OFF_T &offset);
/// Keeps track of all the segments being used.
struct SHM_TABLE
@@ -175,7 +176,7 @@ protected:
size_t max_segments_;
/// What the minimim bytes of the initial segment should be.
- off_t minimum_bytes_;
+ ACE_OFF_T minimum_bytes_;
/// Shared memory segment size.
size_t segment_size_;
@@ -185,11 +186,11 @@ protected:
/// Find the segment that contains the @a searchPtr
virtual int find_seg (const void *const searchPtr,
- off_t &offset,
+ ACE_OFF_T &offset,
size_t &counter);
/// Determine how much memory is currently in use.
- virtual int in_use (off_t &offset,
+ virtual int in_use (ACE_OFF_T &offset,
size_t &counter);
/// Handles SIGSEGV.
diff --git a/ace/Truncate.h b/ace/Truncate.h
index a45af94a21a..901e36823de 100644
--- a/ace/Truncate.h
+++ b/ace/Truncate.h
@@ -491,37 +491,14 @@ namespace ACE_Utils
template<typename FROM, typename TO> struct Truncator;
- // Partial specialization for the case where the types are the same.
- // No truncation is necessary.
- template<typename T>
- struct Truncator<T, T>
- {
- static T trunc (T val)
- {
- return val;
- }
- };
-
//----------------------------------------------------------
// sizeof(FROM) > sizeof(TO)
//----------------------------------------------------------
template<>
- struct ACE_Export Truncator<ACE_INT32, ACE_INT8>
- {
- static ACE_INT8 trunc (ACE_INT32 val)
- {
- return
- (val > ACE_Numeric_Limits<ACE_INT8>::max ()
- ? ACE_Numeric_Limits<ACE_INT8>::max ()
- : static_cast<ACE_INT8> (val));
- }
- };
-
- template<>
- struct ACE_Export Truncator<ACE_UINT32, ACE_UINT8>
+ struct Truncator<ACE_INT32, ACE_INT8>
{
- static ACE_UINT8 truncate (ACE_UINT32 val)
+ ACE_INT8 operator() (ACE_INT32 val)
{
return
(val > ACE_Numeric_Limits<ACE_INT8>::max ()
@@ -531,9 +508,9 @@ namespace ACE_Utils
};
template<>
- struct ACE_Export Truncator<ACE_UINT32, ACE_UINT8>
+ struct Truncator<ACE_UINT32, ACE_UINT8>
{
- static ACE_UINT8 trunc (ACE_UINT32 val)
+ ACE_UINT8 operator() (ACE_UINT32 val)
{
return
(val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_UINT8>::max ())
@@ -543,9 +520,9 @@ namespace ACE_Utils
};
template<>
- struct ACE_Export Truncator<ACE_INT32, ACE_UINT8>
+ struct Truncator<ACE_INT32, ACE_UINT8>
{
- static ACE_UINT8 trunc (ACE_INT32 val)
+ ACE_UINT8 operator() (ACE_INT32 val)
{
return
(val > static_cast<ACE_INT32> (ACE_Numeric_Limits<ACE_UINT8>::max ())
@@ -555,9 +532,9 @@ namespace ACE_Utils
};
template<>
- struct ACE_Export Truncator<ACE_UINT32, ACE_INT8>
+ struct Truncator<ACE_UINT32, ACE_INT8>
{
- static ACE_INT8 trunc (ACE_UINT32 val)
+ ACE_INT8 operator() (ACE_UINT32 val)
{
return
(val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_INT8>::max ())
@@ -567,9 +544,9 @@ namespace ACE_Utils
};
template<>
- struct ACE_Export Truncator<ACE_INT64, ACE_INT32>
+ struct Truncator<ACE_INT64, ACE_INT32>
{
- static ACE_INT32 trunc (ACE_INT64 val)
+ ACE_INT32 operator() (ACE_INT64 val)
{
return
(val > ACE_Numeric_Limits<ACE_INT32>::max ()
@@ -579,9 +556,9 @@ namespace ACE_Utils
};
template<>
- struct ACE_Export Truncator<ACE_INT64, ACE_UINT32>
+ struct Truncator<ACE_INT64, ACE_UINT32>
{
- static ACE_UINT32 trunc (ACE_INT64 val)
+ ACE_UINT32 operator() (ACE_INT64 val)
{
return
(val > static_cast<ACE_INT64> (ACE_Numeric_Limits<ACE_UINT32>::max ())
@@ -591,10 +568,11 @@ namespace ACE_Utils
};
template<>
- struct ACE_Export Truncator<ACE_UINT64, ACE_UINT32>
+ struct Truncator<ACE_UINT64, ACE_UINT32>
{
- static ACE_UINT32 trunc (ACE_UINT64 val)
+ ACE_UINT32 operator() (ACE_UINT64 val)
{
+ return
(val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_UINT32>::max ())
? ACE_Numeric_Limits<ACE_UINT32>::max ()
: static_cast<ACE_UINT32> (val));
@@ -602,9 +580,9 @@ namespace ACE_Utils
};
template<>
- struct ACE_Export Truncator<ACE_UINT64, ACE_INT32>
+ struct Truncator<ACE_UINT64, ACE_INT32>
{
- static ACE_INT32 trunc (ACE_UINT64 val)
+ ACE_INT32 operator() (ACE_UINT64 val)
{
return
(val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_INT32>::max ())
@@ -618,18 +596,18 @@ namespace ACE_Utils
//----------------------------------------------------------
template<>
- struct ACE_Export Truncator<ACE_INT32, ACE_UINT32>
+ struct Truncator<ACE_INT32, ACE_UINT32>
{
- static ACE_UINT32 trunc (ACE_INT32 val)
+ ACE_UINT32 operator() (ACE_INT32 val)
{
return static_cast<ACE_UINT32> (val);
}
};
template<>
- struct ACE_Export Truncator<ACE_UINT32, ACE_INT32>
+ struct Truncator<ACE_UINT32, ACE_INT32>
{
- static ACE_INT32 trunc (ACE_UINT32 val)
+ ACE_INT32 operator() (ACE_UINT32 val)
{
return
(val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_INT32>::max ())
@@ -639,18 +617,18 @@ namespace ACE_Utils
};
template<>
- struct ACE_Export Truncator<ACE_INT64, ACE_UINT64>
+ struct Truncator<ACE_INT64, ACE_UINT64>
{
- static ACE_UINT64 trunc (ACE_INT64 val)
+ ACE_UINT64 operator() (ACE_INT64 val)
{
return static_cast<ACE_UINT64> (val);
}
};
template<>
- struct ACE_Export Truncator<ACE_UINT64, ACE_INT64>
+ struct Truncator<ACE_UINT64, ACE_INT64>
{
- static ACE_INT64 trunc (ACE_UINT64 val)
+ ACE_INT64 operator() (ACE_UINT64 val)
{
return
(val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_INT64>::max ())
@@ -664,82 +642,95 @@ namespace ACE_Utils
//----------------------------------------------------------
template<>
- struct ACE_Export Truncator<ACE_INT8, ACE_INT32>
+ struct Truncator<ACE_INT8, ACE_INT32>
{
- static ACE_INT32 trunc (ACE_INT8 val)
+ ACE_INT32 operator() (ACE_INT8 val)
{
return static_cast<ACE_INT32> (val);
}
};
template<>
- struct ACE_Export Truncator<ACE_UINT8, ACE_UINT32>
+ struct Truncator<ACE_UINT8, ACE_UINT32>
{
- static ACE_UINT32 trunc (ACE_UINT8 val)
+ ACE_UINT32 operator() (ACE_UINT8 val)
{
return static_cast<ACE_UINT32> (val);
}
};
template<>
- struct ACE_Export Truncator<ACE_UINT8, ACE_INT32>
+ struct Truncator<ACE_UINT8, ACE_INT32>
{
- static ACE_INT32 trunc (ACE_UINT8 val)
+ ACE_INT32 operator() (ACE_UINT8 val)
{
return static_cast<ACE_INT32> (val);
}
};
template<>
- struct ACE_Export Truncator<ACE_INT8, ACE_UINT32>
+ struct Truncator<ACE_INT8, ACE_UINT32>
{
- static ACE_UINT32 trunc (ACE_INT8 val)
+ ACE_UINT32 operator() (ACE_INT8 val)
{
return static_cast<ACE_UINT32> (val);
}
};
template<>
- struct ACE_Export Truncator<ACE_INT32, ACE_INT64>
+ struct Truncator<ACE_INT32, ACE_INT64>
{
- static ACE_INT64 trunc (ACE_INT32 val)
+ ACE_INT64 operator() (ACE_INT32 val)
{
return static_cast<ACE_INT64> (val);
}
};
template<>
- struct ACE_Export Truncator<ACE_INT32, ACE_UINT64>
+ struct Truncator<ACE_INT32, ACE_UINT64>
{
- static ACE_UINT64 trunc (ACE_INT32 val)
+ ACE_UINT64 operator() (ACE_INT32 val)
{
return static_cast<ACE_UINT64> (val);
}
};
template<>
- struct ACE_Export Truncator<ACE_UINT32, ACE_UINT64>
+ struct Truncator<ACE_UINT32, ACE_UINT64>
{
- static ACE_UINT64 trunc (ACE_UINT32 val)
+ ACE_UINT64 operator() (ACE_UINT32 val)
{
return static_cast<ACE_UINT64> (val);
}
};
template<>
- struct ACE_Export Truncator<ACE_UINT32, ACE_INT64>
+ struct Truncator<ACE_UINT32, ACE_INT64>
{
- static ACE_INT64 trunc (ACE_UINT32 val)
+ ACE_INT64 operator() (ACE_UINT32 val)
{
return static_cast<ACE_INT64> (val);
}
};
+ // Partial specialization for the case where the types are the same.
+ // No truncation is necessary.
+ template<typename T>
+ struct Truncator<T, T>
+ {
+ T operator() (T val)
+ {
+ return val;
+ }
+ };
+
// -------------------------------------
template<typename TO, typename FROM>
inline TO Truncate (FROM val)
{
- return Truncator<FROM, TO>::trunc (val);
+ typedef Truncator<FROM, TO> truncator;
+
+ return truncator() (val);
}
#endif /* !__BORLANDC__ || __BORLANDC__ > 0x582 */
diff --git a/ace/config-lynxos.h b/ace/config-lynxos.h
index 703419ca8a5..739ecee49c8 100644
--- a/ace/config-lynxos.h
+++ b/ace/config-lynxos.h
@@ -15,8 +15,13 @@
# include "ace/config-g++-common.h"
#endif /* __GNUG__ */
-#define ACE_NEEDS_IPC_1C_H
+// Compile using multi-thread libraries.
+#if !defined (ACE_MT_SAFE)
+# define ACE_MT_SAFE 1
+# define _REENTRANT
+#endif
+#include "ace/config-posix.h"
#if defined (__x86__)
# define ACE_HAS_PENTIUM
@@ -56,12 +61,10 @@
#define ACE_HAS_NONCONST_SETRLIMIT
#define ACE_HAS_NONCONST_WRITEV
#define ACE_HAS_POSIX_NONBLOCK
-#define ACE_HAS_POSIX_REALTIME_SIGNALS
#define ACE_HAS_POSIX_TIME
#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
#define ACE_HAS_SCANDIR
#define ACE_HAS_SEMUN
-#define ACE_HAS_SHM_OPEN
#define ACE_HAS_SIGINFO_T
#define ACE_HAS_SIGWAIT
#define ACE_HAS_SIG_ATOMIC_T
@@ -101,20 +104,13 @@
#define ACE_LACKS_USECONDS_T
#define ACE_LACKS_WCHAR_H
#define ACE_MALLOC_ALIGN 8
+#define ACE_NEEDS_IPC_1C_H
#define ACE_PAGE_SIZE 4096
#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR
-// Compile using multi-thread libraries.
-#if !defined (ACE_MT_SAFE)
-# define ACE_MT_SAFE 1
-# define _REENTRANT
-#endif
-
#if ACE_MT_SAFE == 1
// Platform supports threads.
# define ACE_HAS_PTHREADS
-# define ACE_HAS_PTHREADS_STD
-# define ACE_HAS_THREADS
# define ACE_HAS_THREAD_SPECIFIC_STORAGE
# define ACE_LACKS_NULL_PTHREAD_STATUS
# define ACE_LACKS_SETDETACH
@@ -122,7 +118,6 @@
# define ACE_LACKS_THREAD_STACK_ADDR
#endif /* ACE_MT_SAFE */
-#define ACE_HAS_AIO_CALLS
#define ACE_POSIX_AIOCB_PROACTOR
// AIOCB Proactor works on Lynx. But it is not multi-threaded.
// Lynx OS 3.0.0 lacks POSIX call <pthread_sigmask>. So,we cannot use
@@ -145,7 +140,6 @@
// System include files are not in sys/, this gets rid of warning.
#define __NO_INCLUDE_WARN__
-#define ACE_HAS_POSIX_SEM
// "changes signedness" error (OS.i and many other files)
#define ACE_HAS_SOCKLEN_T
// LSOCK.cpp uses a macro from param.h, not included
diff --git a/ace/config-posix.h b/ace/config-posix.h
index 81b11be381f..42656c9989e 100644
--- a/ace/config-posix.h
+++ b/ace/config-posix.h
@@ -33,12 +33,6 @@
# endif /* ACE_HAS_POSIX_SEM */
#endif /* ACE_HAS_POSIX_SEM */
-#if defined(_POSIX_MESSAGE_PASSING) && (_POSIX_MESSAGE_PASSING-0 != -1 )
-# if !defined(ACE_HAS_POSIX_MESSAGE_PASSING)
-# define ACE_HAS_POSIX_MESSAGE_PASSING
-# endif /* ACE_HAS_POSIX_MESSAGE_PASSING */
-#endif /* _POSIX_MESSAGE_PASSING */
-
#if defined(_POSIX_SHARED_MEMORY_OBJECTS) && (_POSIX_SHARED_MEMORY_OBJECTS-0 != -1 )
# if !defined(ACE_HAS_SHM_OPEN)
# define ACE_HAS_SHM_OPEN
@@ -81,4 +75,3 @@
#endif /* _XOPEN_SOURCE */
#endif /* ACE_CONFIG_POSIX_H */
-
diff --git a/ace/config-rtems.h b/ace/config-rtems.h
index 98c1dab9e1e..657e7b771d8 100644
--- a/ace/config-rtems.h
+++ b/ace/config-rtems.h
@@ -63,6 +63,7 @@
#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS
#define ACE_LACKS_REALPATH
#define ACE_LACKS_TEMPNAM
+#define ACE_LACKS_INTPTR_T
// Temporarily, enabling this results in compile errors with
// rtems 4.6.6.
@@ -167,7 +168,6 @@
# define ACE_LACKS_PROTOENT
# define ACE_LACKS_SERVENT
# define ACE_LACKS_IFREQ
-# define ACE_LACKS_INTPTR_T
// Missing methods
# define ACE_LACKS_GETHOSTBYADDR
diff --git a/ace/config-vxworks5.x.h b/ace/config-vxworks5.x.h
index 469c1cacfc6..df5faa15189 100644
--- a/ace/config-vxworks5.x.h
+++ b/ace/config-vxworks5.x.h
@@ -200,6 +200,7 @@
#define ACE_LACKS_DUP
#define ACE_LACKS_SUSECONDS_T
#define ACE_LACKS_USECONDS_T
+#define ACE_LACKS_INTPTR_T
#define ACE_PAGE_SIZE 4096
#define ACE_THR_PRI_FIFO_DEF 101
#define ACE_THR_PRI_OTHER_DEF ACE_THR_PRI_FIFO_DEF
diff --git a/ace/os_include/os_unistd.h b/ace/os_include/os_unistd.h
index 687557bfe26..828c45b5cd4 100644
--- a/ace/os_include/os_unistd.h
+++ b/ace/os_include/os_unistd.h
@@ -100,14 +100,14 @@ extern "C"
// It seems that _XOPEN_SOURCE == 500 means that the prototypes are
// already defined in the system headers.
ssize_t pread (int fd,
- void *buf,
- size_t nbytes,
- off_t offset);
+ void *buf,
+ size_t nbytes,
+ ACE_OFF_T offset);
ssize_t pwrite (int fd,
- const void *buf,
- size_t n,
- off_t offset);
+ const void *buf,
+ size_t n,
+ ACE_OFF_T offset);
#endif /* ACE_LACKS_PREAD_PROTOTYPE && (_XOPEN_SOURCE - 0) < 500 */
#if defined (ACE_LACKS_GETPGID_PROTOTYPE) && \
diff --git a/ace/os_include/sys/os_stat.h b/ace/os_include/sys/os_stat.h
index 0c4a703f5f2..a7c69dc36d4 100644
--- a/ace/os_include/sys/os_stat.h
+++ b/ace/os_include/sys/os_stat.h
@@ -111,7 +111,7 @@ extern "C"
ACE_Time_Value st_ctime;
/// file size, in bytes
- off_t st_size;
+ ACE_OFF_T st_size;
// Following members do not have direct conversion in Window platforms.
//u_long st_blksize; // optimal blocksize for I/O
diff --git a/ace/os_include/sys/os_types.h b/ace/os_include/sys/os_types.h
index 737f53322ca..dbf1cfa412f 100644
--- a/ace/os_include/sys/os_types.h
+++ b/ace/os_include/sys/os_types.h
@@ -72,6 +72,12 @@ typedef double ACE_timer_t;
typedef unsigned int dev_t;
#endif /* ACE_HAS_WINCE */
+#if defined(ACE_WIN32) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS==64)
+ typedef __int64 ACE_OFF_T;
+#else
+ typedef off_t ACE_OFF_T;
+#endif
+
#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8
typedef off_t ACE_LOFF_T;
#elif defined (ACE_HAS_RTEMS) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || \
diff --git a/bin/MakeProjectCreator/config/tc.mpb b/bin/MakeProjectCreator/config/tc.mpb
index fc9efc8b653..34ac31dff72 100644
--- a/bin/MakeProjectCreator/config/tc.mpb
+++ b/bin/MakeProjectCreator/config/tc.mpb
@@ -5,3 +5,10 @@ project {
after += TC
libs += TAO_TC
}
+// -*- MPC -*-
+// $Id$
+
+project {
+ after += TC
+ libs += TAO_TC
+}
diff --git a/bin/tao_other_tests.lst b/bin/tao_other_tests.lst
index 15782c52570..20a09a01833 100644
--- a/bin/tao_other_tests.lst
+++ b/bin/tao_other_tests.lst
@@ -87,6 +87,7 @@ TAO/orbsvcs/tests/Redundant_Naming/run_test.pl: !ST !SUNCC5_1 !MINIMUM !ACE_FOR_
TAO/orbsvcs/tests/Trading/run_test.pl: !MINIMUM !SUNCC5_1
TAO/orbsvcs/tests/Event/Basic/run_test.pl: !ST !MINIMUM !ACE_FOR_TAO
TAO/orbsvcs/tests/Event/Performance/run_test.pl: !ST !MINIMUM !ACE_FOR_TAO
+TAO/orbsvcs/tests/Event/UDP/run_test.pl: !MINIMUM !ACE_FOR_TAO !NO_DIOP
TAO/orbsvcs/tests/EC_Custom_Marshal/run_test.pl: !ST !MINIMUM !ACE_FOR_TAO !DISABLE_ToFix_LynxOS_x86
TAO/orbsvcs/tests/EC_Throughput/run_test.pl: !ST !MINIMUM !DISABLE_ToFix_LynxOS_x86 !ACE_FOR_TAO
TAO/orbsvcs/tests/EC_MT_Mcast/run_test.pl:!ST !MINIMUM !ACE_FOR_TAO
diff --git a/examples/IPC_SAP/FILE_SAP/client.cpp b/examples/IPC_SAP/FILE_SAP/client.cpp
index f26302f3b57..7c2402f0b3e 100644
--- a/examples/IPC_SAP/FILE_SAP/client.cpp
+++ b/examples/IPC_SAP/FILE_SAP/client.cpp
@@ -55,7 +55,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
static_cast<u_long > (fileinfo.nlink_),
(u_long) fileinfo.size_);
- off_t fpos = cli_file.tell ();
+ ACE_OFF_T fpos = cli_file.tell ();
if (fpos == -1)
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/examples/Web_Crawler/Iterators.cpp b/examples/Web_Crawler/Iterators.cpp
index 98b4f999622..232042cb835 100644
--- a/examples/Web_Crawler/Iterators.cpp
+++ b/examples/Web_Crawler/Iterators.cpp
@@ -46,7 +46,7 @@ HTML_Body_Iterator::next (ACE_CString &url)
if ( href_index > 0)
{
// Get back to buffer start location.
- this->url_.stream ().seek (-1 * static_cast<off_t> (len),
+ this->url_.stream ().seek (-1 * static_cast<ACE_OFF_T> (len),
SEEK_CUR);
int start_index = buffer.find ('\"',
diff --git a/examples/Web_Crawler/Mem_Map_Stream.cpp b/examples/Web_Crawler/Mem_Map_Stream.cpp
index dda1d465a71..26422e07dd3 100644
--- a/examples/Web_Crawler/Mem_Map_Stream.cpp
+++ b/examples/Web_Crawler/Mem_Map_Stream.cpp
@@ -70,7 +70,7 @@ Mem_Map_Stream::recv (size_t &len)
const char *s = this->recv_pos_;
- off_t olen = static_cast <off_t> (len);
+ ACE_OFF_T olen = static_cast <ACE_OFF_T> (len);
this->seek (olen, SEEK_CUR);
len = this->get_pos_ - s;
return s;
@@ -94,8 +94,8 @@ Mem_Map_Stream::peek_str (size_t offset,
return &this->get_pos_[offset];
}
-off_t
-Mem_Map_Stream::seek (off_t offset, int whence)
+ACE_OFF_T
+Mem_Map_Stream::seek (ACE_OFF_T offset, int whence)
{
switch (whence)
{
@@ -120,7 +120,7 @@ Mem_Map_Stream::seek (off_t offset, int whence)
// Make sure that the backing store will cover this.
while (this->get_pos_ > this->end_of_mapping_plus1_)
if (this->grow_file_and_remap () == -1)
- return (off_t) -1;
+ return (ACE_OFF_T) -1;
this->recv_pos_ = this->get_pos_;
return this->recv_pos_ - reinterpret_cast<char *> (this->mem_map_.addr ());
diff --git a/examples/Web_Crawler/Mem_Map_Stream.h b/examples/Web_Crawler/Mem_Map_Stream.h
index 3595f04ab77..b7aa58c85f0 100644
--- a/examples/Web_Crawler/Mem_Map_Stream.h
+++ b/examples/Web_Crawler/Mem_Map_Stream.h
@@ -124,7 +124,7 @@ public:
// store if necessary. Returns 0 if <offset> or <offset + size> is
// past the end of the stream.
- virtual off_t seek (off_t offset, int whence = SEEK_CUR);
+ virtual ACE_OFF_T seek (ACE_OFF_T offset, int whence = SEEK_CUR);
// Sets the <get> and <recv> positions as follows:
// o If <whence> is <SEEK_SET>, the positions are set to <offset>
// bytes from the start of the stream.
diff --git a/tests/Integer_Truncate_Test.cpp b/tests/Integer_Truncate_Test.cpp
new file mode 100755
index 00000000000..f9c60764bca
--- /dev/null
+++ b/tests/Integer_Truncate_Test.cpp
@@ -0,0 +1,377 @@
+// ============================================================================
+/**
+ * @file Integer_Truncate_Test.cpp
+ *
+ * $Id$
+ *
+ * Test @c ACE_Utils::Truncate<> function template.
+ *
+ * @author Ossama Othman <ossama_othman at symantec dot com>
+ */
+// ============================================================================
+
+#include "test_config.h"
+
+#include <ace/Truncate.h>
+#include <ace/Numeric_Limits.h>
+
+#include <algorithm>
+#include <functional>
+
+using namespace ACE_Utils;
+
+// ----------------------------------------------------
+
+bool
+sizeof_from_lt_sizeof_to (void)
+{
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("Running sizeof(FROM) < sizeof(TO) test\n")));
+
+ bool success = true;
+
+ // signed from_type, unsigned to_type
+ {
+ typedef signed char from_type;
+ typedef unsigned int to_type;
+
+ ACE_ASSERT (sizeof (from_type) < sizeof (to_type));
+
+ from_type f =
+ ACE_Numeric_Limits<from_type>::max (); // Should not be truncated.
+
+ if (Truncate<to_type> (f) != static_cast<to_type> (f))
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tsigned from_type / unsigned to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ // unsigned from_type, signed to_type
+ {
+ typedef unsigned char from_type;
+ typedef signed int to_type;
+
+ ACE_ASSERT (sizeof (from_type) < sizeof (to_type));
+
+ from_type f =
+ ACE_Numeric_Limits<from_type>::max (); // Should not be truncated.
+
+ if (Truncate<to_type> (f) != static_cast<to_type> (f))
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tunsigned from_type / signed to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ // signed from_type, signed to_type
+ {
+ typedef signed char from_type;
+ typedef signed int to_type;
+
+ ACE_ASSERT (sizeof (from_type) < sizeof (to_type));
+
+ from_type f1 = -1; // Should not be truncated.
+ from_type f2 =
+ ACE_Numeric_Limits<from_type>::max (); // Should not be truncated.
+
+ if (Truncate<to_type> (f1) != f1
+ || Truncate<to_type> (f2) != f2)
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tsigned from_type / signed to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ // unsigned from_type, unsigned to_type
+ {
+ typedef unsigned char from_type;
+ typedef unsigned int to_type;
+
+ ACE_ASSERT (sizeof (from_type) < sizeof (to_type));
+
+ from_type f =
+ ACE_Numeric_Limits<from_type>::max (); // Should not be truncated.
+
+ if (Truncate<to_type> (f) != static_cast<to_type> (f))
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tunsigned from_type / unsigned to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("\t%s\n"),
+ success
+ ? ACE_TEXT ("PASSED")
+ : ACE_TEXT ("FAILED")));
+
+ return success;
+}
+
+bool
+sizeof_from_eq_sizeof_to (void)
+{
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("Running sizeof(FROM) == sizeof(TO) test\n")));
+
+ bool success = true;
+
+ // signed from_type, unsigned to_type
+ {
+ typedef signed int from_type;
+ typedef unsigned int to_type;
+
+ ACE_ASSERT (sizeof (from_type) == sizeof (to_type));
+
+ from_type f1 = -1; // Should not be truncated.
+ from_type f2 =
+ ACE_Numeric_Limits<from_type>::max (); // Should not be truncated.
+
+ if (static_cast<from_type> (Truncate<to_type> (f1)) != f1
+ || static_cast<from_type> (Truncate<to_type> (f2)) != f2)
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tsigned from_type / unsigned to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ // unsigned from_type, signed to_type
+ {
+ typedef unsigned int from_type;
+ typedef signed int to_type;
+
+ ACE_ASSERT (sizeof (from_type) == sizeof (to_type));
+
+ from_type f =
+ ACE_Numeric_Limits<from_type>::max (); // Should be truncated.
+
+ if (Truncate<to_type> (f) != ACE_Numeric_Limits<to_type>::max ())
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tunsigned from_type / signed to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ // signed from_type, signed to_type
+ {
+ typedef signed int from_type;
+ typedef signed int to_type;
+
+ ACE_ASSERT (sizeof (from_type) == sizeof (to_type));
+
+ from_type f1 = -1; // Should not be truncated.
+ from_type f2 =
+ ACE_Numeric_Limits<from_type>::max (); // Should not be truncated.
+
+ if (Truncate<to_type> (f1) != f1
+ || Truncate<to_type> (f2) != f2)
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tsigned from_type / signed to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ // unsigned from_type, unsigned to_type
+ {
+ typedef unsigned int from_type;
+ typedef unsigned int to_type;
+
+ ACE_ASSERT (sizeof (from_type) == sizeof (to_type));
+
+ from_type f =
+ ACE_Numeric_Limits<from_type>::max (); // Should not be truncated.
+
+ if (Truncate<to_type> (f) != f)
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tunsigned from_type / unsigned to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("\t%s\n"),
+ success
+ ? ACE_TEXT ("PASSED")
+ : ACE_TEXT ("FAILED")));
+
+ return success;
+}
+
+bool
+sizeof_from_gt_sizeof_to (void)
+{
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("Running sizeof(FROM) > sizeof(TO) test\n")));
+
+ bool success = true;
+
+ // signed from_type, unsigned to_type
+ {
+ typedef signed int from_type;
+ typedef unsigned char to_type;
+
+ ACE_ASSERT (sizeof (from_type) > sizeof (to_type));
+
+ from_type f =
+ ACE_Numeric_Limits<from_type>::max (); // Should be truncated.
+
+ if (Truncate<to_type> (f) != ACE_Numeric_Limits<to_type>::max ())
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tsigned from_type / unsigned to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ // unsigned from_type, signed to_type
+ {
+ typedef unsigned int from_type;
+ typedef signed char to_type;
+
+ ACE_ASSERT (sizeof (from_type) > sizeof (to_type));
+
+ from_type f =
+ ACE_Numeric_Limits<from_type>::max (); // Should be truncated.
+
+ if (Truncate<to_type> (f) != ACE_Numeric_Limits<to_type>::max ())
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tunsigned from_type / signed to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ // signed from_type, signed to_type
+ {
+ typedef signed int from_type;
+ typedef signed char to_type;
+
+ ACE_ASSERT (sizeof (from_type) > sizeof (to_type));
+
+ from_type f1 = -1; // Should not be truncated.
+ from_type f2 =
+ ACE_Numeric_Limits<from_type>::max (); // Should be truncated.
+
+ if (Truncate<to_type> (f1) != f1
+ || Truncate<to_type> (f2) != ACE_Numeric_Limits<to_type>::max ())
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tsigned from_type / signed to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ // unsigned from_type, unsigned to_type
+ {
+ typedef unsigned int from_type;
+ typedef unsigned char to_type;
+
+ ACE_ASSERT (sizeof (from_type) > sizeof (to_type));
+
+ from_type f =
+ ACE_Numeric_Limits<from_type>::max (); // Should be truncated.
+
+ if (Truncate<to_type> (f) != ACE_Numeric_Limits<to_type>::max ())
+ {
+ success = false;
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\tunsigned from_type / unsigned to_type ")
+ ACE_TEXT ("truncation test failed")));
+ }
+ }
+
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("\t%s\n"),
+ success
+ ? ACE_TEXT ("PASSED")
+ : ACE_TEXT ("FAILED")));
+
+ return success;
+}
+
+// ----------------------------------------------------
+
+/**
+ * @struct Caller
+ *
+ * @brief Test method invocation functor.
+ *
+ * Test method invocation functor.
+ */
+template <typename T>
+struct Caller : public std::unary_function<T, void>
+{
+ /// Constructor
+ Caller (void) : success (true) {}
+
+ /// Function call operator overload.
+ void operator() (T f)
+ {
+ if (!f ())
+ success = false;
+ }
+
+ /// Flag that indicates success of all tests.
+ bool success;
+};
+
+// ----------------------------------------------------
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT ("Integer_Truncate_Test"));
+
+ typedef bool (*test_func) ();
+
+ static test_func const tests[] =
+ {
+ sizeof_from_lt_sizeof_to
+ , sizeof_from_eq_sizeof_to
+ , sizeof_from_gt_sizeof_to
+ };
+
+ static size_t const test_count = sizeof (tests) / sizeof (tests[0]);
+
+ // Have some fun with the STL. :-)
+ Caller<test_func> c =
+ std::for_each (tests,
+ tests + test_count,
+ Caller<test_func> ());
+
+ ACE_END_TEST;
+
+ return c.success ? 0 : -1;
+}