diff options
149 files changed, 2887 insertions, 11131 deletions
diff --git a/ChangeLog b/ChangeLog index 6a3df8f755a..dd31daa2877 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,93 +1,3 @@ -Fri Sep 24 12:39:31 2004 Carlos O'Ryan <coryan@atdesk.com> - - * build/Linux/include/makeinclude/platform_linux.GNU: - Provide reasonable defaults for Boost.Test - - * bin/MakeProjectCreator/config/boost_unit_test.mpb: - Different sites may have different configurations for boost, - made the options needed to compile with it configurable via the - platform_macros.GNU file. - -Fri Sep 24 10:21:38 2004 Jeff Parsons <j.parsons@vanderbilt.edu> - - * performance-tests/Server_Concurrrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp: - - Replaced ACE_UINT64_DBLCAST_ADAPTER, which doesn't satisfy - the stricter MSVC 7.1, with static_cast<double>. - -Fri Sep 24 10:55:34 2004 Steve Huston <shuston@riverace.com> - - * ace/config-linux-common.h: If __USE_POSIX199309 is defined from - <features.h> set ACE_HAS_CLOCK_GETTIME. This is most often the case. - -Fri Sep 24 10:40:11 2004 Steve Huston <shuston@riverace.com> - - * apps/JAWS/clients/Blobby/blobby.cpp: - * apps/JAWS/clients/Blobby/Blob.{h cpp}: - * apps/JAWS/clients/Blobby/Blob_Handler.cpp: - * apps/JAWS/clients/Blobby/Options.{h cpp}: - * apps/JAWS/clients/Caching/http_client.cpp: - * apps/JAWS/clients/Caching/http_handler.cpp: - * apps/JAWS/server/HTTP_Server.{h cpp}: - * apps/JAWS/server/HTTP_Response.cpp: - Wide-char fixes. - -Fri Sep 24 10:34:26 2004 Steve Huston <shuston@riverace.com> - - * bin/MakeProjectCreator/config/acedefaults.mpb: - * bin/MakeProjectCreator/config/acelib.mpb: For automake projects, - change ACE_ROOT to either top_srcdir or top_builddir depending - on whether it's looking for source (such as includes) or libraries. - - * performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Benchmarks_Synch_Lib.mpc: - Changed base project from aceexe to acelib. This builds a library. - -Fri Sep 24 07:04:29 2004 J.T. Conklin <jtc@acorntoolworks.com> - - * Makefile.am: - * ace.mpc: - - Add new files. - - * ACE.h: - * ACE_crc_ccitt.cpp: - - Added ACE::crc_ccitt() family of functions in new file - ACE_crc_ccitt.cpp. - - * ACE_crc32.cpp: - - Changed table and shift expression so the special case with - additional masking for systems where ACE_UINT32 is more than 32 - bits wide (such as the Cray) is not needed. See "A Painless - Guide to CRC Error Detection Algorithms" by Ross Williams for - details. - - * ACE.cpp: - * ACE_crc32.cpp: - - Split out ACE::crc32() family of functions out of ACE.cpp into - new file ACE_crc32.cpp. - -Fri Sep 24 08:36:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl> - - * ace/config-lite.h: - The ACE_UNUSED_ARG macro didn't work with the DMC compiler, so - added a new version of this macro that silences the not used - warning with DMC. - -Fri Sep 24 08:29:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl> - - * ace/OS_NS_sys_socket.inl (sendto): - Removed usage of ACE_CONST_CAST - -Thu Sep 23 19:27:22 2004 J.T. Conklin <jtc@acorntoolworks.com> - - * ace/ACE.cpp: - * ace/ACE.h: - - Changed iovec version of ACE::crc32 to take a const iovec. - Thu Sep 23 19:59:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl> * ace/Service_Manager.h: diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 602d72cff41..219be329e81 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,252 +1,3 @@ -Fri Sep 24 12:28:04 2004 Carlos O'Ryan <coryan@atdesk.com> - - * tests/Sequence_Unit_Tests/string_sequence_element.hpp: - * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp: - Changed the template parameter on the string_sequence_element - from charT to the string_traits. With this change the - "string_sequence_element" no longer depends on the "string" - aspect, with suitable traits it works for object references too! - Also, because all the types depend on the template parameter I - have some hope of working around the MSVC6 bugs. - - * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp: - * tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp: - * tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp: - * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp: - * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp: - * tests/Sequence_Unit_Tests/value_sequence_tester.hpp: - Changed the unit tests so they would compile with boost-1.30.2 - -Fri Sep 24 11:25:18 2004 Chad Elliott <elliott_c@ociweb.com> - - * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: - * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp: - * tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp: - * tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp: - * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp: - * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp: - - Removed the #if 0'ed main() from these cpp files and added exename - settings to the necessary projects in the mpc file. - -Fri Sep 24 11:13:30 2004 Jeff Parsons <j.parsons@vanderbilt.edu> - - * tests/Sequence_Unit_Tests/allocation_traits.hpp: - - Changed line with reinterpret_cast<> in - unbounded_reference_allocation_traits::allocbuf() to be - more palatable for MSVC 7.1. Thanks to Carlos O'Ryan - <coryan@atdesk.com> for the replacement line. - -Fri Sep 24 10:08:50 2004 Jeff Parsons <j.parsons@vanderbilt.edu> - - * orbsvcs/orbsvcs/AV/RTP.cpp: - - Added statc_cast<> to the last argument passed to the - RTP_Packet constructor, to avoid loss-of-data warnings - on MSVC 7.1. - -Fri Sep 24 09:38:16 2004 Jeff Parsons <j.parsons@vanderbilt.edu> - - * tao/CORBALOC_Parser.cpp: - - Added #include of ace/os_include/os_netdb.h to pull in define of - MAXHOSTNAMELEN for Windows platforms. - -Fri Sep 24 08:58:40 2004 Iliyan Jeliazkov <jeliazkov_i@ociweb.com> - - Added capability to use INS-style corbaloc references to specify SSLIOP - references. This was motivated by a desire to access a naming service - exclusively using SSLIOP, but needing to specify its endpoint to clients - via a corbaloc-style IOR. - - This change originated in OCITAO 1.3a, and relies (and brings along with - it) code from OCITAO that refactored the CORBALOC parser to support - corbaloc and corbaname parsing via protocols beyond iiop. Thanks to - Phil Mesnier and Jonathan Pollack for contributing this functionality. - Their changes are credited accordingly in the text below. - - * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h: - * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp: - - Added code to check for the new "ssliop:" protocol prefix and to parse - a corbaloc-style URL with ssliop prefix. - - * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp: - - Updated the factory to correctly recognize ssliop: and iiop: protocol - prefixes. - - * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h: - * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp: - - Modified to allow creation of profiles that allways use SSL (when the - ssliop: protocol prefix is present). Such profiles will allways create - connections with Security::NoProtection disabled. - - * orbsvcs/tests/Security/MT_SSLIOP/MT_SSLIOP.mpc: - * orbsvcs/tests/Security/MT_SSLIOP/server.cpp: - - Added a "-i ObjectKey" option to provide an object key in the IORTable for - the object reference, so that clients can use corbaloc object - references like "corbaloc:ssliop:localhost:12345/ObjectKey". The intent - was to use it in testing the working of the corbaloc:ssliop, however it - is suiteable for more general use and that is why I left it here. - - * orbsvcs/tests/Security/ssliop_corbaloc/README: - * orbsvcs/tests/Security/ssliop_corbaloc/client.conf: - * orbsvcs/tests/Security/ssliop_corbaloc/client.h: - * orbsvcs/tests/Security/ssliop_corbaloc/client.conf.xml: - * orbsvcs/tests/Security/ssliop_corbaloc/client.cpp: - * orbsvcs/tests/Security/ssliop_corbaloc/corbaloc_ssliop.mpc: - * orbsvcs/tests/Security/ssliop_corbaloc/pvtkey-client.pem: - * orbsvcs/tests/Security/ssliop_corbaloc/pvtkey.pem: - * orbsvcs/tests/Security/ssliop_corbaloc/run_test.pl: - * orbsvcs/tests/Security/ssliop_corbaloc/selfsigncert-client.pem: - * orbsvcs/tests/Security/ssliop_corbaloc/selfsigncert.pem: - * orbsvcs/tests/Security/ssliop_corbaloc/server.conf: - * orbsvcs/tests/Security/ssliop_corbaloc/server.conf.xml: - * orbsvcs/tests/Security/ssliop_corbaloc/test_object.idl: - - Added the test to demonstrate the use of corbaloc:ssliop-style - object references and exclusive use of secure connection. - Introduced client- and server-side configuration file(s) for - the SSL-based tests, which I borrowed from - $TAO_ROOT/orbsvcs/tests/Security/Security/MT_SSLIOP. - Also generated a pair of private keys and the corresponding - certificates. - - - * tao/CORBALOC_Parser.h: - * tao/CORBALOC_Parser.cpp: - - Phil Mesnier refactored CORBALOC_Parser. The goal of this effort is to - support corbaloc and corbaname style object URLs with protocols other than those - shipped with TAO. Now the corbaloc parser works in conjunction - with the connector registry to allow the loaded transport - connectors to parse out known address strings. This change works - in conjunction with the changed TAO_Transport_Connector class, - described below. Thanks also to Jonathan Pollack for contributing, and - reviewing the final version. - - * tao/Connector_Registry.cpp: - * tao/IIOP_Connector.cpp: - - Phil Mesnier added an "" to the list of valid prefixes. This allows the - corbaloc parser code to remain clean, while still allowing corbaloc:: to - be eqivalent to corbaloc:iiop:. - - * tao/IIOP_Profile.cpp: - - Added a better error message for the case when a port number appears - with no host name specified. Originaly this threw and exception, but - provided no clues why the object reference would be invalid. - - * tao/Strategies/UIOP_Connector.h: - * tao/Strategies/UIOP_Connector.cpp: - - Phil Mesnier overode corbaloc parsing for UIOP, as it is a profile that - may contain commas or slashes in the address, therefore it must provide - its own implementation of corbaloc_scan method. The UIOP parser scans - for a '|' preceeding the comma or slash. - - * tao/Strategies/UIOP_Profile.cpp: - - Phil Mesnier updated the to_string method to output a stringified object - reference compatible with the updated corbaloc parser. - - * tao/Transport_Connector.h: - * tao/Transport_Connector.cpp: - - Phil Mesnier added a new virtual method, corbaloc_scan, which is called by - the corbaloc parser in order to find the end of the address specification, - ordinarily a comma or a slash. This method is virtual so that specific - protocols that need to have an additional adornment, or may include a comma - or slash in a valid endpoint string, may use an alternative method to - determine the end of the address. Ensured (in corbaloc_scan) that commas - that appear inside object key, following a slash are not counted as - separators between addresses. - -Fri Sep 24 07:12:12 2004 Carlos O'Ryan <coryan@atdesk.com> - - * tests/Sequence_Unit_Tests/allocation_traits.hpp: - Add missing return statement to allocbuf() for bounded strings - of reference-like types. Since this code is not used yet it is - quite cool that gcc-3.2.3 was able to pick the problem. - -Fri Sep 24 10:18:24 2004 <ops@iki.fi> - - * orbsvcs/CosEvent_Service/CosEvent_Service.mpc: - Changed order of base projects to fix linking error - for static builds. - -Thu Sep 23 22:48:14 2004 Carlos O'Ryan <coryan@atdesk.com> - - * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: - * tests/Sequence_Unit_Tests/Unbounded_String.cpp: - * tests/Sequence_Unit_Tests/run_test.pl: - New smoke test to verify that unbounded string sequences compile - across all platforms. The test is incomplete because the - sequences are, but there is enough code there to start shaking - out the bugs. - -Thu Sep 23 22:38:39 2004 Carlos O'Ryan <coryan@atdesk.com> - - * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp: - * tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp: - * tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp: - * tests/Sequence_Unit_Tests/testing_counters.hpp: - * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp: - * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp: - * tests/Sequence_Unit_Tests/value_sequence_tester.hpp: - The enable_shared_from_this trick was introduced in boost-1.31, - but I do not want to force Jeff and others to move out of 1.30.2 - just to run the unit tests. So I reimplemented the trick using - the canonical weak_ptr<> self reference, and a static allocator - to initialize the self reference. - -Thu Sep 23 22:23:46 2004 Carlos O'Ryan <coryan@atdesk.com> - - * tests/Sequence_Unit_Tests/testing_counters.hpp: - Include <boost/utility.hpp> instead of <boost/noncopyable.hpp> - as the second header only showed up in 1.31 - -Thu Sep 23 22:21:22 2004 Carlos O'Ryan <coryan@atdesk.com> - - * tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp: - Try to work around an (apparent) MSVC7.1 problem. It somehow - got confused about template to template member functions. No - biggie, I can wrap them through an extra call, so: - &Class::member<parameter> - becomes - &Class::member_parameter - and the implementation of the last function reads: - Class::member_parameter() { - member<parameter>(); - } - Thanks to Jeff Parson for testing that platform. He also - pointed out that he is using boost-1.30.2, so I'll use the - backwards compatible unit test features in a future commit. - - * tests/Sequence_Unit_Tests/run_test.pl: - Add the testing_allocation_traits_ut to the list of tests. - Somehow I missed it earlier. - -Thu Sep 23 22:14:01 2004 Carlos O'Ryan <coryan@atdesk.com> - - * Bala found the following problems for me: - - * tests/Sequence_Unit_Tests/string_traits_base.hpp: - I returned the result of a void function in a void function. - Perfectly legal C++, but MSVC6 is too lame. On the other hand I - do not care to skip the return statement, and it is actually - clearer written the new way. - - * tests/Sequence_Unit_Tests/string_sequence_element.hpp: - Try to work an MSVC6 wart. Use a base class of the traits - instead of using the traits directly. Slightly less elegant, - but not the end of the world. - Thu Sep 23 19:49:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl> * TAO_IDL/be/be_codegen.cpp: @@ -259,268 +10,268 @@ Thu Sep 23 19:49:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl> Thu Sep 23 17:48:50 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu> - * tests/Sequence_Unit_Tests/string_sequence_element.hpp: - * tests/Sequence_Unit_Tests/string_traits_base.hpp: + * tests/Sequence_Unit_Tests/string_sequence_element.hpp: + * tests/Sequence_Unit_Tests/string_traits_base.hpp: - Left a couple of coments for Carlos. + Left a couple of coments for Carlos. Wed Sep 22 21:39:48 2004 Carlos O'Ryan <coryan@atdesk.com> - * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp: - Add test for freebuf(), this motivated the changes below. - Add test for to verify that index checking works. + * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp: + Add test for freebuf(), this motivated the changes below. + Add test for to verify that index checking works. - * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp: - Enable the implementation of allocbuf() and freebuf(). + * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp: + Enable the implementation of allocbuf() and freebuf(). - * tests/Sequence_Unit_Tests/allocation_traits.hpp: - Because freebuf() has such crazy requirements for sequences of - reference-like types I had to implement special allocators for - those types. Basically they decorate the normal allocators and - call the ::release_range() and ::zero_range() traits in the - element type. + * tests/Sequence_Unit_Tests/allocation_traits.hpp: + Because freebuf() has such crazy requirements for sequences of + reference-like types I had to implement special allocators for + those types. Basically they decorate the normal allocators and + call the ::release_range() and ::zero_range() traits in the + element type. - * tests/Sequence_Unit_Tests/generic_sequence.hpp: - Improved the documentation. - Moved the zeroing-out of buffers to the allocation traits. + * tests/Sequence_Unit_Tests/generic_sequence.hpp: + Improved the documentation. + Moved the zeroing-out of buffers to the allocation traits. - * tests/Sequence_Unit_Tests/string_traits.hpp: - Add trait to release all the strings in a (buffer) range. + * tests/Sequence_Unit_Tests/string_traits.hpp: + Add trait to release all the strings in a (buffer) range. Wed Sep 22 20:41:44 2004 Carlos O'Ryan <coryan@atdesk.com> - * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp: - * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp: - To avoid compilation warnings on Tru64_Compaq_C++ we do not use - explicit template intantiation, instead we just use all the - functions. + * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp: + * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp: + To avoid compilation warnings on Tru64_Compaq_C++ we do not use + explicit template intantiation, instead we just use all the + functions. Wed Sep 22 20:25:12 2004 Carlos O'Ryan <coryan@atdesk.com> - * tests/Sequence_Unit_Tests/string_sequence_element.hpp: - Implement the type returned by the non-const operator[] in - string sequences. A lot of the evilness of string sequences is - encapsulated here. + * tests/Sequence_Unit_Tests/string_sequence_element.hpp: + Implement the type returned by the non-const operator[] in + string sequences. A lot of the evilness of string sequences is + encapsulated here. - * tests/Sequence_Unit_Tests/run_test.pl: - * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: - * tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp: - Unit test for the previous class. + * tests/Sequence_Unit_Tests/run_test.pl: + * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: + * tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp: + Unit test for the previous class. - * tests/Sequence_Unit_Tests/string_traits_base.hpp: - Add missing #include for the string manager types. + * tests/Sequence_Unit_Tests/string_traits_base.hpp: + Add missing #include for the string manager types. - * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp: - Implement the non-const operator[] to return a - string_sequence_element<charT>. + * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp: + Implement the non-const operator[] to return a + string_sequence_element<charT>. - * tests/Sequence_Unit_Tests/run_test.pl: - * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp: - Add more tests for copy constructors. - Test the non-cost operator[] for sequences. - Move the add_all() function to the end, easier to add tests that - way. + * tests/Sequence_Unit_Tests/run_test.pl: + * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp: + Add more tests for copy constructors. + Test the non-cost operator[] for sequences. + Move the add_all() function to the end, easier to add tests that + way. Tue Sep 21 22:11:10 2004 Carlos O'Ryan <coryan@atdesk.com> - * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp: - New file, this will implement (obviously enough) unbounded - sequences of strings. The implementation is incomplete, but - enough is there to show the main ideas and start the cycle: - write test -> get test to compile + fail -> get test to pass - -> rinse and repeat. - - * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: - * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp: - Initial unit test for unbounded string sequences. - - * tests/Sequence_Unit_Tests/testing_counters.hpp: - Helper classes to implement some common testing idioms, namely, - count how many times a function is called and raise an exception - after a prescribed number of calls. - - * tests/Sequence_Unit_Tests/string_traits.hpp: - Implement the element manipulation traits for strings (and wide - strings.) - - * tests/Sequence_Unit_Tests/string_traits_base.hpp: - Isolate most of the string element manipulation traits from the - silly CORBA names for string vs. wstring functions. Apparently - they forgot that C++ has overloading. - - * tests/Sequence_Unit_Tests/testing_string_traits.hpp: - More helper classes to write unit tests related to string - sequences. - - * tests/Sequence_Unit_Tests/testing_allocation_traits.hpp: - * tests/Sequence_Unit_Tests/value_sequence_tester.hpp: - * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp: - * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp: - Refactored the code to use the testing_counters.hpp helpers. - - * tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp: - Wrote a unit test for the allocation traits used in testing. - Normally I would not "test the test" but the helpers in - testing_counters.hpp made it desirable to have this extra layer - of checking. + * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp: + New file, this will implement (obviously enough) unbounded + sequences of strings. The implementation is incomplete, but + enough is there to show the main ideas and start the cycle: + write test -> get test to compile + fail -> get test to pass + -> rinse and repeat. + + * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: + * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp: + Initial unit test for unbounded string sequences. + + * tests/Sequence_Unit_Tests/testing_counters.hpp: + Helper classes to implement some common testing idioms, namely, + count how many times a function is called and raise an exception + after a prescribed number of calls. + + * tests/Sequence_Unit_Tests/string_traits.hpp: + Implement the element manipulation traits for strings (and wide + strings.) + + * tests/Sequence_Unit_Tests/string_traits_base.hpp: + Isolate most of the string element manipulation traits from the + silly CORBA names for string vs. wstring functions. Apparently + they forgot that C++ has overloading. + + * tests/Sequence_Unit_Tests/testing_string_traits.hpp: + More helper classes to write unit tests related to string + sequences. + + * tests/Sequence_Unit_Tests/testing_allocation_traits.hpp: + * tests/Sequence_Unit_Tests/value_sequence_tester.hpp: + * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp: + * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp: + Refactored the code to use the testing_counters.hpp helpers. + + * tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp: + Wrote a unit test for the allocation traits used in testing. + Normally I would not "test the test" but the helpers in + testing_counters.hpp made it desirable to have this extra layer + of checking. Tue Sep 21 20:15:01 2004 Carlos O'Ryan <coryan@atdesk.com> - * tests/Sequence_Unit_Tests/generic_sequence.hpp: - Refactor the code to decompose the problem a little better. - Basically it all boils down to creating + * tests/Sequence_Unit_Tests/generic_sequence.hpp: + Refactor the code to decompose the problem a little better. + Basically it all boils down to creating - 1) A set of traits to handle buffer allocation. This - encapsulates the bounded vs. unbounded aspect of a sequence. + 1) A set of traits to handle buffer allocation. This + encapsulates the bounded vs. unbounded aspect of a sequence. - 2) Another set trait to handle element initialization, - copying and destruction. This encapsulates the value - vs. reference aspect of a sequence. + 2) Another set trait to handle element initialization, + copying and destruction. This encapsulates the value + vs. reference aspect of a sequence. In the process I created smaller files to hold each class. - The traits have an extra <bool> template parameter, whose - motivation would hopefully become clear in a second. + The traits have an extra <bool> template parameter, whose + motivation would hopefully become clear in a second. - * tests/Sequence_Unit_Tests/bounded_value_sequence.hpp: - Move the implementation of bounded sequences of by-value types - to this file. + * tests/Sequence_Unit_Tests/bounded_value_sequence.hpp: + Move the implementation of bounded sequences of by-value types + to this file. - * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp: - Unit test for bounded_value_sequence. + * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp: + Unit test for bounded_value_sequence. - * tests/Sequence_Unit_Tests/unbounded_value_sequence.hpp: - Move the implementation of unbounded sequences of by-value types - to this file. + * tests/Sequence_Unit_Tests/unbounded_value_sequence.hpp: + Move the implementation of unbounded sequences of by-value types + to this file. - * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp: - Unit test for unbounded_value_sequence. + * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp: + Unit test for unbounded_value_sequence. - * tests/Sequence_Unit_Tests/value_sequence_tester.hpp: - Refactor common code shared by bounded_value_sequence_ut.cpp and - unbounded_value_sequence_ut.cpp + * tests/Sequence_Unit_Tests/value_sequence_tester.hpp: + Refactor common code shared by bounded_value_sequence_ut.cpp and + unbounded_value_sequence_ut.cpp - * tests/Sequence_Unit_Tests/testing_allocation_traits.hpp: - Specialize the allocation traits in a form suitable for - testing. The unit tests make the traits raise exceptions in - certain tests, and they can count how many times certain - functions are called. + * tests/Sequence_Unit_Tests/testing_allocation_traits.hpp: + Specialize the allocation traits in a form suitable for + testing. The unit tests make the traits raise exceptions in + certain tests, and they can count how many times certain + functions are called. - * tests/Sequence_Unit_Tests/testing_range_checking.hpp: - Specializes the range_checking traits to raise an exception when - an out-of-range access is attempted. + * tests/Sequence_Unit_Tests/testing_range_checking.hpp: + Specializes the range_checking traits to raise an exception when + an out-of-range access is attempted. - * tests/Sequence_Unit_Tests/testing_exception.hpp: - Exception raised by the testing traits. + * tests/Sequence_Unit_Tests/testing_exception.hpp: + Exception raised by the testing traits. - * tests/Sequence_Unit_Tests/allocation_traits.hpp: - New file, implements the allocation traits for bounded and - unbounded sequences. + * tests/Sequence_Unit_Tests/allocation_traits.hpp: + New file, implements the allocation traits for bounded and + unbounded sequences. - * tests/Sequence_Unit_Tests/value_traits.hpp: - Implement the element manipulation traits for by-value types. + * tests/Sequence_Unit_Tests/value_traits.hpp: + Implement the element manipulation traits for by-value types. - * tests/Sequence_Unit_Tests/range_checking.hpp: - New file, implements yet another trait to control what are the - effects of accessing an index out of range. The default - implementation is a no-op, but applications can specialize the - class to throw exceptions, call abort, phone your mom and call - you names, whatever. + * tests/Sequence_Unit_Tests/range_checking.hpp: + New file, implements yet another trait to control what are the + effects of accessing an index out of range. The default + implementation is a no-op, but applications can specialize the + class to throw exceptions, call abort, phone your mom and call + you names, whatever. - * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: - * tests/Sequence_Unit_Tests/run_test.pl: - Removed some projects, add new ones. + * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: + * tests/Sequence_Unit_Tests/run_test.pl: + Removed some projects, add new ones. - * tests/Sequence_Unit_Tests/Bounded_Primitive_Types.cpp: - * tests/Sequence_Unit_Tests/Unbounded_Primitive_Types.cpp: - Removed, replaced by {bounded,unbounded}_value_sequence_ut.cpp + * tests/Sequence_Unit_Tests/Bounded_Primitive_Types.cpp: + * tests/Sequence_Unit_Tests/Unbounded_Primitive_Types.cpp: + Removed, replaced by {bounded,unbounded}_value_sequence_ut.cpp - * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp: - * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp: - Updated to use TAO::{bounded,unbounded}_value_sequence - vs. TAO::{bounded,unbounded}_sequence. + * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp: + * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp: + Updated to use TAO::{bounded,unbounded}_value_sequence + vs. TAO::{bounded,unbounded}_sequence. - * tests/Sequence_Unit_Tests/sequence.hpp: - Removed, replaced by {bounded,unbounded}_value_sequence.hpp + * tests/Sequence_Unit_Tests/sequence.hpp: + Removed, replaced by {bounded,unbounded}_value_sequence.hpp - * tests/Sequence_Unit_Tests/sequence_traits.hpp: - Removed, the traits have been broken up in multiple files. + * tests/Sequence_Unit_Tests/sequence_traits.hpp: + Removed, the traits have been broken up in multiple files. Tue Sep 21 20:31:43 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu> - * orbsvcs/orbsvcs/Log/LogRecordStore_persist.cpp: - * orbsvcs/orbsvcs/Log/LogRecordStore_persist.h: - * orbsvcs/orbsvcs/Log/PersistStore.cpp: + * orbsvcs/orbsvcs/Log/LogRecordStore_persist.cpp: + * orbsvcs/orbsvcs/Log/LogRecordStore_persist.h: + * orbsvcs/orbsvcs/Log/PersistStore.cpp: - Applied patches to Logging service provided by - Thomas Girard <thomas dot g dot girard at free.fr>. + Applied patches to Logging service provided by + Thomas Girard <thomas dot g dot girard at free.fr>. Tue Sep 21 07:19:29 2004 J.T. Conklin <jtc@acorntoolworks.com> - * tao/Makefile.am: + * tao/Makefile.am: - Updated. + Updated. Mon Sep 20 07:00:15 2004 Carlos O'Ryan <coryan@atdesk.com> - * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp: - * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp: - Use the argc/argv prototype for main, apparently the ACE - renaming of main() does not work for the other standard - prototype for main(). + * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp: + * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp: + Use the argc/argv prototype for main, apparently the ACE + renaming of main() does not work for the other standard + prototype for main(). Sun Sep 19 14:19:06 2004 Carlos O'Ryan <coryan@atdesk.com> - * tests/Sequence_Unit_Tests/README: - * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: - Unit tests for the CORBA sequence classes, we are currently - replacing the implementation of CORBA sequence in TAO. In good - TDD form I am writing the tests first, and adding them to this - directory. - The initial implementations will also reside in this directory - but the plan is to move them to the library once all the - portability bugs are cleaned up. - If you are interested in TDD you may want to check the code to - see how I managed to test exceptions in operator new[] without - introducing run-time overhead. Likewise, the user can configure - the range checking functions in CORBA sequences. - - * tests/Sequence_Unit_Tests/sequence_traits.hpp: - Define trait class templates to implement sequences. These - traits can be partially of fully specialized by the user to - modify the default behavior. - - * tests/Sequence_Unit_Tests/generic_sequence.hpp: - Generic sequence implementation, currently implements bounded - and unbounded sequences of self-managed types, but I expect to - implement all sequences using a single class. The variations - between all the different sequence types will be factored out to - trait classes. - - * tests/Sequence_Unit_Tests/sequence.hpp: - The interface for unbounded and bounded sequences of - self-managed types. - - * tests/Sequence_Unit_Tests/Bounded_Primitive_Types.cpp: - * tests/Sequence_Unit_Tests/Unbounded_Primitive_Types.cpp: - Unit tests for bounded and unbounded sequences. They are based - on the boost unit test framework, so they only compile if boost - is configured. - - * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp: - * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp: - Smoke test (basic compilation) for sequences of self-managed - types. They compile on all platforms. - - * tests/Sequence_Unit_Tests/run_test.pl: - Run all the tests. + * tests/Sequence_Unit_Tests/README: + * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc: + Unit tests for the CORBA sequence classes, we are currently + replacing the implementation of CORBA sequence in TAO. In good + TDD form I am writing the tests first, and adding them to this + directory. + The initial implementations will also reside in this directory + but the plan is to move them to the library once all the + portability bugs are cleaned up. + If you are interested in TDD you may want to check the code to + see how I managed to test exceptions in operator new[] without + introducing run-time overhead. Likewise, the user can configure + the range checking functions in CORBA sequences. + + * tests/Sequence_Unit_Tests/sequence_traits.hpp: + Define trait class templates to implement sequences. These + traits can be partially of fully specialized by the user to + modify the default behavior. + + * tests/Sequence_Unit_Tests/generic_sequence.hpp: + Generic sequence implementation, currently implements bounded + and unbounded sequences of self-managed types, but I expect to + implement all sequences using a single class. The variations + between all the different sequence types will be factored out to + trait classes. + + * tests/Sequence_Unit_Tests/sequence.hpp: + The interface for unbounded and bounded sequences of + self-managed types. + + * tests/Sequence_Unit_Tests/Bounded_Primitive_Types.cpp: + * tests/Sequence_Unit_Tests/Unbounded_Primitive_Types.cpp: + Unit tests for bounded and unbounded sequences. They are based + on the boost unit test framework, so they only compile if boost + is configured. + + * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp: + * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp: + Smoke test (basic compilation) for sequences of self-managed + types. They compile on all platforms. + + * tests/Sequence_Unit_Tests/run_test.pl: + Run all the tests. Sat Sep 18 19:32:55 2004 J.T. Conklin <jtc@acorntoolworks.com> - * orbavcs/orbsvcs/DsLogAdmin.idl: + * orbavcs/orbsvcs/DsLogAdmin.idl: - Changed to include "tao/TimeBase.pidl" instead of "TimeBase.idl" - to avoid adding an otherwise unnecessary dependency on svc_utils - project. + Changed to include "tao/TimeBase.pidl" instead of "TimeBase.idl" + to avoid adding an otherwise unnecessary dependency on svc_utils + project. Sat Sep 18 17:16:23 2004 Olli Savia <ops@iki.fi> diff --git a/TAO/cjc.mwc b/TAO/cjc.mwc new file mode 100644 index 00000000000..b8b8ec010b2 --- /dev/null +++ b/TAO/cjc.mwc @@ -0,0 +1,13 @@ +// -*- MPC -*- +// $Id$ + +workspace { + ../ace + ../apps/gperf/src + ../ACEXML/common + ../ACEXML/parser/parser + ../ACEXML/apps/svcconf + tao + TAO_IDL + performance-tests/Latency +} diff --git a/TAO/orbsvcs/CosEvent_Service/CosEvent_Service.mpc b/TAO/orbsvcs/CosEvent_Service/CosEvent_Service.mpc index 2bdb8761528..220aa334965 100644 --- a/TAO/orbsvcs/CosEvent_Service/CosEvent_Service.mpc +++ b/TAO/orbsvcs/CosEvent_Service/CosEvent_Service.mpc @@ -1,6 +1,6 @@ // -*- MPC -*- // $Id$ -project : orbsvcsexe, core, naming, event_serv, svc_utils, iortable, messaging, portableserver { +project : orbsvcsexe, core, event_serv, naming, svc_utils, iortable, messaging, portableserver { exename = CosEvent_Service } diff --git a/TAO/orbsvcs/orbsvcs/AV/RTP.cpp b/TAO/orbsvcs/orbsvcs/AV/RTP.cpp index eeb27381690..37b86fa9478 100644 --- a/TAO/orbsvcs/orbsvcs/AV/RTP.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/RTP.cpp @@ -517,7 +517,7 @@ TAO_AV_RTP_Object::send_frame (const iovec *iov, // set the ssrc on the control object so the RTCP traffic can be matched // to the RTP traffic rtcp_prot_obj->ssrc(this->ssrc_); - ACE_UINT16 data_size = static_cast<ACE_UINT16> (iov[0].iov_len); + ACE_NEW_RETURN (rtp_packet, RTP_Packet (0, // padding @@ -528,8 +528,8 @@ TAO_AV_RTP_Object::send_frame (const iovec *iov, this->ssrc_, // ssrc csrc_count, // csrc count csrc_list, // csrc list - (char *)iov[0].iov_base, // data - data_size), // data size + (char *)iov[0].iov_base, // data + iov[0].iov_len), // data size -1); frame_info->sequence_num ++; @@ -575,7 +575,6 @@ TAO_AV_RTP_Object::send_frame (const iovec *iov, (now.sec () * samples_per_sec + ((double)now.usec () * samples_per_usec) + this->timestamp_offset_); - ACE_UINT16 data_size = static_cast<ACE_UINT16> (iov[0].iov_len); ACE_NEW_RETURN (rtp_packet, RTP_Packet (0, // padding @@ -586,8 +585,8 @@ TAO_AV_RTP_Object::send_frame (const iovec *iov, this->ssrc_, // ssrc csrc_count, // csrc count csrc_list, // csrc list - (char *)iov[0].iov_base, // data - data_size), // data size + (char *)iov[0].iov_base, // data + iov[0].iov_len), // data size -1); this->sequence_num_ ++; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp index bcdd093c8d8..a78d1baf81f 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp @@ -474,7 +474,7 @@ TAO_UIPMC_Transport::handle_input (TAO_Resume_Handle &rh, // Read the message into the message block that we have created on // the stack. - ssize_t n = this->recv (message_block.rd_ptr (), + ssize_t n = this->recv (message_block.wr_ptr (), message_block.space (), max_wait_time); @@ -498,14 +498,14 @@ TAO_UIPMC_Transport::handle_input (TAO_Resume_Handle &rh, // Set the write pointer in the stack buffer. message_block.wr_ptr (n); - // Parse the incoming message for validity. The check needs to be + // Check the incoming message for validity. The check needs to be // performed by the messaging objects. - if (this->parse_incoming_messages (message_block) == -1) + if (this->messaging_object ()->check_for_valid_header (message_block) == 0) { if (TAO_debug_level) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO: (%P|%t|%N|%l) parse_incoming_messages failed on transport %d after fault %p\n"), + ACE_TEXT ("TAO: (%P|%t|%N|%l) failed to find a valid header on transport %d after fault %p\n"), this->id (), ACE_TEXT ("handle_input_i ()\n"))); } @@ -514,17 +514,27 @@ TAO_UIPMC_Transport::handle_input (TAO_Resume_Handle &rh, } // NOTE: We are not performing any queueing nor any checking for - // missing data. We are assuming that ALL the data would be got in a + // missing data. We are assuming that ALL the data arrives in a // single read. // Make a node of the message block.. - TAO_Queued_Data qd (&message_block); - - // Extract the data for the node.. - this->messaging_object ()->get_message_data (&qd); - - // Process the message - return this->process_parsed_messages (&qd, rh); + // + // We could make this more efficient by having a fixed Queued Data + // allocator, i.e., it always gave back the same thing. Actually, + // we *could* create an allocator that took a stack-allocated object + // as an argument and returned that when asked an allocation is + // done. Something to contemplate... + TAO_Queued_Data* qd = + TAO_Queued_Data::make_completed_message (message_block, + *this->messaging_object ()); + int retval = -1; + if (qd) + { + // Process the message + retval = this->process_parsed_messages (qd, rh); + TAO_Queued_Data::release (qd); + } + return retval; } int diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp index 00be46eb157..ba933c34608 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp @@ -271,7 +271,7 @@ TAO::SSLIOP::Connector::create_profile (TAO_InputCDR& cdr) } TAO_Profile * -TAO::SSLIOP::Connector::make_profile (int is_secure ACE_ENV_ARG_DECL) +TAO::SSLIOP::Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL) { // The endpoint should be of the form: // N.n@host:port/object_key @@ -281,7 +281,7 @@ TAO::SSLIOP::Connector::make_profile (int is_secure ACE_ENV_ARG_DECL) TAO_Profile *profile = 0; ACE_NEW_THROW_EX (profile, TAO_SSLIOP_Profile (this->orb_core (), - is_secure), // SSL component + 0), // SSL component CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO_DEFAULT_MINOR_CODE, @@ -292,78 +292,6 @@ TAO::SSLIOP::Connector::make_profile (int is_secure ACE_ENV_ARG_DECL) return profile; } - -TAO_Profile * -TAO::SSLIOP::Connector::corbaloc_scan (const char *endpoint, - size_t &len - ACE_ENV_ARG_DECL) -{ - int ssl_only = 0; - if( this->check_prefix( endpoint) == 0) - { - ssl_only = 1; - } - else - { - if (this->TAO_IIOP_Connector::check_prefix ( endpoint) != 0) - return 0; - } - - // Determine the (first in a list of possibly > 1) endpoint address - const char *comma_pos = ACE_OS::strchr ( endpoint,','); - const char *slash_pos = ACE_OS::strchr ( endpoint,'/'); - if( comma_pos == 0 && slash_pos == 0) - { - if( TAO_debug_level) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("(%P|%t) SSLIOP_Connector::corbaloc_scan warning: ") - ACE_TEXT("supplied string contains no comma or slash: %s\n"), - endpoint)); - } - len = ACE_OS::strlen (endpoint); - } - else if( slash_pos != 0 || comma_pos > slash_pos) - { - // The endpoint address does not extend past the first '/' or ',' - len = slash_pos - endpoint; - } - else - { - len = comma_pos - endpoint; - } - - return this->make_profile( ssl_only ACE_ENV_ARG_PARAMETER); -} - -int -TAO::SSLIOP::Connector::check_prefix (const char *endpoint) -{ - // Check for a valid string - if (!endpoint || !*endpoint) return -1; // Failure - - const char *protocol[] = { "ssliop", "sslioploc" }; - - size_t first_slot = ACE_OS::strchr (endpoint, ':') - endpoint; - - size_t len0 = ACE_OS::strlen (protocol[0]); - size_t len1 = ACE_OS::strlen (protocol[1]); - - // Check for the proper prefix in the IOR. If the proper prefix - // isn't in the IOR then it is not an IOR we can use. - if (first_slot == len0 && ACE_OS::strncmp (endpoint, protocol[0], len0) == 0) - return 0; - - if (first_slot == len1 && ACE_OS::strncmp (endpoint, protocol[1], len1) == 0) - return 0; - - // Failure: not an SSLIOP IOR - // DO NOT throw an exception here. - return -1; -} - - - TAO_Transport* TAO::SSLIOP::Connector::iiop_connect ( TAO_SSLIOP_Endpoint *ssl_endpoint, diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h index 518fe6310dd..9a3a5ddb1a2 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h @@ -70,11 +70,6 @@ namespace TAO ACE_ENV_ARG_DECL); virtual TAO_Profile *create_profile (TAO_InputCDR& cdr); - virtual int check_prefix (const char *endpoint); - virtual TAO_Profile * corbaloc_scan (const char *ior, - size_t &len - ACE_ENV_ARG_DECL); - //@} protected: @@ -84,7 +79,7 @@ namespace TAO * * Please check the documentation in Pluggable.h. */ - virtual TAO_Profile * make_profile (int is_secure ACE_ENV_ARG_DECL); + virtual TAO_Profile * make_profile (ACE_ENV_SINGLE_ARG_DECL); /// Cancel the passed cvs handler from the connector virtual int cancel_svc_handler (TAO_Connection_Handler * svc_handler); diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp index c209a7aa563..fbb32f89f96 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp @@ -18,7 +18,7 @@ ACE_RCSID (SSLIOP, "$Id$") -static const char *prefix_[] = {"iiop", "ssliop"}; +static const char prefix_[] = "iiop"; namespace TAO { @@ -44,18 +44,13 @@ int TAO::SSLIOP::Protocol_Factory::match_prefix (const ACE_CString &prefix) { // Check for the proper prefix for this protocol. - return (ACE_OS::strcasecmp (prefix.c_str (), ::prefix_[0]) == 0) - || (ACE_OS::strcasecmp (prefix.c_str (), ::prefix_[1]) == 0); + return (ACE_OS::strcasecmp (prefix.c_str (), ::prefix_) == 0); } const char * TAO::SSLIOP::Protocol_Factory::prefix (void) const { - // Note: This method doesn't seem to be used anywhere. Moreover, - // keeping it may make things more confusing - a Factory can - // well be handling multiple protocol prefixes, not just one! - // Shouldn't it be deprecated? - return ::prefix_[0]; + return ::prefix_; } char diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp index 6a203a8813b..23642aaa94a 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp @@ -23,8 +23,7 @@ TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (const ACE_INET_Addr & addr, object_key, version, orb_core), - ssl_endpoint_ (ssl_component, 0), - ssl_only_ (0) + ssl_endpoint_ (ssl_component, 0) { this->ssl_endpoint_.iiop_endpoint (&this->endpoint_, true); } @@ -42,8 +41,7 @@ TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (const char * host, addr, version, orb_core), - ssl_endpoint_ (ssl_component, 0), - ssl_only_ (0) + ssl_endpoint_ (ssl_component, 0) { this->ssl_endpoint_.iiop_endpoint (&this->endpoint_, true); } @@ -51,16 +49,14 @@ TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (const char * host, TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (TAO_ORB_Core * orb_core, const ::SSLIOP::SSL * ssl_component) : TAO_IIOP_Profile (orb_core), - ssl_endpoint_ (ssl_component, 0), - ssl_only_ (0) + ssl_endpoint_ (ssl_component, 0) { this->ssl_endpoint_.iiop_endpoint (&this->endpoint_, true); } -TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (TAO_ORB_Core * orb_core, int ssl_only) +TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (TAO_ORB_Core * orb_core) : TAO_IIOP_Profile (orb_core), - ssl_endpoint_ (0, 0), - ssl_only_ (ssl_only) + ssl_endpoint_ (0, 0) { this->ssl_endpoint_.iiop_endpoint (&this->endpoint_, true); } @@ -344,14 +340,4 @@ TAO_SSLIOP_Profile::parse_string (const char * ior ACE_CHECK; this->ssl_endpoint_.iiop_endpoint (&this->endpoint_, true); - - if( ssl_only_) - { - this->ssl_endpoint_.ssl_component_.port = this->endpoint_.port_; - - // Note that the Security::NoProtection bit is cleared since we - // are sure the server supports SSL (we're told so) - ACE_CLR_BITS (this->ssl_endpoint_.ssl_component_.target_supports, - Security::NoProtection); - } } diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h index 7d90d00f290..026765b860b 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h @@ -68,10 +68,8 @@ TAO_SSLIOP_Profile (TAO_ORB_Core * orb_core, const ::SSLIOP::SSL * ssl_component); - /// Profile constructor. ssl_only != 0 will force secure - /// connections, pnly. - TAO_SSLIOP_Profile (TAO_ORB_Core * orb_core, int ssl_only = 0); - + /// Profile constructor, default. + TAO_SSLIOP_Profile (TAO_ORB_Core * orb_core); // = Please see Profile.h for the documentation of these methods. virtual int decode (TAO_InputCDR& cdr); @@ -155,16 +153,6 @@ * rest of the SSL endpoint list is transmitted. */ TAO_SSLIOP_Endpoint ssl_endpoint_; - - /** - * Allways treat this endpoint as secure, even if the constructor - * did not explicitely specify a tagged component for SSL. - * @par - * Most likely the parse_string() will supply a subset of the - * attributes - port number, for instance. - */ - int ssl_only_; - }; // } // End SSLIOP namespace. diff --git a/TAO/orbsvcs/tests/Security/MT_SSLIOP/MT_SSLIOP.mpc b/TAO/orbsvcs/tests/Security/MT_SSLIOP/MT_SSLIOP.mpc index 1e76f1acf6f..48f43312e62 100644 --- a/TAO/orbsvcs/tests/Security/MT_SSLIOP/MT_SSLIOP.mpc +++ b/TAO/orbsvcs/tests/Security/MT_SSLIOP/MT_SSLIOP.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*security server): orbsvcsexe, portableserver, ssl, iortable { +project(*security server): orbsvcsexe, portableserver, ssl { Source_Files { Server_Worker.cpp test_i.cpp diff --git a/TAO/orbsvcs/tests/Security/MT_SSLIOP/server.cpp b/TAO/orbsvcs/tests/Security/MT_SSLIOP/server.cpp index e67568600ad..29c53ecb7b8 100644 --- a/TAO/orbsvcs/tests/Security/MT_SSLIOP/server.cpp +++ b/TAO/orbsvcs/tests/Security/MT_SSLIOP/server.cpp @@ -1,27 +1,21 @@ // $Id$ #include "ace/Get_Opt.h" -#include "tao/IORTable/IORTable.h" #include "test_i.h" #include "Server_Worker.h" const char *ior_output_file = 0; -const char *ior_table_name = 0; int nthreads = 4; int parse_args (int argc, char *argv[]) { - ACE_Get_Opt get_opts (argc, argv, "i:o:n:"); + ACE_Get_Opt get_opts (argc, argv, "o:n:"); int c; while ((c = get_opts ()) != -1) switch (c) { - case 'i': - ior_table_name = get_opts.opt_arg (); - break; - case 'o': ior_output_file = get_opts.opt_arg (); break; @@ -34,7 +28,6 @@ parse_args (int argc, char *argv[]) default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s " - "[-i <iortable name>]" "-o <iorfile>" "\n", argv [0]), @@ -87,29 +80,7 @@ main (int argc, char *argv[]) orb->object_to_string (server.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ()));A - - - if (ior_table_name != 0) - { - CORBA::Object_var table_object = - orb->resolve_initial_references ("IORTable" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - IORTable::Table_var adapter = - IORTable::Table::_narrow (table_object.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - if (CORBA::is_nil (adapter.in ())) - { - ACE_ERROR ((LM_ERROR, "Nil IORTable\n")); - return -1; - } - - adapter->bind ( ior_table_name, ior.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - } - + ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); // If the ior_output_file exists, output the ior to it if (ior_output_file != 0) diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/README b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/README deleted file mode 100644 index 6e28b065fb8..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/README +++ /dev/null @@ -1,87 +0,0 @@ -// $Id$ - -These application tests address various features of TAO's -Naming Service. The functionality is the same as in the -Simple_Naming test, but the difference is that all the -communication is done over SSLIOP and clients are using -INS-style corbaloc URLs. - -To run all tests automatically - - execute Perl script run_test.pl - -To run tests manually - - start the Naming Service (see - TAO/orbsvcs/Naming_Service/README for valid options). - Make sure you use " -ORBSvcConf server.conf" and - "-ORBEndpoint iiop://localhost:23456/ssl_port=12345" - - Then run ./client with one of the options below. - Make sure you add " -ORBSvcConf client.conf" and - "-ORBInitRef NameService=corbaloc:ssliop:localhost:12345/NameService" - -NOTE: if running tests manually, Naming Service has to be restarted -before each test (this is due to some tests not 'cleaning up' bindings -after themselves). - -The following options exist: ---------------------------- --s Run the Simple test of the Naming Service. - --t Run the Tree test of the Naming Service. - --e Run the Exceptions test of the Naming Service - --i Run the Iterator test of the Naming Service. - --y Run the Destroy test of the Naming Service. - -Persistent test consists of two parts (below). - --p <file_name> - Run the Persistent Naming Service test, part 1. Requires an - argument specifying the name of the file in which to store an ior for - use by Persistent Naming Service test, part 2. Note, in order - to test out persistent capabilities of the Naming Service, the - Naming Service must be started with -f and -ORBendpoint options. - The values for these options must be the same for both runs of - the Naming Service (i.e., for part 1 and part 2 of persistent test). - --c <ior> - Run the Persistent Naming Service test, part 2. Requires an - argument specifying the ior, which was produced in part 1 of - the test. Note, in order to test out persistent capabilities - of the Naming Service, the Naming Service must be started with - -f and -ORBendpoint options. The values for these options - must remain the same for both runs of the Naming Service (i.e., - for part 1 and part 2 of persistent test). - - Example of testing persistence on a Unix system: - $ ../../Naming_Service -f log -ORBendpoint iiop://localhost:20000 - $ ./client -p ior_file - kill the Naming_Service process - $ ../../Naming_Service -f log -ORBendpoint iiop://localhost:20000 - $ ./client -c file://ior_file - - where the steps correspond to 1)starting the Naming Service on - port 20000 in persistent mode, with persistent state being - stored in file called "log", 2) running the first part of the - client persistent naming test, and sending its data to file - called "ior_file", 3) killing the Naming Service process, 4) - restarting the Naming Service on the same port with the same - persistent state storage file, and 5) running the second part - of the client persistence test by specifying the ior from part - 1 in the file format. - - We kill the Naming Service process between 2 client runs to - make sure it can recreate its state from persistent storage. - It is necessary to restart the Naming Service on the same - host/port in order for the persistent IORs from the first - run to be valid for the second run. - -If no option is specified, Simple test is run. If more than one -option is specified, only one test runs. - - -DESCRIPTION AND EXPECTED OUTPUT FOR EACH TEST -******************************************* -Please see $TAO_ROOT/orbsvcs/tests/Simple_Naming/README diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.conf b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.conf deleted file mode 100644 index 880c1b7d372..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.conf +++ /dev/null @@ -1,5 +0,0 @@ -dynamic SSLIOP_Factory Service_Object * - TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() - "-SSLPrivateKey PEM:pvtkey-client.pem -SSLCertificate PEM:selfsigncert-client.pem" -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" - diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.conf.xml b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.conf.xml deleted file mode 100644 index 50bb24f73ee..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.conf.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version='1.0'?> -<!-- Converted from client.conf by svcconf-convert.pl --> -<ACE_Svc_Conf> - <dynamic id="SSLIOP_Factory" type="Service_Object"> - <initializer path="TAO_SSLIOP" init="_make_TAO_SSLIOP_Protocol_Factory" params="-SSLPrivateKey PEM:pvtkey-client.pem -SSLCertificate PEM:selfsigncert-client.pem"/> - </dynamic> - <static id="Resource_Factory" params="-ORBProtocolFactory SSLIOP_Factory"/> -</ACE_Svc_Conf> - diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.cpp b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.cpp deleted file mode 100644 index 1279dee82b7..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.cpp +++ /dev/null @@ -1,1280 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/orbsvcs/Naming_Service/ -// -// = FILENAME -// client.cpp -// -// = DESCRIPTION -// This class implements a simple CORBA client for the CosNaming -// example using stubs generated by the TAO ORB IDL compiler. -// -// = AUTHORS -// Sergio Flores-Gaitan <sergio@cs.wustl.edu>, -// Marina Spivak <marina@cs.wustl.edu>, and -// Douglas C. Schmidt <schmidt@cs.wustl.edu> -// ============================================================================ - -#include "client.h" -#include "tao/debug.h" -#include "ace/Get_Opt.h" - -ACE_RCSID(Simple_Naming, client, "$Id$") - -#if defined (_MSC_VER) -# pragma warning (disable : 4250) -#endif /* _MSC_VER */ - -class My_Test_Object : - public virtual PortableServer::RefCountServantBase, - public virtual POA_Test_Object -{ -public: - // = Initialization and termination methods. - My_Test_Object (CORBA::Short id = 0); - // Constructor. - - ~My_Test_Object (void); - // Destructor. - - // = Interface implementation accessor methods. - - void id (CORBA::Short id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Sets id. - - CORBA::Short id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Gets id. - -private: - short id_; -}; - -My_Test_Object::My_Test_Object (CORBA::Short id) - : id_ (id) -{ -} - -My_Test_Object::~My_Test_Object (void) -{ -} - -CORBA::Short -My_Test_Object::id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return id_; -} - -void -My_Test_Object::id (CORBA::Short id ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - id_ = id; -} - -// Constructor. - -CosNaming_Client::CosNaming_Client (void) - : argc_ (0), - argv_ (0), - test_ (0) -{ -} - -// Parses the command line arguments and returns an error status. - -int -CosNaming_Client::parse_args (void) -{ - ACE_Get_Opt get_opts (argc_, argv_, "p:dstieym:c:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'd': // debug flag - TAO_debug_level++; - break; - case 's': - if (this->test_ == 0) - ACE_NEW_RETURN (this->test_, - Simple_Test, - -1); - break; - case 'm': - if (this->test_ == 0) - { - int size = ACE_OS::atoi (get_opts.opt_arg ()); - if (size <= 0) - size = 10; - - ACE_NEW_RETURN (this->test_, - MT_Test (this->orbmgr_.orb (), size), - -1); - } - - break; - case 't': - if (this->test_ == 0) - ACE_NEW_RETURN (this->test_, - Tree_Test, - -1); - break; - case 'i': - if (this->test_ == 0) - ACE_NEW_RETURN (this->test_, - Iterator_Test, - -1); - break; - case 'e': - if (this->test_ == 0) - ACE_NEW_RETURN (this->test_, - Exceptions_Test, - -1); - break; - case 'y': - if (this->test_ == 0) - ACE_NEW_RETURN (this->test_, - Destroy_Test, - -1); - break; - case 'p': - if (this->test_ == 0) - { - FILE * ior_output_file = - ACE_OS::fopen (get_opts.opt_arg (), "w"); - - if (ior_output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to open %s for writing: %p\n", - get_opts.opt_arg ()), -1); - - ACE_NEW_RETURN (this->test_, - Persistent_Test_Begin (this->orbmgr_.orb (), - ior_output_file), - -1); - } - break; - case 'c': - if (this->test_ == 0) - ACE_NEW_RETURN (this->test_, - Persistent_Test_End (this->orbmgr_.orb (), - get_opts.opt_arg ()), - -1); - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "Argument %c \n usage: %s" - " [-d]" - " [-s or -e or -t or -i or -y or -p or -c<ior> or -m<size>]" - "\n", - c, - this->argv_ [0]), - -1); - } - - if (this->test_ == 0) - ACE_NEW_RETURN (this->test_, - Simple_Test, - -1); - - // Indicates successful parsing of command line. - return 0; -} - -// Execute client example code. - -int -CosNaming_Client::run (void) -{ - return test_->execute (naming_client_); -} - -CosNaming_Client::~CosNaming_Client (void) -{ - delete test_; -} - -int -CosNaming_Client::init (int argc, char **argv) -{ - this->argc_ = argc; - this->argv_ = argv; - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Initialize ORB. - this->orbmgr_.init (this->argc_, - this->argv_ - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - this->orbmgr_.activate_poa_manager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Parse command line and verify parameters. - if (this->parse_args () == -1) - return -1; - - CORBA::ORB_var orb = this->orbmgr_.orb (); - return this->naming_client_.init (orb.in ()); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "init"); - // and return -1 below . . . - } - ACE_ENDTRY; - - return -1; -} - -MT_Test::MT_Test (CORBA::ORB_ptr orb, - int size) - :size_ (size), - orb_ (orb), - name_service_ior_ (0) -{ -} - -int -MT_Test::svc (void) -{ - // Obtain object reference to the Naming Service (create new stub.) - - CosNaming::NamingContext_var name_service; - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY_EX (SETUP) - { - CORBA::Object_var name_service_obj = - orb_->string_to_object (name_service_ior_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK_EX (SETUP); - - name_service = - CosNaming::NamingContext::_narrow (name_service_obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK_EX (SETUP); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception in MT test setup"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - if (name_service.in () == 0) - return -1; - - // Bind the object. - ACE_TRY_EX (BIND) - { - name_service->bind (test_name_, - test_ref_.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK_EX (BIND); - ACE_DEBUG ((LM_DEBUG, - "Bound name OK in thread %t\n")); - } - ACE_CATCH (CosNaming::NamingContext::AlreadyBound, ex) - { - ACE_DEBUG ((LM_DEBUG, - "Unable to bind in thread %t\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception in MT test bind"); - // This debug statement works around a IRIX/MIPSPro 7.3 bug (it - // fails with optimize=1 debug=0; but works with any other - // settings for those flags). - ACE_DEBUG ((LM_DEBUG, "MT_Test(%t) - bind[3] %d\n", - test_name_.length ())); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - // Resolve the object from the Naming Context. - ACE_TRY_EX (RESOLVE) - { - CORBA::Object_var result_obj_ref = - name_service->resolve (test_name_ - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK_EX (RESOLVE); - - Test_Object_var result_object = - Test_Object::_narrow (result_obj_ref.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK_EX (RESOLVE); - - if (!CORBA::is_nil (result_object.in ())) - { - CORBA::Short id = result_object->id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK_EX (RESOLVE); - - if (id == CosNaming_Client::OBJ1_ID) - ACE_DEBUG ((LM_DEBUG, - "Resolved name OK in thread %t\n")); - } - } - ACE_CATCH (CosNaming::NamingContext::NotFound, ex) - { - ACE_DEBUG ((LM_DEBUG, - "Unable to resolve in thread %t\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception in MT test resolve"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - // Unbind the object from the Naming Context. - ACE_TRY_EX (UNBIND) - { - name_service->unbind (test_name_ - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK_EX (UNBIND); - ACE_DEBUG ((LM_DEBUG, - "Unbound name OK in thread %t\n")); - } - ACE_CATCH (CosNaming::NamingContext::NotFound, ex) - { - ACE_DEBUG ((LM_DEBUG, - "Unable to unbind in thread %t\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception in MT test unbind"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} - -int -MT_Test::execute (TAO_Naming_Client &root_context) -{ - if (CORBA::is_nil (this->orb_.in ())) - return -1; - - // Create data which will be used by all threads. - - // Dummy object instantiation. - My_Test_Object *test_obj_impl = - new My_Test_Object (CosNaming_Client::OBJ1_ID); - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - test_ref_ = - test_obj_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - test_obj_impl->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Get the IOR for the Naming Service. Each thread can use it - // in <string_to_object> to create its own stub for the Naming - // Service. This 'trick' is necessary, because multiple threads - // cannot be using the same stub - bad things happen... This is - // just a way to give each thread its own stub. - - CosNaming::NamingContext_var context = - root_context.get_context (); - - name_service_ior_ = - orb_->object_to_string (context.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception while instantiating dummy"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - // Create a name for dummy. - test_name_.length (1); - test_name_[0].id = CORBA::string_dup ("Foo"); - - // Spawn threads, each of which will be executing svc (). - int status = this->activate (THR_NEW_LWP | THR_JOINABLE, - size_); - - if (status == -1) - return -1; - - status = this->wait (); - return status; -} - -int -Simple_Test::execute (TAO_Naming_Client &root_context) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Dummy object instantiation. - My_Test_Object *test_obj_impl = new My_Test_Object (CosNaming_Client::OBJ1_ID); - Test_Object_var test_obj_ref = - test_obj_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Give ownership of this object to POA. - test_obj_impl->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Bind an object to the Naming Context. - CosNaming::Name test_name; - test_name.length (1); - test_name[0].id = CORBA::string_dup ("Foo"); - root_context->bind (test_name, - test_obj_ref.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, - "Bound name OK\n")); - - // Resolve the object from the Naming Context. - CORBA::Object_var result_obj_ref = - root_context->resolve (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - Test_Object_var result_object = - Test_Object::_narrow (result_obj_ref.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (!CORBA::is_nil (result_object.in ())) - { - CORBA::Short id = result_object->id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - if (id == CosNaming_Client::OBJ1_ID) - ACE_DEBUG ((LM_DEBUG, "Resolved name OK\n")); - } - - // Unbind the object from the Naming Context. - root_context->unbind (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, - "Unbound name OK\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception in Simple test"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} - -int -Tree_Test::execute (TAO_Naming_Client &root_context) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Create a tree of contexts: root->level1->level2. Bind object - // foo under context level2. - - // Bind level1 context under root. - CosNaming::Name level1; - level1.length (1); - level1[0].id = CORBA::string_dup ("level1_context"); - CosNaming::NamingContext_var level1_context; - level1_context = root_context->bind_new_context (level1 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Create a new context. - CosNaming::NamingContext_var level2_context; - level2_context = root_context->new_context (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Instantiate a dummy object and bind it under the new context. - My_Test_Object *impl1 = - new My_Test_Object (CosNaming_Client::OBJ1_ID); - Test_Object_var obj1 = impl1->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - impl1->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosNaming::Name obj_name; - obj_name.length (1); - obj_name[0].id = CORBA::string_dup ("foo"); - level2_context->bind (obj_name, obj1.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Bind the context we just created under level1. - CosNaming::Name level2 (level1); - level2.length (2); - level2[1].id = CORBA::string_dup ("level2_context"); - root_context->bind_context (level2, - level2_context.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Resolve and unbind level1/level2/foo, and bind it back. - CosNaming::Name test_name (level2); - test_name.length (3); - test_name[2].id = obj_name[0].id; - CORBA::Object_var result_obj_ref = - root_context->resolve (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - Test_Object_var result_object = - Test_Object::_narrow (result_obj_ref.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (result_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "Problems with resolving foo in Tree Test - nil object ref.\n"), - -1); - - CORBA::Short id = result_object->id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (id != CosNaming_Client::OBJ1_ID) - ACE_ERROR_RETURN ((LM_ERROR, - "Problems with resolving foo in Tree Test - wrong id.\n"), - -1); - - // Unbind the object from the Naming Context and bind it back - // in. - root_context->unbind (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - root_context->bind (test_name, - obj1.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Create new context and rebind under the name level1/level2. - CosNaming::NamingContext_var new_level2_context; - new_level2_context = - root_context->new_context (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - root_context->rebind_context (level2, - new_level2_context.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Bind, resolve, rebind, and resolve foo under level1/level2. - root_context->bind (test_name, - obj1.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - result_obj_ref = root_context->resolve (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - result_object = Test_Object::_narrow (result_obj_ref.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Short obj_id = result_object->id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (result_object.in ()) - || !(obj_id == CosNaming_Client::OBJ1_ID)) - ACE_ERROR_RETURN ((LM_ERROR, - "Problems in the Tree Test\n"), - -1); - - My_Test_Object *impl2 = - new My_Test_Object (CosNaming_Client::OBJ2_ID); - Test_Object_var obj2 = impl2->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - impl2->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - root_context->rebind (test_name, - obj2.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - result_obj_ref = root_context->resolve (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - result_object = Test_Object::_narrow (result_obj_ref.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - obj_id = result_object->id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (result_object.in ()) - || !( obj_id == CosNaming_Client::OBJ2_ID)) - ACE_ERROR_RETURN ((LM_ERROR, - "Problems with rebind in Tree Test\n"), - -1); - } - - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception in Tree test"); - return -1; - } - - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - ACE_DEBUG ((LM_DEBUG, - "All functions work properly \n")); - return 0; -} - -int -Exceptions_Test::execute (TAO_Naming_Client &root_context) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Set things up. - - // Create a tree of contexts root->level1->level2. - CosNaming::Name context_name; - context_name.length (1); - context_name[0].id = CORBA::string_dup ("level1_context"); - CosNaming::NamingContext_var level1_context; - level1_context = root_context->bind_new_context (context_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - context_name[0].id = CORBA::string_dup ("level2_context"); - CosNaming::NamingContext_var level2_context; - level2_context = level1_context->bind_new_context (context_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Bind a dummy object foo under each context. - My_Test_Object *impl = new My_Test_Object; - Test_Object_var obj = impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - impl->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosNaming::Name object_name; - object_name.length (1); - object_name[0].id = CORBA::string_dup ("foo"); - root_context->bind (object_name, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - level1_context->bind (object_name, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - level2_context->bind (object_name, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Run exceptions tests. - invalid_name_test (root_context - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - already_bound_test (root_context - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - already_bound_test2 (root_context - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - not_found_test (root_context - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - not_found_test2 (root_context - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - not_found_test3 (root_context - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception in Exceptions test"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} - -void -Exceptions_Test::invalid_name_test (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - CosNaming::Name test_name; - test_name.length (0); - - root_context->resolve (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Invalid name test failed\n")); - } - ACE_CATCH (CosNaming::NamingContext::InvalidName, ex) - { - ACE_DEBUG ((LM_DEBUG, - "InvalidName exception works properly\n")); - } - ACE_CATCHANY - { - ACE_DEBUG ((LM_DEBUG, "Invalid name test failed\n")); - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; -} - -void -Exceptions_Test::already_bound_test (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - CosNaming::Name test_name; - test_name.length (1); - test_name[0].id = CORBA::string_dup ("foo"); - My_Test_Object *impl = new My_Test_Object; - Test_Object_var obj = impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - impl->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - root_context->bind (test_name, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Already bound (case 1) test failed\n")); - } - ACE_CATCH (CosNaming::NamingContext::AlreadyBound, ex) - { - ACE_DEBUG ((LM_DEBUG, - "AlreadyBound exception (case 1) works properly\n")); - } - ACE_CATCHANY - { - ACE_DEBUG ((LM_DEBUG, "Already bound (case 1) test failed\n")); - ACE_RE_THROW; - } - - ACE_ENDTRY; - ACE_CHECK; -} - -void -Exceptions_Test::already_bound_test2 (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - CosNaming::Name test_name; - test_name.length (2); - test_name[0].id = CORBA::string_dup ("level1_context"); - test_name[1].id = CORBA::string_dup ("foo"); - My_Test_Object *impl = new My_Test_Object; - Test_Object_var obj = impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - impl->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - root_context->bind (test_name, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Already bound (case 2) test failed\n")); - } - ACE_CATCH (CosNaming::NamingContext::AlreadyBound, ex) - { - ACE_DEBUG ((LM_DEBUG, - "AlreadyBound exception (case 2) works properly\n")); - } - ACE_CATCHANY - { - ACE_DEBUG ((LM_DEBUG, "Already bound (case 2) test failed\n")); - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; -} - -void -Exceptions_Test::not_found_test (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - CosNaming::Name test_name; - test_name.length (3); - test_name[0].id = CORBA::string_dup ("level1_context"); - test_name[1].id = CORBA::string_dup ("level2_context"); - test_name[2].id = CORBA::string_dup ("bar"); - - root_context->unbind (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Not found test failed\n")); - } - ACE_CATCH (CosNaming::NamingContext::NotFound, ex) - { - if (ex.why == CosNaming::NamingContext::missing_node && - ex.rest_of_name.length () == 1 - && ACE_OS::strcmp (ex.rest_of_name[0].id.in (), - "bar") == 0) - ACE_DEBUG ((LM_DEBUG, - "NotFound exception (case 1) works properly\n")); - else - ACE_DEBUG ((LM_DEBUG, - "NotFound exception (case 1)" - " - parameters aren't set correctly\n")); - } - ACE_CATCHANY - { - ACE_DEBUG ((LM_DEBUG, "Not found test failed\n")); - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; -} - -void -Exceptions_Test::not_found_test2 (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - CosNaming::Name test_name; - test_name.length (3); - test_name[0].id = CORBA::string_dup ("level1_context"); - test_name[1].id = CORBA::string_dup ("level3_context"); - test_name[2].id = CORBA::string_dup ("foo"); - - root_context->unbind (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Unbind test failed\n")); - } - ACE_CATCH (CosNaming::NamingContext::NotFound, ex) - { - if (ex.why == CosNaming::NamingContext::missing_node - && ex.rest_of_name.length () == 2 - && ACE_OS::strcmp (ex.rest_of_name[0].id.in (), - "level3_context") == 0 - && ACE_OS::strcmp (ex.rest_of_name[1].id.in (), - "foo") == 0) - ACE_DEBUG ((LM_DEBUG, - "NotFound exception (case 2) works properly\n")); - else - ACE_DEBUG ((LM_DEBUG, - "NotFound exception (case 2)" - " - parameters aren't set correctly\n")); - } - ACE_CATCHANY - { - ACE_DEBUG ((LM_DEBUG, "Unbind test failed\n")); - ACE_RE_THROW; - } - - ACE_ENDTRY; - ACE_CHECK; -} - -void -Exceptions_Test::not_found_test3 (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - CosNaming::Name test_name; - test_name.length (3); - test_name[0].id = CORBA::string_dup ("level1_context"); - test_name[1].id = CORBA::string_dup ("foo"); - test_name[2].id = CORBA::string_dup ("foo"); - - root_context->unbind (test_name ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Not found (case 3) test failed - no exception was thrown\n")); - } - ACE_CATCH (CosNaming::NamingContext::NotFound, ex) - { - if (ex.why == CosNaming::NamingContext::not_context - && ex.rest_of_name.length () == 2 - && ACE_OS::strcmp (ex.rest_of_name[0].id.in (), - "foo") == 0 - && ACE_OS::strcmp (ex.rest_of_name[1].id.in (), - "foo") == 0) - ACE_DEBUG ((LM_DEBUG, - "NotFound exception (case 3) works properly\n")); - else - ACE_DEBUG ((LM_DEBUG, - "NotFound exception (case 3)" - " - parameters aren't set correctly\n")); - } - ACE_CATCHANY - { - ACE_DEBUG ((LM_DEBUG, "Not found (case 3) test failed\n")); - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; -} - -int -Iterator_Test::execute (TAO_Naming_Client &root_context) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Instantiate four dummy objects. - My_Test_Object *impl = new My_Test_Object; - Test_Object_var obj = impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - impl->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Bind objects to the naming context. - CosNaming::Name name1; - name1.length (1); - name1[0].id = CORBA::string_dup ("foo1"); - CosNaming::Name name2; - name2.length (1); - name2[0].id = CORBA::string_dup ("foo2"); - CosNaming::Name name3; - name3.length (1); - name3[0].id = CORBA::string_dup ("foo3"); - CosNaming::Name name4; - name4.length (1); - name4[0].id = CORBA::string_dup ("foo4"); - root_context->bind (name1, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - root_context->bind (name2, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - root_context->bind (name3, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - root_context->bind (name4, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // List the content of the Naming Context. - CosNaming::BindingIterator_var iter; - CosNaming::BindingList_var bindings_list; - root_context->list (1, - bindings_list.out (), - iter.out () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (CORBA::is_nil (iter.in ()) - || bindings_list->length () != 1 - || bindings_list[0u].binding_type != CosNaming::nobject) - ACE_ERROR_RETURN ((LM_ERROR, - "CosNaming::list does not function properly\n"), - -1); - ACE_DEBUG ((LM_DEBUG, - "First binding: %s\n", - bindings_list[0u].binding_name[0u].id.in ())); - - // Invoke operations on the iterator. - CosNaming::Binding_var binding; - iter->next_one (binding.out () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (binding->binding_type != CosNaming::nobject) - ACE_ERROR_RETURN ((LM_ERROR, - "CosNaming::next_one does not function properly\n"), - -1); - ACE_DEBUG ((LM_DEBUG, - "Second binding: %s\n", - binding->binding_name[0].id.in ())); - - iter->next_n (2, bindings_list.out () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (bindings_list->length () != 2 - || bindings_list[0u].binding_type != CosNaming::nobject - || bindings_list[1u].binding_type != CosNaming::nobject) - ACE_ERROR_RETURN ((LM_ERROR, - "CosNaming::BindingIterator does not function properly\n"), - -1); - ACE_DEBUG ((LM_DEBUG, - "Third binding: %s\n" - "Fourth binding: %s\n", - bindings_list[0u].binding_name[0].id.in (), - bindings_list[1u].binding_name[0].id.in ())); - - // We already iterated over all the bindings, so the following - // should return false. - CORBA::Boolean result = iter->next_one (binding.out () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (result) - ACE_ERROR_RETURN ((LM_ERROR, - "CosNaming::BindingIterator does not function properly\n"), - -1); - iter->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception in Iterator test"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} - -int -Destroy_Test::execute (TAO_Naming_Client &root_context) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Create a context and bind an object under it. - - CosNaming::NamingContext_var my_context; - my_context = root_context->new_context (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Bind a dummy object foo under my_context. - My_Test_Object *impl = new My_Test_Object; - Test_Object_var obj = impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - impl->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosNaming::Name object_name; - object_name.length (1); - object_name[0].id = CORBA::string_dup ("foo"); - my_context->bind (object_name, - obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Do the testing. - not_empty_test (my_context - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - my_context->unbind (object_name ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - my_context->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - not_exist_test (my_context - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception in Destroy test"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} - -void -Destroy_Test::not_empty_test (CosNaming::NamingContext_var &ref - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - ref->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_CATCH (CosNaming::NamingContext::NotEmpty, ex) - { - ACE_DEBUG ((LM_DEBUG, - "NotEmpty exception works properly\n")); - } - ACE_ENDTRY; - ACE_CHECK; -} - -void -Destroy_Test::not_exist_test (CosNaming::NamingContext_var &ref - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - ref->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) - { - ACE_DEBUG ((LM_DEBUG, - "Destroy works properly\n")); - } - ACE_ENDTRY; - ACE_CHECK; -} - -Persistent_Test_Begin::Persistent_Test_Begin (CORBA::ORB_ptr orb, - FILE * ior_output_file) - : orb_ (orb), - file_ (ior_output_file) -{ -} - -Persistent_Test_Begin::~Persistent_Test_Begin (void) -{ -} - -int -Persistent_Test_Begin::execute (TAO_Naming_Client &root_context) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Create a name structure we will reuse. - CosNaming::Name test_name; - test_name.length (1); - test_name[0].id = CORBA::string_dup ("level1"); - - // Create and bind a naming context under the <root> context. - CosNaming::NamingContext_var level1_context = - root_context->bind_new_context (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Create and bind a naming context under <level1> context. - test_name[0].id = CORBA::string_dup ("level2"); - CosNaming::NamingContext_var level2_context = - level1_context->bind_new_context (test_name - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Log the ior of <level1_context> for use by <Persistent_Test_End>. - CORBA::String_var ior = - orb_->object_to_string (level1_context.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_OS::fprintf (this->file_, - "%s", - ior.in ()); - ACE_OS::fclose (this->file_); - - ACE_DEBUG ((LM_DEBUG, "Persistent Naming test (part 1) OK.\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Unexpected exception in Persistent Test (part 1)"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} - -Persistent_Test_End::Persistent_Test_End (CORBA::ORB_ptr orb, - const char *ior) - : orb_ (orb), - ior_ (ior) -{ -} - -Persistent_Test_End::~Persistent_Test_End (void) -{ -} - -int -Persistent_Test_End::execute (TAO_Naming_Client &root_context) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Create a name structure we will reuse. - CosNaming::Name test_name; - test_name.length (1); - test_name[0].id = CORBA::string_dup ("level2"); - - // Convert stringified ior we got from <Persistent_Test_Begin> - // for <level1> Naming Context to Naming Context reference. - CORBA::Object_var obj = - orb_->string_to_object (ior_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CosNaming::NamingContext_var level1_context = - CosNaming::NamingContext::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (level1_context.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot narrow object to Naming Context\n"), - -1); - - // Resolve for <level2> context through the persistent ior we - // got from part 1 of this test. - obj = level1_context->resolve (test_name ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Now, resolve for <level2> context using the <root> context - // reference which we obtained through <resolve_initial_references>. - test_name.length (2); - test_name[0].id = CORBA::string_dup ("level1"); - test_name[1].id = CORBA::string_dup ("level2"); - CORBA::Object_var obj2 = - root_context->resolve (test_name ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Make sure we got the same answer through both methods. - if (obj2->_is_equivalent (obj.in ())) - ACE_DEBUG ((LM_DEBUG, "Persistent Naming test (part 2) OK.\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Unexpected exception in Persistent Test (part 2)"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} - -// This function runs the test. - -int -main (int argc, char **argv) -{ - CosNaming_Client cosnaming_client; - - if (cosnaming_client.init (argc, argv) == -1) - return 1; - - return cosnaming_client.run (); -} diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.h b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.h deleted file mode 100644 index 15eb7fe577e..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/client.h +++ /dev/null @@ -1,334 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/orbsvcs/tests -// -// = FILENAME -// client.h -// -// = DESCRIPTION -// This class tests the facilities to connect to the naming service. -// -// = AUTHORS -// Marina Spivak <marina@cs.wustl.edu> -// -// ============================================================================ - -#include "test_objectS.h" -#include "orbsvcs/CosNamingC.h" -#include "orbsvcs/Naming/Naming_Client.h" -#include "tao/PortableServer/ORB_Manager.h" -#include "ace/Task.h" - -class Naming_Test -{ - // = TITLE - // This is an abstract class which is subclassed - // to create different Naming Service tests. - // - // = DESCRIPTION - // This is a basic example of the "Strategy" pattern. This class - // provides a common interface for different tests (or - // "strategies"), so that a specific test to be used can be - // chosen at runtime. - -public: - virtual int execute (TAO_Naming_Client &root_context) = 0; - // Execute the test code. <root_context> is the context to assume - // as the root for all tests operations. -}; - -class Simple_Test : public Naming_Test -{ - // = TITLE - // This class implements a simple Naming Service test. - // - // = DESCRIPTION - // The test binds(), resolves(), and unbinds() an object - // reference from the given Naming Context. -public: - virtual int execute (TAO_Naming_Client &root_context); - // Execute the simple test code. -}; - -class MT_Test : public Naming_Test, public ACE_Task_Base -{ - // = TITLE - // This class implements a simple Multithreaded (multiclient) Naming Service test. - // - // = DESCRIPTION - // The test spawns multiple threads: each attempts to - // bind(), resolve(), and unbind() an object - // reference using the same name, and the same Naming Context. -public: - // = Initialization and termination methods. - - MT_Test (CORBA::ORB_ptr orb, - int size = 10); - // Constructor. Takes in an orb pointer and number of threads to spawn. - - virtual int execute (TAO_Naming_Client &root_context); - // Execute the MT test code. - - virtual int svc (void); - // This code is executed by each thread. - -private: - int size_; - // Number of threads to spawn. By default is set to 10. - - CORBA::ORB_var orb_; - // A pointer to our ORB. - - char* name_service_ior_; - // IOR in the string format for Naming Service we are to deal with. - // Each thread will use string_to_object() and this IOR to create - // its own NamingContext stub for invoking operations on the - // Naming Service. If all threads try to use the same stub, bad things - // happen... - - // This can be replaced with CORBA::String_var when <string_to_object> - // is fixed - this will clean up the memory properly. - - CosNaming::Name test_name_; - // Holds name used for registering the object with Naming Service. - - Test_Object_var test_ref_; - // Holds object to be registered with the Naming Service by each thread. - -}; - -class Tree_Test : public Naming_Test -{ - // = TITLE - // This class implements a test of all Naming Service functions - // on a tree of Naming Contexts. - // - // = DESCRIPTION - // Bind_context() under the root context with the name level1. - // Create_new_context(), bind() foo object into it, and - // bind the context into root/level1 under the name level2. - // Resolve (root/level1/level2/foo). - // Unbind (root/level1/level2/foo). - // Bind (root/level1/level2/foo, obj) - // Create_new_context() - // and invoke rebind_context() to substitute it for the current - // level2 context. - // Bind (root/level1/level2/foo, obj) - // Resolve (root/level1/level2/foo). - // Rebind() to have a different object under the name bar. - // Resolve (root/level1/level2/foo) to make sure correct reference is returned. -public: - virtual int execute (TAO_Naming_Client &root_context); - // Execute the tree test code. -}; - -class Iterator_Test : public Naming_Test -{ - // = TITLE - // This class implements a test of Naming Service functions - // which involve BindingIterator. - // - // = DESCRIPTION - // The test binds foo1, foo2, foo3, and foo4 objects to the - // Naming Context. It lists() one binding and receives - // BindingIterator to iterate over the rest of the bindings. It - // then invokes next_one(), next_n(2), next_one(), and destroy() - // on the iterator. -public: - virtual int execute (TAO_Naming_Client &root_context); - // Execute the iterator test code. -}; - -class Exceptions_Test : public Naming_Test -{ - // = TITLE - // This class implements a test of exceptions in the Naming Service. - // - // = DESCRIPTION - // Makes sure that Naming Service throws exceptions as expected, and - // data inside exceptions is set correctly. The test creates a tree of - // of Naming Contexts: root context -> level1 -> level2. It then binds() an - // object with the name foo to each of Naming Contexts in the tree. - // Invoke resolve() with a Name of length 0 - make sure we get InvalidName exception. - // Invoke bind( foo, obj) on root context - make sure we get AlreadyBound exception. - // Invoke bind( level1/foo, obj) on root context - make sure we get AlreadyBound exc. - // Invoke unbind( level1/level2/bar) on root context - make sure we get NotFound exc. - // with why = not_object, rest_of_name = bar. - // Invoke unbind( level1/level3/foo) on root context - make sure we get NotFound exc. - // with why = missing_node, rest_of_name = level3/foo. - // Invoke unbind( level1/foo/foo) on root context - make sure we get NotFound exc. - // with why = not_context, rest_of_name = foo/foo. -public: - virtual int execute (TAO_Naming_Client &root_context); - // Execute the exceptions test code. - -private: - // the following functions isolate specific tests due to the - // limitation of only 1 TAO_TRY being allowed per function. - - void invalid_name_test (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL); - void already_bound_test (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL); - void already_bound_test2 (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL); - void not_found_test (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL); - void not_found_test2 (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL); - void not_found_test3 (TAO_Naming_Client &root_context - ACE_ENV_ARG_DECL); -}; - -class Destroy_Test : public Naming_Test -{ - // = TITLE - // This class implements a test of destroy() function - // in the Naming Service. - // - // = DESCRIPTION - // Create a context and bind an object under it. - // Attempt to destroy the context - NotEmpty exception should be raised. - // - // Unbind the object and call destroy on the context. - // Attempt to call destroy on the object again - OBJECT_NOT_EXIST - // exception should be raised. - // -public: - virtual int execute (TAO_Naming_Client &root_context); - // Execute the destroy test code. - -private: - // = The following functions isolate specific tests. - void not_empty_test (CosNaming::NamingContext_var &ref - ACE_ENV_ARG_DECL); - void not_exist_test (CosNaming::NamingContext_var &ref - ACE_ENV_ARG_DECL); -}; - -class Persistent_Test_Begin : public Naming_Test -{ - // = TITLE - // This class implements the first part of the Persistent Naming - // Service test. - // - // = DESCRIPTION - // This test creates the Naming Context hierarchy: - // root -> level1_context -> level2_context, - // and prints out the ior of the <level1_context>. -public: - // = Initialization and termination methods. - - Persistent_Test_Begin (CORBA::ORB_ptr orb, - FILE * ior_output_file); - // Constructor. Takes in an orb pointer. - - virtual ~Persistent_Test_Begin (void); - // Destructor. - - virtual int execute (TAO_Naming_Client &root_context); - // Execute the persistent test (part 1) code. - -private: - - CORBA::ORB_var orb_; - // A pointer to our ORB (needed for object/string conversion). - - FILE *file_; - // File where we output the ior for use by part 2 of persistent test. -}; - -class Persistent_Test_End : public Naming_Test -{ - // = TITLE - // This class implements the second part of the Persistent Naming - // Service test. - // - // = DESCRIPTION - // This test attempts to resolve <level2_context> both through the - // <root> Naming Context, which it gets from <resolve_initial_references>, and - // through <level1_context> stringified ior, which it gets from part 1 of - // the persistent test. The results of both methods are then - // compared for equality. -public: - // = Initialization and termination methods. - - Persistent_Test_End (CORBA::ORB_ptr orb, - const char * ior); - // Constructor. Takes in an orb pointer and the ior received from - // <Persistent_Test_Begin>. - - virtual ~Persistent_Test_End (void); - // Destructor. - - virtual int execute (TAO_Naming_Client &root_context); - // Execute the persistent test (part 2). - -private: - - CORBA::ORB_var orb_; - // A pointer to our ORB (used for string/object conversion). - - const char* ior_; - // IOR of <level1_context> recorded during the run of part 1 of - // persistent test. -}; - -class CosNaming_Client -{ - // = TITLE, - // Defines a class that encapsulates behaviour of the CosNaming - // client example. Provides a better understanding of the logic - // in an object-oriented way. - // - // = DESCRIPTION - // This class declares an interface to run the example client for - // CosNaming CORBA server. All the complexity for initializing - // the server is hidden in the class. Just the <run> interface - // is needed. -public: - // = Initialization and termination methods. - - CosNaming_Client (void); - // Constructor. - - ~CosNaming_Client (void); - // Destructor. - - int run (void); - // Execute client example code. - - int init (int argc, char **argv); - // Initialize the client communication endpoint with server. - - // = Symbolic ids. - enum OBJ_ID - { - OBJ1_ID = 5, - OBJ2_ID = 6 - }; - -private: - int parse_args (void); - // Parses the arguments passed on the command line. - - int argc_; - // # of arguments on the command line. - - char **argv_; - // arguments from command line. - - Naming_Test *test_; - // A pointer to the specific Naming Service test a client will - // execute. - - TAO_ORB_Manager orbmgr_; - // Our ORB manager helper class. - - TAO_Naming_Client naming_client_; - // Our naming client helper class. -}; diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/corbaloc_ssliop.mpc b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/corbaloc_ssliop.mpc deleted file mode 100644 index 97620a0feb0..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/corbaloc_ssliop.mpc +++ /dev/null @@ -1,9 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Client) : namingexe, portableserver { - Source_Files { - client.cpp - } -} - diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/pvtkey-client.pem b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/pvtkey-client.pem deleted file mode 100644 index cf53308cae2..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/pvtkey-client.pem +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXwIBAAKBgQD3LcZOo8tF7BHEYMsm5pn3zYV+u6NhhvPC5G5bErY8qi8Xt4CZ -PSQPm4JmVFvLsY2H6Eme8Oe7j4bCquRuB1D/U5auKdINQ1aG2CgKqPtBy1SliHE3 -FD1Ht43O+z2mRzGHtqLowhEvFEpEVHcJLUQ7HVHPJaRNQkn80DA/nN9+5wIDAQAB -AoGBANpBJPWTU43uINIR1dAHlrRkWRfKfz1CeEMCiR8JqrhuXR7H/VlRz2Goor/Q -hS2bHal/xmH9veCznv6M/x7Yfv74hhUJxyqngNxbwGI4G+LfR3/x1fqVcweDGmv6 -LYLL4JWyDLEL5I3PEZP/dUnT6+bmmuXWU5z83itqYw8VRbsBAkEA/MnqXFlWl1KF -jTee5pijKOXGAvllrpN8MkTKM2MdjltzOkuhC1OEwhXYy86e90gRQvXAs3t7A4dT -Q5/eUYHgYQJBAPpRnYcqqDP0Rj/JqMDapwIVjMoMDQP+thB4Ey6fSRC7dYiX4+Qo -cyX8j0YnF0RYl426+Qv2O6egmOmzrQwQxEcCQQDAfUBocd7t+3iWv/PPxAr56X2O -Zjp3ZPb9kEQoPSEUda6YhV5sMXy2Dcy35O5Hfikmw9uo0C4r0bAlnma7yhoBAkEA -tI0/6ansDyVnskTbktdj1Q4EMgxFKxeC7RgfBebghdAg87hTKVO/0qt8EGbL0oFw -N0ugrW8bEkq1YQQ3kldZqwJBAJPIe/NE+NhSOoSo3kEQ70SkjU5EB2sbVxhjq6ci -UdXa+EOAna5JS5ZFMDq4AI+qU8OoSgI26hdH5S8lf10fIDo= ------END RSA PRIVATE KEY----- - diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/pvtkey.pem b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/pvtkey.pem deleted file mode 100644 index 81ba8e3f968..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/pvtkey.pem +++ /dev/null @@ -1,10 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAPXZ7YNyFU8T8PVitNwZmdwuc4tG64V/lDYHnmzolmFPQ6gvI2uo -KBQeHeJFPI6LJ5TGb8hCnypy+zbc+pve8vECAwEAAQJAE/fmZbW/a1PYT2X8AKCH -sa2ILvjMqmQpWpYV1QyzIiYQPEmQ/5GMUj/t3PZd/17BOH8aPakBT/c1Gp+os6vR -zQIhAP2RDmm6UyMrJhAtAcNC5s8nbfhKPG80Q0DZ2kiodjQfAiEA+DXqwEZlCh0j -VPzEXY7vrdQa641zQ5XIX1S/+WbCdu8CIDT9m4V86uLuoYW/4h5sXM/t7Y119itH -QMbMwFFu40UBAiEA9z+mN6An2BpMbsVXyiavREYMBuahkgprTeM7VHHzdssCIQCY -QEgmpzGzfdZoREy9B7ooNeRO919lR9qvbte9vvJvWQ== ------END RSA PRIVATE KEY----- - diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/run_test.pl b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/run_test.pl deleted file mode 100755 index a63768a2dc3..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/run_test.pl +++ /dev/null @@ -1,161 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -# $Id$ -# -*- perl -*- - -# This is a Perl script that runs some Naming Service tests. -# It runs all the tests that will run with min CORBA. -# It starts all the servers and clients as necessary. - -use lib '../../../../../bin'; -use PerlACE::Run_Test; - -# Amount of delay (in seconds) between starting a server and a client -# to allow proper server initialization. -$sleeptime = 10; - -# The default host name. -$TARGETHOSTNAME = "localhost"; - -$quiet = 0; -$use_ssl = 1; -$debug_level = 0; - -while (my $argument = shift) { - if ($argument eq '-q') { - $quiet = 1; - next; - } - if ($argument eq '-d') { - $debug_level = shift; - next; - } - print STDERR "Unknown: $argument\nUsage $0 [-q] [-d n]\n"; - exit(-1); -} - -# Variables for command-line arguments to client and server -# executables. -$ns_multicast_port = 10001 + PerlACE::uniqueid (); # Can not be 10000 on Chorus 4.0 -$ns_orb_port = 12000 + PerlACE::uniqueid (); -$ns_ssl_port = 14000 + PerlACE::uniqueid (); -$iorfile = PerlACE::LocalFile ("ns.ior"); -$persistent_ior_file = PerlACE::LocalFile ("pns.ior"); -$persistent_log_file = PerlACE::LocalFile ("test_log"); -$data_file = PerlACE::LocalFile ("test_run.data"); - -$status = 0; - -sub name_server -{ - my $args = "-ORBNameServicePort $ns_multicast_port -o $iorfile -m 1 @_"; - my $prog = "../../../Naming_Service/Naming_Service"; - $NS = new PerlACE::Process ($prog, $args); - - unlink $iorfile; - - print STDERR "CommandLine: server " . $NS->Arguments() . "\n\n" unless $quiet; - $NS->Spawn (); - - if (PerlACE::waitforfile_timed ($iorfile, $sleeptime) == -1) { - print STDERR "ERROR: cannot find IOR file <$iorfile>\n"; - $NS->Kill (); - exit 1; - } -} - -sub client -{ - my $args = "@_"." "; - my $prog = "client"; - - $CL = new PerlACE::Process ($prog, $args); - - print STDERR "CommandLine: client " . $CL->Arguments() . "\n\n" unless $quiet; - $client = $CL->SpawnWaitKill (60); - - if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; - } -} - -## The options below have been reordered due to a -## initialization problem (within the Naming_Service) -## that has only been seen on Windows XP. - -$orb_debug_level = ($quiet || $debug_level == 0) ? "" : "-ORBDebugLevel $debug_level"; - -# Options for all simple tests recognized by the 'client' program. -@opts = ( - "-s -ORBInitRef NameService=corbaloc:ssliop:$TARGETHOSTNAME:$ns_ssl_port/NameService" - . " -ORBSvcConf client.conf $orb_debug_level", - "-t -ORBInitRef NameService=corbaloc:ssliop:$TARGETHOSTNAME:$ns_ssl_port/NameService" - . " -ORBSvcConf client.conf $orb_debug_level", - "-i -ORBInitRef NameService=corbaloc:ssliop:$TARGETHOSTNAME:$ns_ssl_port/NameService" - . " -ORBSvcConf client.conf $orb_debug_level", - "-e -ORBInitRef NameService=corbaloc:ssliop:$TARGETHOSTNAME:$ns_ssl_port/NameService" - . " -ORBSvcConf client.conf $orb_debug_level", - "-y -ORBInitRef NameService=corbaloc:ssliop:$TARGETHOSTNAME:$ns_ssl_port/NameService" - . " -ORBSvcConf client.conf $orb_debug_level", - - ); - -@server_opts = ( - "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port/ssl_port=$ns_ssl_port" - . " -ORBSvcConf server.conf $orb_debug_level", - "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port/ssl_port=$ns_ssl_port" - . " -ORBSvcConf server.conf $orb_debug_level", - "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port/ssl_port=$ns_ssl_port" - . " -ORBSvcConf server.conf $orb_debug_level", - "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port/ssl_port=$ns_ssl_port" - . " -ORBSvcConf server.conf $orb_debug_level", - "-ORBEndpoint iiop://$TARGETHOSTNAME:$ns_orb_port/ssl_port=$ns_ssl_port" - . " -ORBSvcConf server.conf $orb_debug_level", - - ); - -@comments = ( - "(SSL) Simple Test:", - "(SSL) Tree Test:", - "(SSL) Iterator Test:", - "(SSL) Exceptions Test:", - "(SSL) Destroy Test:", - ); - -$test_number = 0; - -unlink ($persistent_ior_file, $persistent_log_file); - -# Run server and client for each of the tests. Client uses ior in a -# file to bootstrap to the server. -foreach $o (@opts) { - - print STDERR "\n " . $comments[$test_number]; - if ($use_ssl == 0 && $comments[$test_number] =~ /SSL/) { - print STDERR " - Skipping, use -s to run the SSL tests"; - next; - } - - print STDERR "\n"; - name_server ($server_opts[$test_number]); - client ($o); - - $NS->Kill (); - - ## For some reason, only on Windows XP, we need to - ## wait before starting another Naming_Service when - ## the mmap persistence option is used - if ($^O eq "MSWin32") { - sleep(1); - } - - $test_number++; -} - -unlink ($persistent_ior_file, $persistent_log_file); -unlink $iorfile; - -exit $status; diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/selfsigncert-client.pem b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/selfsigncert-client.pem deleted file mode 100644 index dc0a69d76e6..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/selfsigncert-client.pem +++ /dev/null @@ -1,24 +0,0 @@ ------BEGIN CERTIFICATE----- -MIID3zCCA0igAwIBAgIBADANBgkqhkiG9w0BAQUFADCBrDELMAkGA1UEBhMCVVMx -ETAPBgNVBAgTCE1pc3NvdXJpMRMwEQYDVQQHEwpDcmV2ZSBDb3JlMR4wHAYDVQQK -ExVPYmplY3QgQ29tcHV0aW5nIEluYy4xETAPBgNVBAsTCFRBTyBUZWFtMRswGQYD -VQQDExJvY2kxMTc5Lm9jaXdlYi5jb20xJTAjBgkqhkiG9w0BCQEWFmplbGlhemtv -dl9pQG9jaXdlYi5jb20wHhcNMDQwOTEwMTY0MjMwWhcNMDUwOTEwMTY0MjMxWjCB -rDELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE1pc3NvdXJpMRMwEQYDVQQHEwpDcmV2 -ZSBDb3JlMR4wHAYDVQQKExVPYmplY3QgQ29tcHV0aW5nIEluYy4xETAPBgNVBAsT -CFRBTyBUZWFtMRswGQYDVQQDExJvY2kxMTc5Lm9jaXdlYi5jb20xJTAjBgkqhkiG -9w0BCQEWFmplbGlhemtvdl9pQG9jaXdlYi5jb20wgZ8wDQYJKoZIhvcNAQEBBQAD -gY0AMIGJAoGBAPctxk6jy0XsEcRgyybmmffNhX67o2GG88LkblsStjyqLxe3gJk9 -JA+bgmZUW8uxjYfoSZ7w57uPhsKq5G4HUP9Tlq4p0g1DVobYKAqo+0HLVKWIcTcU -PUe3jc77PaZHMYe2oujCES8USkRUdwktRDsdUc8lpE1CSfzQMD+c337nAgMBAAGj -ggENMIIBCTAdBgNVHQ4EFgQUgtnhUdIQh1ESq81PL+urdJj1LRkwgdkGA1UdIwSB -0TCBzoAUgtnhUdIQh1ESq81PL+urdJj1LRmhgbKkga8wgawxCzAJBgNVBAYTAlVT -MREwDwYDVQQIEwhNaXNzb3VyaTETMBEGA1UEBxMKQ3JldmUgQ29yZTEeMBwGA1UE -ChMVT2JqZWN0IENvbXB1dGluZyBJbmMuMREwDwYDVQQLEwhUQU8gVGVhbTEbMBkG -A1UEAxMSb2NpMTE3OS5vY2l3ZWIuY29tMSUwIwYJKoZIhvcNAQkBFhZqZWxpYXpr -b3ZfaUBvY2l3ZWIuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD -gYEAVZSDOJ40+iAJPb1GZWmmh5y5Y1DVXsQF5vRENYq15Pi5Y9GBhHaYFn3qjN2U -+zyO2Cp2IJJG4HNazhBoDEj7EhDsxEyOYZiG2pd6BLe1dPl/viy6ysvdijjpcXw7 -bFPbXpCIa5rg8VKQsGYscWerLxvi79uoo+p6DrOU1FxDcYo= ------END CERTIFICATE----- - diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/selfsigncert.pem b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/selfsigncert.pem deleted file mode 100644 index e616730ca63..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/selfsigncert.pem +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICeDCCAiKgAwIBAgIBADANBgkqhkiG9w0BAQQFADBjMQswCQYDVQQGEwJVUzEL -MAkGA1UECBMCTU8xDDAKBgNVBAcTA1NUTDELMAkGA1UEChMCV1UxDDAKBgNVBAsT -A0RPQzELMAkGA1UEAxMCS0ExETAPBgkqhkiG9w0BCQEWAktBMB4XDTAxMDgyNzE2 -NTUxMVoXDTAxMDkyNjE2NTUxMVowYzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAk1P -MQwwCgYDVQQHEwNTVEwxCzAJBgNVBAoTAldVMQwwCgYDVQQLEwNET0MxCzAJBgNV -BAMTAktBMREwDwYJKoZIhvcNAQkBFgJLQTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgC -QQD12e2DchVPE/D1YrTcGZncLnOLRuuFf5Q2B55s6JZhT0OoLyNrqCgUHh3iRTyO -iyeUxm/IQp8qcvs23Pqb3vLxAgMBAAGjgcAwgb0wHQYDVR0OBBYEFL8LnC8csuIX -+TUw6FCoReB27PHoMIGNBgNVHSMEgYUwgYKAFL8LnC8csuIX+TUw6FCoReB27PHo -oWekZTBjMQswCQYDVQQGEwJVUzELMAkGA1UECBMCTU8xDDAKBgNVBAcTA1NUTDEL -MAkGA1UEChMCV1UxDDAKBgNVBAsTA0RPQzELMAkGA1UEAxMCS0ExETAPBgkqhkiG -9w0BCQEWAktBggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADQQAZP9CT -TVRxAz3Acxxxn32rsnwSeNJr1uTA4hew7f4QZ187oZia+rcFLOILrwgCmtqEmWVj -dj6COUrqKo60BI5V ------END CERTIFICATE----- diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/server.conf b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/server.conf deleted file mode 100644 index 672a471014d..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/server.conf +++ /dev/null @@ -1,6 +0,0 @@ -dynamic SSLIOP_Factory Service_Object * - TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() - "-SSLPrivateKey PEM:pvtkey.pem -SSLCertificate PEM:selfsigncert.pem" -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" - - diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/server.conf.xml b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/server.conf.xml deleted file mode 100644 index 5aa645eb3bf..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/server.conf.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version='1.0'?> -<!-- Converted from server.conf by svcconf-convert.pl --> -<ACE_Svc_Conf> - <dynamic id="SSLIOP_Factory" type="Service_Object"> - <initializer path="TAO_SSLIOP" init="_make_TAO_SSLIOP_Protocol_Factory" params="-SSLPrivateKey PEM:pvtkey.pem -SSLCertificate PEM:selfsigncert.pem"/> - </dynamic> - <static id="Resource_Factory" params="-ORBProtocolFactory SSLIOP_Factory"/> -</ACE_Svc_Conf> diff --git a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/test_object.idl b/TAO/orbsvcs/tests/Security/ssliop_corbaloc/test_object.idl deleted file mode 100644 index 4737f6dc6c8..00000000000 --- a/TAO/orbsvcs/tests/Security/ssliop_corbaloc/test_object.idl +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -interface Test_Object -{ - // = TITLE - // This is a simple interface that tests the Naming Service. - - attribute short id; - // This provides an easy way to differentiate objects if each - // objects is served by a separate servant. -}; diff --git a/TAO/performance-tests/AMI_Latency/Roundtrip.cpp b/TAO/performance-tests/AMI_Latency/Roundtrip.cpp deleted file mode 100644 index c9e68d98406..00000000000 --- a/TAO/performance-tests/AMI_Latency/Roundtrip.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// $Id$ -// -#include "Roundtrip.h" - -ACE_RCSID(AMI_Latency, Roundtrip, "$Id$") - -Roundtrip::Roundtrip (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -Test::Timestamp -Roundtrip::test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return send_time; -} - -void -Roundtrip::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/performance-tests/AMI_Latency/Roundtrip.h b/TAO/performance-tests/AMI_Latency/Roundtrip.h deleted file mode 100644 index efef33dd7e6..00000000000 --- a/TAO/performance-tests/AMI_Latency/Roundtrip.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -#ifndef ROUNDTRIP_H -#define ROUNDTRIP_H -#include "ace/pre.h" - -#include "TestS.h" - -#if defined (_MSC_VER) -# if (_MSC_VER >= 1200) -# pragma warning(push) -# endif /* _MSC_VER >= 1200 */ -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - -/// Implement the Test::Roundtrip interface -class Roundtrip - : public virtual POA_Test::Roundtrip - , public virtual PortableServer::RefCountServantBase -{ -public: - /// Constructor - Roundtrip (CORBA::ORB_ptr orb); - - // = The skeleton methods - virtual Test::Timestamp test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - /// Use an ORB reference to conver strings to objects and shutdown - /// the application. - CORBA::ORB_var orb_; -}; - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include "ace/post.h" -#endif /* ROUNDTRIP_H */ diff --git a/TAO/performance-tests/AMI_Latency/Roundtrip_Handler.cpp b/TAO/performance-tests/AMI_Latency/Roundtrip_Handler.cpp deleted file mode 100644 index 5f0061601e4..00000000000 --- a/TAO/performance-tests/AMI_Latency/Roundtrip_Handler.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -// $Id$ -// -#include "Roundtrip_Handler.h" - -ACE_RCSID(AMI_Latency, Roundtrip, "$Id$") - -Roundtrip_Handler::Roundtrip_Handler (int expected_callbacks) - : pending_callbacks_ (expected_callbacks) -{ -} - -int -Roundtrip_Handler::pending_callbacks (void) const -{ - return this->pending_callbacks_; -} - -void -Roundtrip_Handler::dump_results (ACE_UINT32 gsf) -{ - this->latency_stats_.dump_results ("AMI Latency", gsf); -} - -void -Roundtrip_Handler::test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->pending_callbacks_--; - - ACE_hrtime_t now = ACE_OS::gethrtime (); - this->latency_stats_.sample (now - send_time); -} - -void -Roundtrip_Handler::test_method_excep (Test::AMI_RoundtripExceptionHolder *holder - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_TRY - { - this->pending_callbacks_--; - holder->raise_test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "test_method:"); - } - ACE_ENDTRY; -} - -void -Roundtrip_Handler::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Roundtrip_Handler::shutdown_excep (Test::AMI_RoundtripExceptionHolder *holder - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_TRY - { - holder->raise_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "shutdown:"); - } - ACE_ENDTRY; -} diff --git a/TAO/performance-tests/AMI_Latency/Roundtrip_Handler.h b/TAO/performance-tests/AMI_Latency/Roundtrip_Handler.h deleted file mode 100644 index ae777f50f20..00000000000 --- a/TAO/performance-tests/AMI_Latency/Roundtrip_Handler.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// $Id$ -// - -#ifndef ROUNDTRIP_HANDLER_H -#define ROUNDTRIP_HANDLER_H -#include "ace/pre.h" - -#include "TestS.h" -#include "ace/Basic_Stats.h" - -#if defined (_MSC_VER) -# if (_MSC_VER >= 1200) -# pragma warning(push) -# endif /* _MSC_VER >= 1200 */ -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - -/// Implement the Test::Roundtrip interface -class Roundtrip_Handler - : public virtual POA_Test::AMI_RoundtripHandler - , public virtual PortableServer::RefCountServantBase -{ -public: - /// Constructor - Roundtrip_Handler (int expected_callbacks); - - /// Return the number of pending callbacks - int pending_callbacks (void) const; - - /// Dump the results - void dump_results (ACE_UINT32 gsf); - - // = The skeleton methods - virtual void test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void test_method_excep (Test::AMI_RoundtripExceptionHolder *holder - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void shutdown_excep (Test::AMI_RoundtripExceptionHolder *holder - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - /// The number of callbacks not received yet - int pending_callbacks_; - - /// Collect the latency results - ACE_Basic_Stats latency_stats_; -}; - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include "ace/post.h" -#endif /* ROUNDTRIP_H */ diff --git a/TAO/performance-tests/AMI_Latency/Server_Task.cpp b/TAO/performance-tests/AMI_Latency/Server_Task.cpp deleted file mode 100644 index 6df92f32a3f..00000000000 --- a/TAO/performance-tests/AMI_Latency/Server_Task.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// $Id$ -// -#include "Server_Task.h" - -ACE_RCSID(AMI_Latency, Server_Task, "$Id$") - -Server_Task::Server_Task (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -int -Server_Task::svc (void) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY {} ACE_ENDTRY; - return 0; -} diff --git a/TAO/performance-tests/AMI_Latency/client.cpp b/TAO/performance-tests/AMI_Latency/client.cpp deleted file mode 100644 index 0d396c4b67b..00000000000 --- a/TAO/performance-tests/AMI_Latency/client.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// $Id$ - -#include "Roundtrip_Handler.h" -#include "tao/debug.h" -#include "ace/Get_Opt.h" -#include "ace/High_Res_Timer.h" -#include "ace/Sched_Params.h" -#include "ace/Stats.h" - -ACE_RCSID(AMI_Latency, client, "$Id$") - -const char *ior = "file://test.ior"; - -ACE_hrtime_t throughput_base; - -int niterations = 1000; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "k:i:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'i': - niterations = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "-i <niterations> " - "-p <period (msecs)> " - "-b <burst size> " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "server (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "server (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var object = - orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Roundtrip_var roundtrip = - Test::Roundtrip::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (roundtrip.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "Nil Test::Roundtrip reference <%s>\n", - ior), - 1); - - for (int j = 0; j < 100; ++j) - { - ACE_hrtime_t start = 0; - (void) roundtrip->test_method (start ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - Roundtrip_Handler *roundtrip_handler_impl; - ACE_NEW_RETURN (roundtrip_handler_impl, - Roundtrip_Handler (niterations), - 1); - PortableServer::ServantBase_var owner_transfer(roundtrip_handler_impl); - - Test::AMI_RoundtripHandler_var roundtrip_handler = - roundtrip_handler_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_hrtime_t test_start = ACE_OS::gethrtime (); - - for (int i = 0; i != niterations; ++i) - { - // Invoke asynchronous operation.... - roundtrip->sendc_test_method (roundtrip_handler.in (), - ACE_OS::gethrtime () - ACE_ENV_ARG_PARAMETER); - if (orb->work_pending (ACE_ENV_SINGLE_ARG_PARAMETER)) - orb->perform_work (ACE_ENV_SINGLE_ARG_PARAMETER); - - ACE_TRY_CHECK; - } - - ACE_Time_Value tv (0, 2000); - - while (roundtrip_handler_impl->pending_callbacks ()) - { - orb->perform_work (tv ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_hrtime_t test_end = ACE_OS::gethrtime (); - - ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - ACE_DEBUG ((LM_DEBUG, "done\n")); - - roundtrip_handler_impl->dump_results (gsf); - - ACE_Throughput_Stats::dump_throughput ("Total", gsf, - test_end - test_start, - niterations); - - roundtrip->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught: "); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/AMI_Latency/server.cpp b/TAO/performance-tests/AMI_Latency/server.cpp deleted file mode 100644 index 74498dc13e0..00000000000 --- a/TAO/performance-tests/AMI_Latency/server.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// $Id$ - -#include "Roundtrip.h" -#include "Server_Task.h" -#include "ace/Get_Opt.h" -#include "ace/Sched_Params.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(AMI_Latency, server, "$Id$") - -const char *ior_output_file = "test.ior"; -int nthreads = 4; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:n:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - - case 'n': - nthreads = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <iorfile> " - "-n <nthreads> " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, - priority); - - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, - priority); - - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "server (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "server (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - Roundtrip *roundtrip_impl; - ACE_NEW_RETURN (roundtrip_impl, - Roundtrip (orb.in ()), - 1); - PortableServer::ServantBase_var owner_transfer(roundtrip_impl); - - Test::Roundtrip_var roundtrip = - roundtrip_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (roundtrip.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // If the ior_output_file exists, output the ior to it - FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_output_file), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - Server_Task server_task (orb.in ()); - if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, - nthreads) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot activate server threads\n"), - 1); - - server_task.thr_mgr ()->wait (); - - ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); - - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/DII_Latency/Roundtrip.cpp b/TAO/performance-tests/DII_Latency/Roundtrip.cpp deleted file mode 100644 index df15cd65d8a..00000000000 --- a/TAO/performance-tests/DII_Latency/Roundtrip.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// $Id$ -// -#include "Roundtrip.h" - -ACE_RCSID(DII_Latency, Roundtrip, "$Id$") - -Roundtrip::Roundtrip (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -Test::Timestamp -Roundtrip::test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return send_time; -} - -void -Roundtrip::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/performance-tests/DII_Latency/Roundtrip.h b/TAO/performance-tests/DII_Latency/Roundtrip.h deleted file mode 100644 index efef33dd7e6..00000000000 --- a/TAO/performance-tests/DII_Latency/Roundtrip.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -#ifndef ROUNDTRIP_H -#define ROUNDTRIP_H -#include "ace/pre.h" - -#include "TestS.h" - -#if defined (_MSC_VER) -# if (_MSC_VER >= 1200) -# pragma warning(push) -# endif /* _MSC_VER >= 1200 */ -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - -/// Implement the Test::Roundtrip interface -class Roundtrip - : public virtual POA_Test::Roundtrip - , public virtual PortableServer::RefCountServantBase -{ -public: - /// Constructor - Roundtrip (CORBA::ORB_ptr orb); - - // = The skeleton methods - virtual Test::Timestamp test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - /// Use an ORB reference to conver strings to objects and shutdown - /// the application. - CORBA::ORB_var orb_; -}; - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include "ace/post.h" -#endif /* ROUNDTRIP_H */ diff --git a/TAO/performance-tests/DII_Latency/client.cpp b/TAO/performance-tests/DII_Latency/client.cpp deleted file mode 100644 index 57935526269..00000000000 --- a/TAO/performance-tests/DII_Latency/client.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// $Id$ - -#include "ace/Get_Opt.h" -#include "ace/High_Res_Timer.h" -#include "ace/Sched_Params.h" -#include "ace/Stats.h" -#include "ace/Sample_History.h" - -#include "tao/Strategies/advanced_resource.h" -#include "tao/DynamicInterface/Request.h" - -ACE_RCSID(DII_Latency, client, "$Id$") - -const char *ior = "file://test.ior"; -int niterations = 100; -int do_dump_history = 0; -int do_shutdown = 1; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "hxk:i:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'h': - do_dump_history = 1; - break; - - case 'x': - do_shutdown = 0; - break; - - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'i': - niterations = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "-i <niterations> " - "-x (disable shutdown) " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "client (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "client (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var object = - orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (object.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Nil CORBA::Object reference <%s>\n", - ior), - 1); - } - - for (int j = 0; j < 100; ++j) - { - CORBA::Request_var request = - object->_request ("test_method" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::ULongLong dummy = 0; - request->add_in_arg("send_time") <<= dummy; - - request->set_return_type (CORBA::_tc_ulonglong); - request->invoke (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_Sample_History history (niterations); - - ACE_hrtime_t test_start = ACE_OS::gethrtime (); - for (int i = 0; i < niterations; ++i) - { - CORBA::ULongLong start = ACE_OS::gethrtime (); - - CORBA::Request_var request = - object->_request ("test_method" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - request->add_in_arg("send_time") <<= start; - - request->set_return_type (CORBA::_tc_ulonglong); - request->invoke (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_hrtime_t now = ACE_OS::gethrtime (); - history.sample (now - start); - } - - ACE_hrtime_t test_end = ACE_OS::gethrtime (); - - ACE_DEBUG ((LM_DEBUG, "test finished\n")); - - ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - ACE_DEBUG ((LM_DEBUG, "done\n")); - - if (do_dump_history) - { - history.dump_samples ("HISTORY", gsf); - } - - ACE_Basic_Stats stats; - history.collect_basic_stats (stats); - stats.dump_results ("Total", gsf); - - ACE_Throughput_Stats::dump_throughput ("Total", gsf, - test_end - test_start, - stats.samples_count ()); - - if (do_shutdown) - { - CORBA::Request_var request = - object->_request ("shutdown" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - request->invoke (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - } - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/DII_Latency/server.cpp b/TAO/performance-tests/DII_Latency/server.cpp deleted file mode 100644 index e96f0ff595a..00000000000 --- a/TAO/performance-tests/DII_Latency/server.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// $Id$ - -#include "Roundtrip.h" -#include "ace/Get_Opt.h" -#include "ace/Sched_Params.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Single_Threaded_Latency, server, "$Id$") - -const char *ior_output_file = "test.ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <iorfile>" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, - priority); - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "server (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "server (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - Roundtrip *roundtrip_impl; - ACE_NEW_RETURN (roundtrip_impl, - Roundtrip (orb.in ()), - 1); - PortableServer::ServantBase_var owner_transfer(roundtrip_impl); - - Test::Roundtrip_var roundtrip = - roundtrip_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (roundtrip.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // If the ior_output_file exists, output the ior to it - FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_output_file), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); - - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/DSI_Latency/Roundtrip.cpp b/TAO/performance-tests/DSI_Latency/Roundtrip.cpp deleted file mode 100644 index 6de5cfe047a..00000000000 --- a/TAO/performance-tests/DSI_Latency/Roundtrip.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// -// $Id$ -// -#include "Roundtrip.h" -#include "tao/DynamicInterface/Server_Request.h" - -ACE_RCSID(Single_Threaded_Latency, Roundtrip, "$Id$") - -Roundtrip::Roundtrip (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -void -Roundtrip::invoke (CORBA::ServerRequest_ptr request - ACE_ENV_ARG_DECL) -{ - if (ACE_OS::strcmp ("shutdown", request->operation ()) == 0) - { - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - return; - } - - else if (ACE_OS::strcmp ("_is_a", request->operation ()) == 0) - { - CORBA::NVList_ptr list; - this->orb_->create_list (0, list ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Any type_id (CORBA::_tc_string); - list->add_value ("type_id", type_id, CORBA::ARG_IN - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - request->arguments (list ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CORBA::NamedValue_ptr nv = list->item (0 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *arg; - *(nv->value ()) >>= arg; - - CORBA::Boolean type_matches = 0; - if (ACE_OS::strcmp (arg, "IDL:Test/Roundtrip:1.0") == 0 - || ACE_OS::strcmp (arg, "IDL:omg.org/CORBA/Object:1.0") == 0 - || ACE_OS::strcmp (arg, "") == 0) - type_matches = 1; - - CORBA::Any result; - result <<= CORBA::Any::from_boolean (type_matches); - - request->set_result (result ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - return; - } - - else if (ACE_OS::strcmp ("test_method", request->operation ()) == 0) - { - CORBA::NVList_ptr list; - this->orb_->create_list (0, list ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Any send_time (CORBA::_tc_ulonglong); - list->add_value ("send_time", send_time, CORBA::ARG_IN - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - request->arguments (list ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CORBA::NamedValue_ptr nv = list->item (0 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - request->set_result (*(nv->value ()) ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - return; - } - - CORBA::Any bad_operation; - CORBA::BAD_OPERATION exception; - bad_operation <<= exception; - request->set_exception (bad_operation ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -CORBA::RepositoryId -Roundtrip::_primary_interface (const PortableServer::ObjectId &, - PortableServer::POA_ptr - ACE_ENV_ARG_DECL_NOT_USED) -{ - return CORBA::string_dup ("IDL:Test/Roundtrip:1.0"); -} diff --git a/TAO/performance-tests/DSI_Latency/Roundtrip.h b/TAO/performance-tests/DSI_Latency/Roundtrip.h deleted file mode 100644 index d795dcb56f1..00000000000 --- a/TAO/performance-tests/DSI_Latency/Roundtrip.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// $Id$ -// - -#ifndef ROUNDTRIP_H -#define ROUNDTRIP_H -#include "ace/pre.h" - -#include "tao/DynamicInterface/Dynamic_Implementation.h" -#include "tao/PortableServer/PortableServer.h" -#include "tao/corba.h" - -#if defined (_MSC_VER) -# if (_MSC_VER >= 1200) -# pragma warning(push) -# endif /* _MSC_VER >= 1200 */ -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - -/// Implement the Test::Roundtrip interface -class Roundtrip - : public virtual PortableServer::DynamicImplementation - , public virtual PortableServer::RefCountServantBase -{ -public: - /// Constructor - Roundtrip (CORBA::ORB_ptr orb); - - // = The DSI methods - virtual void invoke (CORBA::ServerRequest_ptr request - ACE_ENV_ARG_DECL); - virtual CORBA::RepositoryId _primary_interface ( - const PortableServer::ObjectId &oid, - PortableServer::POA_ptr poa - ACE_ENV_ARG_DECL); - -private: - /// Use an ORB reference to conver strings to objects and shutdown - /// the application. - CORBA::ORB_var orb_; -}; - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include "ace/post.h" -#endif /* ROUNDTRIP_H */ diff --git a/TAO/performance-tests/DSI_Latency/client.cpp b/TAO/performance-tests/DSI_Latency/client.cpp deleted file mode 100644 index 2a264e91b43..00000000000 --- a/TAO/performance-tests/DSI_Latency/client.cpp +++ /dev/null @@ -1,163 +0,0 @@ -// $Id$ - -#include "TestC.h" -#include "ace/Get_Opt.h" -#include "ace/High_Res_Timer.h" -#include "ace/Sched_Params.h" -#include "ace/Stats.h" -#include "ace/Sample_History.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(DSI_Latency, client, "$Id$") - -const char *ior = "file://test.ior"; -int niterations = 100; -int do_dump_history = 0; -int do_shutdown = 1; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "hxk:i:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'h': - do_dump_history = 1; - break; - - case 'x': - do_shutdown = 0; - break; - - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'i': - niterations = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "-i <niterations> " - "-x (disable shutdown) " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "client (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "client (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var object = - orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Roundtrip_var roundtrip = - Test::Roundtrip::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (roundtrip.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Nil Test::Roundtrip reference <%s>\n", - ior), - 1); - } - - for (int j = 0; j < 100; ++j) - { - ACE_hrtime_t start = 0; - (void) roundtrip->test_method (start ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_Sample_History history (niterations); - - ACE_hrtime_t test_start = ACE_OS::gethrtime (); - for (int i = 0; i < niterations; ++i) - { - ACE_hrtime_t start = ACE_OS::gethrtime (); - - (void) roundtrip->test_method (start ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_hrtime_t now = ACE_OS::gethrtime (); - history.sample (now - start); - } - - ACE_hrtime_t test_end = ACE_OS::gethrtime (); - - ACE_DEBUG ((LM_DEBUG, "test finished\n")); - - ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - ACE_DEBUG ((LM_DEBUG, "done\n")); - - if (do_dump_history) - { - history.dump_samples ("HISTORY", gsf); - } - - ACE_Basic_Stats stats; - history.collect_basic_stats (stats); - stats.dump_results ("Total", gsf); - - ACE_Throughput_Stats::dump_throughput ("Total", gsf, - test_end - test_start, - stats.samples_count ()); - - if (do_shutdown) - { - roundtrip->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/DSI_Latency/server.cpp b/TAO/performance-tests/DSI_Latency/server.cpp deleted file mode 100644 index ebc70ade1d7..00000000000 --- a/TAO/performance-tests/DSI_Latency/server.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// $Id$ - -#include "Roundtrip.h" -#include "ace/Get_Opt.h" -#include "ace/Sched_Params.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(DSI_Latency, server, "$Id$") - -const char *ior_output_file = "test.ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <iorfile>" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, - priority); - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "server (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "server (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - Roundtrip *roundtrip_impl; - ACE_NEW_RETURN (roundtrip_impl, - Roundtrip (orb.in ()), - 1); - PortableServer::ServantBase_var owner_transfer(roundtrip_impl); - - PortableServer::ObjectId_var oid = - root_poa->activate_object (roundtrip_impl - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var roundtrip = - root_poa->id_to_reference (oid.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (roundtrip.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // If the ior_output_file exists, output the ior to it - FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_output_file), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); - - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/Deferred_Latency/Roundtrip.cpp b/TAO/performance-tests/Deferred_Latency/Roundtrip.cpp deleted file mode 100644 index 72f83576b44..00000000000 --- a/TAO/performance-tests/Deferred_Latency/Roundtrip.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// $Id$ -// -#include "Roundtrip.h" - -ACE_RCSID(Single_Threaded_Latency, Roundtrip, "$Id$") - -Roundtrip::Roundtrip (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -Test::Timestamp -Roundtrip::test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return send_time; -} - -void -Roundtrip::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/performance-tests/Deferred_Latency/Roundtrip.h b/TAO/performance-tests/Deferred_Latency/Roundtrip.h deleted file mode 100644 index efef33dd7e6..00000000000 --- a/TAO/performance-tests/Deferred_Latency/Roundtrip.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -#ifndef ROUNDTRIP_H -#define ROUNDTRIP_H -#include "ace/pre.h" - -#include "TestS.h" - -#if defined (_MSC_VER) -# if (_MSC_VER >= 1200) -# pragma warning(push) -# endif /* _MSC_VER >= 1200 */ -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - -/// Implement the Test::Roundtrip interface -class Roundtrip - : public virtual POA_Test::Roundtrip - , public virtual PortableServer::RefCountServantBase -{ -public: - /// Constructor - Roundtrip (CORBA::ORB_ptr orb); - - // = The skeleton methods - virtual Test::Timestamp test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - /// Use an ORB reference to conver strings to objects and shutdown - /// the application. - CORBA::ORB_var orb_; -}; - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include "ace/post.h" -#endif /* ROUNDTRIP_H */ diff --git a/TAO/performance-tests/Deferred_Latency/client.cpp b/TAO/performance-tests/Deferred_Latency/client.cpp deleted file mode 100644 index 8aa94d94172..00000000000 --- a/TAO/performance-tests/Deferred_Latency/client.cpp +++ /dev/null @@ -1,203 +0,0 @@ -// $Id$ - -#include "TestC.h" - -#include "tao/DynamicInterface/Request.h" - -#include "tao/Strategies/advanced_resource.h" - -#include "ace/Get_Opt.h" -#include "ace/Sched_Params.h" -#include "ace/High_Res_Timer.h" -#include "ace/Sched_Params.h" -#include "ace/Stats.h" -#include "ace/Sample_History.h" - -ACE_RCSID(Deferred_Latency, client, "$Id$") - -const char *ior = "file://test.ior"; -int niterations = 1000; -int burst = 10; -int do_shutdown = 1; -int do_dump_history = 0; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "hxk:i:b:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'h': - do_dump_history = 1; - break; - - case 'x': - do_shutdown = 0; - break; - - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'i': - niterations = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case 'b': - burst = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "-i <niterations> " - "-b <burst> " - "-x (disable shutdown) " - "-h (dump history) " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "client (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "client (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var object = - orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Roundtrip_var roundtrip = - Test::Roundtrip::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (roundtrip.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Nil Test::Roundtrip reference <%s>\n", - ior), - 1); - } - - for (int j = 0; j < 100; ++j) - { - ACE_hrtime_t start = 0; - (void) roundtrip->test_method (start ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_Sample_History history (niterations); - - ACE_hrtime_t test_start = ACE_OS::gethrtime (); - - CORBA::Request_var *request; - ACE_NEW_RETURN (request, CORBA::Request_var[burst], 1); - - for (int i = 0; i < niterations; ++i) - { - int j; - - for (j = 0; j != burst; ++j) - { - CORBA::ULongLong start = ACE_OS::gethrtime (); - - request[j] = - roundtrip->_request ("test_method" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - request[j]->add_in_arg () <<= start; - request[j]->set_return_type (CORBA::_tc_ulonglong); - - request[j]->send_deferred (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - for (j = 0; j != burst; ++j) - { - request[j]->get_response (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::ULongLong retval; - if ((request[j]->return_value () >>= retval) == 1) - { - ACE_hrtime_t now = ACE_OS::gethrtime (); - history.sample (now - retval); - } - } - } - delete[] request; - - ACE_hrtime_t test_end = ACE_OS::gethrtime (); - - ACE_DEBUG ((LM_DEBUG, "test finished\n")); - - ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - ACE_DEBUG ((LM_DEBUG, "done\n")); - - if (do_dump_history) - { - history.dump_samples ("HISTORY", gsf); - } - - ACE_Basic_Stats stats; - history.collect_basic_stats (stats); - stats.dump_results ("Total", gsf); - - ACE_Throughput_Stats::dump_throughput ("Total", gsf, - test_end - test_start, - stats.samples_count ()); - - if (do_shutdown) - { - roundtrip->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Caught exception:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/Deferred_Latency/server.cpp b/TAO/performance-tests/Deferred_Latency/server.cpp deleted file mode 100644 index e96f0ff595a..00000000000 --- a/TAO/performance-tests/Deferred_Latency/server.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// $Id$ - -#include "Roundtrip.h" -#include "ace/Get_Opt.h" -#include "ace/Sched_Params.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Single_Threaded_Latency, server, "$Id$") - -const char *ior_output_file = "test.ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <iorfile>" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, - priority); - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "server (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "server (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - Roundtrip *roundtrip_impl; - ACE_NEW_RETURN (roundtrip_impl, - Roundtrip (orb.in ()), - 1); - PortableServer::ServantBase_var owner_transfer(roundtrip_impl); - - Test::Roundtrip_var roundtrip = - roundtrip_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (roundtrip.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // If the ior_output_file exists, output the ior to it - FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_output_file), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); - - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/Makefile b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/Makefile deleted file mode 100644 index 6abeb8554f4..00000000000 --- a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/Makefile +++ /dev/null @@ -1,616 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -ifndef TAO_ROOT - TAO_ROOT = $(ACE_ROOT)/TAO -endif # ! TAO_ROOT - -LDLIBS = -lRTCORBA_Common -lTAO_Strategies -lTAO_PortableServer -lTAO - -BIN_UNCHECKED = server client - -CLIENT_OBJS = client.o -SERVER_OBJS = server.o - -BUILD = $(BIN) -VLDLIBS = $(LDLIBS:%=%$(VAR)) -VBIN = $(BIN:%=%$(VAR)) -SRC=$(CLIENT_OBJS:.o=.cpp) $(SERVER_OBJS:.o=.cpp) -CPPFLAGS += -I../Common - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(TAO_ROOT)/rules.tao.GNU - -ifeq ($(rt_corba),1) - ifeq ($(minimum_corba),0) - BIN=$(BIN_UNCHECKED) - endif # minimum_corba -endif # rt_corba - -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU -include $(TAO_ROOT)/taoconfig.mk - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -server: $(addprefix $(VDIR),$(SERVER_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) - -client: $(addprefix $(VDIR),$(CLIENT_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) - -realclean: clean - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - -.obj/client.o .obj/client.o .obj/client.o .obj/client.o: client.cpp ../Common/testC.h \ - $(TAO_ROOT)/tao/corba.h \ - $(ACE_ROOT)/ace/pre.h \ - $(ACE_ROOT)/ace/post.h \ - $(ACE_ROOT)/ace/ACE_export.h \ - $(ACE_ROOT)/ace/svc_export.h \ - $(ACE_ROOT)/ace/ace_wchar.h \ - $(ACE_ROOT)/ace/ace_wchar.inl \ - $(ACE_ROOT)/ace/OS_Errno.h \ - $(ACE_ROOT)/ace/OS_Export.h \ - $(ACE_ROOT)/ace/OS_Errno.inl \ - $(TAO_ROOT)/tao/corbafwd.h \ - $(ACE_ROOT)/ace/CDR_Base.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Message_Block.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/OS_Dirent.h \ - $(ACE_ROOT)/ace/OS_Dirent.inl \ - $(ACE_ROOT)/ace/OS_String.h \ - $(ACE_ROOT)/ace/OS_String.inl \ - $(ACE_ROOT)/ace/OS_Memory.h \ - $(ACE_ROOT)/ace/OS_Memory.inl \ - $(ACE_ROOT)/ace/OS_TLI.h \ - $(ACE_ROOT)/ace/OS_TLI.inl \ - $(ACE_ROOT)/ace/Min_Max.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(ACE_ROOT)/ace/Flag_Manip.h \ - $(ACE_ROOT)/ace/Flag_Manip.i \ - $(ACE_ROOT)/ace/Handle_Ops.h \ - $(ACE_ROOT)/ace/Handle_Ops.i \ - $(ACE_ROOT)/ace/Lib_Find.h \ - $(ACE_ROOT)/ace/Lib_Find.i \ - $(ACE_ROOT)/ace/Init_ACE.h \ - $(ACE_ROOT)/ace/Init_ACE.i \ - $(ACE_ROOT)/ace/Sock_Connect.h \ - $(ACE_ROOT)/ace/Sock_Connect.i \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Malloc.h \ - $(ACE_ROOT)/ace/Log_Msg.h \ - $(ACE_ROOT)/ace/Log_Record.h \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \ - $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ - $(ACE_ROOT)/ace/Malloc.i \ - $(ACE_ROOT)/ace/Malloc_T.h \ - $(ACE_ROOT)/ace/Synch.h \ - $(ACE_ROOT)/ace/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread_Adapter.h \ - $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ - $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ - $(ACE_ROOT)/ace/Thread_Adapter.inl \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(ACE_ROOT)/ace/Malloc_Allocator.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Malloc_Allocator.i \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Malloc_T.cpp \ - $(ACE_ROOT)/ace/Memory_Pool.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ - $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ - $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ - $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ - $(ACE_ROOT)/ace/Unbounded_Set.h \ - $(ACE_ROOT)/ace/Node.h \ - $(ACE_ROOT)/ace/Node.cpp \ - $(ACE_ROOT)/ace/Unbounded_Set.inl \ - $(ACE_ROOT)/ace/Unbounded_Set.cpp \ - $(ACE_ROOT)/ace/Memory_Pool.i \ - $(ACE_ROOT)/ace/Message_Block.i \ - $(ACE_ROOT)/ace/Message_Block_T.h \ - $(ACE_ROOT)/ace/Message_Block_T.i \ - $(ACE_ROOT)/ace/Message_Block_T.cpp \ - $(ACE_ROOT)/ace/CDR_Base.inl \ - $(TAO_ROOT)/tao/try_macros.h \ - $(TAO_ROOT)/tao/orbconf.h \ - $(ACE_ROOT)/ace/CORBA_macros.h \ - $(TAO_ROOT)/tao/varbase.h \ - $(TAO_ROOT)/tao/TAO_Export.h \ - $(TAO_ROOT)/tao/corbafwd.i \ - $(TAO_ROOT)/tao/Typecode.h \ - $(TAO_ROOT)/tao/Exception.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(TAO_ROOT)/tao/Exception.i \ - $(TAO_ROOT)/tao/Typecode.i \ - $(TAO_ROOT)/tao/Any.h \ - $(TAO_ROOT)/tao/CDR.h \ - $(ACE_ROOT)/ace/CDR_Stream.h \ - $(ACE_ROOT)/ace/CDR_Stream.i \ - $(TAO_ROOT)/tao/CDR.i \ - $(TAO_ROOT)/tao/Environment.h \ - $(TAO_ROOT)/tao/Environment.i \ - $(TAO_ROOT)/tao/Object.h \ - $(TAO_ROOT)/tao/Object_Proxy_Broker.h \ - $(TAO_ROOT)/tao/Object_Proxy_Impl.h \ - $(TAO_ROOT)/tao/Object.i \ - $(TAO_ROOT)/tao/Any.i \ - $(TAO_ROOT)/tao/NVList.h \ - $(ACE_ROOT)/ace/Unbounded_Queue.h \ - $(ACE_ROOT)/ace/Unbounded_Queue.inl \ - $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ - $(TAO_ROOT)/tao/NVList.i \ - $(TAO_ROOT)/tao/LocalObject.h \ - $(TAO_ROOT)/tao/LocalObject.i \ - $(TAO_ROOT)/tao/Principal.h \ - $(TAO_ROOT)/tao/OctetSeqC.h \ - $(TAO_ROOT)/tao/Sequence.h \ - $(TAO_ROOT)/tao/Managed_Types.h \ - $(TAO_ROOT)/tao/Managed_Types.i \ - $(TAO_ROOT)/tao/Sequence.i \ - $(TAO_ROOT)/tao/Sequence_T.h \ - $(TAO_ROOT)/tao/Sequence_T.i \ - $(TAO_ROOT)/tao/Sequence_T.cpp \ - $(TAO_ROOT)/tao/OctetSeqC.i \ - $(TAO_ROOT)/tao/Principal.i \ - $(TAO_ROOT)/tao/ORB.h \ - $(TAO_ROOT)/tao/Services.h \ - $(TAO_ROOT)/tao/Services.i \ - $(TAO_ROOT)/tao/CORBA_String.h \ - $(TAO_ROOT)/tao/CORBA_String.inl \ - $(TAO_ROOT)/tao/PolicyC.h \ - $(TAO_ROOT)/tao/Encodable.h \ - $(TAO_ROOT)/tao/Remote_Object_Proxy_Impl.h \ - $(TAO_ROOT)/tao/CurrentC.h \ - $(TAO_ROOT)/tao/CurrentC.i \ - $(TAO_ROOT)/tao/PolicyC.i \ - $(TAO_ROOT)/tao/ORB.i \ - $(TAO_ROOT)/tao/BoundsC.h \ - $(TAO_ROOT)/tao/BoundsC.i \ - $(TAO_ROOT)/tao/ValueBase.h \ - $(TAO_ROOT)/tao/ValueBase.i \ - $(TAO_ROOT)/tao/ValueFactory.h \ - $(TAO_ROOT)/tao/ValueFactory.i \ - $(TAO_ROOT)/tao/DomainC.h \ - $(TAO_ROOT)/tao/DomainC.i \ - $(TAO_ROOT)/tao/WrongTransactionC.h \ - $(TAO_ROOT)/tao/Object_KeyC.h \ - $(TAO_ROOT)/tao/Object_KeyC.i \ - $(TAO_ROOT)/tao/ObjectIDList.h \ - $(TAO_ROOT)/tao/ObjectIDList.i \ - $(TAO_ROOT)/tao/StringSeqC.h \ - $(TAO_ROOT)/tao/StringSeqC.i \ - $(TAO_ROOT)/tao/PortableInterceptorC.h \ - $(TAO_ROOT)/tao/DynamicC.h \ - $(TAO_ROOT)/tao/DynamicC.i \ - $(TAO_ROOT)/tao/MessagingC.h \ - $(TAO_ROOT)/tao/TimeBaseC.h \ - $(TAO_ROOT)/tao/SmartProxies/Smart_Proxies.h \ - $(TAO_ROOT)/tao/SmartProxies/smartproxies_export.h \ - $(TAO_ROOT)/tao/TAO_Singleton.h \ - $(TAO_ROOT)/tao/TAO_Singleton.inl \ - $(TAO_ROOT)/tao/TAO_Singleton.cpp \ - $(ACE_ROOT)/ace/Object_Manager.h \ - $(ACE_ROOT)/ace/Object_Manager.i \ - $(ACE_ROOT)/ace/Managed_Object.h \ - $(ACE_ROOT)/ace/Managed_Object.i \ - $(ACE_ROOT)/ace/Managed_Object.cpp \ - $(TAO_ROOT)/tao/TAO_Singleton_Manager.h \ - $(TAO_ROOT)/tao/TAO_Singleton_Manager.inl \ - $(TAO_ROOT)/tao/SmartProxies/Smart_Proxies.inl \ - $(TAO_ROOT)/tao/TimeBaseC.i \ - $(TAO_ROOT)/tao/IOPC.h \ - $(TAO_ROOT)/tao/IOPC.i \ - $(TAO_ROOT)/tao/PollableC.h \ - $(TAO_ROOT)/tao/PollableC.i \ - $(TAO_ROOT)/tao/MessagingC.i \ - $(TAO_ROOT)/tao/PortableInterceptorC.i \ - ../Common/rtcorba_common_export.h ../Common/testC.i \ - $(TAO_ROOT)/tao/TAOC.h \ - $(TAO_ROOT)/tao/TAOC.i \ - $(ACE_ROOT)/ace/Get_Opt.h \ - $(ACE_ROOT)/ace/Get_Opt.i \ - $(ACE_ROOT)/ace/Task.h \ - $(ACE_ROOT)/ace/Service_Object.h \ - $(ACE_ROOT)/ace/Shared_Object.h \ - $(ACE_ROOT)/ace/Shared_Object.i \ - $(ACE_ROOT)/ace/Service_Object.i \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Array_Base.h \ - $(ACE_ROOT)/ace/Array_Base.inl \ - $(ACE_ROOT)/ace/Array_Base.cpp \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/Singleton.cpp \ - $(ACE_ROOT)/ace/Thread_Manager.i \ - $(ACE_ROOT)/ace/Task.i \ - $(ACE_ROOT)/ace/Task_T.h \ - $(ACE_ROOT)/ace/Message_Queue.h \ - $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ - $(ACE_ROOT)/ace/Message_Queue_T.h \ - $(ACE_ROOT)/ace/Message_Queue_T.i \ - $(ACE_ROOT)/ace/Message_Queue_T.cpp \ - $(ACE_ROOT)/ace/Strategies.h \ - $(ACE_ROOT)/ace/Strategies_T.h \ - $(ACE_ROOT)/ace/Service_Config.h \ - $(ACE_ROOT)/ace/Service_Config.i \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(ACE_ROOT)/ace/Timer_Queue_T.h \ - $(ACE_ROOT)/ace/Test_and_Set.h \ - $(ACE_ROOT)/ace/Test_and_Set.i \ - $(ACE_ROOT)/ace/Test_and_Set.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ - $(ACE_ROOT)/ace/Synch_Options.h \ - $(ACE_ROOT)/ace/Synch_Options.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager.h \ - $(ACE_ROOT)/ace/Functor.h \ - $(ACE_ROOT)/ace/Functor.i \ - $(ACE_ROOT)/ace/Functor_T.h \ - $(ACE_ROOT)/ace/Functor_T.i \ - $(ACE_ROOT)/ace/Functor_T.cpp \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ - $(ACE_ROOT)/ace/Strategies_T.i \ - $(ACE_ROOT)/ace/Strategies_T.cpp \ - $(ACE_ROOT)/ace/Service_Repository.h \ - $(ACE_ROOT)/ace/Service_Types.h \ - $(ACE_ROOT)/ace/Service_Types.i \ - $(ACE_ROOT)/ace/Service_Repository.i \ - $(ACE_ROOT)/ace/WFMO_Reactor.h \ - $(ACE_ROOT)/ace/Process_Mutex.h \ - $(ACE_ROOT)/ace/Process_Mutex.inl \ - $(ACE_ROOT)/ace/WFMO_Reactor.i \ - $(ACE_ROOT)/ace/Strategies.i \ - $(ACE_ROOT)/ace/Message_Queue.i \ - $(ACE_ROOT)/ace/Task_T.i \ - $(ACE_ROOT)/ace/Task_T.cpp \ - $(ACE_ROOT)/ace/Module.h \ - $(ACE_ROOT)/ace/Module.i \ - $(ACE_ROOT)/ace/Module.cpp \ - $(ACE_ROOT)/ace/Stream_Modules.h \ - $(ACE_ROOT)/ace/Stream_Modules.cpp \ - $(ACE_ROOT)/ace/Stats.h \ - $(ACE_ROOT)/ace/Basic_Stats.h \ - $(ACE_ROOT)/ace/Basic_Stats.inl \ - $(ACE_ROOT)/ace/Stats.i \ - $(ACE_ROOT)/ace/High_Res_Timer.h \ - $(ACE_ROOT)/ace/High_Res_Timer.i \ - $(ACE_ROOT)/ace/Sched_Params.h \ - $(ACE_ROOT)/ace/Sched_Params.i - -.obj/server.o .obj/server.o .obj/server.o .obj/server.o: server.cpp ../Common/test_i.h ../Common/testS.h \ - ../Common/testC.h \ - $(TAO_ROOT)/tao/corba.h \ - $(ACE_ROOT)/ace/pre.h \ - $(ACE_ROOT)/ace/post.h \ - $(ACE_ROOT)/ace/ACE_export.h \ - $(ACE_ROOT)/ace/svc_export.h \ - $(ACE_ROOT)/ace/ace_wchar.h \ - $(ACE_ROOT)/ace/ace_wchar.inl \ - $(ACE_ROOT)/ace/OS_Errno.h \ - $(ACE_ROOT)/ace/OS_Export.h \ - $(ACE_ROOT)/ace/OS_Errno.inl \ - $(TAO_ROOT)/tao/corbafwd.h \ - $(ACE_ROOT)/ace/CDR_Base.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Message_Block.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/OS_Dirent.h \ - $(ACE_ROOT)/ace/OS_Dirent.inl \ - $(ACE_ROOT)/ace/OS_String.h \ - $(ACE_ROOT)/ace/OS_String.inl \ - $(ACE_ROOT)/ace/OS_Memory.h \ - $(ACE_ROOT)/ace/OS_Memory.inl \ - $(ACE_ROOT)/ace/OS_TLI.h \ - $(ACE_ROOT)/ace/OS_TLI.inl \ - $(ACE_ROOT)/ace/Min_Max.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(ACE_ROOT)/ace/Flag_Manip.h \ - $(ACE_ROOT)/ace/Flag_Manip.i \ - $(ACE_ROOT)/ace/Handle_Ops.h \ - $(ACE_ROOT)/ace/Handle_Ops.i \ - $(ACE_ROOT)/ace/Lib_Find.h \ - $(ACE_ROOT)/ace/Lib_Find.i \ - $(ACE_ROOT)/ace/Init_ACE.h \ - $(ACE_ROOT)/ace/Init_ACE.i \ - $(ACE_ROOT)/ace/Sock_Connect.h \ - $(ACE_ROOT)/ace/Sock_Connect.i \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Malloc.h \ - $(ACE_ROOT)/ace/Log_Msg.h \ - $(ACE_ROOT)/ace/Log_Record.h \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \ - $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ - $(ACE_ROOT)/ace/Malloc.i \ - $(ACE_ROOT)/ace/Malloc_T.h \ - $(ACE_ROOT)/ace/Synch.h \ - $(ACE_ROOT)/ace/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread_Adapter.h \ - $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ - $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ - $(ACE_ROOT)/ace/Thread_Adapter.inl \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(ACE_ROOT)/ace/Malloc_Allocator.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Malloc_Allocator.i \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Malloc_T.cpp \ - $(ACE_ROOT)/ace/Memory_Pool.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ - $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ - $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ - $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ - $(ACE_ROOT)/ace/Unbounded_Set.h \ - $(ACE_ROOT)/ace/Node.h \ - $(ACE_ROOT)/ace/Node.cpp \ - $(ACE_ROOT)/ace/Unbounded_Set.inl \ - $(ACE_ROOT)/ace/Unbounded_Set.cpp \ - $(ACE_ROOT)/ace/Memory_Pool.i \ - $(ACE_ROOT)/ace/Message_Block.i \ - $(ACE_ROOT)/ace/Message_Block_T.h \ - $(ACE_ROOT)/ace/Message_Block_T.i \ - $(ACE_ROOT)/ace/Message_Block_T.cpp \ - $(ACE_ROOT)/ace/CDR_Base.inl \ - $(TAO_ROOT)/tao/try_macros.h \ - $(TAO_ROOT)/tao/orbconf.h \ - $(ACE_ROOT)/ace/CORBA_macros.h \ - $(TAO_ROOT)/tao/varbase.h \ - $(TAO_ROOT)/tao/TAO_Export.h \ - $(TAO_ROOT)/tao/corbafwd.i \ - $(TAO_ROOT)/tao/Typecode.h \ - $(TAO_ROOT)/tao/Exception.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(TAO_ROOT)/tao/Exception.i \ - $(TAO_ROOT)/tao/Typecode.i \ - $(TAO_ROOT)/tao/Any.h \ - $(TAO_ROOT)/tao/CDR.h \ - $(ACE_ROOT)/ace/CDR_Stream.h \ - $(ACE_ROOT)/ace/CDR_Stream.i \ - $(TAO_ROOT)/tao/CDR.i \ - $(TAO_ROOT)/tao/Environment.h \ - $(TAO_ROOT)/tao/Environment.i \ - $(TAO_ROOT)/tao/Object.h \ - $(TAO_ROOT)/tao/Object_Proxy_Broker.h \ - $(TAO_ROOT)/tao/Object_Proxy_Impl.h \ - $(TAO_ROOT)/tao/Object.i \ - $(TAO_ROOT)/tao/Any.i \ - $(TAO_ROOT)/tao/NVList.h \ - $(ACE_ROOT)/ace/Unbounded_Queue.h \ - $(ACE_ROOT)/ace/Unbounded_Queue.inl \ - $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ - $(TAO_ROOT)/tao/NVList.i \ - $(TAO_ROOT)/tao/LocalObject.h \ - $(TAO_ROOT)/tao/LocalObject.i \ - $(TAO_ROOT)/tao/Principal.h \ - $(TAO_ROOT)/tao/OctetSeqC.h \ - $(TAO_ROOT)/tao/Sequence.h \ - $(TAO_ROOT)/tao/Managed_Types.h \ - $(TAO_ROOT)/tao/Managed_Types.i \ - $(TAO_ROOT)/tao/Sequence.i \ - $(TAO_ROOT)/tao/Sequence_T.h \ - $(TAO_ROOT)/tao/Sequence_T.i \ - $(TAO_ROOT)/tao/Sequence_T.cpp \ - $(TAO_ROOT)/tao/OctetSeqC.i \ - $(TAO_ROOT)/tao/Principal.i \ - $(TAO_ROOT)/tao/ORB.h \ - $(TAO_ROOT)/tao/Services.h \ - $(TAO_ROOT)/tao/Services.i \ - $(TAO_ROOT)/tao/CORBA_String.h \ - $(TAO_ROOT)/tao/CORBA_String.inl \ - $(TAO_ROOT)/tao/PolicyC.h \ - $(TAO_ROOT)/tao/Encodable.h \ - $(TAO_ROOT)/tao/Remote_Object_Proxy_Impl.h \ - $(TAO_ROOT)/tao/CurrentC.h \ - $(TAO_ROOT)/tao/CurrentC.i \ - $(TAO_ROOT)/tao/PolicyC.i \ - $(TAO_ROOT)/tao/ORB.i \ - $(TAO_ROOT)/tao/BoundsC.h \ - $(TAO_ROOT)/tao/BoundsC.i \ - $(TAO_ROOT)/tao/ValueBase.h \ - $(TAO_ROOT)/tao/ValueBase.i \ - $(TAO_ROOT)/tao/ValueFactory.h \ - $(TAO_ROOT)/tao/ValueFactory.i \ - $(TAO_ROOT)/tao/DomainC.h \ - $(TAO_ROOT)/tao/DomainC.i \ - $(TAO_ROOT)/tao/WrongTransactionC.h \ - $(TAO_ROOT)/tao/Object_KeyC.h \ - $(TAO_ROOT)/tao/Object_KeyC.i \ - $(TAO_ROOT)/tao/ObjectIDList.h \ - $(TAO_ROOT)/tao/ObjectIDList.i \ - $(TAO_ROOT)/tao/StringSeqC.h \ - $(TAO_ROOT)/tao/StringSeqC.i \ - $(TAO_ROOT)/tao/PortableInterceptorC.h \ - $(TAO_ROOT)/tao/DynamicC.h \ - $(TAO_ROOT)/tao/DynamicC.i \ - $(TAO_ROOT)/tao/MessagingC.h \ - $(TAO_ROOT)/tao/TimeBaseC.h \ - $(TAO_ROOT)/tao/SmartProxies/Smart_Proxies.h \ - $(TAO_ROOT)/tao/SmartProxies/smartproxies_export.h \ - $(TAO_ROOT)/tao/TAO_Singleton.h \ - $(TAO_ROOT)/tao/TAO_Singleton.inl \ - $(TAO_ROOT)/tao/TAO_Singleton.cpp \ - $(ACE_ROOT)/ace/Object_Manager.h \ - $(ACE_ROOT)/ace/Object_Manager.i \ - $(ACE_ROOT)/ace/Managed_Object.h \ - $(ACE_ROOT)/ace/Managed_Object.i \ - $(ACE_ROOT)/ace/Managed_Object.cpp \ - $(TAO_ROOT)/tao/TAO_Singleton_Manager.h \ - $(TAO_ROOT)/tao/TAO_Singleton_Manager.inl \ - $(TAO_ROOT)/tao/SmartProxies/Smart_Proxies.inl \ - $(TAO_ROOT)/tao/TimeBaseC.i \ - $(TAO_ROOT)/tao/IOPC.h \ - $(TAO_ROOT)/tao/IOPC.i \ - $(TAO_ROOT)/tao/PollableC.h \ - $(TAO_ROOT)/tao/PollableC.i \ - $(TAO_ROOT)/tao/MessagingC.i \ - $(TAO_ROOT)/tao/PortableInterceptorC.i \ - ../Common/rtcorba_common_export.h ../Common/testC.i \ - $(TAO_ROOT)/tao/PortableServer/PortableServer.h \ - $(TAO_ROOT)/tao/PortableServer/portableserver_export.h \ - $(TAO_ROOT)/tao/PortableServer/PortableServerC.h \ - $(TAO_ROOT)/tao/PortableServer/PortableServerC.i \ - $(TAO_ROOT)/tao/PortableServer/Servant_Base.h \ - $(TAO_ROOT)/tao/Abstract_Servant_Base.h \ - $(TAO_ROOT)/tao/PortableServer/Servant_Base.i \ - $(TAO_ROOT)/tao/PortableServer/Collocated_Object.h \ - $(TAO_ROOT)/tao/PortableServer/Collocated_Object.i \ - $(TAO_ROOT)/tao/PortableServer/ThruPOA_Object_Proxy_Impl.h \ - $(TAO_ROOT)/tao/PortableServer/Direct_Object_Proxy_Impl.h \ - ../Common/testS_T.h ../Common/testS_T.i ../Common/testS_T.cpp \ - ../Common/testS.i ../Common/test_i.i \ - $(TAO_ROOT)/tao/RTCORBA/Pool_Per_Endpoint.h \ - $(TAO_ROOT)/tao/RTCORBA/rtcorba_export.h \ - $(ACE_ROOT)/ace/Task.h \ - $(ACE_ROOT)/ace/Service_Object.h \ - $(ACE_ROOT)/ace/Shared_Object.h \ - $(ACE_ROOT)/ace/Shared_Object.i \ - $(ACE_ROOT)/ace/Service_Object.i \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Array_Base.h \ - $(ACE_ROOT)/ace/Array_Base.inl \ - $(ACE_ROOT)/ace/Array_Base.cpp \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/Singleton.cpp \ - $(ACE_ROOT)/ace/Thread_Manager.i \ - $(ACE_ROOT)/ace/Task.i \ - $(ACE_ROOT)/ace/Task_T.h \ - $(ACE_ROOT)/ace/Message_Queue.h \ - $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ - $(ACE_ROOT)/ace/Message_Queue_T.h \ - $(ACE_ROOT)/ace/Message_Queue_T.i \ - $(ACE_ROOT)/ace/Message_Queue_T.cpp \ - $(ACE_ROOT)/ace/Strategies.h \ - $(ACE_ROOT)/ace/Strategies_T.h \ - $(ACE_ROOT)/ace/Service_Config.h \ - $(ACE_ROOT)/ace/Service_Config.i \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(ACE_ROOT)/ace/Timer_Queue_T.h \ - $(ACE_ROOT)/ace/Test_and_Set.h \ - $(ACE_ROOT)/ace/Test_and_Set.i \ - $(ACE_ROOT)/ace/Test_and_Set.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ - $(ACE_ROOT)/ace/Synch_Options.h \ - $(ACE_ROOT)/ace/Synch_Options.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager.h \ - $(ACE_ROOT)/ace/Functor.h \ - $(ACE_ROOT)/ace/Functor.i \ - $(ACE_ROOT)/ace/Functor_T.h \ - $(ACE_ROOT)/ace/Functor_T.i \ - $(ACE_ROOT)/ace/Functor_T.cpp \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ - $(ACE_ROOT)/ace/Strategies_T.i \ - $(ACE_ROOT)/ace/Strategies_T.cpp \ - $(ACE_ROOT)/ace/Service_Repository.h \ - $(ACE_ROOT)/ace/Service_Types.h \ - $(ACE_ROOT)/ace/Service_Types.i \ - $(ACE_ROOT)/ace/Service_Repository.i \ - $(ACE_ROOT)/ace/WFMO_Reactor.h \ - $(ACE_ROOT)/ace/Process_Mutex.h \ - $(ACE_ROOT)/ace/Process_Mutex.inl \ - $(ACE_ROOT)/ace/WFMO_Reactor.i \ - $(ACE_ROOT)/ace/Strategies.i \ - $(ACE_ROOT)/ace/Message_Queue.i \ - $(ACE_ROOT)/ace/Task_T.i \ - $(ACE_ROOT)/ace/Task_T.cpp \ - $(ACE_ROOT)/ace/Module.h \ - $(ACE_ROOT)/ace/Module.i \ - $(ACE_ROOT)/ace/Module.cpp \ - $(ACE_ROOT)/ace/Stream_Modules.h \ - $(ACE_ROOT)/ace/Stream_Modules.cpp \ - $(TAO_ROOT)/tao/RTCORBA/Pool_Per_Endpoint.i \ - $(ACE_ROOT)/ace/Get_Opt.h \ - $(ACE_ROOT)/ace/Get_Opt.i \ - $(ACE_ROOT)/ace/Sched_Params.h \ - $(ACE_ROOT)/ace/Sched_Params.i - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/performance-tests/Single_Threaded_Latency/Roundtrip.cpp b/TAO/performance-tests/Single_Threaded_Latency/Roundtrip.cpp deleted file mode 100644 index 72f83576b44..00000000000 --- a/TAO/performance-tests/Single_Threaded_Latency/Roundtrip.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// $Id$ -// -#include "Roundtrip.h" - -ACE_RCSID(Single_Threaded_Latency, Roundtrip, "$Id$") - -Roundtrip::Roundtrip (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -Test::Timestamp -Roundtrip::test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return send_time; -} - -void -Roundtrip::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/performance-tests/Single_Threaded_Latency/Roundtrip.h b/TAO/performance-tests/Single_Threaded_Latency/Roundtrip.h deleted file mode 100644 index efef33dd7e6..00000000000 --- a/TAO/performance-tests/Single_Threaded_Latency/Roundtrip.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -#ifndef ROUNDTRIP_H -#define ROUNDTRIP_H -#include "ace/pre.h" - -#include "TestS.h" - -#if defined (_MSC_VER) -# if (_MSC_VER >= 1200) -# pragma warning(push) -# endif /* _MSC_VER >= 1200 */ -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - -/// Implement the Test::Roundtrip interface -class Roundtrip - : public virtual POA_Test::Roundtrip - , public virtual PortableServer::RefCountServantBase -{ -public: - /// Constructor - Roundtrip (CORBA::ORB_ptr orb); - - // = The skeleton methods - virtual Test::Timestamp test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - /// Use an ORB reference to conver strings to objects and shutdown - /// the application. - CORBA::ORB_var orb_; -}; - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include "ace/post.h" -#endif /* ROUNDTRIP_H */ diff --git a/TAO/performance-tests/Single_Threaded_Latency/client.cpp b/TAO/performance-tests/Single_Threaded_Latency/client.cpp deleted file mode 100644 index 2d841b9909d..00000000000 --- a/TAO/performance-tests/Single_Threaded_Latency/client.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// $Id$ - -#include "TestC.h" -#include "ace/Get_Opt.h" -#include "ace/High_Res_Timer.h" -#include "ace/Sched_Params.h" -#include "ace/Stats.h" -#include "ace/Sample_History.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Single_Threaded_Latency, client, "$Id$") - -const char *ior = "file://test.ior"; -int niterations = 100; -int do_dump_history = 0; -int do_shutdown = 1; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "hxk:i:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'h': - do_dump_history = 1; - break; - - case 'x': - do_shutdown = 0; - break; - - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'i': - niterations = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "-i <niterations> " - "-x (disable shutdown) " - "-h (dump history) " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "client (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "client (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var object = - orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Roundtrip_var roundtrip = - Test::Roundtrip::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (roundtrip.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Nil Test::Roundtrip reference <%s>\n", - ior), - 1); - } - - for (int j = 0; j < 100; ++j) - { - ACE_hrtime_t start = 0; - (void) roundtrip->test_method (start ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - - ACE_Sample_History history (niterations); - - ACE_hrtime_t test_start = ACE_OS::gethrtime (); - for (int i = 0; i < niterations; ++i) - { - ACE_hrtime_t start = ACE_OS::gethrtime (); - - (void) roundtrip->test_method (start ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_hrtime_t now = ACE_OS::gethrtime (); - history.sample (now - start); - } - - ACE_hrtime_t test_end = ACE_OS::gethrtime (); - - ACE_DEBUG ((LM_DEBUG, "test finished\n")); - - ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - ACE_DEBUG ((LM_DEBUG, "done\n")); - - if (do_dump_history) - { - history.dump_samples ("HISTORY", gsf); - } - - ACE_Basic_Stats stats; - history.collect_basic_stats (stats); - stats.dump_results ("Total", gsf); - - ACE_Throughput_Stats::dump_throughput ("Total", gsf, - test_end - test_start, - stats.samples_count ()); - - if (do_shutdown) - { - roundtrip->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/Single_Threaded_Latency/server.cpp b/TAO/performance-tests/Single_Threaded_Latency/server.cpp deleted file mode 100644 index e96f0ff595a..00000000000 --- a/TAO/performance-tests/Single_Threaded_Latency/server.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// $Id$ - -#include "Roundtrip.h" -#include "ace/Get_Opt.h" -#include "ace/Sched_Params.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Single_Threaded_Latency, server, "$Id$") - -const char *ior_output_file = "test.ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <iorfile>" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, - priority); - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "server (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "server (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - Roundtrip *roundtrip_impl; - ACE_NEW_RETURN (roundtrip_impl, - Roundtrip (orb.in ()), - 1); - PortableServer::ServantBase_var owner_transfer(roundtrip_impl); - - Test::Roundtrip_var roundtrip = - roundtrip_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (roundtrip.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // If the ior_output_file exists, output the ior to it - FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_output_file), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); - - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/Thread_Per_Connection_Latency/Client_Task.cpp b/TAO/performance-tests/Thread_Per_Connection_Latency/Client_Task.cpp deleted file mode 100644 index 09d15331436..00000000000 --- a/TAO/performance-tests/Thread_Per_Connection_Latency/Client_Task.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -// $Id$ -// -#include "Client_Task.h" - -ACE_RCSID(Thread_Per_Connection_Latency, Client_Task, "$Id$") - -Client_Task::Client_Task (Test::Roundtrip_ptr roundtrip, - int niterations) - : roundtrip_ (Test::Roundtrip::_duplicate (roundtrip)) - , niterations_ (niterations) -{ -} - -int -Client_Task::svc (void) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->validate_connection (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - for (int i = 0; i != this->niterations_; ++i) - { - CORBA::ULongLong start = ACE_OS::gethrtime (); - - (void) this->roundtrip_->test_method (start ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_hrtime_t now = ACE_OS::gethrtime (); - this->latency_.sample (now - start); - } - } - ACE_CATCHANY - { - return 0; - } - ACE_ENDTRY; - return 0; -} - -void -Client_Task::accumulate_and_dump (ACE_Basic_Stats &totals, - const char *msg, - ACE_UINT32 gsf) -{ - totals.accumulate (this->latency_); - this->latency_.dump_results (msg, gsf); -} - -void -Client_Task::validate_connection (ACE_ENV_SINGLE_ARG_DECL) -{ - CORBA::ULongLong dummy = 0; - for (int i = 0; i != 100; ++i) - { - ACE_TRY - { - (void) this->roundtrip_->test_method (dummy ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY {} ACE_ENDTRY; - } -} diff --git a/TAO/performance-tests/Thread_Per_Connection_Latency/Client_Task.h b/TAO/performance-tests/Thread_Per_Connection_Latency/Client_Task.h deleted file mode 100644 index ffc4e9d6b6a..00000000000 --- a/TAO/performance-tests/Thread_Per_Connection_Latency/Client_Task.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -#ifndef CLIENT_TASK_H -#define CLIENT_TASK_H -#include "ace/pre.h" - -#include "TestC.h" -#include "ace/Task.h" -#include "ace/Basic_Stats.h" - -/// Implement the Test::Client_Task interface -class Client_Task : public ACE_Task_Base -{ -public: - /// Constructor - Client_Task (Test::Roundtrip_ptr roundtrip, - int niterations); - - /// Add this thread results to the global numbers and print the - /// per-thread results. - void accumulate_and_dump (ACE_Basic_Stats &totals, - const char *msg, - ACE_UINT32 gsf); - - /// The service method - virtual int svc (void); - -private: - /// Make sure that the current thread has a connection available. - void validate_connection (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// The object reference used for this test - Test::Roundtrip_var roundtrip_; - - /// The number of iterations - int niterations_; - - /// Keep track of the latency (minimum, average, maximum and jitter) - ACE_Basic_Stats latency_; -}; - -#include "ace/post.h" -#endif /* CLIENT_TASK_H */ diff --git a/TAO/performance-tests/Thread_Per_Connection_Latency/Roundtrip.cpp b/TAO/performance-tests/Thread_Per_Connection_Latency/Roundtrip.cpp deleted file mode 100644 index 2bc67948fd0..00000000000 --- a/TAO/performance-tests/Thread_Per_Connection_Latency/Roundtrip.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// $Id$ -// -#include "Roundtrip.h" - -ACE_RCSID(Single_Per_Connection_Latency, Roundtrip, "$Id$") - -Roundtrip::Roundtrip (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -Test::Timestamp -Roundtrip::test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return send_time; -} - -void -Roundtrip::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/performance-tests/Thread_Per_Connection_Latency/Roundtrip.h b/TAO/performance-tests/Thread_Per_Connection_Latency/Roundtrip.h deleted file mode 100644 index efef33dd7e6..00000000000 --- a/TAO/performance-tests/Thread_Per_Connection_Latency/Roundtrip.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -#ifndef ROUNDTRIP_H -#define ROUNDTRIP_H -#include "ace/pre.h" - -#include "TestS.h" - -#if defined (_MSC_VER) -# if (_MSC_VER >= 1200) -# pragma warning(push) -# endif /* _MSC_VER >= 1200 */ -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - -/// Implement the Test::Roundtrip interface -class Roundtrip - : public virtual POA_Test::Roundtrip - , public virtual PortableServer::RefCountServantBase -{ -public: - /// Constructor - Roundtrip (CORBA::ORB_ptr orb); - - // = The skeleton methods - virtual Test::Timestamp test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - /// Use an ORB reference to conver strings to objects and shutdown - /// the application. - CORBA::ORB_var orb_; -}; - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include "ace/post.h" -#endif /* ROUNDTRIP_H */ diff --git a/TAO/performance-tests/Thread_Per_Connection_Latency/client.cpp b/TAO/performance-tests/Thread_Per_Connection_Latency/client.cpp deleted file mode 100644 index 69aac2b4ca5..00000000000 --- a/TAO/performance-tests/Thread_Per_Connection_Latency/client.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// $Id$ - -#include "Client_Task.h" -#include "ace/Get_Opt.h" -#include "ace/High_Res_Timer.h" -#include "ace/Sched_Params.h" -#include "ace/Stats.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Thread_Per_Connection_Latency, client, "$Id$") - -const char *ior = "file://test.ior"; -int niterations = 1000; -int do_shutdown = 1; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "xk:i:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'x': - do_shutdown = 0; - break; - - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'i': - niterations = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "-i <niterations> " - "-x (disable shutdown) " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "client (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "client (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var object = - orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Roundtrip_var roundtrip = - Test::Roundtrip::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (roundtrip.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Nil Test::Roundtrip reference <%s>\n", - ior), - 1); - } - - ACE_DEBUG ((LM_DEBUG, "Starting threads\n")); - - Client_Task task0(roundtrip.in (), niterations); - Client_Task task1(roundtrip.in (), niterations); - Client_Task task2(roundtrip.in (), niterations); - Client_Task task3(roundtrip.in (), niterations); - - ACE_hrtime_t test_start = ACE_OS::gethrtime (); - task0.activate(THR_NEW_LWP | THR_JOINABLE); - task1.activate(THR_NEW_LWP | THR_JOINABLE); - task2.activate(THR_NEW_LWP | THR_JOINABLE); - task3.activate(THR_NEW_LWP | THR_JOINABLE); - - task0.thr_mgr()->wait (); - ACE_hrtime_t test_end = ACE_OS::gethrtime (); - - ACE_DEBUG ((LM_DEBUG, "Threads finished\n")); - - ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - ACE_DEBUG ((LM_DEBUG, "done\n")); - - ACE_Basic_Stats totals; - task0.accumulate_and_dump (totals, "Task[0]", gsf); - task1.accumulate_and_dump (totals, "Task[1]", gsf); - task2.accumulate_and_dump (totals, "Task[2]", gsf); - task3.accumulate_and_dump (totals, "Task[3]", gsf); - - totals.dump_results ("Total", gsf); - - ACE_Throughput_Stats::dump_throughput ("Total", gsf, - test_end - test_start, - totals.samples_count ()); - - if (do_shutdown) - { - roundtrip->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/Thread_Per_Connection_Latency/server.cpp b/TAO/performance-tests/Thread_Per_Connection_Latency/server.cpp deleted file mode 100644 index 004ce70cebf..00000000000 --- a/TAO/performance-tests/Thread_Per_Connection_Latency/server.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// $Id$ - -#include "Roundtrip.h" -#include "ace/Get_Opt.h" -#include "ace/Sched_Params.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Thread_Per_Connection_Latency, server, "$Id$") - -const char *ior_output_file = "test.ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <iorfile>" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, - priority); - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "server (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "server (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - Roundtrip *roundtrip_impl; - ACE_NEW_RETURN (roundtrip_impl, - Roundtrip (orb.in ()), - 1); - PortableServer::ServantBase_var owner_transfer(roundtrip_impl); - - Test::Roundtrip_var roundtrip = - roundtrip_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (roundtrip.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // If the ior_output_file exists, output the ior to it - FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_output_file), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); - - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/Thread_Pool_Latency/Client_Task.cpp b/TAO/performance-tests/Thread_Pool_Latency/Client_Task.cpp deleted file mode 100644 index efb544633b2..00000000000 --- a/TAO/performance-tests/Thread_Pool_Latency/Client_Task.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -// $Id$ -// -#include "Client_Task.h" - -ACE_RCSID(Thread_Pool_Latency, Client_Task, "$Id$") - -Client_Task::Client_Task (Test::Roundtrip_ptr roundtrip, - int niterations) - : roundtrip_ (Test::Roundtrip::_duplicate (roundtrip)) - , niterations_ (niterations) -{ -} - -int -Client_Task::svc (void) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->validate_connection (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - for (int i = 0; i != this->niterations_; ++i) - { - CORBA::ULongLong start = ACE_OS::gethrtime (); - - (void) this->roundtrip_->test_method (start ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_hrtime_t now = ACE_OS::gethrtime (); - this->latency_.sample (now - start); - } - } - ACE_CATCHANY - { - return 0; - } - ACE_ENDTRY; - return 0; -} - -void -Client_Task::accumulate_and_dump (ACE_Basic_Stats &totals, - const char *msg, - ACE_UINT32 gsf) -{ - totals.accumulate (this->latency_); - this->latency_.dump_results (msg, gsf); -} - -void -Client_Task::validate_connection (ACE_ENV_SINGLE_ARG_DECL) -{ - CORBA::ULongLong dummy = 0; - for (int i = 0; i != 100; ++i) - { - ACE_TRY - { - (void) this->roundtrip_->test_method (dummy ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY {} ACE_ENDTRY; - } -} diff --git a/TAO/performance-tests/Thread_Pool_Latency/Client_Task.h b/TAO/performance-tests/Thread_Pool_Latency/Client_Task.h deleted file mode 100644 index ffc4e9d6b6a..00000000000 --- a/TAO/performance-tests/Thread_Pool_Latency/Client_Task.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -#ifndef CLIENT_TASK_H -#define CLIENT_TASK_H -#include "ace/pre.h" - -#include "TestC.h" -#include "ace/Task.h" -#include "ace/Basic_Stats.h" - -/// Implement the Test::Client_Task interface -class Client_Task : public ACE_Task_Base -{ -public: - /// Constructor - Client_Task (Test::Roundtrip_ptr roundtrip, - int niterations); - - /// Add this thread results to the global numbers and print the - /// per-thread results. - void accumulate_and_dump (ACE_Basic_Stats &totals, - const char *msg, - ACE_UINT32 gsf); - - /// The service method - virtual int svc (void); - -private: - /// Make sure that the current thread has a connection available. - void validate_connection (ACE_ENV_SINGLE_ARG_DECL); - -private: - /// The object reference used for this test - Test::Roundtrip_var roundtrip_; - - /// The number of iterations - int niterations_; - - /// Keep track of the latency (minimum, average, maximum and jitter) - ACE_Basic_Stats latency_; -}; - -#include "ace/post.h" -#endif /* CLIENT_TASK_H */ diff --git a/TAO/performance-tests/Thread_Pool_Latency/Roundtrip.cpp b/TAO/performance-tests/Thread_Pool_Latency/Roundtrip.cpp deleted file mode 100644 index 6028512202c..00000000000 --- a/TAO/performance-tests/Thread_Pool_Latency/Roundtrip.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// $Id$ -// -#include "Roundtrip.h" - -ACE_RCSID(Thread_Pool_Latency, Roundtrip, "$Id$") - -Roundtrip::Roundtrip (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -Test::Timestamp -Roundtrip::test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return send_time; -} - -void -Roundtrip::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/performance-tests/Thread_Pool_Latency/Roundtrip.h b/TAO/performance-tests/Thread_Pool_Latency/Roundtrip.h deleted file mode 100644 index efef33dd7e6..00000000000 --- a/TAO/performance-tests/Thread_Pool_Latency/Roundtrip.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -#ifndef ROUNDTRIP_H -#define ROUNDTRIP_H -#include "ace/pre.h" - -#include "TestS.h" - -#if defined (_MSC_VER) -# if (_MSC_VER >= 1200) -# pragma warning(push) -# endif /* _MSC_VER >= 1200 */ -# pragma warning (disable:4250) -#endif /* _MSC_VER */ - -/// Implement the Test::Roundtrip interface -class Roundtrip - : public virtual POA_Test::Roundtrip - , public virtual PortableServer::RefCountServantBase -{ -public: - /// Constructor - Roundtrip (CORBA::ORB_ptr orb); - - // = The skeleton methods - virtual Test::Timestamp test_method (Test::Timestamp send_time - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - /// Use an ORB reference to conver strings to objects and shutdown - /// the application. - CORBA::ORB_var orb_; -}; - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma warning(pop) -#endif /* _MSC_VER */ - -#include "ace/post.h" -#endif /* ROUNDTRIP_H */ diff --git a/TAO/performance-tests/Thread_Pool_Latency/Worker_Thread.cpp b/TAO/performance-tests/Thread_Pool_Latency/Worker_Thread.cpp deleted file mode 100644 index e485bb2b843..00000000000 --- a/TAO/performance-tests/Thread_Pool_Latency/Worker_Thread.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// $Id$ -// -#include "Worker_Thread.h" - -ACE_RCSID(Thread_Pool_Latency, Worker_Thread, "$Id$") - -Worker_Thread::Worker_Thread (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -int -Worker_Thread::svc (void) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY {} ACE_ENDTRY; - return 0; -} diff --git a/TAO/performance-tests/Thread_Pool_Latency/client.cpp b/TAO/performance-tests/Thread_Pool_Latency/client.cpp deleted file mode 100644 index 643f541a53f..00000000000 --- a/TAO/performance-tests/Thread_Pool_Latency/client.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// $Id$ - -#include "Client_Task.h" -#include "ace/Get_Opt.h" -#include "ace/High_Res_Timer.h" -#include "ace/Sched_Params.h" -#include "ace/Stats.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Thread_Pool_Latency, client, "$Id$") - -const char *ior = "file://test.ior"; -int niterations = 1000; -int do_shutdown = 1; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "xk:i:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'x': - do_shutdown = 0; - break; - - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'i': - niterations = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "-i <niterations> " - "-x (disable shutdown) " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "client (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "client (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var object = - orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Roundtrip_var roundtrip = - Test::Roundtrip::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (roundtrip.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Nil Test::Roundtrip reference <%s>\n", - ior), - 1); - } - - ACE_DEBUG ((LM_DEBUG, "Starting threads\n")); - - Client_Task task0(roundtrip.in (), niterations); - Client_Task task1(roundtrip.in (), niterations); - Client_Task task2(roundtrip.in (), niterations); - Client_Task task3(roundtrip.in (), niterations); - - ACE_hrtime_t test_start = ACE_OS::gethrtime (); - task0.activate(THR_NEW_LWP | THR_JOINABLE); - task1.activate(THR_NEW_LWP | THR_JOINABLE); - task2.activate(THR_NEW_LWP | THR_JOINABLE); - task3.activate(THR_NEW_LWP | THR_JOINABLE); - - task0.thr_mgr()->wait (); - ACE_hrtime_t test_end = ACE_OS::gethrtime (); - - ACE_DEBUG ((LM_DEBUG, "Threads finished\n")); - - ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - ACE_DEBUG ((LM_DEBUG, "done\n")); - - ACE_Basic_Stats totals; - task0.accumulate_and_dump (totals, "Task[0]", gsf); - task1.accumulate_and_dump (totals, "Task[1]", gsf); - task2.accumulate_and_dump (totals, "Task[2]", gsf); - task3.accumulate_and_dump (totals, "Task[3]", gsf); - - totals.dump_results ("Total", gsf); - - ACE_Throughput_Stats::dump_throughput ("Total", gsf, - test_end - test_start, - totals.samples_count ()); - - if (do_shutdown) - { - roundtrip->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/performance-tests/Thread_Pool_Latency/server.cpp b/TAO/performance-tests/Thread_Pool_Latency/server.cpp deleted file mode 100644 index bcacaf713c2..00000000000 --- a/TAO/performance-tests/Thread_Pool_Latency/server.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// $Id$ - -#include "Roundtrip.h" -#include "Worker_Thread.h" -#include "ace/Get_Opt.h" -#include "ace/Sched_Params.h" - -#include "tao/Strategies/advanced_resource.h" - -ACE_RCSID(Thread_Pool_Latency, server, "$Id$") - -const char *ior_output_file = "test.ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <iorfile>" - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, - priority); - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. - - if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "server (%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "server (%P|%t): sched_params failed\n")); - } - - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - Roundtrip *roundtrip_impl; - ACE_NEW_RETURN (roundtrip_impl, - Roundtrip (orb.in ()), - 1); - PortableServer::ServantBase_var owner_transfer(roundtrip_impl); - - Test::Roundtrip_var roundtrip = - roundtrip_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (roundtrip.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // If the ior_output_file exists, output the ior to it - FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_output_file), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - Worker_Thread worker (orb.in ()); - - worker.activate (THR_NEW_LWP | THR_JOINABLE, 4, 1); - worker.thr_mgr ()->wait (); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); - - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tao/CORBALOC_Parser.cpp b/TAO/tao/CORBALOC_Parser.cpp index 8d54c22764a..cd64090e2b4 100644 --- a/TAO/tao/CORBALOC_Parser.cpp +++ b/TAO/tao/CORBALOC_Parser.cpp @@ -1,41 +1,301 @@ #include "CORBALOC_Parser.h" #include "ORB_Core.h" #include "Stub.h" -#include "MProfile.h" #include "Connector_Registry.h" -#include "Transport_Connector.h" -#include "Protocol_Factory.h" +#include "SystemException.h" #include "tao/debug.h" -#include "ace/Vector_T.h" -#include "ace/INET_Addr.h" -#include "ace/os_include/os_netdb.h" +#include "ace/OS_NS_strings.h" +#include "ace/OS_NS_string.h" #if !defined(__ACE_INLINE__) #include "CORBALOC_Parser.i" #endif /* __ACE_INLINE__ */ -ACE_RCSID (TAO, + +ACE_RCSID (tao, CORBALOC_Parser, "$Id$") + TAO_CORBALOC_Parser::~TAO_CORBALOC_Parser (void) { } -static const char prefix[] = "corbaloc:"; -static const size_t prefix_len = sizeof prefix - 1; -static const char rir_token[] = "rir:/"; // includes key separator -static const size_t rir_token_len = sizeof rir_token - 1; -static const char iiop_token[] = "iiop:"; -static const char iiop_token_len = sizeof iiop_token - 1; +static const char corbaloc_prefix[] = "corbaloc:"; + +static const char* protocol_prefixes[] = { + "iiop", + "miop", + "rir", + "sciop", + "shmiop", + "uiop" +}; int TAO_CORBALOC_Parser::match_prefix (const char *ior_string) const { // Check if the prefix is 'corbaloc:' and return the result. return (ACE_OS::strncmp (ior_string, - prefix, - prefix_len) == 0); + corbaloc_prefix, + sizeof corbaloc_prefix - 1) == 0); +} + +void +TAO_CORBALOC_Parser::parse_string_count_helper (const char * s, + CORBA::ULong &addr_list_length, + CORBA::ULong &addr_count + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + char object_key_delimiter = '/'; + + if (ACE_OS::strncmp (s, "uiop", 4) == 0) + object_key_delimiter = '|'; + + for (const char *i = s; *i != '\0'; ++i) + { + if (*i == ',') + { + // Increment the address count + ++addr_count; + } + + if (*i == ':' + && *(i + 1) == '/' + && *(i + 2) == '/') + { + if (TAO_debug_level > 0) + ACE_ERROR((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) Invalid Syntax: %s\n"), + ACE_TEXT_CHAR_TO_TCHAR (s))); + + ACE_THROW (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10, + CORBA::COMPLETED_NO)); + } + + if (*i == object_key_delimiter + && *(i+1) != object_key_delimiter) + { + // Indication that the next characters are to be + // assigned to key_string + return; + } + + ++addr_list_length; + } +} + +void +TAO_CORBALOC_Parser::assign_key_string (char *& cloc_name_ptr, + ACE_CString & key_string, + CORBA::ULong + &addr_list_length, + CORBA::ORB_ptr orb, + TAO_MProfile &mprofile + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::String_var end_point; + const char protocol_prefix[] = ":"; + const char protocol_suffix_append[] = "://"; + const char iiop_prefix[] = "iiop"; + const char uiop_prefix[] = "uiop"; + const char def_port[] = ":2809"; + + // Copy the cloc_name_ptr to cloc_name_cstring. + ACE_CString cloc_name_cstring (cloc_name_ptr, + addr_list_length, + 0, + 1); + + // pos_colon is the position of the ':' in the iiop_id + // <iiop_id> = ":" | <iiop_prot_token>":" + int pos_colon = cloc_name_cstring.find (':', 0); + + if (ACE_OS::strncmp (cloc_name_ptr, + protocol_prefix, + sizeof (protocol_prefix) - 1) == 0) + { + // If there is no protocol explicitly specified then default to + // "iiop". + end_point = CORBA::string_alloc (addr_list_length + + sizeof (iiop_prefix) - 1 + + 1 // Object key separator + + 3 // "://" + + sizeof (def_port) - 1 + + static_cast<CORBA::ULong> ( + key_string.length ())); + + // Copy the default <iiop> prefix. + ACE_OS::strcpy (end_point.inout (), + iiop_prefix); + + // Append '://' + ACE_OS::strcat (end_point.inout (), + protocol_suffix_append); + } + else + { + // The case where the protocol to be used is explicitly + // specified. + + // The space allocated for the default IIOP port is not needed + // for all protocols, but it is only 5 bytes. No biggy. + end_point = CORBA::string_alloc (addr_list_length + + 1 // Object key separator + + 3 // "://" + + sizeof (def_port) - 1 + + static_cast<CORBA::ULong> ( + key_string.length ())); + + ACE_CString prot_name = cloc_name_cstring.substring (0, + pos_colon); + + // Form the endpoint + + // Example: + // prot_name.c_str () = iiop + ACE_OS::strcpy (end_point.inout (), + prot_name.c_str ());; + + + // Example: + // The endpoint will now be of the form 'iiop' + + ACE_OS::strcat (end_point.inout (), + protocol_suffix_append); + + // The endpoint will now be of the form 'iiop://' + } + + ACE_CString addr = + cloc_name_cstring.substring (pos_colon + 1, -1); + + ACE_OS::strcat (end_point.inout (), + addr.c_str ()); + + // Check for an IIOP corbaloc IOR. If the port number is not + // specified, append the default corbaloc port number (i.e. "2809") + if (ACE_OS::strncmp (end_point.in (), + iiop_prefix, + sizeof (iiop_prefix) - 1) == 0 + && addr.find (':') == ACE_CString::npos) + ACE_OS::strcat (end_point.inout (), def_port); + + // Example: + // The End_point will now be of the form + // 'iiop://1.0@doc.ece.uci.edu:12345' + + if (ACE_OS::strncmp (cloc_name_ptr, + uiop_prefix, + sizeof (uiop_prefix) - 1) == 0) + { + // The separator for the uiop protocol is '|'. This should + // actually be later changed so that the separator is '/' as the + // other protocols. + ACE_OS::strcat (end_point.inout (), "|"); + } + else + { + ACE_OS::strcat (end_point.inout (), "/"); + } + + // Append the key string. + ACE_OS::strcat (end_point.inout (), + key_string.c_str ()); + + // Example: The End_point will now be of the form: + // 'iiop://1.0@doc.ece.uci.edu:12345/object_name' + + // Call the mprofile helper which makes an mprofile for this + // endpoint and adds it to the big mprofile. + this->parse_string_mprofile_helper (end_point.in (), + orb, + mprofile + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_CORBALOC_Parser::parse_string_assign_helper ( + ACE_CString &key_string, + ACE_CString &cloc_name, + CORBA::ORB_ptr orb, + TAO_MProfile &mprofile + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + char *cloc_name_ptr = 0; + + // Tokenize using "," as the seperator + char *last_addr = 0; + + cloc_name_ptr = + ACE_OS::strtok_r (const_cast<char *> (cloc_name.c_str ()), + ",", + &last_addr); + + CORBA::ULong length; + while (cloc_name_ptr != 0) + { + length = static_cast<CORBA::ULong> (ACE_OS::strlen (cloc_name_ptr)); + // Forms the endpoint and calls the mprofile_helper. + this->assign_key_string (cloc_name_ptr, + key_string, + length, + orb, + mprofile + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Get the next token. + cloc_name_ptr = ACE_OS::strtok_r ((char*)NULL, + ",", + &last_addr); + } +} + + +void +TAO_CORBALOC_Parser::parse_string_mprofile_helper ( + const char * end_point, + CORBA::ORB_ptr orb, + TAO_MProfile &mprofile + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + TAO_MProfile jth_mprofile; + + TAO_Connector_Registry *conn_reg = + orb->orb_core ()->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + int retv = + conn_reg->make_mprofile (end_point, + jth_mprofile + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (retv != 0) + { + ACE_THROW (CORBA::INV_OBJREF ( + CORBA::SystemException::_tao_minor_code ( + 0, + EINVAL), + CORBA::COMPLETED_NO)); + } + + TAO_MProfile *jth_mprofile_ptr = &jth_mprofile; + + // Add this profile to the main mprofile. + int result = mprofile.add_profiles (jth_mprofile_ptr); + + if (result == -1) + { + // The profile is not added. Either way, go to the next + // endpoint. + } } CORBA::Object_ptr @@ -56,263 +316,176 @@ TAO_CORBALOC_Parser::make_stub_from_mprofile (CORBA::ORB_ptr orb, if (!CORBA::is_nil (obj.in ())) { - /// All is well, so release the stub object from its - /// auto_ptr. + // All is well, so release the stub object from its auto_ptr. (void) safe_data.release (); - /// Return the object reference to the application. + // Return the object reference to the application. return obj._retn (); } - /// Shouldnt come here: if so, return nil reference. + // Shouldn't come here: if so, return nil reference. return CORBA::Object::_nil (); } CORBA::Object_ptr -TAO_CORBALOC_Parser::parse_string_rir_helper (const char * ior, +TAO_CORBALOC_Parser::parse_string_rir_helper (const char *& corbaloc_name, CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - // Pass the key string as an argument to resolve_initial_references. - // NameService is the default if an empty key string is supplied. - const char *objkey = ior + rir_token_len; + + + // "rir" protocol. Pass the key string as an + // argument to the resolve_initial_references. + const char *key_string = corbaloc_name + sizeof ("rir:/") -1; + + if (ACE_OS::strcmp (key_string, "") == 0) + { + // If the key string is empty, assume the default + // "NameService". + key_string = "NameService"; + } CORBA::Object_var rir_obj = - orb->resolve_initial_references (*objkey == '\0' ? "NameService" : - objkey + orb->resolve_initial_references (key_string ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CORBA::Object::_nil ()); return rir_obj._retn (); } -CORBA::Object_ptr -TAO_CORBALOC_Parser::parse_string (const char * ior, - CORBA::ORB_ptr orb +int +TAO_CORBALOC_Parser::check_prefix (const char *end_point ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - // The decomposition of a corbaloc string is in Section 13.6.10. - // - // following the "corbaloc:" - // a comma separated list of <prot_addr> strings - // for each, - // Separate out the key, delimited by '/' - // Split out the various parts of our corbaloc string, comma-delimited - // For each part - // Determine the protocol - // If rir, defer to another function and return the object - // If iiop, make the profile with <endpoint>:<port>/<key> - // If another protocol, use <remainder>/<key> - // Search through the collection of protocols for the correct one - // If not found, throw exception - // If found, make our_connector from it. - // our_connector->make_mprofile_unchecked (...); - // object = this->make_stub_from_mprofile (...); - // Return the object - // Skip the prefix. We know it is there because this method is only - // called if match_prefix() returns 1. - ior += ACE_OS::strlen(prefix); - - // First check for rir - if (ACE_OS::strncmp (ior,rir_token,rir_token_len) == 0) - return this->parse_string_rir_helper (ior,orb - ACE_ENV_ARG_PARAMETER); - - // set up space for parsed endpoints. there will be at least 1, and - // most likely commas will separate endpoints, although they could be - // part of an endpoint address for some protocols. - size_t max_endpoint_count = 1; - for (const char *comma = ACE_OS::strchr (ior,','); - comma; - comma = ACE_OS::strchr (comma+1,',')) - max_endpoint_count++; - - ACE_Array<parsed_endpoint> endpoints(max_endpoint_count); - endpoints.size (0); - - // Get the Connector Registry from the ORB. - TAO_Connector_Registry *conn_reg = - orb->orb_core ()->connector_registry(ACE_ENV_SINGLE_ARG_PARAMETER); - - while (1) { // will loop on comma only. - size_t len = 0; - size_t ndx = endpoints.size(); - endpoints.size(ndx+1); - int uiop_compatible = 0; - TAO_ConnectorSetIterator conn_iter = 0; - for (conn_iter = conn_reg->begin(); - conn_iter != conn_reg->end() && - endpoints[ndx].profile_ == 0; - conn_iter ++) - { - endpoints[ndx].profile_ = - (*conn_iter)->corbaloc_scan(ior,len - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - if (endpoints[ndx].profile_) - { - endpoints[ndx].obj_key_sep_ = - (*conn_iter)->object_key_delimiter(); - uiop_compatible = (endpoints[ndx].obj_key_sep_ == '|'); - this->make_canonical (ior,len,endpoints[ndx].prot_addr_ - ACE_ENV_ARG_PARAMETER); - ior += len; - break; - } - } - - if (endpoints[ndx].profile_ == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - "(%P|%t) TAO_CORBALOC_Parser::parse_string " - "could not parse from %s",ior)); - ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10, - CORBA::COMPLETED_NO), - CORBA::Object::_nil ()); - } - if (*ior == ',') // more endpoints follow - { - ior++; - continue; - } - - if (*ior == '/') // found key separator - { - ior ++; - break; - } - - if (uiop_compatible && *(ior - 1) == '|') - // Assume this is an old uiop style corbaloc. No need to warn here, - // the UIOP_Connector::corbaloc_scan already did. - break; - - // anything else is a violation. - if (TAO_debug_level) - ACE_ERROR ((LM_ERROR, - "(%P|%t) TAO_CORBALOC_Parser::parse_string " - "could not parse from %s",ior)); - ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10, - CORBA::COMPLETED_NO), - CORBA::Object::_nil ()); - } // end of while - - // At this point, ior points at the start of the object key - ACE_CString obj_key (*ior ? ior : (const char *)"NameService"); - - // now take the collection of endpoints along with the decoded key and - // mix them together to get the mprofile. - TAO_MProfile mprofile (endpoints.size()); - - for (size_t i = 0; i < endpoints.size(); i++) + // This checks if the prefix is "rir:" or not. Returns a -1 if it is + // "rir:" else returns a zero; + // Check for a valid string + if (!end_point || !*end_point) + return -1; // Failure + + const char *protocol[] = {"rir:"}; + size_t slot = ACE_OS::strchr (end_point, '/') - end_point; + const char* colon_pos = ACE_OS::strchr (end_point, ':'); + size_t colon_slot = colon_pos ? colon_pos - end_point : 0; + size_t len0 = ACE_OS::strlen (protocol[0]); + + // Lets first check if it is a valid protocol: + if (colon_slot != 0) + { + size_t i; + const size_t protocol_prefixes_size = + sizeof(protocol_prefixes)/sizeof(protocol_prefixes[0]); + + for (i = 0; i < protocol_prefixes_size ; ++i) { - ACE_CString full_ep = endpoints[i].prot_addr_ + - endpoints[i].obj_key_sep_ + - obj_key; - const char * str = full_ep.c_str(); - endpoints[i].profile_->parse_string (str - ACE_ENV_ARG_PARAMETER); - if (mprofile.add_profile(endpoints[i].profile_) != -1) - endpoints[i].profile_ = 0; + if (ACE_OS::strncmp (end_point, + protocol_prefixes[i], + colon_slot) == 0) + break; } - CORBA::Object_ptr object = CORBA::Object::_nil (); - // Get an object stub out. - object = this->make_stub_from_mprofile (orb, - mprofile - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); + if (i == protocol_prefixes_size) + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) ") + ACE_TEXT ("no usable transport protocol ") + ACE_TEXT ("was found.\n"))); + + ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10, + CORBA::COMPLETED_NO), + -1); + } + } - return object; + // Check for the proper prefix in the IOR. If the proper prefix + // isn't in the IOR then it is not an IOR we can use. + if (slot == len0 + && ACE_OS::strncasecmp (end_point, protocol[0], len0) == 0) + return 0; + + return 1; } -void -TAO_CORBALOC_Parser::make_canonical (const char *ior, - size_t prot_addr_len, - ACE_CString &canonical_endpoint - ACE_ENV_ARG_DECL) +CORBA::Object_ptr +TAO_CORBALOC_Parser::parse_string (const char * ior, + CORBA::ORB_ptr orb + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - const char *separator = ACE_OS::strchr (ior, ':'); + // MProfile which consists of the profiles for each endpoint. + TAO_MProfile mprofile; - // A special case for handling iiop - if (ior[0] != ':' && ACE_OS::strncmp (ior,iiop_token,iiop_token_len) != 0) - { - canonical_endpoint.set (separator+1, - prot_addr_len - (separator - ior) - 1,1); - return; - } - - const char *addr_base = separator+1; - const char *addr_tail = ior + prot_addr_len; - // skip past version, if any - separator = ACE_OS::strchr (addr_base,'@'); - if (separator != 0 && separator < addr_tail) - { - canonical_endpoint.set (addr_base,(separator - addr_base)+1,1); - addr_base = separator + 1; - } - else - canonical_endpoint.clear (); + // Skip the prefix. We know it is there because this method is only + // called if match_prefix() returns 1. + const char *corbaloc_name = + ior + sizeof corbaloc_prefix - 1; - ACE_CString raw_host; - ACE_CString raw_port; - separator = ACE_OS::strchr (addr_base,':'); - if (separator != 0 && separator < addr_tail) - { - // we have a port number - if (separator - addr_base > 0) - raw_host.set (addr_base, (separator - addr_base),1); - raw_port.set (separator, (addr_tail - separator), 1); - } - else - { - // we must default port # - if (addr_base < addr_tail) - raw_host.set (addr_base, (addr_tail - addr_base),1); - raw_port.set (":2809"); - } + CORBA::Object_ptr object = CORBA::Object::_nil (); - if (raw_host.length() == 0) - { - ACE_INET_Addr host_addr; + // Number of endpoints + CORBA::ULong count_addr = 1; - char tmp_host [MAXHOSTNAMELEN + 1]; + // Length of obj_addr_list + CORBA::ULong addr_list_length = 0; - // If no host is specified: assign the default host, i.e. the - // local host. - if (host_addr.get_host_name (tmp_host, - sizeof (tmp_host)) != 0) - { - // Can't get the IP address since the INET_Addr wasn't - // initialized. Just throw an exception. + // If the protocol is not "rir:" and also is a valid protocol + int check_prefix_result = this->check_prefix (corbaloc_name + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) ") - ACE_TEXT ("cannot determine hostname.\n"))); - - ACE_THROW (CORBA::INV_OBJREF - (CORBA::SystemException::_tao_minor_code - (0, EINVAL), - CORBA::COMPLETED_NO)); - } - else - { - canonical_endpoint += tmp_host; - } + if (check_prefix_result != 0) + { + // Count the length of the obj_addr_list and number of + // endpoints in the obj_addr_list + this->parse_string_count_helper (corbaloc_name, + addr_list_length, + count_addr + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + // Convert corbaloc_name to an ACE_CString + ACE_CString corbaloc_name_str (corbaloc_name, 0, 1); + + // Get the key_string which is a substring of corbaloc_name_str + ACE_CString key_string = + corbaloc_name_str.substring (addr_list_length + 1); + + // Copy the <obj_addr_list> to cloc_name. + ACE_CString cloc_name (corbaloc_name, + addr_list_length, + 0, + 1); + + // Get each endpoint: For each endpoint, make a MProfile and add + // it to the main MProfile whose reference is passed to the + // application + this->parse_string_assign_helper (key_string, + cloc_name, + orb, + mprofile + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + // Create the stub for the mprofile and get the object reference + // to it which is to be returned to the client application. + object = this->make_stub_from_mprofile (orb, + mprofile + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); } else { - canonical_endpoint += raw_host; + // RIR case: + object = this->parse_string_rir_helper (corbaloc_name, + orb + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); } - - canonical_endpoint += raw_port; + return object; } ACE_STATIC_SVC_DEFINE (TAO_CORBALOC_Parser, @@ -326,7 +499,7 @@ ACE_STATIC_SVC_DEFINE (TAO_CORBALOC_Parser, ACE_FACTORY_DEFINE (TAO, TAO_CORBALOC_Parser) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Array_Base<TAO_CORBALOC_Parser::parsed_endpoint>; +template class ACE_Array_Base<char *>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Array_Base<TAO_CORBALOC_Parser::parsed_endpoint> +#pragma instantiate ACE_Array_Base<char *> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/CORBALOC_Parser.h b/TAO/tao/CORBALOC_Parser.h index 115923899a3..0d12aa87d95 100644 --- a/TAO/tao/CORBALOC_Parser.h +++ b/TAO/tao/CORBALOC_Parser.h @@ -11,24 +11,20 @@ */ //============================================================================= - #ifndef TAO_CORBALOC_PARSER_H #define TAO_CORBALOC_PARSER_H -#include "ace/pre.h" -#include "tao/IOR_Parser.h" +#include /**/ "ace/pre.h" +#include "ace/Service_Config.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Service_Config.h" -#include "ace/Array.h" -#include "tao/Profile.h" +#include "tao/IOR_Parser.h" class TAO_MProfile; - /** * @class TAO_CORBALOC_Parser * @@ -55,40 +51,78 @@ public: /// Parse the ior-string that is passed. virtual CORBA::Object_ptr parse_string (const char *ior, CORBA::ORB_ptr orb - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)); private: + /// Checks the prefix to see if it is RIR. + virtual int check_prefix (const char *endpoint + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Helps count the length of the <obj_addr_list> and the number of + /// individual <obj_addr> in the <obj_addr_list>. + virtual void parse_string_count_helper (const char * corbaloc_name, + CORBA::ULong &addr_list_length, + CORBA::ULong &count_addr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /** + * Creates a MProfile for the endpoint passed and each such mprofile + * is added to the big mprofile <mprofile_> from which a pointer to + * the Object represented by the key_string is obtained and passed + * to the application. + */ + virtual void parse_string_mprofile_helper (const char * end_point, + CORBA::ORB_ptr orb, + TAO_MProfile &mprofile + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + /** * Make a stub from the MProfile that is created in * parse_string_mprofile_helper. Using this stub, create an object * reference which is sent to the application. */ - CORBA::Object_ptr make_stub_from_mprofile (CORBA::ORB_ptr orb, - TAO_MProfile &mprofile - ACE_ENV_ARG_DECL) + virtual CORBA::Object_ptr + make_stub_from_mprofile (CORBA::ORB_ptr orb, + TAO_MProfile &mprofile + ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)); /// Gets the pointer to the key_string when the protocol used is RIR - CORBA::Object_ptr parse_string_rir_helper (const char *corbaloc_name, - CORBA::ORB_ptr orb - ACE_ENV_ARG_DECL) + virtual CORBA::Object_ptr + parse_string_rir_helper (const char * &corbaloc_name, + CORBA::ORB_ptr orb + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Tokenizes the <obj_addr_list> using "," as the seperator. Assigns + /// individual endpoints to the elements of the ACE_Array_Base. + virtual void parse_string_assign_helper ( + ACE_CString &key_string, + ACE_CString &cloc_name, + CORBA::ORB_ptr orb, + TAO_MProfile &mprofile + ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)); - void make_canonical (const char *ior, - size_t ior_len, - ACE_CString &canonical_endpoint - ACE_ENV_ARG_DECL) + /** + * Helps parse_string_assign_helper by assigning in the case when + * the protocol name is present and we have to append jsut the key + * string. + */ + virtual void + assign_key_string(char * &cloc_name_ptr, + ACE_CString &key_string, + CORBA::ULong &addr_list_length, + CORBA::ORB_ptr orb, + TAO_MProfile &mprofile + ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)); - struct parsed_endpoint { - parsed_endpoint () : profile_ (0) {} - ~parsed_endpoint () { delete this->profile_; } - TAO_Profile *profile_; - char obj_key_sep_; - ACE_CString prot_addr_; - }; }; #if defined (__ACE_INLINE__) @@ -98,5 +132,5 @@ private: ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_CORBALOC_Parser) ACE_FACTORY_DECLARE (TAO, TAO_CORBALOC_Parser) -#include "ace/post.h" +#include /**/ "ace/post.h" #endif /* TAO_CORBALOC_PARSER_H */ diff --git a/TAO/tao/Connector_Registry.cpp b/TAO/tao/Connector_Registry.cpp index 7fd840cffc8..57bc3f9d201 100644 --- a/TAO/tao/Connector_Registry.cpp +++ b/TAO/tao/Connector_Registry.cpp @@ -71,22 +71,18 @@ TAO_Connector_Registry::open (TAO_ORB_Core *orb_core) TAO_Connector * connector = (*factory)->factory ()->make_connector (); - if (connector) + if (connector && connector->open (orb_core) != 0) { - if (connector->open (orb_core) != 0) - { - delete connector; - - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("TAO (%P|%t) unable to open connector for ") - ACE_LIB_TEXT ("<%s>.\n"), - ACE_TEXT_CHAR_TO_TCHAR((*factory)->protocol_name ().c_str ())), - -1); - } - this->connectors_[this->size_++] = connector; + delete connector; + + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) unable to open connector for ") + ACE_TEXT ("<%s>.\n"), + ACE_TEXT_CHAR_TO_TCHAR((*factory)->protocol_name ().c_str ())), + -1); } else - return -1; + this->connectors_[this->size_++] = connector; } return 0; diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index dfdd5db0474..0dc4d09e384 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -254,19 +254,18 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) // this particular environment and that isn't handled by the // networking infrastructure (e.g., IPSEC). - CORBA::ULong bodylen = ACE_static_cast (CORBA::ULong, - total_len - TAO_GIOP_MESSAGE_HEADER_LEN); + CORBA::ULong bodylen = + static_cast<CORBA::ULong> (total_len - TAO_GIOP_MESSAGE_HEADER_LEN); #if !defined (ACE_ENABLE_SWAP_ON_WRITE) - *ACE_reinterpret_cast (CORBA::ULong *, buf + - TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; + *reinterpret_cast<CORBA::ULong *> (buf + TAO_GIOP_MESSAGE_SIZE_OFFSET) + = bodylen; #else if (!stream.do_byte_swap ()) - *ACE_reinterpret_cast (CORBA::ULong *, - buf + TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; + *reinterpret_cast<CORBA::ULong *> (buf + TAO_GIOP_MESSAGE_SIZE_OFFSET) + = bodylen; else - ACE_CDR::swap_4 (ACE_reinterpret_cast (char *, - &bodylen), + ACE_CDR::swap_4 (reinterpret_cast<char *>(&bodylen), buf + TAO_GIOP_MESSAGE_SIZE_OFFSET); #endif /* ACE_ENABLE_SWAP_ON_WRITE */ @@ -284,8 +283,7 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) } /// this->dump_msg ("send", - ACE_reinterpret_cast (u_char *, - buf), + reinterpret_cast<u_char *>(buf), total_len); // @@ -334,264 +332,6 @@ TAO_GIOP_Message_Base::message_type ( } int -TAO_GIOP_Message_Base::parse_incoming_messages (ACE_Message_Block &incoming) -{ - - if (this->message_state_.parse_message_header (incoming) == -1) - { - return -1; - } - - return 0; -} - -ssize_t -TAO_GIOP_Message_Base::missing_data (ACE_Message_Block &incoming) -{ - // Actual message size including the header.. - CORBA::ULong msg_size = - this->message_state_.message_size (); - - size_t len = incoming.length (); - - // If we have too many messages or if we have less than even a size - // of the GIOP header then .. - if (len > msg_size || - len < TAO_GIOP_MESSAGE_HEADER_LEN) - { - return -1; - } - else if (len == msg_size) - return 0; - - return msg_size - len; -} - - -int -TAO_GIOP_Message_Base::extract_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data *&qd) -{ - TAO_GIOP_Message_State state (this->orb_core_, - this); - - if (incoming.length () < TAO_GIOP_MESSAGE_HEADER_LEN) - { - if (incoming.length () > 0) - { - // Make a node which has a message block of the size of - // MESSAGE_HEADER_LEN. - qd = - this->make_queued_data (TAO_GIOP_MESSAGE_HEADER_LEN); - - qd->msg_block_->copy (incoming.rd_ptr (), - incoming.length ()); - qd->missing_data_ = -1; - } - return 0; - } - - if (state.parse_message_header (incoming) == -1) - { - return -1; - } - - size_t copying_len = state.message_size (); - - qd = this->make_queued_data (copying_len); - - if (copying_len > incoming.length ()) - { - qd->missing_data_ = - copying_len - incoming.length (); - - copying_len = incoming.length (); - } - - qd->msg_block_->copy (incoming.rd_ptr (), - copying_len); - - incoming.rd_ptr (copying_len); - qd->byte_order_ = state.byte_order_; - qd->major_version_ = state.giop_version_.major; - qd->minor_version_ = state.giop_version_.minor; - qd->msg_type_ = this->message_type (state); - return 1; -} - -int -TAO_GIOP_Message_Base::consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming) -{ - // Look to see whether we had atleast parsed the GIOP header ... - if (qd->missing_data_ == -1) - { - // The data length that has been stuck in there during the last - // read .... - size_t len = - qd->msg_block_->length (); - - // We know that we would have space for - // TAO_GIOP_MESSAGE_HEADER_LEN here. So copy that much of data - // from the <incoming> into the message block in <qd> - qd->msg_block_->copy (incoming.rd_ptr (), - TAO_GIOP_MESSAGE_HEADER_LEN - len); - - // Move the rd_ptr () in the incoming message block.. - incoming.rd_ptr (TAO_GIOP_MESSAGE_HEADER_LEN - len); - - TAO_GIOP_Message_State state (this->orb_core_, - this); - - // Parse the message header now... - if (state.parse_message_header (*qd->msg_block_) == -1) - return -1; - - // Now grow the message block so that we can copy the rest of - // the data... - if (qd->msg_block_->space () < state.message_size ()) - { - ACE_CDR::grow (qd->msg_block_, - state.message_size ()); - } - - // Copy the pay load.. - // Calculate the bytes that needs to be copied in the queue... - size_t copy_len = - state.payload_size (); - - // If the data that needs to be copied is more than that is - // available to us .. - if (copy_len > incoming.length ()) - { - // Calculate the missing data.. - qd->missing_data_ = - copy_len - incoming.length (); - - // Set the actual possible copy_len that is available... - copy_len = incoming.length (); - } - else - { - qd->missing_data_ = 0; - } - - // ..now we are set to copy the right amount of data to the - // node.. - qd->msg_block_->copy (incoming.rd_ptr (), - copy_len); - - // Set the <rd_ptr> of the <incoming>.. - incoming.rd_ptr (copy_len); - - // Get the other details... - qd->byte_order_ = state.byte_order_; - qd->major_version_ = state.giop_version_.major; - qd->minor_version_ = state.giop_version_.minor; - qd->msg_type_ = this->message_type (state); - } - else - { - // @@todo: Need to abstract this out to a seperate method... - size_t copy_len = qd->missing_data_; - - if (copy_len > incoming.length ()) - { - // Calculate the missing data.. - qd->missing_data_ = - copy_len - incoming.length (); - - // Set the actual possible copy_len that is available... - copy_len = incoming.length (); - } - - // Copy the right amount of data in to the node... - // node.. - qd->msg_block_->copy (incoming.rd_ptr (), - copy_len); - - // Set the <rd_ptr> of the <incoming>.. - qd->msg_block_->rd_ptr (copy_len); - - } - - - return 0; -} - - -int -TAO_GIOP_Message_Base::consolidate_fragments (TAO_Queued_Data *dqd, - const TAO_Queued_Data *sqd) -{ - if (dqd->byte_order_ != sqd->byte_order_ - || dqd->major_version_ != sqd->major_version_ - || dqd->minor_version_ != sqd->minor_version_) - { - // Yes, print it out in all debug levels!. This is an error by - // CORBA 2.4 spec - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) incompatible fragments:") - ACE_TEXT ("different GIOP versions or byte order\n"))); - return -1; - } - - // Skip the header in the incoming message - sqd->msg_block_->rd_ptr (TAO_GIOP_MESSAGE_HEADER_LEN); - - // If we have a fragment header skip the header length too.. - if (sqd->minor_version_ == 2 && - sqd->msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT) - sqd->msg_block_->rd_ptr (TAO_GIOP_MESSAGE_FRAGMENT_HEADER); - - // Get the length of the incoming message block.. - size_t incoming_length = - sqd->msg_block_->length (); - - // Increase the size of the destination message block if we need - // to. - ACE_Message_Block *mb = - dqd->msg_block_; - - // Check space before growing. - if (mb->space () < incoming_length) - { - ACE_CDR::grow (mb, - mb->length () + incoming_length); - } - - // Copy the data - dqd->msg_block_->copy (sqd->msg_block_->rd_ptr (), - incoming_length); - return 0; -} - -void -TAO_GIOP_Message_Base::get_message_data (TAO_Queued_Data *qd) -{ - // Get the message information - qd->byte_order_ = - this->message_state_.byte_order_; - qd->major_version_ = - this->message_state_.giop_version_.major; - qd->minor_version_ = - this->message_state_.giop_version_.minor; - - //qd->more_fragments_ = this->message_state_.more_fragments_; - - if (this->message_state_.more_fragments_) - qd->more_fragments_ = 1; - else - qd->more_fragments_ = 0; - - qd->msg_type_= - this->message_type (this->message_state_); - - // Reset the message_state - this->message_state_.reset (); -} - -int TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, TAO_Queued_Data *qd) @@ -641,8 +381,7 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, if (TAO_debug_level > 0) this->dump_msg ("recv", - ACE_reinterpret_cast (u_char *, - qd->msg_block_->rd_ptr ()), + reinterpret_cast<u_char *> (qd->msg_block_->rd_ptr ()), qd->msg_block_->length ()); @@ -735,8 +474,7 @@ TAO_GIOP_Message_Base::process_reply_message ( if (TAO_debug_level > 0) this->dump_msg ("recv", - ACE_reinterpret_cast (u_char *, - qd->msg_block_->rd_ptr ()), + reinterpret_cast<u_char *>(qd->msg_block_->rd_ptr ()), qd->msg_block_->length ()); @@ -901,7 +639,9 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, parse_error = parser->parse_request_header (request); - request.orb_core()->codeset_manager()->process_service_context(request); + TAO_Codeset_Manager *csm = request.orb_core()->codeset_manager(); + if (csm) + csm->process_service_context(request); transport->assign_translators(&cdr,&output); // Throw an exception if the @@ -1347,6 +1087,7 @@ TAO_GIOP_Message_Base::set_state ( // orderly disconnect as provided by TCP. This quality of service is // required to write robust distributed systems.) +#if 0 void TAO_GIOP_Message_Base:: send_close_connection (const TAO_GIOP_Message_Version &version, @@ -1427,6 +1168,7 @@ TAO_GIOP_Message_Base:: transport-> id ())); } +#endif int @@ -1520,14 +1262,14 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, #if !defined (ACE_DISABLE_SWAP_ON_READ) if (byte_order == TAO_ENCAP_BYTE_ORDER) { - id = ACE_reinterpret_cast (ACE_CDR::ULong*, tmp_id); + id = reinterpret_cast<ACE_CDR::ULong*> (tmp_id); } else { - ACE_CDR::swap_4 (tmp_id, ACE_reinterpret_cast (char*,id)); + ACE_CDR::swap_4 (tmp_id, reinterpret_cast<char*> (id)); } #else - id = ACE_reinterpret_cast(ACE_CDR::ULong*, tmp_id); + id = reinterpret_cast<ACE_CDR::ULong*> (tmp_id); #endif /* ACE_DISABLE_SWAP_ON_READ */ } @@ -1584,44 +1326,49 @@ TAO_GIOP_Message_Base::is_ready_for_bidirectional (TAO_OutputCDR &msg) } -TAO_Queued_Data * -TAO_GIOP_Message_Base::make_queued_data (size_t sz) +void +TAO_GIOP_Message_Base::set_queued_data_from_message_header ( + TAO_Queued_Data *qd, + const ACE_Message_Block &mb + ) const { - // Get a node for the queue.. - TAO_Queued_Data *qd = - TAO_Queued_Data::get_queued_data ( - this->orb_core_->transport_message_buffer_allocator ()); - - // @@todo: We have a similar method in Transport.cpp. Need to see how - // we can factor them out.. - // Make a datablock for the size requested + something. The - // "something" is required because we are going to align the data - // block in the message block. During alignment we could loose some - // bytes. As we may not know how many bytes will be lost, we will - // allocate ACE_CDR::MAX_ALIGNMENT extra. - ACE_Data_Block *db = - this->orb_core_->create_input_cdr_data_block (sz + - ACE_CDR::MAX_ALIGNMENT); - - ACE_Allocator *alloc = - this->orb_core_->input_cdr_msgblock_allocator (); - - ACE_Message_Block mb (db, - 0, - alloc); - - ACE_Message_Block *new_mb = mb.duplicate (); - - ACE_CDR::mb_align (new_mb); - - qd->msg_block_ = new_mb; - + // @@CJC: Try leaving out the declaration for this->message_state_ + // and see what pukes. I don't think we need it any more. + TAO_GIOP_Message_State state; + if (state.take_values_from_message_block (mb) == -1) + { + // what the heck do we do here?! + qd->current_state_ = TAO_Queued_Data::INVALID; + return; + } - return qd; + // It'd be nice to have an abstract base for GIOP_Message_State + // so that there could just be a line like: + // qd->take_values_from (state); + // Get the message information + qd->byte_order_ = state.byte_order (); + qd->major_version_ = state.giop_version ().major; + qd->minor_version_ = state.giop_version ().minor; + qd->more_fragments_ = state.more_fragments () ? 1 : 0; + qd->request_id_ = state.request_id_; + qd->msg_type_= message_type (state); + qd->missing_data_bytes_ = state.payload_size (); } -size_t -TAO_GIOP_Message_Base::header_length (void) const +int +TAO_GIOP_Message_Base::check_for_valid_header ( + const ACE_Message_Block &mb + ) const { - return TAO_GIOP_MESSAGE_HEADER_LEN; + // NOTE! We don't hardcode the length of the header b/c header_length should + // be eligible for inlining by pretty much any compiler, and it should return + // a constant. The rest of this method is hard-coded and hand-optimized because + // this method gets called A LOT. + if (mb.length () < this->header_length ()) + return -1; + + // Is finding that it's the right length and the magic bytes present + // enough to declare it a valid header? I think so... + register const char* h = mb.rd_ptr (); + return (h[0] == 'G' && h[1] == 'I' && h[2] == 'O' && h[3] == 'P'); } diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h index d4142a28fdc..70d5a23f31e 100644 --- a/TAO/tao/GIOP_Message_Base.h +++ b/TAO/tao/GIOP_Message_Base.h @@ -93,35 +93,37 @@ public: /// the message. virtual int format_message (TAO_OutputCDR &cdr); - /// Parse the incoming messages.. - virtual int parse_incoming_messages (ACE_Message_Block &message_block); + /// Process the request message that we have received on the + /// connection + virtual int process_request_message (TAO_Transport *transport, + TAO_Queued_Data *qd); - /// Calculate the amount of data that is missing in the <incoming> - /// message block. - virtual ssize_t missing_data (ACE_Message_Block &message_block); + /*! + \brief Inspects the bytes in \param mb to see if they "look like" the beginning of a message. - /* Extract the details of the next message from the @a incoming - * through @a qd. Returns 1 if there are more messages and returns a - * 0 if there are no more messages in @a incoming. - */ - virtual int extract_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data *&qd); + Inspects the bytes in \param mb, beginning at \code mb.rd_ptr, to + see if they look like the beginning of a message. If \code mb does not + contain less than \code header_length() bytes, this method cannot make a + complete evaluation, and returns a commensurate value. - /// Check whether the node @a qd needs consolidation from @a incoming. - virtual int consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming); + \return 1 \code header_length() bytes found, and constitute a valid header + \return 0 \code header_length() bytes found, and do not constitute a valid header + \return -1 not enough bytes available to make a determination of header validity + */ + virtual int check_for_valid_header (const ACE_Message_Block &mb) const; - /// Get the details of the message parsed through the @a qd. - virtual void get_message_data (TAO_Queued_Data *qd); + /*! + \brief Set fields in \param qd based on values derived from \param mb. - /// @@Bala:Docu?? - virtual int consolidate_fragments (TAO_Queued_Data *dqd, - const TAO_Queued_Data *sqd); + This function sets fields in \param qd based on values derived + from \param mb. It assumes that if the length of \param mb is + enough to hold a header, then the data in there can be trusted to + make sense. + */ + virtual void set_queued_data_from_message_header ( + TAO_Queued_Data *, + const ACE_Message_Block &mb) const; - /// Process the request message that we have received on the - /// connection - virtual int process_request_message (TAO_Transport *transport, - TAO_Queued_Data *qd); /// Parse the reply message that we received and return the reply @@ -171,7 +173,7 @@ protected: /// TAO_PLUGGABLE_MESSAGE_REPLY, /// TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION, /// TAO_PLUGGABLE_MESSAGE_MESSAGE_ERROR. - TAO_Pluggable_Message_Type message_type (TAO_GIOP_Message_State &state); + static TAO_Pluggable_Message_Type message_type (TAO_GIOP_Message_State &state); private: @@ -194,10 +196,12 @@ private: /// Send error messages int send_error (TAO_Transport *transport); +#if 0 /// Close a connection, first sending GIOP::CloseConnection. void send_close_connection (const TAO_GIOP_Message_Version &version, TAO_Transport *transport, void *ctx); +#endif /// We must send a LocateReply through @a transport, this request /// resulted in some kind of exception. diff --git a/TAO/tao/GIOP_Message_Base.i b/TAO/tao/GIOP_Message_Base.i index a589447a413..f5e39d9aa54 100644 --- a/TAO/tao/GIOP_Message_Base.i +++ b/TAO/tao/GIOP_Message_Base.i @@ -4,3 +4,11 @@ // // GIOP_Message_Base // + + +ACE_INLINE size_t +TAO_GIOP_Message_Base::header_length (void) const +{ + return TAO_GIOP_MESSAGE_HEADER_LEN; +} + diff --git a/TAO/tao/GIOP_Message_Generator_Parser_Impl.inl b/TAO/tao/GIOP_Message_Generator_Parser_Impl.inl index 18bb7936ffd..47e4730befb 100644 --- a/TAO/tao/GIOP_Message_Generator_Parser_Impl.inl +++ b/TAO/tao/GIOP_Message_Generator_Parser_Impl.inl @@ -5,9 +5,24 @@ TAO_GIOP_Message_Generator_Parser_Impl:: check_revision (CORBA::Octet incoming_major, CORBA::Octet incoming_minor) { - if (incoming_major > TAO_DEF_GIOP_MAJOR || - incoming_minor > TAO_DEF_GIOP_MINOR) + CORBA::UShort version_as_whole_num = incoming_major << 8 | incoming_minor; + CORBA::UShort max_allowable_version = TAO_DEF_GIOP_MAJOR << 8 | TAO_DEF_GIOP_MINOR; + + CORBA::Boolean ret = 0; + + // If it's greater than the max, we know it's not allowed. + if (version_as_whole_num > max_allowable_version) return 0; - - return 1; + + // If it's less than the max, though, we still have to check for + // each explicit version and only allow the ones we know work. + switch (version_as_whole_num) + { + case 0x0100: + case 0x0101: + case 0x0102: + ret = 1; + } + + return ret; } diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp index 344e84a3388..e0d1010a201 100644 --- a/TAO/tao/GIOP_Message_Lite.cpp +++ b/TAO/tao/GIOP_Message_Lite.cpp @@ -250,6 +250,7 @@ TAO_GIOP_Message_Lite::format_message (TAO_OutputCDR &stream) } +#if 0 int TAO_GIOP_Message_Lite::parse_incoming_messages (ACE_Message_Block &block) { @@ -508,6 +509,7 @@ TAO_GIOP_Message_Lite::consolidate_fragments (TAO_Queued_Data * /*dqd*/, // We dont know what fragments are??? return -1; } +#endif int TAO_GIOP_Message_Lite::process_request_message (TAO_Transport *transport, @@ -735,7 +737,9 @@ TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport, parse_error = this->parse_request_header (request); - request.orb_core()->codeset_manager()->process_service_context(request); + TAO_Codeset_Manager *csm = request.orb_core()->codeset_manager(); + if (csm) + csm->process_service_context(request); transport->assign_translators(&cdr,&output); // Throw an exception if the @@ -1633,38 +1637,6 @@ TAO_GIOP_Message_Lite::dump_msg (const char *label, } } -TAO_Queued_Data * -TAO_GIOP_Message_Lite::make_queued_data (size_t sz) -{ - // Get a node for the queue.. - TAO_Queued_Data *qd = - TAO_Queued_Data::get_queued_data (); - - // Make a datablock for the size requested + something. The - // "something" is required because we are going to align the data - // block in the message block. During alignment we could loose some - // bytes. As we may not know how many bytes will be lost, we will - // allocate ACE_CDR::MAX_ALIGNMENT extra. - ACE_Data_Block *db = - this->orb_core_->create_input_cdr_data_block (sz + - ACE_CDR::MAX_ALIGNMENT); - - ACE_Allocator *alloc = - this->orb_core_->input_cdr_msgblock_allocator (); - - ACE_Message_Block mb (db, - 0, - alloc); - - ACE_Message_Block *new_mb = mb.duplicate (); - - ACE_CDR::mb_align (new_mb); - - qd->msg_block_ = new_mb; - - return qd; -} - int TAO_GIOP_Message_Lite::generate_locate_reply_header ( TAO_OutputCDR & /*cdr*/, @@ -1686,3 +1658,22 @@ TAO_GIOP_Message_Lite::header_length (void) const { return TAO_GIOP_LITE_HEADER_LEN; } + +void +TAO_GIOP_Message_Lite::set_queued_data_from_message_header ( + TAO_Queued_Data *qd, + const ACE_Message_Block &mb + ) const +{ + ACE_UNUSED_ARG (qd); + ACE_UNUSED_ARG (mb); +} + +int +TAO_GIOP_Message_Lite::check_for_valid_header ( + const ACE_Message_Block &mb + ) const +{ + ACE_UNUSED_ARG (mb); + return 0; +} diff --git a/TAO/tao/GIOP_Message_Lite.h b/TAO/tao/GIOP_Message_Lite.h index 3393e074da0..cb28abf36cc 100644 --- a/TAO/tao/GIOP_Message_Lite.h +++ b/TAO/tao/GIOP_Message_Lite.h @@ -89,44 +89,31 @@ public: /// the message. virtual int format_message (TAO_OutputCDR &cdr); - /// Parse the incoming messages.. - virtual int parse_incoming_messages (ACE_Message_Block &message_block); - - /// Get the message type. The return value would be one of the - /// following: - /// TAO_PLUGGABLE_MESSAGE_REQUEST, - /// TAO_PLUGGABLE_MESSAGE_REPLY, - /// TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION, - /// TAO_PLUGGABLE_MESSAGE_MESSAGE_ERROR. - TAO_Pluggable_Message_Type message_type (void); + /// Process the request message that we have received on the + /// connection + virtual int process_request_message (TAO_Transport *transport, + TAO_Queued_Data *qd); - /// Calculate the amount of data that is missing in the <incoming> - /// message block. - virtual ssize_t missing_data (ACE_Message_Block &message_block); + /*! + \brief Inspects the bytes in \param mb to see if they "look like" the beginning of a message. - /* Extract the details of the next message from the @a incoming - * through @a qd. Returns 1 if there are more messages and returns a - * 0 if there are no more messages in @a incoming. + Inspects the bytes in \param mb, beginning at \code mb.rd_ptr, to + see if they look like the beginning of a message. Does */ - virtual int extract_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data *&qd); - - /// Check whether the node @a qd needs consolidation from @a incoming - virtual int consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming); + virtual int check_for_valid_header (const ACE_Message_Block &mb) const; - /// Get the details of the message parsed through the <qd>. - virtual void get_message_data (TAO_Queued_Data *qd); + /*! + \brief Set fields in \param qd based on values derived from \param mb. - /// @@Bala: Docu??? - virtual int consolidate_fragments (TAO_Queued_Data *dqd, - const TAO_Queued_Data *sqd); - - /// Process the request message that we have received on the - /// connection - virtual int process_request_message (TAO_Transport *transport, - TAO_Queued_Data *qd); + This function sets fields in \param qd based on values derived + from \param mb. It assumes that if the length of \param mb is + enough to hold a header, then the data in there can be trusted to + make sense. + */ + virtual void set_queued_data_from_message_header ( + TAO_Queued_Data *, + const ACE_Message_Block &mb) const; /// Parse the reply message that we received and return the reply /// information through @a reply_info diff --git a/TAO/tao/GIOP_Message_State.cpp b/TAO/tao/GIOP_Message_State.cpp index 90449d1b4f5..462281ecfc5 100644 --- a/TAO/tao/GIOP_Message_State.cpp +++ b/TAO/tao/GIOP_Message_State.cpp @@ -10,15 +10,54 @@ # include "tao/GIOP_Message_State.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - GIOP_Message_State, - "$Id$") + +class TAO_Debug_Msg_Emitter_Guard +{ +public: + TAO_Debug_Msg_Emitter_Guard (unsigned int debug_level, const char* msg) + : which_level_(debug_level) + { + if (TAO_debug_level < this->which_level_) + { + msg_ = 0; + return; + } + this->msg_ = new char[ACE_OS::strlen (msg) + MAGIC_LENGTH ]; + ACE_OS::strcpy (this->msg_, msg); + ACE_OS::strcat (this->msg_, " begin\n"); + if (TAO_debug_level >= this->which_level_) + ACE_DEBUG ((LM_DEBUG, this->msg_ )); + } + + ~TAO_Debug_Msg_Emitter_Guard () + { + if (this->msg_) + { + if (TAO_debug_level >= this->which_level_) + { + char* begin_start = + this->msg_ + ACE_OS::strlen(this->msg_) - MAGIC_LENGTH + 1; + ACE_OS::strcpy (begin_start, " end\n"); + ACE_DEBUG ((LM_DEBUG, this->msg_)); + } + delete[] this->msg_; + } + } + +private: + static const int MAGIC_LENGTH; + unsigned int which_level_; + char* msg_; +}; + +const int TAO_Debug_Msg_Emitter_Guard::MAGIC_LENGTH = 8; // " begin\n" + \000 + +ACE_RCSID(tao, GIOP_Message_State, "$Id$") TAO_GIOP_Message_State::TAO_GIOP_Message_State ( TAO_ORB_Core * /*orb_core*/, - TAO_GIOP_Message_Base *base) - : base_ (base), - giop_version_ (TAO_DEF_GIOP_MAJOR, + TAO_GIOP_Message_Base */*base*/) + : giop_version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR), byte_order_ (0), message_type_ (0), @@ -29,125 +68,64 @@ TAO_GIOP_Message_State::TAO_GIOP_Message_State ( { } - -int -TAO_GIOP_Message_State::parse_message_header (ACE_Message_Block &incoming) -{ - if (incoming.length () >= TAO_GIOP_MESSAGE_HEADER_LEN) - { - // Parse the GIOP header - if (this->parse_message_header_i (incoming) == -1) - return -1; - } - - return 0; -} - +// This doesn't check the message block's length, so that means that +// the *caller* needs to do that first. int -TAO_GIOP_Message_State::parse_message_header_i (ACE_Message_Block &incoming) +TAO_GIOP_Message_State::take_values_from_message_block ( + const ACE_Message_Block& mb + ) { - if (TAO_debug_level > 8) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - GIOP_Message_State::parse_message_header_i\n" - )); - } - - // Grab the rd_ptr_ from the message block.. - char *buf = incoming.rd_ptr (); - - // Parse the magic bytes first - if (this->parse_magic_bytes (buf) == -1) - { - return -1; - } + const char* buf = mb.rd_ptr (); // Get the version information - if (this->get_version_info (buf) == -1) + if (this->set_version_info_from_buffer (buf) == -1) return -1; // Get the byte order information... - if (this->get_byte_order_info (buf) == -1) + if (this->set_byte_order_info_from_buffer (buf) == -1) return -1; // Get the message type this->message_type_ = buf[TAO_GIOP_MESSAGE_TYPE_OFFSET]; - // Get the size of the message.. - this->get_payload_size (buf); + this->set_payload_size_from_buffer (buf); + + // Get the request id + this->parse_fragment_header (buf, mb.length ()); if (this->message_size_ == 0) { - if (this->message_type_ == TAO_GIOP_MESSAGERROR) + const char* msgname = 0; + switch (this->message_type_) + { + case TAO_GIOP_MESSAGERROR: + msgname = "GIOP_MESSAGE_ERROR"; break; + case TAO_GIOP_CLOSECONNECTION: + msgname = "GIOP_CLOSE_CONNECTION"; break; + } + if (msgname != 0) { if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) -" - "GIOP_MESSAGE_ERROR received \n")); - } - return 0; + ACE_DEBUG ((LM_DEBUG, "(%P|%t) GIOP_Message_State::take_values: %s rcv'd.\n", + msgname)); } else { if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - " - "Message of size zero recd. \n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) GIOP_Message_State::take_values: Message of size zero rcv'd.\n")); return -1; } } - - if (this->more_fragments_) - { - (void) this->parse_fragment_header (buf, - incoming.length ()); - } - return 0; } - - - int -TAO_GIOP_Message_State::parse_magic_bytes (char *buf) +TAO_GIOP_Message_State::set_version_info_from_buffer (const char *buf) { - // The values are hard-coded to support non-ASCII platforms. - if (!(buf [0] == 0x47 // 'G' - && buf [1] == 0x49 // 'I' - && buf [2] == 0x4f // 'O' - && buf [3] == 0x50)) // 'P' - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - bad header, ") - ACE_TEXT ("magic word [%2.2x,%2.2x,%2.2x,%2.2x]\n"), - buf[0], - buf[1], - buf[2], - buf[3])); - return -1; - } - - return 0; -} - -int -TAO_GIOP_Message_State::get_version_info (char *buf) -{ - if (TAO_debug_level > 8) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - GIOP_Message_State::get_version_info\n")); - } - // We have a GIOP message on hand. Get its revision numbers - CORBA::Octet incoming_major = - buf[TAO_GIOP_VERSION_MAJOR_OFFSET]; - CORBA::Octet incoming_minor = - buf[TAO_GIOP_VERSION_MINOR_OFFSET]; + CORBA::Octet incoming_major = buf[TAO_GIOP_VERSION_MAJOR_OFFSET]; + CORBA::Octet incoming_minor = buf[TAO_GIOP_VERSION_MINOR_OFFSET]; // Check the revision information if (TAO_GIOP_Message_Generator_Parser_Impl::check_revision ( @@ -157,7 +135,9 @@ TAO_GIOP_Message_State::get_version_info (char *buf) if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - bad version <%d.%d>\n"), + ACE_TEXT ("TAO (%P|%t) - ") + ACE_TEXT ("GIOP_Message_State::set_version_info_from_buffer:") + ACE_TEXT ("bad version <%d.%d>\n"), incoming_major, incoming_minor)); } @@ -172,15 +152,9 @@ TAO_GIOP_Message_State::get_version_info (char *buf) } int -TAO_GIOP_Message_State::get_byte_order_info (char *buf) +TAO_GIOP_Message_State::set_byte_order_info_from_buffer (const char *buf) { - if (TAO_debug_level > 8) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - GIOP_Message_State::get_byte_order_info\n")); - } - - // Let us be specific that this is for 1.0 + // Let us be specific that this is for 1.0 if (this->giop_version_.minor == 0 && this->giop_version_.major == 1) { @@ -191,12 +165,10 @@ TAO_GIOP_Message_State::get_byte_order_info (char *buf) this->byte_order_ != 1) { if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - GIOP_Message_State::get_byte_order_info, " - "invalid byte order <%d> for version <1.0>\n", - this->byte_order_)); - } + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - GIOP_Message_State::get_byte_order_info, " + "invalid byte order <%d> for version <1.0>\n", + this->byte_order_)); return -1; } } @@ -213,14 +185,12 @@ TAO_GIOP_Message_State::get_byte_order_info (char *buf) if ((buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & ~0x3) != 0) { if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - invalid flags for <%d> ") - ACE_TEXT ("for version <%d %d> \n"), - buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET], - this->giop_version_.major, - this->giop_version_.minor)); - } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - invalid flags for <%d>") + ACE_TEXT (" for version <%d %d> \n"), + buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET], + this->giop_version_.major, + this->giop_version_.minor)); return -1; } } @@ -228,19 +198,10 @@ TAO_GIOP_Message_State::get_byte_order_info (char *buf) return 0; } -void -TAO_GIOP_Message_State::get_payload_size (char *rd_ptr) -{ - // Move the read pointer - rd_ptr += TAO_GIOP_MESSAGE_SIZE_OFFSET; - - this->message_size_ = this->read_ulong (rd_ptr); -} - int -TAO_GIOP_Message_State::parse_fragment_header (char *buf, +TAO_GIOP_Message_State::parse_fragment_header (const char *buf, size_t length) { size_t len = @@ -250,9 +211,7 @@ TAO_GIOP_Message_State::parse_fragment_header (char *buf, // By this point we are doubly sure that we have a more or less // valid GIOP message with a valid major revision number. - if (this->giop_version_.minor == 2 && - this->message_type_ == TAO_GIOP_FRAGMENT && - length > len) + if (this->giop_version_.minor >= 2 && length > len) { // Fragmented message in GIOP 1.2 should have a fragment header // following the GIOP header. Grab the rd_ptr to get that @@ -267,7 +226,7 @@ TAO_GIOP_Message_State::parse_fragment_header (char *buf, } CORBA::ULong -TAO_GIOP_Message_State::read_ulong (char *rd_ptr) +TAO_GIOP_Message_State::read_ulong (const char *rd_ptr) { CORBA::ULong x = 0; diff --git a/TAO/tao/GIOP_Message_State.h b/TAO/tao/GIOP_Message_State.h index f902fa03a0e..9ae3db82230 100644 --- a/TAO/tao/GIOP_Message_State.h +++ b/TAO/tao/GIOP_Message_State.h @@ -41,11 +41,10 @@ class TAO_Export TAO_GIOP_Message_State public: /// Ctor - TAO_GIOP_Message_State (TAO_ORB_Core *orb_core, - TAO_GIOP_Message_Base *base); + TAO_GIOP_Message_State (TAO_ORB_Core *orb_core = 0, + TAO_GIOP_Message_Base *base = 0); - /// Parse the message header. - int parse_message_header (ACE_Message_Block &incoming); + int take_values_from_message_block (const ACE_Message_Block& mb); /// Return the message size CORBA::ULong message_size (void) const; @@ -53,9 +52,24 @@ public: /// Return the message size CORBA::ULong payload_size (void) const; - /// Return the byte order information + /*! + \brief Return the byte order information. + \return 0 big-endian + \return 1 little-endian + */ CORBA::Octet byte_order (void) const; + /*! + \brief Return GIOP version information. + */ + const TAO_GIOP_Message_Version &giop_version () const; + + /// (Requests and Replys) + CORBA::Octet more_fragments () const; + + /// MsgType above + CORBA::Octet message_type () const; + /// Reset the state.. void reset (void); @@ -63,40 +77,30 @@ private: friend class TAO_GIOP_Message_Base; - /// Parse the message header. - int parse_message_header_i (ACE_Message_Block &incoming); - - /// Checks for the magic word 'GIOP' in the start of the incoing - /// stream - int parse_magic_bytes (char *buf); - /// Extracts the version information from the incoming /// stream. Performs a check for whether the version information is /// right and sets the information in the <state> - int get_version_info (char *buf); + int set_version_info_from_buffer (const char *buf); /// Extracts the byte order information from the incoming /// stream. Performs a check for whether the byte order information /// right and sets the information in the <state> - int get_byte_order_info (char *buf); + int set_byte_order_info_from_buffer (const char *buf); /// Gets the size of the payload and set the size in the <state> - void get_payload_size (char *buf); + void set_payload_size_from_buffer (const char *buf); /// Parses the GIOP FRAGMENT_HEADER information from the incoming /// stream. - int parse_fragment_header (char *buf, + int parse_fragment_header (const char *buf, size_t length); /// Read the unsigned long from the buffer. The <buf> should just /// point to the next 4 bytes data that represent the ULong - CORBA::ULong read_ulong (char *buf); + CORBA::ULong read_ulong (const char *buf); private: - /// The GIOP base class.. - TAO_GIOP_Message_Base *base_; - // GIOP version information.. TAO_GIOP_Message_Version giop_version_; diff --git a/TAO/tao/GIOP_Message_State.inl b/TAO/tao/GIOP_Message_State.inl index fe076bee689..80d421c7340 100644 --- a/TAO/tao/GIOP_Message_State.inl +++ b/TAO/tao/GIOP_Message_State.inl @@ -33,22 +33,29 @@ TAO_GIOP_Message_State::reset (void) this->missing_data_ = 0; } -#if 0 -ACE_INLINE int -TAO_GIOP_Message_State::message_fragmented (void) +ACE_INLINE const TAO_GIOP_Message_Version & +TAO_GIOP_Message_State::giop_version () const { - if (this->more_fragments) - return 1; - - return 0; + return this->giop_version_; } +ACE_INLINE CORBA::Octet +TAO_GIOP_Message_State::more_fragments () const +{ + return this->more_fragments_; +} - -ACE_INLINE CORBA::Boolean -TAO_GIOP_Message_State::header_received (void) const +ACE_INLINE CORBA::Octet +TAO_GIOP_Message_State::message_type () const { - return this->message_size != 0; + return this->message_type_; } -#endif +ACE_INLINE void +TAO_GIOP_Message_State::set_payload_size_from_buffer (const char *rd_ptr) +{ + // Move the read pointer + rd_ptr += TAO_GIOP_MESSAGE_SIZE_OFFSET; + + this->message_size_ = this->read_ulong (rd_ptr); +} diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index b99f47d2132..8deb1c31355 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -349,9 +349,7 @@ TAO_IIOP_Connector::check_prefix (const char *endpoint) static const char *protocol[] = { "iiop", "iioploc" }; const size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint; - if (slot == 0) // an empty string is valid for corbaloc. - return 0; - + const size_t len0 = ACE_OS::strlen (protocol[0]); const size_t len1 = ACE_OS::strlen (protocol[1]); diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp index af4d0b85cc3..724fcd451fc 100644 --- a/TAO/tao/IIOP_Profile.cpp +++ b/TAO/tao/IIOP_Profile.cpp @@ -136,15 +136,7 @@ TAO_IIOP_Profile::parse_string_i (const char *ior if (cp_pos == ior) { - // No hostname, however one is required by the spec when specifying a port. - // See formal-04-03-01, section 13.6.10.3 - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_ERROR, - ACE_LIB_TEXT ("\nTAO (%P|%t) IIOP_Profile: ") - ACE_LIB_TEXT ("Host address may be omited only when no port has been specified.\n"))); - } - + // No hostname specified! It is required by the spec. ACE_THROW (CORBA::INV_OBJREF ( CORBA::SystemException::_tao_minor_code ( 0, diff --git a/TAO/tao/Incoming_Message_Queue.cpp b/TAO/tao/Incoming_Message_Queue.cpp index 662ee3afbec..c57aef5fc86 100644 --- a/TAO/tao/Incoming_Message_Queue.cpp +++ b/TAO/tao/Incoming_Message_Queue.cpp @@ -1,21 +1,24 @@ #include "Incoming_Message_Queue.h" #include "debug.h" - -#include "ace/Log_Msg.h" -#include "ace/Malloc_Base.h" - +#include "ace/Malloc_T.h" +#include "ace/Message_Block.h" #if !defined (__ACE_INLINE__) # include "Incoming_Message_Queue.inl" #endif /* __ACE_INLINE__ */ +ACE_RCSID (tao, Incoming_Message_Queue, "$Id$") + +#define TAO_DECLARE_IMQ_ERROR_VALUE(valuename) \ + auto_ptr<TAO_Queued_Data> TAO_Queued_Data::valuename (TAO_Queued_Data::make_queued_data(0)) -ACE_RCSID (tao, - Incoming_Message_Queue, - "$Id$") +TAO_DECLARE_IMQ_ERROR_VALUE(COULD_NOT_FIND_VALID_HEADER); +TAO_DECLARE_IMQ_ERROR_VALUE(DYNAMIC_ALLOCATION_FAILED); +TAO_DECLARE_IMQ_ERROR_VALUE(COULD_NOT_UNDERSTAND_HEADER); +auto_ptr<TAO_Queued_Data> TAO_Queued_Data::GENERAL_FAILURE (0); TAO_Incoming_Message_Queue::TAO_Incoming_Message_Queue (TAO_ORB_Core *orb_core) - : queued_data_ (0), + : last_added_ (0), size_ (0), orb_core_ (orb_core) { @@ -45,21 +48,21 @@ TAO_Incoming_Message_Queue::copy_tail (ACE_Message_Block &block) { // Check to see if the length of the incoming block is less than // that of the <missing_data_> of the tail. - if ((CORBA::Long)block.length () <= this->queued_data_->missing_data_) + if (block.length () <= this->last_added_->missing_data_bytes_) { n = block.length (); } else { - n = this->queued_data_->missing_data_; + n = this->last_added_->missing_data_bytes_; } // Do the copy - this->queued_data_->msg_block_->copy (block.rd_ptr (), + this->last_added_->msg_block_->copy (block.rd_ptr (), n); // Decerement the missing data - this->queued_data_->missing_data_ -= n; + this->last_added_->missing_data_bytes_ -= n; } return n; @@ -68,17 +71,20 @@ TAO_Incoming_Message_Queue::copy_tail (ACE_Message_Block &block) TAO_Queued_Data * TAO_Incoming_Message_Queue::dequeue_head (void) { + if (this->size_ == 0) + return 0; + // Get the node on the head of the queue... - TAO_Queued_Data *tmp = - this->queued_data_->next_; + TAO_Queued_Data *head = this->last_added_->next_; // Reset the head node.. - this->queued_data_->next_ = tmp->next_; + this->last_added_->next_ = head->next_; + + // Decrease the size and reset last_added_ if empty + if (--this->size_ == 0) + this->last_added_ = 0; - // Decrease the size - --this->size_; - - return tmp; + return head; } TAO_Queued_Data * @@ -89,95 +95,441 @@ TAO_Incoming_Message_Queue::dequeue_tail (void) return 0; // Get the node on the head of the queue... - TAO_Queued_Data *tmp = - this->queued_data_->next_; + TAO_Queued_Data *head = + this->last_added_->next_; - while (tmp->next_ != this->queued_data_) + while (head->next_ != this->last_added_) { - tmp = tmp->next_; + head = head->next_; } // Put the head in tmp. - tmp->next_ = this->queued_data_->next_; + head->next_ = this->last_added_->next_; - TAO_Queued_Data *ret_qd = this->queued_data_; + TAO_Queued_Data *ret_qd = this->last_added_; - this->queued_data_ = tmp; + this->last_added_ = head; // Decrease the size - --this->size_; + if (--this->size_ == 0) + this->last_added_ = 0; return ret_qd; } - int TAO_Incoming_Message_Queue::enqueue_tail (TAO_Queued_Data *nd) { if (this->size_ == 0) { - this->queued_data_ = nd; - this->queued_data_->next_ = this->queued_data_; + this->last_added_ = nd; + this->last_added_->next_ = this->last_added_; } else { - nd->next_ = this->queued_data_->next_; - this->queued_data_->next_ = nd; - this->queued_data_ = nd; + nd->next_ = this->last_added_->next_; + this->last_added_->next_ = nd; + this->last_added_ = nd; } ++ this->size_; return 0; } +TAO_Queued_Data * +TAO_Incoming_Message_Queue::find_fragment (CORBA::Octet major, + CORBA::Octet minor) const +{ + TAO_Queued_Data *found = 0; + if (this->last_added_ != 0) + { + TAO_Queued_Data *qd = this->last_added_->next_; + + do { + if (qd->more_fragments_ && + qd->major_version_ == major && qd->minor_version_ == minor) + { + found = qd; + } + else + { + qd = qd->next_; + } + } while (found == 0 && qd != this->last_added_->next_); + } + + return found; +} + +TAO_Queued_Data * +TAO_Incoming_Message_Queue::find_fragment (CORBA::ULong request_id) const +{ + TAO_Queued_Data *found = 0; + if (this->last_added_ != 0) + { + TAO_Queued_Data *qd = this->last_added_->next_; + + do { + if (qd->more_fragments_ && qd->request_id_ == request_id) + { + found = qd; + } + else + { + qd = qd->next_; + } + } while (found == 0 && qd != this->last_added_->next_); + } + + return found; +} + /************************************************************************/ // Methods for TAO_Queued_Data /************************************************************************/ TAO_Queued_Data::TAO_Queued_Data (ACE_Allocator *alloc) - : msg_block_ (0), - missing_data_ (0), - byte_order_ (0), - major_version_ (0), - minor_version_ (0), - more_fragments_ (0), - msg_type_ (TAO_PLUGGABLE_MESSAGE_MESSAGERROR), - next_ (0), - allocator_ (alloc) + : msg_block_ (0) + , current_state_ (INVALID) + , missing_data_bytes_ (0) + , byte_order_ (0) + , major_version_ (0) + , minor_version_ (0) + , more_fragments_ (0) + , request_id_ (0) + , msg_type_ (TAO_PLUGGABLE_MESSAGE_MESSAGERROR) + , next_ (0) + , allocator_ (alloc) { } TAO_Queued_Data::TAO_Queued_Data (ACE_Message_Block *mb, ACE_Allocator *alloc) - : msg_block_ (mb), - missing_data_ (0), - byte_order_ (0), - major_version_ (0), - minor_version_ (0), - more_fragments_ (0), - msg_type_ (TAO_PLUGGABLE_MESSAGE_MESSAGERROR), - next_ (0), - allocator_ (alloc) + : msg_block_ (mb) + , current_state_ (INVALID) + , missing_data_bytes_ (0) + , byte_order_ (0) + , major_version_ (0) + , minor_version_ (0) + , more_fragments_ (0) + , request_id_ (0) + , msg_type_ (TAO_PLUGGABLE_MESSAGE_MESSAGERROR) + , next_ (0) + , allocator_ (alloc) { } TAO_Queued_Data::TAO_Queued_Data (const TAO_Queued_Data &qd) - : msg_block_ (qd.msg_block_->duplicate ()), - missing_data_ (qd.missing_data_), - byte_order_ (qd.byte_order_), - major_version_ (qd.major_version_), - minor_version_ (qd.minor_version_), - more_fragments_ (qd.more_fragments_), - msg_type_ (qd.msg_type_), - next_ (0), - allocator_ (qd.allocator_) + : msg_block_ (qd.msg_block_->duplicate ()) + , current_state_ (qd.current_state_) + , missing_data_bytes_ (qd.missing_data_bytes_) + , byte_order_ (qd.byte_order_) + , major_version_ (qd.major_version_) + , minor_version_ (qd.minor_version_) + , more_fragments_ (qd.more_fragments_) + , request_id_ (qd.request_id_) + , msg_type_ (qd.msg_type_) + , next_ (0) + , allocator_ (qd.allocator_) +{ +} + + +/*! + \brief Allocate and return a new empty message block of size \a new_size mimicking parameters of \a mb. + + This function allocates a new aligned message block using the same + allocators and flags as found in \a mb. The size of the new message + block is at least \a new_size; the size may be adjusted up in order + to accomodate alignment requirements and still fit \a new_size bytes + into the aligned buffer. + + \param mb message block whose parameters should be mimicked + \param new_size size of the new message block (will be adjusted for proper alignment) + \return an aligned message block with rd_ptr sitting at correct alignment spot, 0 on failure + + \author Thanks to Rich Seibel for helping implement with the public API for ACE_Message_Block! + */ +static ACE_Message_Block* +clone_mb_nocopy_size (ACE_Message_Block *mb, size_t span_size) +{ + // Calculate the required size of the cloned block with alignment + size_t aligned_size = ACE_CDR::first_size (span_size + ACE_CDR::MAX_ALIGNMENT); + + // Get the allocators + ACE_Allocator *data_allocator; + ACE_Allocator *data_block_allocator; + ACE_Allocator *message_block_allocator; + mb->access_allocators (data_allocator, + data_block_allocator, + message_block_allocator); + + // Create a new Message Block + ACE_Message_Block *nb; + ACE_NEW_MALLOC_RETURN (nb, + ACE_static_cast(ACE_Message_Block*, + message_block_allocator->malloc ( + sizeof (ACE_Message_Block))), + ACE_Message_Block(aligned_size, + mb->msg_type(), + mb->cont(), + 0, //we want the data block created + data_allocator, + mb->locking_strategy(), + mb->msg_priority(), + mb->msg_execution_time (), + mb->msg_deadline_time (), + data_block_allocator, + message_block_allocator), + 0); + + ACE_CDR::mb_align (nb); + + // Copy the flags over, but be SURE to clear the DONT_DELETE flag, since + // we just dynamically allocated the two things. + nb->set_flags (mb->flags()); + nb->clr_flags (ACE_Message_Block::DONT_DELETE); + + return nb; +} + +/*! + \brief Copy data from \a src->rd_ptr to \a dst->wr_ptr, of at most \a span_size bytes. + + (This is similar to memcpy, although with message blocks we can be a + little smarter.) This function assumes that \a dst has enough space + for \a span_size bytes, and that \a src has at least \a span_size + bytes available to copy. When everything is copied \a dst->wr_ptr + gets updated accordingly, but \a src->rd_ptr is left to the caller + to update. + + \param dst the destination message block + \param src the source message block + \param span_size size of the maximum span of bytes to be copied + \return 0 on failure, otherwise \a dst + */ +static ACE_Message_Block* +copy_mb_span (ACE_Message_Block *dst, ACE_Message_Block *src, size_t span_size) +{ + // @todo check for enough space in dst, and src contains at least span_size + + if (src == 0 || dst == 0) + return 0; + + if (span_size == 0) + return dst; + + dst->copy (src->rd_ptr (), span_size); + return dst; +} + +/*static*/ +TAO_Queued_Data * +TAO_Queued_Data::make_uncompleted_message (ACE_Message_Block *mb, + TAO_Pluggable_Messaging &msging_obj, + ACE_Allocator *alloc) +{ + register TAO_Queued_Data *new_qd = 0; + register TAO_Queued_Data *error = GENERAL_FAILURE.get(); + register const size_t HDR_LEN = msging_obj.header_length (); /* COMPUTE ONCE! */ + register const size_t MB_LEN = mb->length (); /* COMPUTE ONCE! */ + + // Validate arguments. + if (mb == 0) + return GENERAL_FAILURE.get(); + + new_qd = make_queued_data (alloc); + if (new_qd == 0) + return DYNAMIC_ALLOCATION_FAILED.get(); + + // do we have enough bytes to make a complete header? + if (MB_LEN >= HDR_LEN) + { + // Since we have enough bytes to make a complete header, + // the header needs to be valid. Check that now, and punt + // if it's not valid. + if (! msging_obj.check_for_valid_header (*mb)) + { + error = COULD_NOT_FIND_VALID_HEADER.get(); + goto failure; + } + else + { + new_qd->current_state_ = WAITING_TO_COMPLETE_PAYLOAD; + msging_obj.set_queued_data_from_message_header (new_qd, *mb); + if (new_qd->current_state_ == INVALID) + { + error = COULD_NOT_UNDERSTAND_HEADER.get(); + goto failure; + } + + // missing_data_bytes_ now has the full GIOP message size, so we allocate + // a new message block of that size, plus the header. + new_qd->msg_block_ = clone_mb_nocopy_size (mb, + new_qd->missing_data_bytes_ + + HDR_LEN); + // Of course, we don't have the whole message (if we did, we + // wouldn't be here!), so we copy only what we've got, i.e., whatever's + // in the message block. + if (copy_mb_span (new_qd->msg_block_, mb, MB_LEN) == 0) + goto failure; + + // missing_data_bytes_ now has the full GIOP message size, but + // there might still be stuff in mb. Therefore, we have to adjust + // missing_data_bytes_, i.e., decrease it by the number of "actual + // payload bytes" in mb. + // + // "actual payload bytes" :== length of mb (which included the header) - header length + new_qd->missing_data_bytes_ -= (MB_LEN - HDR_LEN); + mb->rd_ptr (MB_LEN); + } + } + else + { + new_qd->current_state_ = WAITING_TO_COMPLETE_HEADER; + new_qd->msg_block_ = clone_mb_nocopy_size (mb, HDR_LEN); + if (new_qd->msg_block_ == 0 || + copy_mb_span (new_qd->msg_block_, mb, MB_LEN) == 0) + goto failure; + new_qd->missing_data_bytes_ = HDR_LEN - MB_LEN; + mb->rd_ptr (MB_LEN); + } + + ACE_ASSERT (new_qd->current_state_ != INVALID); + if (TAO_debug_level > 7) + { + const char* s = "?unk?"; + switch (new_qd->current_state_) + { + case WAITING_TO_COMPLETE_HEADER: s = "WAITING_TO_COMPLETE_HEADER"; break; + case WAITING_TO_COMPLETE_PAYLOAD: s = "WAITING_TO_COMPLETE_PAYLOAD"; break; + case INVALID: s = "INVALID"; break; + case COMPLETED: s = "COMPLETED"; break; + } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) Queued_Data::make_uncompleted_message: ") + ACE_TEXT ("made uncompleted message from %u bytes into qd=%-08x:") + ACE_TEXT ("state=%s,missing_data_bytes=%u\n"), + new_qd->msg_block_->length(), new_qd, s, new_qd->missing_data_bytes_)); + } + return new_qd; + +failure: + if (TAO_debug_level > 7) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) Queued_Data::make_uncompleted_message: ") + ACE_TEXT ("failed to make uncompleted message: mb=%-08x, qd=%-08x\n"), + mb, new_qd)); + } + if (error != DYNAMIC_ALLOCATION_FAILED.get()) + TAO_Queued_Data::release (new_qd); + return error; +} + + +/*static*/ +TAO_Queued_Data * +TAO_Queued_Data::make_completed_message (ACE_Message_Block &mb, + TAO_Pluggable_Messaging &msging_obj, + ACE_Allocator *alloc) +{ + register TAO_Queued_Data* error = GENERAL_FAILURE.get(); + register const size_t HDR_LEN = msging_obj.header_length (); + register const size_t MB_LEN = mb.length (); + + // Validate arguments. + if (MB_LEN < HDR_LEN) + return GENERAL_FAILURE.get(); + + // Verify that we have a valid GIOP message. + if (msging_obj.check_for_valid_header (mb) != 1) + return COULD_NOT_FIND_VALID_HEADER.get(); + + size_t total_msg_len = 0; + register TAO_Queued_Data *new_qd = make_queued_data (alloc); + if (new_qd == 0) + return DYNAMIC_ALLOCATION_FAILED.get(); + + // We can assume that there are enough bytes for a header, so + // extract the header data. Don't assume that there's enough for + // the payload just yet. + new_qd->current_state_ = WAITING_TO_COMPLETE_PAYLOAD; + msging_obj.set_queued_data_from_message_header (new_qd, mb); + if (new_qd->current_state_ == INVALID) + { + error = COULD_NOT_UNDERSTAND_HEADER.get(); + goto failure; + } + + // new_qd_->missing_data_bytes_ + protocol header length should be + // *at least* the length of the message. Verify that we have that + // many bytes in the message block and, if we don't, release the new + // qd and fail. + total_msg_len = new_qd->missing_data_bytes_ + HDR_LEN; + if (total_msg_len > MB_LEN) + goto failure; + + // Make a copy of the relevant portion of mb and hang on to it + if ((new_qd->msg_block_ = clone_mb_nocopy_size (&mb, total_msg_len)) == 0) + goto failure; + + if (copy_mb_span (new_qd->msg_block_, &mb, total_msg_len) == 0) + goto failure; + + // Update missing data and the current state + new_qd->missing_data_bytes_ = 0; + new_qd->current_state_ = COMPLETED; + + // Advance the rd_ptr on the message block + mb.rd_ptr (total_msg_len); + + if (TAO_debug_level > 7) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) Queued_Data::make_complete_message: ") + ACE_TEXT ("extracted complete message (%u bytes incl hdr) from mblk=%-08x into qd=%-08x\n"), + total_msg_len, &mb, new_qd)); + } + + return new_qd; + +failure: + if (TAO_debug_level > 7) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) Queued_Data::make_complete_message: ") + ACE_TEXT ("failed to find complete message in mblk=%-08x; leaving %u bytes in block\n"), + &mb, MB_LEN)); + if (TAO_debug_level >= 10) + ACE_HEX_DUMP ((LM_DEBUG, + mb.rd_ptr (), MB_LEN, + ACE_TEXT (" residual bytes in buffer"))); + + } + if (error != DYNAMIC_ALLOCATION_FAILED.get()) + TAO_Queued_Data::release (new_qd); + return error; +} + +/* static */ +TAO_Queued_Data* +TAO_Queued_Data::make_close_connection (ACE_Allocator *alloc) { + TAO_Queued_Data* qd = TAO_Queued_Data::make_queued_data (alloc); + if (qd == 0) + return 0; + + qd->msg_type_ = TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION; + qd->current_state_ = TAO_Queued_Data::COMPLETED; + + return qd; } /*static*/ TAO_Queued_Data * -TAO_Queued_Data::get_queued_data (ACE_Allocator *alloc) +TAO_Queued_Data::make_queued_data (ACE_Allocator *alloc) { TAO_Queued_Data *qd = 0; @@ -198,7 +550,7 @@ TAO_Queued_Data::get_queued_data (ACE_Allocator *alloc) { // This debug is for testing purposes! ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Queued_Data::get_queued_data\n" + "TAO (%P|%t) - Queued_Data::make_queued_data\n", "Using global pool for allocation \n")); } @@ -284,3 +636,29 @@ TAO_Queued_Data::duplicate (TAO_Queued_Data &sqd) return qd; } + +void +TAO_Queued_Data::consolidate (void) +{ + // Is this a chain of fragments? + if (this->more_fragments_ && this->msg_block_->cont () != 0) + { + // Create a message block big enough to hold the entire chain + ACE_Message_Block *dest = clone_mb_nocopy_size ( + this->msg_block_, + this->msg_block_->total_length ()); + // Reset the cont() parameter + dest->cont (0); + + // Use ACE_CDR to consolidate the chain for us + ACE_CDR::consolidate (dest, this->msg_block_); + + // free the original message block chain + this->msg_block_->release (); + + // Set the message block to the new consolidated message block + this->msg_block_ = dest; + this->more_fragments_ = 0; + } +} + diff --git a/TAO/tao/Incoming_Message_Queue.h b/TAO/tao/Incoming_Message_Queue.h index 9d600afb16e..f1c918e4f96 100644 --- a/TAO/tao/Incoming_Message_Queue.h +++ b/TAO/tao/Incoming_Message_Queue.h @@ -15,14 +15,17 @@ #include /**/ "ace/pre.h" -#include "tao/Pluggable_Messaging_Utils.h" +#include <ace/Auto_Ptr.h> #include "ace/Message_Block.h" +#include "Pluggable_Messaging.h" +#include "Pluggable_Messaging_Utils.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ /// Forward declarations +class ACE_Data_Block; class ACE_Allocator; class TAO_ORB_Core; class TAO_Queued_Data; @@ -75,30 +78,68 @@ public: /// Return the length of the queue.. CORBA::ULong queue_length (void); - /// Methods for sanity check. Checks to see whether the node on the - /// head or tail is complete or not and ready for further - /// processing. + /*! + @name Node Inspection Predicates + + \brief These methods allow inspection of head and tail nodes for "completeness". + + These methods check to see whether the node on the head or tail is + "complete" and ready for further processing. See each method's + documentation for its definition of "complete". + */ + //@{ + /*! + "complete" == the GIOP message at the tail is not missing any data (it may be a complete GIOP Fragment, though) + + \return -1 queue is empty + \return 0 tail is not "complete" + \return 1 tail is "complete" + */ int is_tail_complete (void); + + /*! + + "complete" == the GIOP message at the head is not missing any data + AND, if it's the first message in a series of GIOP fragments, all + the fragments have been received, parsed, and placed into the + queue + + \return -1 if queue is empty + \return 0 if head is not "complete" + \return 1 if head is "complete" + */ int is_head_complete (void); + //@} - /// This method checks whether the last message that was queued up - /// was fragmented... + /*! + \brief Check to see if the message at the tail (complete or incomplete) is a GIOP Fragment. + */ int is_tail_fragmented (void); /// Return the size of data that is missing in tail of the queue. size_t missing_data_tail (void) const; + /// void missing_data (size_t data); + + /// Find the first fragment that matches the GIOP version + TAO_Queued_Data *find_fragment (CORBA::Octet major, + CORBA::Octet minor) const; + + /// Find the first fragment that matches the request id + TAO_Queued_Data *find_fragment (CORBA::ULong request_id) const; private: friend class TAO_Transport; - /// Make a node for the queue. - TAO_Queued_Data *get_node (void); - private: + /*! + \brief A circular linked list of messages awaiting processing. - /// A linked listof messages that await processing - TAO_Queued_Data *queued_data_; + \a last_message_added_ points to the most recent message added to + the list. The earliest addition can be easily accessed via + \a last_message_added_->next_. + */ + TAO_Queued_Data *last_added_; /// The size of the queue CORBA::ULong size_; @@ -119,23 +160,88 @@ private: * from the reactor to dequeue and process the message by sending it * to the higher layers of the ORB. */ - +class TAO_Queued_Data; class TAO_Export TAO_Queued_Data { -public: +protected: /// Default Constructor TAO_Queued_Data (ACE_Allocator *alloc = 0); /// Constructor. TAO_Queued_Data (ACE_Message_Block *mb, ACE_Allocator *alloc = 0); +public: /// Copy constructor. TAO_Queued_Data (const TAO_Queued_Data &qd); - /// Creation and deletion of a node in the queue. - static TAO_Queued_Data* get_queued_data (ACE_Allocator *alloc = 0); + /*! + \name Factory Methods + + These methods manufacture instances of TAO_Queued_Data and return + them. These instances should be removed via TAO_Queued_Data::release. + + Instances are initialized from data in the ACE_Message_Block, + interpreted according to rules defined in the + TAO_Pluggable_Messaging object. + + The manufactured instance adopts the message block \em without + duplicating it; therefore, the caller must duplicate or orphan the + message block. The caller also must insure that the message block + can be released via ACE_Message_Block::release, and that its life + endures beyond the calling scope. + + For the purposes of TAO_Queued_Data, a completed message is a + completely received message as defined by the messaging protocol + object. For GIOP, that means that the number of bytes specified + in the general GIOP header have been completely received. It + specifically DOES NOT mean that all \em fragments have been + received. Fragment reassembly is another matter altogether. + */ + //@{ + + /*! + \brief Possible error return values from make_completed_message and make_uncompleted_message. + */ + static auto_ptr<TAO_Queued_Data> COULD_NOT_FIND_VALID_HEADER; + static auto_ptr<TAO_Queued_Data> DYNAMIC_ALLOCATION_FAILED; + static auto_ptr<TAO_Queued_Data> COULD_NOT_UNDERSTAND_HEADER; + static auto_ptr<TAO_Queued_Data> GENERAL_FAILURE; + + /*! + \brief Make and return an instance of TAO_Queued_Data suitable for use as an uncompleted message. + */ + static TAO_Queued_Data* make_uncompleted_message (ACE_Message_Block *mb, + TAO_Pluggable_Messaging &msging_obj, + ACE_Allocator *alloc = 0); + /*! + \brief Make and return an instance of TAO_Queued_Data suitable for use as a completed message. + */ + // THIS IMPLEMENTATION DOESN'T WORK THE SAME AS ITS USAGE! + // WE CAN'T JUST ADOPT mb, BECAUSE IT MAY CONTAIN MORE THAN + // ONE PROTOCOL MESSAGE. WE THEREFORE NEED TO CLONE IT. THIS + // MEANS UPDATING THE DOCUMENTATION, AND IT ALSO MEANS THAT IT + // BEHAVES DIFFERENTLY FROM make_uncompleted_message. + static TAO_Queued_Data* make_completed_message (ACE_Message_Block &mb, + TAO_Pluggable_Messaging &msging_obj, + ACE_Allocator *alloc = 0); + + + static TAO_Queued_Data* make_close_connection (ACE_Allocator *alloc = 0); + + /// Consolidate this fragments chained message blocks into one. + void consolidate (void); + + /*! + \brief Creation and deletion of a node in the queue. + \todo Maybe this should be private? + */ +private: + static TAO_Queued_Data* make_queued_data (ACE_Allocator *alloc = 0); +public: + //@} static void release (TAO_Queued_Data *qd); + void release (void); /// Duplicate ourselves. This creates a copy of ourselves on the /// heap and returns a pointer to the duplicated node. @@ -145,11 +251,43 @@ public: /// The message block that contains the message. ACE_Message_Block *msg_block_; - /// Data missing in the above message that hasn't been read or - /// processed yet. - CORBA::Long missing_data_; - - /// The byte order of the message that is stored in the node.. + /*! + @name Missing Data details + + The \a missing_data_bytes_ member contains the number of bytes of + data missing from \a msg_block_. However, there can be two places + where data is missing: header and payload. We cannot know how + much data is missing from the payload until we have a complete + header. Fortunately, headers are a fixed length, so we can know + how much we're missing from the header. + + We use \param current_state_ to indicate which portion of the message + \param missing_data_bytes_ refers to, as well as the general state of + the message. + */ + //@{ + /*! + Describes the meaning given to the number stored in \a missing_data_bytes_. + */ + enum Queued_Data_State + { + INVALID = -1, //!< The queued data is in an invalid/uninitialized state, and no data should be trusted. + COMPLETED = 0, //!< Message is complete; \a missing_data_bytes_ should be zero. + WAITING_TO_COMPLETE_HEADER, //!< Value in \a missing_data_bytes_ indicates part of header is missing. + WAITING_TO_COMPLETE_PAYLOAD //!< Value in \a missing_data_bytes_ indicates part of payload is missing. + }; + + /*! + Indicates the current state of the message, including hints at + how to interpret the value stored in \a missing_data_bytes_. + */ + Queued_Data_State current_state_; + + /*! Data missing in the above message that hasn't been read or processed yet. */ + size_t missing_data_bytes_; + //@} + + /*! The byte order of the message that is stored in the node. */ CORBA::Octet byte_order_; /// Many protocols like GIOP have a major and minor version @@ -164,6 +302,9 @@ public: /// queue already has more fragments that is missing.. CORBA::Octet more_fragments_; + /// The fragment request id + CORBA::ULong request_id_; + /// The message type of the message TAO_Pluggable_Message_Type msg_type_; diff --git a/TAO/tao/Incoming_Message_Queue.inl b/TAO/tao/Incoming_Message_Queue.inl index d67bd485383..f82267b5cea 100644 --- a/TAO/tao/Incoming_Message_Queue.inl +++ b/TAO/tao/Incoming_Message_Queue.inl @@ -18,7 +18,7 @@ TAO_Incoming_Message_Queue::is_tail_complete (void) return -1; if (this->size_ && - this->queued_data_->missing_data_ == 0) + this->last_added_->missing_data_bytes_ == 0) return 1; return 0; @@ -31,8 +31,8 @@ TAO_Incoming_Message_Queue::is_head_complete (void) return -1; if (this->size_ && - this->queued_data_->next_->missing_data_ == 0 && - this->queued_data_->next_->more_fragments_ == 0) + this->last_added_->next_->missing_data_bytes_ == 0 && + this->last_added_->next_->more_fragments_ == 0) return 1; return 0; @@ -45,7 +45,7 @@ TAO_Incoming_Message_Queue::is_tail_fragmented (void) return 0; if (this->size_ && - this->queued_data_->more_fragments_ == 1) + this->last_added_->more_fragments_ == 1) return 1; return 0; @@ -55,23 +55,22 @@ ACE_INLINE size_t TAO_Incoming_Message_Queue::missing_data_tail (void) const { if (this->size_ != 0) - return this->queued_data_->missing_data_; + return this->last_added_->missing_data_bytes_; return 0; } - -ACE_INLINE TAO_Queued_Data * -TAO_Incoming_Message_Queue::get_node (void) -{ - return TAO_Queued_Data::get_queued_data (); -} - /************************************************************************/ // Methods for TAO_Queued_Data /************************************************************************/ +ACE_INLINE void +TAO_Queued_Data::release (void) +{ + TAO_Queued_Data::release (this); +} + /*static*/ ACE_INLINE void TAO_Queued_Data::replace_data_block (ACE_Message_Block &mb) diff --git a/TAO/tao/Pluggable_Messaging.h b/TAO/tao/Pluggable_Messaging.h index c47d1101c9d..87db01ea50e 100644 --- a/TAO/tao/Pluggable_Messaging.h +++ b/TAO/tao/Pluggable_Messaging.h @@ -106,7 +106,8 @@ public: * This method reads the message on the connection. Returns 0 when * there is short read on the connection. Returns 1 when the full * message is read and handled. Returns -1 on errors. If @a block is - * 1, then reply is read in a blocking manner. + * 1, then reply is read in a blocking manner. <bytes> indicates the + * number of bytes that needs to be read from the connection. */ virtual int read_message (TAO_Transport *transport, int block = 0, @@ -120,36 +121,30 @@ public: virtual void init (CORBA::Octet major, CORBA::Octet minor) = 0; - /// Parse the incoming messages.. - virtual int parse_incoming_messages (ACE_Message_Block &message_block) = 0; - - /// Calculate the amount of data that is missing in the @a incoming - /// message block. - virtual ssize_t missing_data (ACE_Message_Block &incoming) = 0; - - /// Get the details of the message parsed through the @a qd. - virtual void get_message_data (TAO_Queued_Data *qd) = 0; - - /* Extract the details of the next message from the @a incoming - * through @a qd. Returns 1 if there are more messages and returns a - * 0 if there are no more messages in @a incoming. - */ - virtual int extract_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data *&qd) = 0; - - /// Check whether the node @a qd needs consolidation from @a incoming - virtual int consolidate_node (TAO_Queued_Data *qd, - ACE_Message_Block &incoming) = 0; - - /// @@Bala:Docu?? - virtual int consolidate_fragments (TAO_Queued_Data *dqd, - const TAO_Queued_Data *sqd) = 0; - /// Parse the request message, make an upcall and send the reply back /// to the "request initiator" virtual int process_request_message (TAO_Transport *transport, TAO_Queued_Data *qd) = 0; + /*! + \brief Inspects the bytes in \param mb to see if they "look like" the beginning of a message. + + Inspects the bytes in \param mb, beginning at \code mb.rd_ptr, to + see if they look like the beginning of a message. Does + */ + virtual int check_for_valid_header (const ACE_Message_Block &mb) const = 0; + + /*! + \brief Set fields in \param qd based on values derived from \param mb. + + This function sets fields in \param qd based on values derived + from \param mb. It assumes that if the length of \param mb is + enough to hold a header, then the data in there can be trusted to + make sense. + */ + virtual void set_queued_data_from_message_header ( + TAO_Queued_Data *, + const ACE_Message_Block &mb) const = 0; /// Parse the reply message that we received and return the reply /// information through @a reply_info diff --git a/TAO/tao/Strategies/DIOP_Transport.cpp b/TAO/tao/Strategies/DIOP_Transport.cpp index 1887f9e3993..dc5d0a45bd1 100644 --- a/TAO/tao/Strategies/DIOP_Transport.cpp +++ b/TAO/tao/Strategies/DIOP_Transport.cpp @@ -88,12 +88,19 @@ TAO_DIOP_Transport::send (iovec *iov, int iovcnt, for (int i = 0; i < iovcnt; i++) bytes_to_send += iov[i].iov_len; - this->connection_handler_->dgram ().send (iov, - iovcnt, - addr); + ssize_t n = this->connection_handler_->dgram ().send (iov, + iovcnt, + addr); // @@ Michael: // Always return a positive number of bytes sent, as we do // not handle sending errors in DIOP. + if (n == -1 && TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO: (%P|%t|%N|%l) Send of %d bytes failed %p\n"), + bytes_to_send, + ACE_TEXT ("send_i ()\n"))); + } bytes_transferred = bytes_to_send; @@ -191,7 +198,7 @@ TAO_DIOP_Transport::handle_input (TAO_Resume_Handle &rh, // Read the message into the message block that we have created on // the stack. - ssize_t n = this->recv (message_block.rd_ptr (), + ssize_t n = this->recv (message_block.wr_ptr (), message_block.space (), max_wait_time); @@ -207,23 +214,43 @@ TAO_DIOP_Transport::handle_input (TAO_Resume_Handle &rh, // Set the write pointer in the stack buffer message_block.wr_ptr (n); - // Parse the incoming message for validity. The check needs to be + // Check the incoming message for validity. The check needs to be // performed by the messaging objects. - if (this->parse_incoming_messages (message_block) == -1) - return -1; + if (this->messaging_object ()->check_for_valid_header (message_block) == 0) + { + if (TAO_debug_level) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO: (%P|%t|%N|%l) failed to find a valid header on transport %d after fault %p\n"), + this->id (), + ACE_TEXT ("handle_input_i ()\n"))); + } + + return -1; + } // NOTE: We are not performing any queueing nor any checking for - // missing data. We are assuming that ALL the data would be got in a + // missing data. We are assuming that ALL the data arrives in a // single read. // Make a node of the message block.. - TAO_Queued_Data qd (&message_block); - - // Extract the data for the node.. - this->messaging_object ()->get_message_data (&qd); - - // Process the message - return this->process_parsed_messages (&qd, rh); + // + // We could make this more efficient by having a fixed Queued Data + // allocator, i.e., it always gave back the same thing. Actually, + // we *could* create an allocator that took a stack-allocated object + // as an argument and returned that when asked an allocation is + // done. Something to contemplate... + TAO_Queued_Data* qd = + TAO_Queued_Data::make_completed_message (message_block, + *this->messaging_object ()); + int retval = -1; + if (qd) + { + // Process the message + retval = this->process_parsed_messages (qd, rh); + TAO_Queued_Data::release (qd); + } + return retval; } diff --git a/TAO/tao/Strategies/SHMIOP_Transport.cpp b/TAO/tao/Strategies/SHMIOP_Transport.cpp index aaebc6860cf..f74c4cffc75 100644 --- a/TAO/tao/Strategies/SHMIOP_Transport.cpp +++ b/TAO/tao/Strategies/SHMIOP_Transport.cpp @@ -136,6 +136,9 @@ TAO_SHMIOP_Transport::recv (char *buf, } +#if 0 +// This no longer exists with the PMB-change flow. Not sure how to deal with that, +// so for now we ditch the method and see if things work. int TAO_SHMIOP_Transport::consolidate_message (ACE_Message_Block &incoming, ssize_t missing_data, @@ -191,6 +194,7 @@ TAO_SHMIOP_Transport::consolidate_message (ACE_Message_Block &incoming, // process that return this->process_parsed_messages (&pqd, rh); } +#endif int TAO_SHMIOP_Transport::send_request (TAO_Stub *stub, diff --git a/TAO/tao/Strategies/SHMIOP_Transport.h b/TAO/tao/Strategies/SHMIOP_Transport.h index 02c67c63116..8b54426aaa7 100644 --- a/TAO/tao/Strategies/SHMIOP_Transport.h +++ b/TAO/tao/Strategies/SHMIOP_Transport.h @@ -82,10 +82,14 @@ protected: size_t len, const ACE_Time_Value *s = 0); +#if 0 + // This no longer exists with the PMB-change flow. Not sure how to deal with that, + // so for now we ditch the method and see if things work. virtual int consolidate_message (ACE_Message_Block &incoming, ssize_t missing_data, TAO_Resume_Handle &rh, ACE_Time_Value *max_wait_time); +#endif //@} diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp index bc39c9c89dc..9d1b9692ad9 100644 --- a/TAO/tao/Strategies/UIOP_Connector.cpp +++ b/TAO/tao/Strategies/UIOP_Connector.cpp @@ -105,37 +105,7 @@ TAO_UIOP_Connector::close (void) return this->base_connector_.close (); } -TAO_Profile * -TAO_UIOP_Connector::corbaloc_scan (const char *str, size_t &len - ACE_ENV_ARG_DECL) -{ - if (this->check_prefix (str) != 0) - return 0; - - const char *separator = ACE_OS::strchr (str,'|'); - if (separator == 0) - { - if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) TAO_UIOP_CONNECTOR::corbaloc_scan error: " - "explicit terminating charactor '|' is missing from <%s>", - str)); - return 0; - } - if (*(separator+1) != ',' && *(separator+1) != '/') - { - if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) TAO_UIOP_CONNECTOR::corbaloc_scan warning: " - "terminating charactor '|' should be followed by a ','" - "or a '/' in <%s>", - str)); - } - len = (separator - str) + 1; - return this->make_profile (ACE_ENV_SINGLE_ARG_PARAMETER); -} - int TAO_UIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint) { diff --git a/TAO/tao/Strategies/UIOP_Connector.h b/TAO/tao/Strategies/UIOP_Connector.h index f86ad350719..ba23060bd9d 100644 --- a/TAO/tao/Strategies/UIOP_Connector.h +++ b/TAO/tao/Strategies/UIOP_Connector.h @@ -72,9 +72,6 @@ public: virtual int check_prefix (const char *endpoint); - virtual TAO_Profile *corbaloc_scan (const char *str, size_t &len - ACE_ENV_ARG_DECL); - virtual char object_key_delimiter (void) const; /// Cancel the passed cvs handler from the connector diff --git a/TAO/tao/Strategies/UIOP_Profile.cpp b/TAO/tao/Strategies/UIOP_Profile.cpp index 4c34e227c91..7a24e0745e1 100644 --- a/TAO/tao/Strategies/UIOP_Profile.cpp +++ b/TAO/tao/Strategies/UIOP_Profile.cpp @@ -101,43 +101,6 @@ void TAO_UIOP_Profile::parse_string_i (const char *string ACE_ENV_ARG_DECL) { - if (!string || !*string) - { - ACE_THROW (CORBA::INV_OBJREF ( - CORBA::SystemException::_tao_minor_code ( - 0, - EINVAL), - CORBA::COMPLETED_NO)); - } - - // Remove the "N.n@" version prefix, if it exists, and verify the - // version is one that we accept. - - // Check for version - if (isdigit (string [0]) && - string[1] == '.' && - isdigit (string [2]) && - string[3] == '@') - { - // @@ This may fail for non-ascii character sets [but take that - // with a grain of salt] - this->version_.set_version ((char) (string [0] - '0'), - (char) (string [2] - '0')); - string += 4; - // Skip over the "N.n@" - } - - if (this->version_.major != TAO_DEF_GIOP_MAJOR || - this->version_.minor > TAO_DEF_GIOP_MINOR) - { - ACE_THROW (CORBA::INV_OBJREF ( - CORBA::SystemException::_tao_minor_code ( - 0, - EINVAL), - CORBA::COMPLETED_NO)); - } - - // Pull off the "rendezvous point" part of the objref // Copy the string because we are going to modify it... CORBA::String_var copy (string); diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index df1e0ffcfe9..6449173e522 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -18,6 +18,7 @@ #include "Resume_Handle.h" #include "Codeset_Manager.h" #include "Codeset_Translator_Factory.h" +#include "GIOP_Message_State.h" #include "debug.h" #include "ace/OS_NS_sys_time.h" @@ -115,6 +116,7 @@ TAO_Transport::TAO_Transport (CORBA::ULong tag, , head_ (0) , tail_ (0) , incoming_message_queue_ (orb_core) + , uncompleted_message_ (0) , current_deadline_ (ACE_Time_Value::zero) , flush_timer_id_ (-1) , transport_timer_ (this) @@ -200,7 +202,7 @@ TAO_Transport::register_handler (void) if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::register_handler\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::register_handler\n"), this->id ())); } @@ -240,12 +242,10 @@ TAO_Transport::generate_locate_request ( == -1) { if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::generate_locate_request, " - "error while marshalling the LocateRequest header\n", - this->id ())); - } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - Transport[%d]::generate_locate_request, ") + ACE_TEXT("error while marshalling the LocateRequest header\n"), + this->id ())); return -1; } @@ -261,25 +261,19 @@ TAO_Transport::generate_request_header ( { // codeset service context is only supposed to be sent in the first request // on a particular connection. - if (this->first_request_) - { - this->orb_core ()->codeset_manager ()->generate_service_context ( - opdetails, - *this - ); - } + TAO_Codeset_Manager *csm = this->orb_core()->codeset_manager(); + if (csm && this->first_request_) + csm->generate_service_context( opdetails, *this ); if (this->messaging_object ()->generate_request_header (opdetails, spec, output) == -1) { if (TAO_debug_level > 0) - { ACE_DEBUG ((LM_DEBUG, - "(%P|%t) - Transport[%d]::generate_request_header, " - "error while marshalling the Request header\n", - this->id())); - } + ACE_TEXT("(%P|%t) - Transport[%d]::generate_request_header, ") + ACE_TEXT("error while marshalling the Request header\n"), + this->id())); return -1; } @@ -336,7 +330,7 @@ TAO_Transport::handle_output (void) if (TAO_debug_level > 3) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::handle_output\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_output\n"), this->id ())); } @@ -348,8 +342,8 @@ TAO_Transport::handle_output (void) if (TAO_debug_level > 3) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::handle_output, " - "drain_queue returns %d/%d\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_output, ") + ACE_TEXT("drain_queue returns %d/%d\n"), this->id (), retval, errno)); } @@ -487,7 +481,6 @@ TAO_Transport::send_synchronous_message_i (const ACE_Message_Block *mb, &synch_message, max_wait_time); } - if (result == -1) { synch_message.remove_from_list (this->head_, this->tail_); @@ -525,9 +518,9 @@ TAO_Transport::send_synchronous_message_i (const ACE_Message_Block *mb, if (TAO_debug_level > 0) { ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Transport[%d]::send_synchronous_message_i, " - "error while flushing message - %m\n", - this->id ())); + ACE_TEXT("TAO (%P|%t) - Transport[%d]::send_synchronous_message_i, ") + ACE_TEXT("error while flushing message %p\n"), + this->id (), "")); } return -1; @@ -568,8 +561,8 @@ TAO_Transport::send_reply_message_i (const ACE_Message_Block *mb, if (TAO_debug_level > 3) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::send_reply_message_i, " - "preparing to add to queue before leaving \n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::send_reply_message_i, ") + ACE_TEXT("preparing to add to queue before leaving \n"), this->id ())); } @@ -644,7 +637,7 @@ TAO_Transport::schedule_output_i (void) if (TAO_debug_level > 3) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::schedule_output_i\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::schedule_output\n"), this->id ())); } @@ -660,7 +653,7 @@ TAO_Transport::cancel_output_i (void) if (TAO_debug_level > 3) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::cancel_output_i\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::cancel_output\n"), this->id ())); } @@ -674,8 +667,8 @@ TAO_Transport::handle_timeout (const ACE_Time_Value & /* current_time */, if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - TAO_Transport[%d]::handle_timeout, " - "timer expired\n", + ACE_TEXT("TAO (%P|%t) - TAO_Transport[%d]::handle_timeout, ") + ACE_TEXT("timer expired\n"), this->id ())); } @@ -703,6 +696,7 @@ int TAO_Transport::drain_queue (void) { ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1); + int retval = this->drain_queue_i (); if (retval == 1) @@ -746,8 +740,8 @@ TAO_Transport::drain_queue_helper (int &iovcnt, iovec iov[]) if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::drain_queue_helper, " - "send() returns 0\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::drain_queue_helper, ") + ACE_TEXT("send() returns 0"), this->id ())); } return -1; @@ -757,9 +751,9 @@ TAO_Transport::drain_queue_helper (int &iovcnt, iovec iov[]) if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::drain_queue_helper, " - "error during %p\n", - this->id (), ACE_TEXT ("send()"))); + ACE_TEXT("TAO (%P|%t) - Transport[%d]::drain_queue_helper, ") + ACE_TEXT("error during %p\n"), + this->id (), "send()")); } if (errno == EWOULDBLOCK || errno == EAGAIN) @@ -780,8 +774,8 @@ TAO_Transport::drain_queue_helper (int &iovcnt, iovec iov[]) if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::drain_queue_helper, " - "byte_count = %d, head_is_empty = %d\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::drain_queue_helper, ") + ACE_TEXT("byte_count = %d, head_is_empty = %d\n"), this->id(), byte_count, (this->head_ == 0))); } @@ -820,8 +814,8 @@ TAO_Transport::drain_queue_i (void) if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::drain_queue_i, " - "helper retval = %d\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::drain_queue_i, ") + ACE_TEXT("helper retval = %d\n"), this->id (), retval)); } @@ -846,8 +840,8 @@ TAO_Transport::drain_queue_i (void) if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::drain_queue_i, " - "helper retval = %d\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::drain_queue_i, ") + ACE_TEXT("helper retval = %d\n"), this->id (), retval)); } @@ -909,8 +903,8 @@ TAO_Transport::cleanup_queue (size_t byte_count) if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::cleanup_queue, " - "byte_count = %d\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::cleanup_queue, ") + ACE_TEXT("byte_count = %d\n"), this->id (), byte_count)); } @@ -920,8 +914,8 @@ TAO_Transport::cleanup_queue (size_t byte_count) if (TAO_debug_level > 4) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::cleanup_queue, " - "after transfer, bc = %d, all_sent = %d, ml = %d\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::cleanup_queue, ") + ACE_TEXT("after transfer, bc = %d, all_sent = %d, ml = %d\n"), this->id (), byte_count, i->all_data_sent (), i->message_length ())); } @@ -991,9 +985,9 @@ TAO_Transport::report_invalid_event_handler (const char *caller) if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::report_invalid_event_handler" - "(%s) no longer associated with handler [tag=%d]\n", - this->id (), ACE_TEXT_CHAR_TO_TCHAR (caller), this->tag_)); + ACE_TEXT("TAO (%P|%t) - Transport[%d]::report_invalid_event_handler") + ACE_TEXT("(%s) no longer associated with handler [tag=%d]\n"), + this->id (), caller, this->tag_)); } } @@ -1068,8 +1062,8 @@ TAO_Transport::send_message_shared_i (TAO_Stub *stub, if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::send_message_shared_i, " - "trying to send the message (ml = %d)\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::send_message_i, ") + ACE_TEXT("trying to send the message (ml = %d)\n"), this->id (), total_length)); } @@ -1091,11 +1085,11 @@ TAO_Transport::send_message_shared_i (TAO_Stub *stub, { if (TAO_debug_level > 0) { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Transport[%d]::send_message_shared_i, " - "fatal error in " - "send_message_block_chain_i - %m\n", - this->id ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - Transport[%d]::send_message_i, ") + ACE_TEXT("fatal error in ") + ACE_TEXT("send_message_block_chain_i %p\n"), + this->id (), "")); } return -1; } @@ -1115,8 +1109,8 @@ TAO_Transport::send_message_shared_i (TAO_Stub *stub, if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::send_message_shared_i, " - "partial send %d / %d bytes\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::send_message_i, ") + ACE_TEXT("partial send %d / %d bytes\n"), this->id (), byte_count, total_length)); } @@ -1138,8 +1132,8 @@ TAO_Transport::send_message_shared_i (TAO_Stub *stub, if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::send_message_shared_i, " - "message is queued\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::send_message_i, ") + ACE_TEXT("message is queued\n"), this->id ())); } @@ -1194,6 +1188,16 @@ TAO_Transport::queue_message_i(const ACE_Message_Block *message_block) return 0; } +class CTHack +{ +public: + CTHack() { enter(); } + ~CTHack() { leave(); } +private: + void enter() { x = 1; } + void leave() { x = 0; } + int x; +}; /* * @@ -1206,27 +1210,26 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh, ACE_Time_Value * max_wait_time, int /*block*/) { + CTHack cthack; + if (TAO_debug_level > 3) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::handle_input\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input\n"), this->id ())); } - // First try to process messages of the head of the incoming queue. + // First try to process messages off the head of the incoming queue. int retval = this->process_queue_head (rh); - if (retval <= 0) { if (retval == -1) { if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::handle_input, " - "error while parsing the head of the queue\n", - this->id())); - } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input, ") + ACE_TEXT("error while parsing the head of the queue\n"), + this->id())); } return retval; @@ -1237,7 +1240,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh, // The buffer on the stack which will be used to hold the input // messages - char buf [TAO_MAXBUFSIZE]; + char buf[TAO_MAXBUFSIZE]; #if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE) (void) ACE_OS::memset (buf, @@ -1259,21 +1262,23 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh, ACE_Message_Block::DONT_DELETE, this->orb_core_->input_cdr_msgblock_allocator ()); + // We'll loop trying to complete the message this number of times, + // and that's it. + unsigned int number_of_read_attempts = TAO_MAX_TRANSPORT_REREAD_ATTEMPTS; + + unsigned int did_queue_message = 0; // Align the message block ACE_CDR::mb_align (&message_block); size_t recv_size = 0; - if (this->orb_core_->orb_params ()->single_read_optimization ()) { - recv_size = - message_block.space (); + recv_size = message_block.space (); } else { - recv_size = - this->messaging_object ()->header_length (); + recv_size = this->messaging_object ()->header_length (); } // Saving the size of the received buffer in case any one needs to @@ -1285,7 +1290,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh, // Read the message into the message block that we have created on // the stack. - ssize_t n = this->recv (message_block.rd_ptr (), + ssize_t n = this->recv (message_block.wr_ptr (), recv_size, max_wait_time); @@ -1298,183 +1303,413 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh, if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::handle_input, " - "read %d bytes\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input: ") + ACE_TEXT("read %d bytes\n"), this->id (), n)); } // Set the write pointer in the stack buffer message_block.wr_ptr (n); - // Parse the message and try consolidating the message if - // needed. - retval = this->parse_consolidate_messages (message_block, - rh, - max_wait_time); + if (TAO_debug_level >= 10) + ACE_HEX_DUMP ((LM_DEBUG, + (const char *) message_block.rd_ptr (), + message_block.length (), + ACE_TEXT ("TAO (%P|%t) Transport::handle_input(): bytes read from socket"))); - if (retval <= 0) + +complete_message_and_possibly_enqueue: + // Check to see if we're still working to complete a message + if (this->uncompleted_message_) { - if (retval == -1 && TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::handle_input, " - "error while parsing and consolidating\n", - this->id ())); - } - return retval; - } + // try to complete it - // Make a node of the message block.. - TAO_Queued_Data qd (&message_block, - this->orb_core_->transport_message_buffer_allocator ()); + // on exit from this frame we have one of the following states: + // + // (a) an uncompleted message still in uncompleted_message_ + // AND message_block is empty + // + // (b) uncompleted_message_ zero, the completed message at the + // tail of the incoming queue; message_block could be empty + // or still contain bytes - // Extract the data for the node.. - this->messaging_object ()->get_message_data (&qd); + // ==> repeat + do + { + /* + * Append the "right number of bytes" to uncompleted_message_ + */ + // ==> right_number_of_bytes = MIN(bytes missing from + // uncompleted_message_, length of message_block); + size_t right_number_of_bytes = + ACE_MIN (this->uncompleted_message_->missing_data_bytes_, + message_block.length () ); - // Check whether the message was fragmented.. - if (qd.more_fragments_ || - (qd.msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT)) - { - // Duplicate the node that we have as the node is on stack.. - TAO_Queued_Data *nqd = - TAO_Queued_Data::duplicate (qd); + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ") + ACE_TEXT("trying to use %u (of %u) ") + ACE_TEXT("bytes to complete message missing %u bytes\n"), + this->id (), + right_number_of_bytes, + message_block.length (), + this->uncompleted_message_->missing_data_bytes_)); + } - return this->consolidate_fragments (nqd, rh); - } + // ==> append right_number_of_bytes from message_block + // to uncomplete_message_ & update read pointer of + // message_block; + + // 1. we assume that uncompleted_message_.msg_block_'s + // wr_ptr is properly maintained + // 2. we presume that uncompleted_message_.msg_block was + // allocated with enough space to contain the *entire* + // expected GIOP message, so this copy shouldn't involve an + // additional allocation + this->uncompleted_message_->msg_block_->copy (message_block.rd_ptr (), + right_number_of_bytes); + this->uncompleted_message_->missing_data_bytes_ -= right_number_of_bytes; + message_block.rd_ptr (right_number_of_bytes); + + switch (this->uncompleted_message_->current_state_) + { + case TAO_Queued_Data::WAITING_TO_COMPLETE_HEADER: + { + int hdrvalidity = this->messaging_object()->check_for_valid_header ( + *this->uncompleted_message_->msg_block_); + if (hdrvalidity == 0) + { + // According to the spec, Section 15.4.8, we should send + // the MessageError GIOP message on receipt of "any message...whose + // header is not properly formed (e.g., has the wrong magic value)". + // + // So, rather than returning -1, what we REALLY need to do is + // send a MessageError in reply. + // + // I'm not sure what the best way to trigger that is...probably to + // queue up a special internal-only COMPLETED message that, when + // processed, sends the MessageError as part of its processing. + return -1; + } + else if (hdrvalidity == 1) + { + // ==> update bytes missing from uncompleted_message_ + // with size of message from valid header; + this->messaging_object()->set_queued_data_from_message_header ( + this->uncompleted_message_, + *this->uncompleted_message_->msg_block_); + // ==> change state of uncompleted_event_ to + // WAITING_TO_COMPLETE_PAYLOAD; + this->uncompleted_message_->current_state_ = + TAO_Queued_Data::WAITING_TO_COMPLETE_PAYLOAD; + + // ==> Resize the message block to have capacity for + // the rest of the incoming message + ACE_Message_Block & mb = *this->uncompleted_message_->msg_block_; + ACE_CDR::grow (&mb, + mb.size () + + this->uncompleted_message_->missing_data_bytes_); + + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ") + ACE_TEXT("found a valid header in the message; ") + ACE_TEXT("waiting for %u bytes to complete payload\n"), + this->id (), + this->uncompleted_message_->missing_data_bytes_)); + } + + // Continue the loop... + continue; + } + + // In the case where we don't have enough information + // (hdrvalidity == -1), we just have to fall through + // and collect more information, i.e., bytes. + + } + break; + + case TAO_Queued_Data::WAITING_TO_COMPLETE_PAYLOAD: + // Here we have an opportunity to try to finish reading the + // uncompleted message. This is a Good Idea(TM) because there are + // good odds that either more data came available since the last + // time we read, or that we simply didn't read the whole message on + // the first read. So, we try to read again. + // + // NOTE! this changes this->uncompleted_message_! + this->try_to_complete (max_wait_time); - // Process the message - return this->process_parsed_messages (&qd, - rh); -} + // ==> if (bytes missing from uncompleted_message_ == 0) + if (this->uncompleted_message_->missing_data_bytes_ == 0) + { + /* + * We completed the message! Hooray! + */ + // ==> place uncompleted_message_ (which is now + // complete!) at the tail of the incoming message + // queue; + + // ---> NOTE: whoever pulls this off the queue must delete it! + this->uncompleted_message_->current_state_ + = TAO_Queued_Data::COMPLETED; + + // @@CJC NEED TO CHECK RETURN VALUE HERE! + this->enqueue_incoming_message (this->uncompleted_message_); + did_queue_message = 1; + // zero out uncompleted_message_; + this->uncompleted_message_ = 0; + + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ") + ACE_TEXT("completed and queued message for processing!\n"), + this->id ())); + } -int -TAO_Transport::parse_consolidate_messages (ACE_Message_Block &block, - TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time) -{ - // Parse the incoming message for validity. The check needs to be - // performed by the messaging objects. - if (this->parse_incoming_messages (block) == -1) - { - return -1; - } + } + else + { - // Check whether we have a complete message for processing - const ssize_t missing_data = this->missing_data (block); + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ") + ACE_TEXT("still need %u bytes to complete uncompleted message.\n"), + this->id (), + this->uncompleted_message_->missing_data_bytes_)); + } + } + break; + default: + // @@CJC What do we do here?! + ACE_ASSERT (! ACE_TEXT("Transport::handle_input: unexpected state") + ACE_TEXT("in uncompleted_message_")); + } + } + // Does the order of the checks matter? In both (a) and (b), + // message_block is empty, but only in (b) is there no + // uncompleted_message_. + // ==> until (message_block is empty || there is no uncompleted_message_); + // or, rewritten in C++ looping constructs + // ==> while ( ! message_block is empty && there is an uncompleted_message_ ); + while (message_block.length() != 0 && this->uncompleted_message_); + } + + // ***************************** + // @@ CJC + // + // Once upon a time we tried to complete reading the uncompleted + // message here, but testing found that completing later worked + // better. + // ***************************** + + + // At this point, there should be nothing in uncompleted_message_. + // We now need to chop up the bytes in message_block and store any + // complete messages in the incoming message queue. + // + // ==> if (message_block still has data) + if (message_block.length () != 0) + { + TAO_Queued_Data *complete_message = 0; + do + { + if (TAO_debug_level >= 10) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) Transport::handle_input: ") + ACE_TEXT("extracting complete messages\n"))); + ACE_HEX_DUMP ((LM_DEBUG, + message_block.rd_ptr (), + message_block.length (), + ACE_TEXT (" from this message buffer"))); + } - if (missing_data < 0) - { - // If we have more than one message - return this->consolidate_extra_messages (block, - rh); + complete_message = + TAO_Queued_Data::make_completed_message ( + message_block, *this->messaging_object ()); + if ((complete_message == TAO_Queued_Data::COULD_NOT_FIND_VALID_HEADER.get()) || + (complete_message == TAO_Queued_Data::DYNAMIC_ALLOCATION_FAILED.get()) || + (complete_message == TAO_Queued_Data::COULD_NOT_UNDERSTAND_HEADER.get())) + { + TAO_Queued_Data* qd = TAO_Queued_Data::make_close_connection (); + this->enqueue_incoming_message (qd); + did_queue_message = 1; + message_block.rd_ptr (message_block.length()); + } + else if (complete_message != TAO_Queued_Data::GENERAL_FAILURE.get()) + { + // If it was a GENERAL FAILURE, we let it go because it might + // be that we can complete it later. + this->enqueue_incoming_message (complete_message); + did_queue_message = 1; + } + } + while (complete_message != TAO_Queued_Data::GENERAL_FAILURE.get()); + // On exit from this frame we have one of the following states: + // (a) message_block is empty + // (b) message_block contains bytes from a partial message } - else if (missing_data > 0) + + // If, at this point, there's still data in message_block, it's + // an incomplete message. Therefore, we stuff it into the + // uncompleted_message_ and clear out message_block. + // ==> if (message_block still has data) + if (message_block.length () != 0) { - // If we have missing data then try doing a read or try queueing - // them. - return this->consolidate_message (block, - missing_data, - rh, - max_wait_time); - } + if (this->uncompleted_message_ != 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) Transport[%d]::handle_input:%d ") + ACE_TEXT("have an uncompleted message I didn't expect.\n"), + this->id (), __LINE__ + )); + } - return 1; -} + // duplicate message_block remainder into this->uncompleted_message_ + ACE_ASSERT (this->uncompleted_message_ == 0); + this->uncompleted_message_ = + TAO_Queued_Data::make_uncompleted_message (&message_block, + *this->messaging_object ()); + if (this->uncompleted_message_ == TAO_Queued_Data::GENERAL_FAILURE.get()) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) Transport[%d]::handle_input:%d ") + ACE_TEXT("failed to create an uncompleted message.\n"), + this->id (), __LINE__ + )); + } + else if ((this->uncompleted_message_ == TAO_Queued_Data::COULD_NOT_FIND_VALID_HEADER.get()) || + (this->uncompleted_message_ == TAO_Queued_Data::DYNAMIC_ALLOCATION_FAILED.get()) || + (this->uncompleted_message_ == TAO_Queued_Data::COULD_NOT_UNDERSTAND_HEADER.get())) + { + TAO_Queued_Data* qd = TAO_Queued_Data::make_close_connection (); + this->enqueue_incoming_message (qd); + did_queue_message = 1; + message_block.rd_ptr (message_block.length()); + } + ACE_ASSERT (this->uncompleted_message_ != 0); + + // In a debug build, we won't reach this point if we couldn't + // create an uncompleted message because the above ASSERT will + // trip. However, in an optimized build, the ASSERT isn't + // there, so we'll go past here. + // + // We could put a check in here similar to the ASSERT condition, + // but doing that would terminate this loop early and result in + // our never processing any completed messages that were received + // in this trip to handle_input. + // + // Maybe we could instead queue up a special completed message that, + // when processed, causes the connection to get closed in a non-graceful + // termination scenario. + } + + // We should have consumed ALL the bytes by now. + ACE_ASSERT (message_block.length () == 0); + + // + // We don't want to try to re-read earlier because we may not have + // an uncompleted message until we get to this point. So, if we did + // it earlier, we could have missed the opportunity to complete it + // and dispatch. + // + // Thanks to Bala <bala@cse.wustl.edu> for the idea to read again + // to increase throughput! + + if (this->uncompleted_message_) + { + if (number_of_read_attempts--) + { + // We try to read again just in case more data arrived while + // we were doing the stuff above. This way, we can increase + // throughput without much of a penalty. -int -TAO_Transport::parse_incoming_messages (ACE_Message_Block &block) -{ - // If we have a queue and if the last message is not complete a - // complete one, then this read will get us the remaining data. So - // do not try to parse the header if we have an incomplete message - // in the queue. - if (this->incoming_message_queue_.is_tail_complete () != 0) - { - // As it looks like a new message has been read, process the - // message. Call the messaging object to do the parsing.. - int retval = - this->messaging_object ()->parse_incoming_messages (block); + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ") + ACE_TEXT("still have an uncompleted message; ") + ACE_TEXT("will try %d more times before letting ") + ACE_TEXT("somebody else have a chance.\n"), + this->id (), + number_of_read_attempts)); + } - if (retval == -1) + // We only bother trying to complete payload, not header, because the + // retry only happens in the complete-the-payload clause above. + if (this->uncompleted_message_->current_state_ == + TAO_Queued_Data::WAITING_TO_COMPLETE_PAYLOAD) + goto complete_message_and_possibly_enqueue; + } + else { + // The queue should be empty because it should have been processed + // above. But I wonder if I should put a check in here anyway. if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::parse_incoming_messages, " - "error in incoming message\n", - this->id ())); + ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ") + ACE_TEXT("giving up reading for now and returning ") + ACE_TEXT("with incoming queue length = %d\n"), + this->id (), + this->incoming_message_queue_.queue_length ())); + if (this->uncompleted_message_) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ") + ACE_TEXT("missing bytes from uncompleted message = %u\n"), + this->id (), + this->uncompleted_message_->missing_data_bytes_)); } - - return -1; + // tell the upper layer not to resume the handle + rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED); + return 1; } } - return 0; -} + // **** END CJC PMG CHANGES **** + retval = did_queue_message ? this->process_queue_head (rh) : 1; -size_t -TAO_Transport::missing_data (ACE_Message_Block &incoming) -{ - // If we have a incomplete message in the queue then find out how - // much of data is required to get a complete message. - if (this->incoming_message_queue_.is_tail_complete () == 0) + if (retval == 1) { - return this->incoming_message_queue_.missing_data_tail (); + rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED); } - return this->messaging_object ()->missing_data (incoming); + return retval; } -int -TAO_Transport::consolidate_message (ACE_Message_Block &incoming, - ssize_t missing_data, - TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time) +void +TAO_Transport::try_to_complete (ACE_Time_Value *max_wait_time) { - // Check whether the last message in the queue is complete.. - if (this->incoming_message_queue_.is_tail_complete () == 0) - { - return this->consolidate_message_queue (incoming, - missing_data, - rh, - max_wait_time); - } - - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message\n", - this->id ())); - } - - // Calculate the actual length of the load that we are supposed to - // read which is equal to the <missing_data> + length of the buffer - // that we have.. - const size_t payload = missing_data + incoming.size (); - - // Grow the buffer to the size of the message - ACE_CDR::grow (&incoming, - payload); + if (this->uncompleted_message_ == 0) + return; ssize_t n = 0; + size_t &missing_data = this->uncompleted_message_->missing_data_bytes_; + ACE_Message_Block &mb = *this->uncompleted_message_->msg_block_; - // As this used for transports where things are available in one - // shot this looping should not create any problems. - for (ssize_t bytes = missing_data; bytes != 0; bytes -= n) + // Try to complete this until we error or block right here... + for (ssize_t bytes = missing_data; + bytes != 0; + bytes -= n) { // .. do a read on the socket again. - n = this->recv (incoming.wr_ptr (), + n = this->recv (mb.wr_ptr (), bytes, max_wait_time); if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message, " - "read %d bytes on attempt\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input_i, ") + ACE_TEXT("read %d bytes on attempt\n"), this->id(), n)); } @@ -1483,381 +1718,175 @@ TAO_Transport::consolidate_message (ACE_Message_Block &incoming, break; } - incoming.wr_ptr (n); + mb.wr_ptr (n); missing_data -= n; } - - // If we got an error.. - if (n == -1) - { - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message, " - "error while trying to consolidate\n", - this->id ())); - } - - return -1; - } - - // If we had gotten a EWOULDBLOCK n would be equal to zero. But we - // have to put the message in the queue anyway. So let us proceed - // to do that and return... - - // Check to see if we have messages in queue or if we have missing - // data . AT this point we cannot have have semi-complete messages - // in the queue as they would have been taken care before. Put - // ourselves in the queue and then try processing one of the - // messages.. - if ((missing_data > 0 - ||this->incoming_message_queue_.queue_length ()) - && this->incoming_message_queue_.is_tail_fragmented () == 0) - { - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message, " - "queueing up the message\n", - this->id ())); - } - - // Get a queued data - TAO_Queued_Data *qd = - this->make_queued_data (incoming); - - // Add the missing data to the queue - qd->missing_data_ = missing_data; - - // Get the rest of the messaging data - this->messaging_object ()->get_message_data (qd); - - // Add it to the tail of the queue.. - this->incoming_message_queue_.enqueue_tail (qd); - - if (this->incoming_message_queue_.is_head_complete ()) - { - return this->process_queue_head (rh); - } - - return 0; - } - - // We dont have any missing data. Just make a queued_data node with - // the existing message block and send it to the higher layers of - // the ORB. - TAO_Queued_Data pqd (&incoming, - this->orb_core_->transport_message_buffer_allocator ()); - pqd.missing_data_ = missing_data; - this->messaging_object ()->get_message_data (&pqd); - - // Check whether the message was fragmented and try to consolidate - // the fragments.. - if (pqd.more_fragments_ || - (pqd.msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT)) - { - // Duplicate the queued data as it is on stack.. - TAO_Queued_Data *nqd = TAO_Queued_Data::duplicate (pqd); - - return this->consolidate_fragments (nqd, rh); - } - - // Now we have a full message in our buffer. Just go ahead and - // process that - return this->process_parsed_messages (&pqd, - rh); } -int -TAO_Transport::consolidate_fragments (TAO_Queued_Data *qd, - TAO_Resume_Handle &rh) -{ - // If we have received a fragment message then we have to - // consolidate <qd> with the last message in queue - // @@todo: this piece of logic follows GIOP a bit... Need to revisit - // if we have protocols other than GIOP - - // @@todo: Fragments now have too much copying overhead. Need to get - // them out if we want to have some reasonable performance metrics - // in future.. Post 1.2 seems a nice time.. - if (qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT) - { - TAO_Queued_Data *tqd = - this->incoming_message_queue_.dequeue_tail (); - - tqd->more_fragments_ = qd->more_fragments_; - tqd->missing_data_ = qd->missing_data_; - - if (this->messaging_object ()->consolidate_fragments (tqd, qd) == -1) - { - return -1; - } - - TAO_Queued_Data::release (qd); - this->incoming_message_queue_.enqueue_tail (tqd); - this->process_queue_head (rh); - } - else - { - // if we dont have a fragment already in the queue just add it in - // the queue - this->incoming_message_queue_.enqueue_tail (qd); - } - - return 0; -} int -TAO_Transport::consolidate_message_queue (ACE_Message_Block &incoming, - ssize_t missing_data, - TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time) +TAO_Transport::enqueue_incoming_message (TAO_Queued_Data *queueable_message) { - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message_queue\n", - this->id ())); - } - - // If the queue did not have a complete message put this piece of - // message in the queue. We know it did not have a complete - // message. That is why we are here. - const size_t n = - this->incoming_message_queue_.copy_tail (incoming); - - if (TAO_debug_level > 6) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message_queue, " - "copied [%d] bytes to the tail\n", - this->id (), - n)); - } - - // Update the missing data... - missing_data = - this->incoming_message_queue_.missing_data_tail (); - - if (TAO_debug_level > 6) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message_queue, " - "missing [%d] bytes in the tail message\n", - this->id (), - missing_data)); - } - - // Move the read pointer of the <incoming> message block to the end - // of the copied message and process the remaining portion... - incoming.rd_ptr (n); - - // If we have some more information left in the message block.. - if (incoming.length ()) - { - // We may have to parse & consolidate. This part of the message - // doesn't seem to be part of the last message in the queue (as - // the copy () hasn't taken away this message). - const int retval = this->parse_consolidate_messages (incoming, - rh, - max_wait_time); - - // If there is an error return - if (retval == -1) - { - if (TAO_debug_level) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message_queue, " - "error while consolidating, part of the read message\n", - this->id ())); - } - return retval; - } - else if (retval == 1) + // Get the GIOP version + CORBA::Octet major = queueable_message->major_version_; + CORBA::Octet minor = queueable_message->minor_version_; + CORBA::UShort whole = major << 8 | minor; + + // Set up a couple of pointers that are shared by the code + // for the different GIOP versions. + ACE_Message_Block *mb = 0; + TAO_Queued_Data *fragment_message = 0; + + switch(whole) + { + case 0x0100: // GIOP 1.0 + if (!queueable_message->more_fragments_) + return this->incoming_message_queue_.enqueue_tail ( + queueable_message); + + // Fragments aren't supported in 1.0. This is an error and + // we should reject it somehow. What do we do here? Do we throw + // an exception to the receiving side? Do we throw an exception + // to the sending side? + // + // At the very least, we need to log the fact that we received + // nonsense. + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - ") + ACE_TEXT("TAO_Transport::enqueue_incoming_message ") + ACE_TEXT("detected a fragmented GIOP 1.0 message\n")), + -1); + break; + case 0x0101: // GIOP 1.1 + // In 1.1, fragments kinda suck because they don't have they're + // own message-specific header. Therefore, we have to do the + // following: + fragment_message = + this->incoming_message_queue_.find_fragment (major, minor); + + // No fragment was found + if (fragment_message == 0) + return this->incoming_message_queue_.enqueue_tail ( + queueable_message); + + if (queueable_message->more_fragments_) { - // If the message in the <incoming> message block has only - // one message left we need to process that seperately. - - // Get a queued data - TAO_Queued_Data *qd = this->make_queued_data (incoming); - - // Get the rest of the message data - this->messaging_object ()->get_message_data (qd); - - // Add the missing data to the queue - qd->missing_data_ = 0; - - // Check whether the message was fragmented and try to consolidate - // the fragments.. - if (qd->more_fragments_ - || (qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT)) - { - return this->consolidate_fragments (qd, rh); - } - - // Add it to the tail of the queue.. - this->incoming_message_queue_.enqueue_tail (qd); - - // We should surely have a message in queue now. So just - // process that. - return this->process_queue_head (rh); + // Find the last message block in the continuation + mb = fragment_message->msg_block_; + while (mb->cont () != 0) + mb = mb->cont (); + + // Add the current message block to the end of the chain + // after adjusting the read pointer to skip the GIOP header + queueable_message->msg_block_->rd_ptr(TAO_GIOP_MESSAGE_HEADER_LEN); + mb->cont (queueable_message->msg_block_); + + // Get rid of the queuable message but save the message block + queueable_message->msg_block_ = 0; + queueable_message->release (); + + // One note is that TAO_Queued_Data contains version numbers, + // but doesn't indicate the actual protocol to which those + // version numbers refer. That's not a problem, though, because + // instances of TAO_Queued_Data live in a queue, and that queue + // lives in a particular instance of a Transport, and the + // transport instance has an association with a particular + // messaging_object. The concrete messaging object embodies a + // messaging protocol, and must cover all versions of that + // protocol. Therefore, we just need to cover the bases of all + // versions of that one protocol. } - - // parse_consolidate_messages () would have processed one of the - // messages, so we better return as we dont want to starve other - // threads. - return 0; - } - - // If we still have some missing data.. - if (missing_data > 0) - { - // Get the last message from the Queue - TAO_Queued_Data *qd = - this->incoming_message_queue_.dequeue_tail (); - - if (TAO_debug_level > 5) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message_queue, " - "trying recv, again\n", - this->id ())); - } - - // Try to do a read again. If we have some luck it would be - // great.. - const ssize_t n = this->recv (qd->msg_block_->wr_ptr (), - missing_data, - max_wait_time); - - if (TAO_debug_level > 5) + else { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_message_queue, " - "recv retval [%d]\n", - this->id (), - n)); - } + // There is a complete chain of fragments + fragment_message->consolidate (); - // Error... - if (n < 0) - { - return n; + // Go ahead and enqueue this message + return this->incoming_message_queue_.enqueue_tail ( + queueable_message); } - - // If we get a EWOULDBLOCK ie. n==0, we should anyway put the - // message in queue before returning.. - // Move the write pointer - qd->msg_block_->wr_ptr (n); - - // Decrement the missing data - qd->missing_data_ -= n; - - // Now put the TAO_Queued_Data back in the queue - this->incoming_message_queue_.enqueue_tail (qd); - - // Any way as we have come this far and are about to return, - // just try to process a message if it is there in the queue. - if (this->incoming_message_queue_.is_head_complete ()) + break; + case 0x0102: // GIOP 1.2 + // In 1.2, we get a little more context. There's a + // FRAGMENT message-specific header, and inside that is the + // request id with which the fragment is associated. + fragment_message = + this->incoming_message_queue_.find_fragment ( + queueable_message->request_id_); + + // No fragment was found + if (fragment_message == 0) + return this->incoming_message_queue_.enqueue_tail ( + queueable_message); + + if (fragment_message->major_version_ != major || + fragment_message->minor_version_ != minor) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - ") + ACE_TEXT("TAO_Transport::enqueue_incoming_message ") + ACE_TEXT("GIOP versions do not match ") + ACE_TEXT("(%d.%d != %d.%d\n"), + fragment_message->major_version_, + fragment_message->minor_version_, + major, minor), + -1); + + // Find the last message block in the continuation + mb = fragment_message->msg_block_; + while (mb->cont () != 0) + mb = mb->cont (); + + // Add the current message block to the end of the chain + // after adjusting the read pointer to skip the GIOP header + queueable_message->msg_block_->rd_ptr(TAO_GIOP_MESSAGE_HEADER_LEN + + TAO_GIOP_MESSAGE_FRAGMENT_HEADER); + mb->cont (queueable_message->msg_block_); + + // Remove our reference to the message block. At this point + // the message block of the fragment head owns it as part of a + // chain + queueable_message->msg_block_ = 0; + + if (!queueable_message->more_fragments_) { - return this->process_queue_head (rh); + // This is the end of the fragments for this request + fragment_message->consolidate (); } - return 0; + // Get rid of the queuable message + queueable_message->release (); + break; + default: + if (!queueable_message->more_fragments_) + return this->incoming_message_queue_.enqueue_tail ( + queueable_message); + // This is an unknown GIOP version + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - ") + ACE_TEXT("TAO_Transport::enqueue_incoming_message ") + ACE_TEXT("can not handle a fragmented GIOP %d.%d ") + ACE_TEXT("message\n"), major, minor), + -1); } - // Process a message in the head of the queue if we have one.. - return this->process_queue_head (rh); + return 0; } int -TAO_Transport::consolidate_extra_messages (ACE_Message_Block - &incoming, - TAO_Resume_Handle &rh) -{ - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_extra_messages\n", - this->id ())); - } - - // Pick the tail of the queue - TAO_Queued_Data *tail = - this->incoming_message_queue_.dequeue_tail (); - - if (tail) - { - // If we have a node in the tail, checek to see whether it needs - // consolidation. If so, just consolidate it. - if (this->messaging_object ()->consolidate_node (tail, incoming) == -1) - { - return -1; - } - - // .. put the tail back in queue.. - this->incoming_message_queue_.enqueue_tail (tail); - } - - int retval = 1; - - if (TAO_debug_level > 6) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::consolidate_extra_messages, " - "extracting extra messages\n", - this->id ())); - } - - // Extract messages.. - while (retval == 1) - { - TAO_Queued_Data *q_data = 0; - - retval = - this->messaging_object ()->extract_next_message (incoming, - q_data); - if (q_data) - { - // If we have read a framented message then... - if (q_data->more_fragments_ || - q_data->msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT) - { - this->consolidate_fragments (q_data, rh); - } - else - { - this->incoming_message_queue_.enqueue_tail (q_data); - } - } - } - - // In case of error return.. - if (retval == -1) - { - return retval; - } - - return this->process_queue_head (rh); -} - -int TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, TAO_Resume_Handle &rh) { // Get the <message_type> that we have received - const TAO_Pluggable_Message_Type t = qd->msg_type_; - - // int result = 0; + TAO_Pluggable_Message_Type t = qd->msg_type_; + int result = 0; if (t == TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION) { if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::process_parsed_messages, " - "received CloseConnection message - %m\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ") + ACE_TEXT("received CloseConnection message\n"), this->id())); // Return a "-1" so that the next stage can take care of @@ -1885,15 +1914,32 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, { rh.resume_handle (); + // @@todo: Maybe the input_cdr can be constructed from the + // message_block TAO_Pluggable_Reply_Params params (this); + if (this->messaging_object ()->process_reply_message (params, qd) == -1) { if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::process_parsed_messages, " - "error in process_reply_message - %m\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ") + ACE_TEXT("error in process_reply_message %p\n"), + this->id (), "")); + return -1; + } + + result = this->tms ()->dispatch_reply (params); + + if (result == -1) + { + // Something really critical happened, we will forget about + // every reply on this connection. + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ") + ACE_TEXT("dispatch reply failed\n"), this->id ())); return -1; @@ -1904,137 +1950,81 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, { if (TAO_debug_level) { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Transport[%d]::process_parsed_messages, " - "received MessageError, closing connection\n", - this->id ())); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ") + ACE_TEXT("received MessageError, closing connection\n"), + this->id ()), + -1); } - return -1; } // If not, just return back.. return 0; } -TAO_Queued_Data * -TAO_Transport::make_queued_data (ACE_Message_Block &incoming) +int +TAO_Transport::process_queue_head (TAO_Resume_Handle &rh) { - // Get an instance of TAO_Queued_Data - TAO_Queued_Data *qd = - TAO_Queued_Data::get_queued_data ( - this->orb_core_->transport_message_buffer_allocator ()); - - // Get the flag for the details of the data block... - ACE_Message_Block::Message_Flags flg = - incoming.self_flags (); - - if (ACE_BIT_DISABLED (flg, - ACE_Message_Block::DONT_DELETE)) + if (TAO_debug_level > 3) { - // Duplicate the data block before putting it in the queue. - qd->msg_block_ = ACE_Message_Block::duplicate (&incoming); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_queue_head\n"), + this->id ())); } - else - { - // As we are in CORBA mode, all the data blocks would be aligned - // on an 8 byte boundary. Hence create a data block for more - // than the actual length - ACE_Data_Block *db = - this->orb_core_->create_input_cdr_data_block (incoming.length ()+ - ACE_CDR::MAX_ALIGNMENT); - - // Get the allocator.. - ACE_Allocator *alloc = - this->orb_core_->input_cdr_msgblock_allocator (); - - // Make message block.. - ACE_Message_Block mb (db, - 0, - alloc); - - // Duplicate the block.. - qd->msg_block_ = mb.duplicate (); - - // Align the message block - ACE_CDR::mb_align (qd->msg_block_); - // Copy the data.. - qd->msg_block_->copy (incoming.rd_ptr (), - incoming.length ()); - } + if (this->incoming_message_queue_.is_head_complete () != 1) + return 1; - return qd; -} + // Get the message on the head of the queue.. + TAO_Queued_Data *qd = + this->incoming_message_queue_.dequeue_head (); -int -TAO_Transport::process_queue_head (TAO_Resume_Handle &rh) -{ if (TAO_debug_level > 3) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::process_queue_head\n", - this->id ())); + ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_queue_head, ") + ACE_TEXT("the size of the queue is [%d]\n"), + this->id (), + this->incoming_message_queue_.queue_length())); } - - // See if the message in the head of the queue is complete... - if (this->incoming_message_queue_.is_head_complete () > 0) + // Now that we have pulled out out one message out of the queue, + // check whether we have one more message in the queue... + if (this->incoming_message_queue_.queue_length () > 0) { - // Get the message on the head of the queue.. - TAO_Queued_Data *qd = - this->incoming_message_queue_.dequeue_head (); - - if (TAO_debug_level > 3) + if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::process_queue_head, " - "the size of the queue is [%d]\n", - this->id (), - this->incoming_message_queue_.queue_length())); - } - // Now that we have pulled out out one message out of the queue, - // check whether we have one more message in the queue... - if (this->incoming_message_queue_.is_head_complete () > 0) - { - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::process_queue_head, " - "notify reactor\n", - this->id ())); - - } - - const int retval = this->notify_reactor (); + ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_queue_head, ") + ACE_TEXT("notify reactor\n"), + this->id ())); - if (retval == 1) - { - // Let the class know that it doesn't need to resume the - // handle.. - rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED); - } - else if (retval < 0) - return -1; - } - else - { - // As we are ready to process the last message just resume - // the handle. Set the flag incase someone had reset the flag.. - rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_RESUMABLE); } + int retval = + this->notify_reactor (); - // Process the message... - if (this->process_parsed_messages (qd, rh) == -1) + if (retval == 1) { - return -1; + // Let the class know that it doesn't need to resume the + // handle.. + rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED); } + else if (retval < 0) + return -1; + } + else + { + // As we are ready to process the last message just resume + // the handle. Set the flag incase someone had reset the flag.. + rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_RESUMABLE); + } - // Delete the Queued_Data.. - TAO_Queued_Data::release (qd); + // Process the message... + int retval = this->process_parsed_messages (qd, rh); - return 0; - } + // Delete the Queued_Data.. + TAO_Queued_Data::release (qd); - return 1; + return (retval == -1) ? -1 : 0; } int @@ -2053,8 +2043,8 @@ TAO_Transport::notify_reactor (void) if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::notify_reactor, " - "notify to Reactor\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::notify_reactor, ") + ACE_TEXT("notify to Reactor\n"), this->id ())); } @@ -2068,8 +2058,8 @@ TAO_Transport::notify_reactor (void) // @@todo: need to think about what is the action that // we can take when we get here. ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport[%d]::notify_reactor, " - "notify to the reactor failed..\n", + ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_queue_head, ") + ACE_TEXT("notify to the reactor failed..\n"), this->id ())); } diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h index e02f53e25ea..9fcd5e2dfb6 100644 --- a/TAO/tao/Transport.h +++ b/TAO/tao/Transport.h @@ -530,8 +530,10 @@ public: * */ virtual int handle_input (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time = 0, - int block = 0); + ACE_Time_Value *max_wait_time = 0, + int block = 0); + void try_to_complete (ACE_Time_Value *max_wait_time); + enum { @@ -611,60 +613,11 @@ public: protected: - /// Called by the handle_input_i(). This method is used to parse - /// message read by the handle_input_i() call. It also decides - /// whether the message needs consolidation before processing. - int parse_consolidate_messages (ACE_Message_Block &bl, - TAO_Resume_Handle &rh, - ACE_Time_Value *time = 0); - - - /// Method does parsing of the message if we have a fresh message in - /// the @a message_block or just returns if we have read part of the - /// previously stored message. - int parse_incoming_messages (ACE_Message_Block &message_block); - - /// Return if we have any missing data in the queue of messages - /// or determine if we have more information left out in the - /// presently read message to make it complete. - size_t missing_data (ACE_Message_Block &message_block); - - /// Consolidate the currently read message or consolidate the last - /// message in the queue. The consolidation of the last message in - /// the queue is done by calling consolidate_message_queue (). - virtual int consolidate_message (ACE_Message_Block &incoming, - ssize_t missing_data, - TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time); - - /// @@Bala: Docu??? - int consolidate_fragments (TAO_Queued_Data *qd, - TAO_Resume_Handle &rh); - - /// First consolidate the message queue. If the message is still not - /// complete, try to read from the handle again to make it - /// complete. If these dont help put the message back in the queue - /// and try to check the queue if we have message to process. (the - /// thread needs to do some work anyway :-)) - int consolidate_message_queue (ACE_Message_Block &incoming, - ssize_t missing_data, - TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time); - - /// Called by parse_consolidate_message () if we have more messages - /// in one read. Queue up the messages and try to process one of - /// them, atleast at the head of them. - int consolidate_extra_messages (ACE_Message_Block &incoming, - TAO_Resume_Handle &rh); - /// Process the message by sending it to the higher layers of the /// ORB. int process_parsed_messages (TAO_Queued_Data *qd, TAO_Resume_Handle &rh); - /// Make a queued data from the @a incoming message block - TAO_Queued_Data *make_queued_data (ACE_Message_Block &incoming); - /// Implement send_message_shared() assuming the handler_lock_ is /// held. int send_message_shared_i (TAO_Stub *stub, @@ -723,6 +676,34 @@ public: /// Accessor to sent_byte_count_ size_t sent_byte_count (void); + + /*! + \name Incoming Queue Methods + */ + //@{ + /*! + \brief Queue up \a queueable_message as a completely-received incoming message. + + This method queues up a completely-received queueable GIOP message + (i.e., it must be dynamically-allocated). It does not assemble a + complete GIOP message; that should be done prior to calling this + message, and is currently done in handle_input_i. + + This does, however, assure that a completely-received GIOP + FRAGMENT gets associated with any previously-received related + fragments. It does this through collaboration with the messaging + object (since fragment reassembly is protocol specific). + + \param queueable_message instance as returned by one of the TAO_Queued_Data::make_*_message that's been completely received + + \return 0 successfully enqueued \a queueable_message + + \return -1 failed to enqueue \a queueable_message + \todo How do we indicate \em what may have failed? + */ + int enqueue_incoming_message (TAO_Queued_Data *queueable_message); + //@} + /// CodeSet Negotiation - Get the char codeset translator factory TAO_Codeset_Translator_Factory *char_translator (void) const; @@ -907,9 +888,12 @@ protected: TAO_Queued_Message *head_; TAO_Queued_Message *tail_; - /// Queue of the incoming messages.. + /// Queue of the completely-received incoming messages.. TAO_Incoming_Message_Queue incoming_message_queue_; + /// Place to hold a partially-received (waiting-to-be-completed) message + TAO_Queued_Data * uncompleted_message_; + /// The queue will start draining no later than <queing_deadline_> /// *if* the deadline is ACE_Time_Value current_deadline_; @@ -1000,6 +984,13 @@ private: TAO_Transport *tr_; }; +// Always inline this method +inline size_t +TAO_Transport::id (void) const +{ + return this->id_; +} + #if defined (__ACE_INLINE__) # include "Transport.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/tao/Transport.inl b/TAO/tao/Transport.inl index be8b82bdac1..bdd9777775d 100644 --- a/TAO/tao/Transport.inl +++ b/TAO/tao/Transport.inl @@ -86,12 +86,6 @@ TAO_Transport::purging_order (unsigned long value) this->purging_order_ = value; } -ACE_INLINE size_t -TAO_Transport::id (void) const -{ - return this->id_; -} - ACE_INLINE void TAO_Transport::id (size_t id) { diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp index 9a2c55c9883..7ef578dfd72 100644 --- a/TAO/tao/Transport_Connector.cpp +++ b/TAO/tao/Transport_Connector.cpp @@ -36,30 +36,6 @@ TAO_Connector::~TAO_Connector (void) delete this->active_connect_strategy_; } -TAO_Profile * -TAO_Connector::corbaloc_scan (const char *str, - size_t &len - ACE_ENV_ARG_DECL) -{ - if (this->check_prefix (str) != 0) - return 0; - const char *comma_pos = ACE_OS::strchr (str,','); - const char *slash_pos = ACE_OS::strchr (str,'/'); - if (comma_pos == 0 && slash_pos == 0) - { - if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("(%P|%t) TAO_CONNECTOR::corbaloc_scan warning: ") - ACE_TEXT("supplied string contains no comma or slash: %s\n"), - str)); - len = ACE_OS::strlen (str); - } - else if (comma_pos == 0 || comma_pos > slash_pos) - len = (slash_pos - str); - else len = comma_pos - str; - return this->make_profile(ACE_ENV_SINGLE_ARG_PARAMETER); -} - int TAO_Connector::make_mprofile (const char *string, TAO_MProfile &mprofile diff --git a/TAO/tao/Transport_Connector.h b/TAO/tao/Transport_Connector.h index e05a3c1eed3..73347185874 100644 --- a/TAO/tao/Transport_Connector.h +++ b/TAO/tao/Transport_Connector.h @@ -75,22 +75,12 @@ public: CORBA::ULong tag (void) const; /// Parse a string containing a URL style IOR and return an - /// MProfile. Verify that ior is in the correct format. + /// MProfile. int make_mprofile ( const char *ior, TAO_MProfile &mprofile ACE_ENV_ARG_DECL); - /// Helper function to assist corbaloc parsing. The default simply validates - /// the protocol identifyier and scans up to the next comma or slash. - /// Any protocol that has a specific need, such as uiop, can override this - /// method to provide a custom scanner. - /// The profile returned is either null if this the ior does not match or an - /// empty profile of the correct type, obtained from make_profile(). - virtual TAO_Profile * corbaloc_scan (const char *ior, - size_t &len - ACE_ENV_ARG_DECL); - /// Initialize object and register with reactor. virtual int open ( TAO_ORB_Core *orb_core) = 0; diff --git a/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc b/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc index e3bffce0eaa..e97b94f1447 100644 --- a/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc +++ b/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc @@ -13,49 +13,37 @@ project(*Bounded_Simple_Types) : taoexe { } } -project(*Unbounded_String) : taoexe { - Source_Files { - Unbounded_String.cpp - } -} - project(*String_Sequence_Element): taoexe, boost_unit_test { - exename = string_sequence_element_ut Source_Files { string_sequence_element_ut.cpp } } project(*Unbounded_String_Sequence): taoexe, boost_unit_test { - exename = unbounded_string_sequence_ut Source_Files { unbounded_string_sequence_ut.cpp } } //project(*String_Sequence_Element): taoexe, boost_unit_test { -// exename = string_sequence_element_ut // Source_Files { // string_sequence_element_ut.cpp // } //} project(*Testing_Allocation_Traits): taoexe, boost_unit_test { - exename = testing_allocation_traits_ut Source_Files { testing_allocation_traits_ut.cpp } } project(*Unbounded_Value_Sequence): taoexe, boost_unit_test { - exename = bounded_value_sequence_ut Source_Files { unbounded_value_sequence_ut.cpp } } project(*Bounded_Value_Sequence): taoexe, boost_unit_test { - exename = bounded_value_sequence_ut Source_Files { bounded_value_sequence_ut.cpp } diff --git a/TAO/tests/Sequence_Unit_Tests/Unbounded_String.cpp b/TAO/tests/Sequence_Unit_Tests/Unbounded_String.cpp deleted file mode 100644 index 1390680db57..00000000000 --- a/TAO/tests/Sequence_Unit_Tests/Unbounded_String.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file - * - * @brief Smoke test (basically just compile) the unbounded sequences - * for strings. - * - * $Id$ - * - * @author Carlos O'Ryan - */ -#include "unbounded_string_sequence.hpp" - -typedef TAO::unbounded_string_sequence s_sequence; - -int main(int,char*[]) -{ - s_sequence a; - s_sequence b(23); - - s_sequence c(32); - a = b; - - a.length(c.maximum()); - if (a.release()) - { - b.length(a.length()); - } - a[0] = const_cast<char const*>("Hello"); - b[0] = a[0]; - - s_sequence const & d = a; - c[0] = d[0]; - - if (d.length()) - { - s_sequence::freebuf(s_sequence::allocbuf(64)); - } - - s_sequence e(c); - - CORBA::String_var w(const_cast<char const*>("World")); - e[0] = w; - - return 0; -} diff --git a/TAO/tests/Sequence_Unit_Tests/allocation_traits.hpp b/TAO/tests/Sequence_Unit_Tests/allocation_traits.hpp index 8682897b395..24727f943ef 100644 --- a/TAO/tests/Sequence_Unit_Tests/allocation_traits.hpp +++ b/TAO/tests/Sequence_Unit_Tests/allocation_traits.hpp @@ -86,7 +86,7 @@ struct unbounded_reference_allocation_traits { value_type * buffer = base_allocation_traits::allocbuf(maximum + 1); - reinterpret_cast<value_type**>(buffer)[0] = buffer + maximum + 1; + reinterpret_cast<value_type*>(buffer[0]) = buffer + maximum + 1; reference_traits::zero_range(buffer + 1, buffer + maximum + 1); @@ -117,7 +117,6 @@ struct bounded_reference_allocation_traits { value_type * buffer = base_allocation_traits::allocbuf(MAX); reference_traits::zero_range(buffer, buffer + MAX); - return buffer; } inline static void freebuf(value_type * buffer) diff --git a/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp index cdb2d92b7ca..8cec8745518 100644 --- a/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp @@ -17,7 +17,7 @@ #include <boost/test/unit_test.hpp> #include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> using namespace boost::unit_test_framework; using namespace TAO; @@ -31,9 +31,50 @@ typedef details::range_checking<int,true> range; typedef bounded_value_sequence<int,MAXIMUM> tested_sequence; struct Tester + : public boost::enable_shared_from_this<Tester> { typedef tested_sequence::value_type value_type; + void add_all(test_suite * ts) + { + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_set_length_less_than_maximum, + shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_buffer_constructor_default, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_buffer_constructor_false, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_buffer_constructor_true, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_replace_default, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_replace_false, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_replace_true, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_get_buffer_const, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_get_buffer_false, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_get_buffer_true_with_release_false, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_get_buffer_true_with_release_true, + shared_from_this())); + + } + + void test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -250,60 +291,6 @@ struct Tester BOOST_CHECK_MESSAGE(f.expect(1), c); tested_sequence::freebuf(buffer); } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_const, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; test_suite * @@ -313,16 +300,21 @@ init_unit_test_suite(int, char*[]) BOOST_TEST_SUITE("unbounded value sequence unit test")); { - boost::shared_ptr<Tester> tester(Tester::allocate()); + boost::shared_ptr<Tester> tester(new Tester); tester->add_all(ts.get()); } { typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate()); + boost::shared_ptr<common> tester(new common); tester->add_all(ts.get()); } return ts.release(); } +#if 0 +// This is just to convince MPC that I do not need a main() to have a +// program. +int main() {} +#endif diff --git a/TAO/tests/Sequence_Unit_Tests/run_test.pl b/TAO/tests/Sequence_Unit_Tests/run_test.pl index cbdce29c243..ec036b2c7fa 100755 --- a/TAO/tests/Sequence_Unit_Tests/run_test.pl +++ b/TAO/tests/Sequence_Unit_Tests/run_test.pl @@ -15,10 +15,8 @@ foreach my $process (qw(unbounded_value_sequence_ut bounded_value_sequence_ut string_sequence_element_ut unbounded_string_sequence_ut - testing_allocation_traits_ut Unbounded_Simple_Types - Bounded_Simple_Types - Unbounded_String)) { + Bounded_Simple_Types)) { # Not all the binaries are generated in all configurations. next unless -x $process; diff --git a/TAO/tests/Sequence_Unit_Tests/string_sequence_element.hpp b/TAO/tests/Sequence_Unit_Tests/string_sequence_element.hpp index f8203e80d8e..61c506b5b3f 100644 --- a/TAO/tests/Sequence_Unit_Tests/string_sequence_element.hpp +++ b/TAO/tests/Sequence_Unit_Tests/string_sequence_element.hpp @@ -11,18 +11,24 @@ * @author Carlos O'Ryan */ +#include "string_traits.hpp" + namespace TAO { namespace details { -template<typename string_traits> +template<typename charT> class string_sequence_element { public: - typedef typename string_traits::char_type character_type; - typedef character_type * value_type; - typedef character_type const * const_value_type; + typedef charT character_type; + typedef charT * value_type; + typedef charT const * const_value_type; + typedef details::string_traits<charT,true> string_traits; + // @@ Carlos, VC6 cannot handle the following typedefs. It simply + // says that "string_var" (or string_mgr) is not a member of + // "string_traits". I seem to understand this code better than VC6! typedef typename string_traits::string_var string_var; typedef typename string_traits::string_mgr string_mgr; @@ -44,7 +50,7 @@ public: { } - string_sequence_element & operator=(character_type const * rhs) + string_sequence_element & operator=(charT const * rhs) { if (release()) { @@ -57,7 +63,7 @@ public: return *this; } - string_sequence_element & operator=(character_type * rhs) + string_sequence_element & operator=(charT * rhs) { if (release()) { diff --git a/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp b/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp index 8c05a87dcfe..2607313cd2e 100644 --- a/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp @@ -19,7 +19,7 @@ #include <boost/test/unit_test.hpp> #include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> using namespace TAO::details; @@ -63,10 +63,10 @@ struct helper<CORBA::WChar> }; template<class charT> -struct Tester +struct Tester : public boost::enable_shared_from_this<Tester<charT> > { typedef string_traits<charT,true> tested_element_traits; - typedef string_sequence_element<tested_element_traits> tested_element; + typedef string_sequence_element<charT> tested_element; typedef charT * string_type; typedef typename tested_element_traits::string_var string_var; typedef typename tested_element_traits::string_mgr string_mgr; @@ -82,7 +82,7 @@ struct Tester BOOST_CHECK_MESSAGE(d.expect(0), d); BOOST_CHECK_MESSAGE(r.expect(0), r); x = helper<charT>::sample0(); - + BOOST_CHECK_MESSAGE(d.expect(1), d); BOOST_CHECK_MESSAGE(r.expect(1), r); @@ -179,7 +179,7 @@ struct Tester BOOST_CHECK_MESSAGE(r.expect(0), r); x = y; - + BOOST_CHECK_MESSAGE(d.expect(0), d); BOOST_CHECK_MESSAGE(r.expect(1), r); @@ -281,7 +281,7 @@ struct Tester BOOST_CHECK_MESSAGE(r.expect(0), r); x = y; - + BOOST_CHECK_MESSAGE(d.expect(1), d); BOOST_CHECK_MESSAGE(r.expect(1), r); @@ -314,7 +314,7 @@ struct Tester BOOST_CHECK_MESSAGE(r.expect(0), r); x = y; - + BOOST_CHECK_MESSAGE(d.expect(1), d); BOOST_CHECK_MESSAGE(r.expect(1), r); @@ -333,47 +333,32 @@ struct Tester void add_all(test_suite * ts) { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_assignment_from_const_string, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_assignment_from_element, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_self_assignment, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_assignment_from_non_const_string, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_copy_constructor, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_assignment_from_copy, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_assignment_from_var, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_assignment_from_mgr, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + shared_from_this())); } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; -}; +}; test_suite * init_unit_test_suite(int, char*[]) @@ -382,13 +367,18 @@ init_unit_test_suite(int, char*[]) BOOST_TEST_SUITE("string sequence element unit test")); boost::shared_ptr<Tester<char> > char_tester( - Tester<char>::allocate()); + new Tester<char>); char_tester->add_all(ts.get()); boost::shared_ptr<Tester<CORBA::WChar> > wchar_tester( - Tester<CORBA::WChar>::allocate()); + new Tester<CORBA::WChar>); wchar_tester->add_all(ts.get()); return ts.release(); } +#if 0 +// This is just to convince MPC that I do not need a main() to have a +// program. +int main() {} +#endif diff --git a/TAO/tests/Sequence_Unit_Tests/string_traits_base.hpp b/TAO/tests/Sequence_Unit_Tests/string_traits_base.hpp index 44a4c287a0e..2be2011b2fa 100644 --- a/TAO/tests/Sequence_Unit_Tests/string_traits_base.hpp +++ b/TAO/tests/Sequence_Unit_Tests/string_traits_base.hpp @@ -43,7 +43,9 @@ struct string_traits_base<char> inline static void release(char_type * s) { - CORBA::string_free(s); + // @@ Carlos, MSVC6 doesn't like to see a "return statement" in + // here, since its declared a void. + return CORBA::string_free(s); } }; @@ -66,7 +68,9 @@ struct string_traits_base<CORBA::WChar> inline static void release(char_type * s) { - CORBA::wstring_free(s); + // @@ Carlos, MSVC6 doesn't like to see a "return statement" in + // here, since its declared a void. + return CORBA::wstring_free(s); } }; diff --git a/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp b/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp index 0084654fb25..ae4c9c132b2 100644 --- a/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp @@ -11,11 +11,7 @@ #include <boost/test/unit_test.hpp> #include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -#define CHECK_NO_THROW(statement) \ -try { statement; } catch(...) { \ - BOOST_ERROR("unexpected exception raised"); } +#include <boost/enable_shared_from_this.hpp> using namespace TAO::details; @@ -24,22 +20,47 @@ using namespace boost::unit_test_framework; CORBA::ULong const MAXIMUM = 32; template<class value_type> -struct Tester +struct Tester : public boost::enable_shared_from_this<Tester<value_type> > { typedef unbounded_allocation_traits<value_type,true> unbounded; typedef bounded_allocation_traits<value_type,MAXIMUM,true> bounded; + void add_all(test_suite * ts) + { + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_default_buffer_allocation_value, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_default_buffer_allocation<unbounded>, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_default_buffer_allocation<bounded>, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_allocbuf<unbounded>, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_allocbuf<bounded>, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_freebuf<unbounded>, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_freebuf<bounded>, + shared_from_this())); + } + template<class aspect> void test_allocbuf() { expected_calls c(aspect::allocbuf_calls); aspect::allocbuf_calls.failure_countdown(2); - value_type * s = 0; - CHECK_NO_THROW(s = aspect::allocbuf(4)); + value_type * s; + BOOST_CHECK_NO_THROW(s = aspect::allocbuf(4)); aspect::freebuf(s); BOOST_CHECK_THROW(s = aspect::allocbuf(4), testing_exception); - CHECK_NO_THROW(s = aspect::allocbuf(4)); + BOOST_CHECK_NO_THROW(s = aspect::allocbuf(4)); aspect::freebuf(s); BOOST_CHECK_MESSAGE(c.expect(3), c); @@ -52,12 +73,12 @@ struct Tester aspect::freebuf_calls.failure_countdown(2); value_type * s = aspect::allocbuf(4); - CHECK_NO_THROW(aspect::freebuf(s)); + BOOST_CHECK_NO_THROW(aspect::freebuf(s)); s = aspect::allocbuf(4); BOOST_CHECK_THROW(aspect::freebuf(s), testing_exception); aspect::freebuf(s); s = aspect::allocbuf(4); - CHECK_NO_THROW(aspect::freebuf(s)); + BOOST_CHECK_NO_THROW(aspect::freebuf(s)); BOOST_CHECK_MESSAGE(c.expect(4), c); } @@ -86,88 +107,19 @@ struct Tester expected_calls c(aspect::default_buffer_allocation_calls); aspect::default_buffer_allocation_calls.failure_countdown(2); - value_type * s = 0; - CHECK_NO_THROW( + value_type * s; + BOOST_CHECK_NO_THROW( s = aspect::default_buffer_allocation()); aspect::freebuf(s); BOOST_CHECK_THROW( s = aspect::default_buffer_allocation(), testing_exception); - CHECK_NO_THROW( + BOOST_CHECK_NO_THROW( s = aspect::default_buffer_allocation()); aspect::freebuf(s); BOOST_CHECK_MESSAGE(c.expect(3), c); } - void test_default_buffer_allocation_unbounded() - { - test_default_buffer_allocation<unbounded>(); - } - - void test_default_buffer_allocation_bounded() - { - test_default_buffer_allocation<bounded>(); - } - - void test_allocbuf_unbounded() - { - test_allocbuf<unbounded>(); - } - - void test_allocbuf_bounded() - { - test_allocbuf<bounded>(); - } - - void test_freebuf_unbounded() - { - test_freebuf<unbounded>(); - } - - void test_freebuf_bounded() - { - test_freebuf<bounded>(); - } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_buffer_allocation_value, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_buffer_allocation_unbounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_buffer_allocation_bounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_allocbuf_unbounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_allocbuf_bounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_freebuf_unbounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_freebuf_bounded, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; struct Foo { int y; }; @@ -179,23 +131,25 @@ init_unit_test_suite(int, char*[]) BOOST_TEST_SUITE("testing allocation traits unit test")); { - boost::shared_ptr<Tester<int> > tester( - Tester<int>::allocate()); + boost::shared_ptr<Tester<int> > tester(new Tester<int>); tester->add_all(ts.get()); } { - boost::shared_ptr<Tester<Foo> > tester( - Tester<Foo>::allocate()); + boost::shared_ptr<Tester<Foo> > tester(new Tester<Foo>); tester->add_all(ts.get()); } { - boost::shared_ptr<Tester<char*> > tester( - Tester<char*>::allocate()); + boost::shared_ptr<Tester<char*> > tester(new Tester<char*>); tester->add_all(ts.get()); } return ts.release(); } +#if 0 +// This is just to convince MPC that I do not need a main() to have a +// program. +int main() {} +#endif diff --git a/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp b/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp index 38e5d1b408f..17c745bffd5 100644 --- a/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp +++ b/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp @@ -12,7 +12,7 @@ * @author Carlos O'Ryan */ -#include <boost/utility.hpp> +#include <boost/noncopyable.hpp> #include <iostream> diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp b/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp index 8d0d126c998..4b7f1124c1c 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp @@ -25,7 +25,7 @@ public: typedef details::string_traits<char,true> element_traits; typedef details::unbounded_reference_allocation_traits<char*,element_traits,true> allocation_traits; - typedef details::string_sequence_element<element_traits> element_type; + typedef details::string_sequence_element<char> element_type; typedef details::generic_sequence<char*, allocation_traits, element_traits> implementation_type; diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp index de059e21e9a..3ec1725c7f6 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp @@ -18,7 +18,7 @@ #include <boost/test/unit_test.hpp> #include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> #include <sstream> @@ -26,6 +26,7 @@ using namespace boost::unit_test_framework; using namespace TAO; struct Tester + : public boost::enable_shared_from_this<Tester> { typedef char char_type; typedef char * value_type; @@ -258,54 +259,40 @@ struct Tester BOOST_CHECK_MESSAGE(f.expect(0), f); BOOST_CHECK_MESSAGE(r.expect(32), r); - + } void add_all(test_suite * ts) { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_default_constructor, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_ulong_constructor, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_copy_constructor_from_default, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_copy_constructor_from_ulong, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_set_length_less_than_maximum, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_set_length_more_than_maximum, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_index_accessor, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_index_checking, - shared_this)); + shared_from_this())); ts->add(BOOST_CLASS_TEST_CASE( &Tester::test_copy_constructor_values, - shared_this)); + shared_from_this())); } - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; test_suite * @@ -314,9 +301,14 @@ init_unit_test_suite(int, char*[]) std::auto_ptr<test_suite> ts( BOOST_TEST_SUITE("unbounded string sequence unit test")); - boost::shared_ptr<Tester> tester(Tester::allocate()); + boost::shared_ptr<Tester> tester(new Tester); tester->add_all(ts.get()); return ts.release(); } +#if 0 +// This is just to convince MPC that I do not need a main() to have a +// program. +int main() {} +#endif diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp index b6db678ffea..335f746c8a8 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp @@ -17,7 +17,7 @@ #include <boost/test/unit_test.hpp> #include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> using namespace boost::unit_test_framework; using namespace TAO; @@ -29,9 +29,72 @@ typedef details::range_checking<int,true> range; typedef unbounded_value_sequence<int> tested_sequence; struct Tester + : public boost::enable_shared_from_this<Tester> { typedef tested_sequence::value_type value_type; + void add_all(test_suite * ts) + { + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_ulong_constructor, shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_copy_constructor_from_ulong, + shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_assignment_from_ulong, + shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_exception_in_ulong_constructor, + shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_set_length_less_than_maximum, + shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_set_length_more_than_maximum, + shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_exception_in_set_length, + shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_buffer_constructor_default, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_buffer_constructor_false, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_buffer_constructor_true, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_replace_default, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_replace_false, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_replace_true, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_get_buffer_const, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_get_buffer_false, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_get_buffer_true_with_release_false, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &Tester::test_get_buffer_true_with_release_true, + shared_from_this())); + + } + void test_copy_constructor_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -356,83 +419,6 @@ struct Tester tested_sequence::freebuf(buffer); } - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_set_length, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_const, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; test_suite * @@ -442,16 +428,21 @@ init_unit_test_suite(int, char*[]) BOOST_TEST_SUITE("unbounded value sequence unit test")); { - boost::shared_ptr<Tester> tester(Tester::allocate()); + boost::shared_ptr<Tester> tester(new Tester); tester->add_all(ts.get()); } { typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate()); + boost::shared_ptr<common> tester(new common); tester->add_all(ts.get()); } return ts.release(); } +#if 0 +// This is just to convince MPC that I do not need a main() to have a +// program. +int main() {} +#endif diff --git a/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp b/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp index 9708e8b3008..ea1b4c05f52 100644 --- a/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp +++ b/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp @@ -12,14 +12,54 @@ #include <boost/test/unit_test.hpp> #include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> template<class tested_sequence, class tested_allocation_traits> struct value_sequence_tester + : public boost::enable_shared_from_this< + value_sequence_tester< + tested_sequence,tested_allocation_traits> > { typedef typename tested_sequence::value_type value_type; + void add_all(boost::unit_test_framework::test_suite * ts) + { + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_default_constructor, + shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_copy_constructor_from_default, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_index_accessor, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_index_modifier, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_index_checking, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_copy_constructor_values, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_assignment_from_default, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_assignment_values, + shared_from_this())); + + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_exception_in_copy_constructor, + shared_from_this())); + ts->add(BOOST_CLASS_TEST_CASE( + &value_sequence_tester::test_exception_in_assignment, + shared_from_this())); + } + + void test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -190,57 +230,6 @@ struct value_sequence_tester BOOST_CHECK_MESSAGE(f.expect(2), f); } - void add_all(boost::unit_test_framework::test_suite * ts) - { - boost::shared_ptr<value_sequence_tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_default_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_copy_constructor_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_index_accessor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_index_modifier, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_index_checking, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_copy_constructor_values, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_assignment_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_assignment_values, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_exception_in_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_exception_in_assignment, - shared_this)); - } - - static boost::shared_ptr<value_sequence_tester> allocate() - { - boost::shared_ptr<value_sequence_tester> ptr( - new value_sequence_tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - value_sequence_tester() {} - - boost::weak_ptr<value_sequence_tester> self_; }; #endif // guard_value_sequence_tester_hpp @@ -1894,7 +1894,7 @@ J. Abelardo Gutierrez <jabelardo at cantv dot net> Roger Sala <Roger dot Sala at gd-ais dot com> Raz Ben-Yehuda <raz dot b at corigin dot com> Geo Sebastian <geosebastian at onmobile dot com> -Simon Massey <simon dot massey at prismtechnologies dot com> +Simon Massey <simon dot massey a tprismtechnologies dot com> Rich Shapiro <rshapiro at bbn dot com> Ramiro Morales <rm0 at gmx dot net> Andrew Athan <aathan-ace-bugs-1524 at cloakmail dot com> @@ -1909,7 +1909,6 @@ Jean-Christophe Cota <jean-christophe dot cota at eurocontrol dot int> Paul <paul at reeder dot cs> Vincent Newsum <Newsum at fel dot tno dot nl> Vasili Goutas <vasili at goutas dot de> -Iliyan Jeliazkov <jeliazkov_i@ociweb.com> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 8ef9a2e7e7d..9f826c05f54 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -382,6 +382,163 @@ ACE::hash_pjw (const wchar_t *str) } #endif /* ACE_HAS_WCHAR */ +// The CRC routine was taken from the FreeBSD implementation of cksum, +// that falls under the following license: +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * James W. Williams of NASA Goddard Space Flight Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +namespace ACE +{ + const ACE_UINT32 crc_table_[] = + { + 0x0, + 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, + 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, + 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, + 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, + 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, + 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, + 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, + 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, + 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, + 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, + 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, + 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, + 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, + 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, + 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, + 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, + 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, + 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, + 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, + 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, + 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, + 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, + 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, + 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, + 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, + 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, + 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, + 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, + 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, + 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, + 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, + 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, + 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, + 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, + 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, + 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, + 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, + 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, + 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, + 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, + 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, + 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, + 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, + 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, + 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, + 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, + 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, + 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, + 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 + }; +} + +// Compute a POSIX 1003.2 checksum. The routine takes an string and +// computes the CRC for it (it stops on the first '\0' character). + +// UNICOS UINT32's are 64-bit on the Cray PVP architecture +#if defined(_UNICOS) +# define COMPUTE(var, ch) (var) = ( 0x00000000ffffffff & ((var) << 8)) ^ ACE::crc_table_[(((var) >> 24) ^ (ch))&0xff] +#else /* _UNICOS */ +# define COMPUTE(var, ch) (var) = ((var) << 8) ^ ACE::crc_table_[(((var) >> 24) ^ (ch))&0xff] +#endif /* _UNICOS */ + +ACE_UINT32 +ACE::crc32 (const char *string) +{ + register ACE_UINT32 crc = 0; + + for (const char *p = string; + *p != 0; + ++p) + { + COMPUTE (crc, *p); + } + + return ~crc; +} + +ACE_UINT32 +ACE::crc32 (const void *buffer, size_t len) +{ + register ACE_UINT32 crc = 0; + + for (const char *p = (char *) buffer, + *e = (char *) buffer + len; + p != e; + ++p) + { + COMPUTE (crc, *p); + } + + return ~crc; +} + +ACE_UINT32 +ACE::crc32 (iovec *iov, int len) +{ + register ACE_UINT32 crc = 0; + + for (int i = 0; i < len; ++i) + { + for (const char *p = (char *) iov[i].iov_base, + *e = (char *) iov[i].iov_base + iov[i].iov_len; + p != e; + ++p) + COMPUTE (crc, *p); + } + + return ~crc; +} + +#undef COMPUTE + #if !defined (ACE_HAS_WINCE) ACE_TCHAR * ACE::strenvdup (const ACE_TCHAR *str) diff --git a/ace/ACE.h b/ace/ACE.h index fe6c599398d..cd6add96bd5 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -536,15 +536,6 @@ namespace ACE extern ACE_Export u_long hash_pjw (const wchar_t *str, size_t len); #endif /* ACE_HAS_WCHAR */ - /// Computes CRC-CCITT for the string. - extern ACE_Export ACE_UINT16 crc_ccitt(const char *str); - - /// Computes CRC-CCITT for the buffer. - extern ACE_Export ACE_UINT16 crc_ccitt(const void *buf, size_t len); - - /// Computes CRC-CCITT for the @ len iovec buffers. - extern ACE_Export ACE_UINT16 crc_ccitt(const iovec *iov, int len); - /// Computes the ISO 8802-3 standard 32 bits CRC for the string. extern ACE_Export ACE_UINT32 crc32 (const char *str); @@ -553,7 +544,7 @@ namespace ACE /// Computes the ISO 8802-3 standard 32 bits CRC for the /// @ len iovec buffers. - extern ACE_Export ACE_UINT32 crc32 (const iovec *iov, int len); + extern ACE_Export ACE_UINT32 crc32 (iovec *iov, int len); /// Euclid's greatest common divisor algorithm. extern ACE_Export u_long gcd (u_long x, u_long y); diff --git a/ace/ACE_crc32.cpp b/ace/ACE_crc32.cpp deleted file mode 100644 index fb13fefbc31..00000000000 --- a/ace/ACE_crc32.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// $Id$ - -#include "ace/ACE.h" - -ACE_RCSID (ace, - ACE_crc32, - "$Id$") - - -namespace -{ - /*****************************************************************/ - /* */ - /* CRC LOOKUP TABLE */ - /* ================ */ - /* The following CRC lookup table was generated automagically */ - /* by the Rocksoft^tm Model CRC Algorithm Table Generation */ - /* Program V1.0 using the following model parameters: */ - /* */ - /* Width : 4 bytes. */ - /* Poly : 0x04C11DB7L */ - /* Reverse : TRUE. */ - /* */ - /* For more information on the Rocksoft^tm Model CRC Algorithm, */ - /* see the document titled "A Painless Guide to CRC Error */ - /* Detection Algorithms" by Ross Williams */ - /* (ross@guest.adelaide.edu.au.). This document is likely to be */ - /* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ - /* */ - /*****************************************************************/ - - const ACE_UINT32 crc_table[] = - { - 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, - 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, - 0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L, - 0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L, - 0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL, - 0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L, - 0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL, - 0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L, - 0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L, - 0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL, - 0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L, - 0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L, - 0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L, - 0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL, - 0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L, - 0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL, - 0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL, - 0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L, - 0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L, - 0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L, - 0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL, - 0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L, - 0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL, - 0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L, - 0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L, - 0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL, - 0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L, - 0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L, - 0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L, - 0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL, - 0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L, - 0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL, - 0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL, - 0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L, - 0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L, - 0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L, - 0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL, - 0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L, - 0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL, - 0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L, - 0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L, - 0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL, - 0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L, - 0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L, - 0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L, - 0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL, - 0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L, - 0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL, - 0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL, - 0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L, - 0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L, - 0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L, - 0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL, - 0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L, - 0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL, - 0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L, - 0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L, - 0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL, - 0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L, - 0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L, - 0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L, - 0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL, - 0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L, - 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL - }; - - /*****************************************************************/ - /* End of CRC Lookup Table */ - /*****************************************************************/ -}; - -#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) - -ACE_UINT32 -ACE::crc32 (const char *string) -{ - ACE_UINT32 crc = 0xFFFFFFFF; - - for (const char *p = string; - *p != 0; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT32 -ACE::crc32 (const void *buffer, size_t len) -{ - ACE_UINT32 crc = 0xFFFFFFFF; - - for (const char *p = (const char *) buffer, - *e = (const char *) buffer + len; - p != e; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT32 -ACE::crc32 (const iovec *iov, int len) -{ - ACE_UINT32 crc = 0xFFFFFFFF; - - for (int i = 0; i < len; ++i) - { - for (const char *p = (const char *) iov[i].iov_base, - *e = (const char *) iov[i].iov_base + iov[i].iov_len; - p != e; - ++p) - COMPUTE (crc, *p); - } - - return ~crc; -} - -#undef COMPUTE diff --git a/ace/ACE_crc_ccitt.cpp b/ace/ACE_crc_ccitt.cpp deleted file mode 100644 index 5f16270abb7..00000000000 --- a/ace/ACE_crc_ccitt.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// $Id$ - -#include "ace/ACE.h" - -ACE_RCSID (ace, - ACE_crc_ccitt, - "$Id$") - -namespace -{ - /*****************************************************************/ - /* */ - /* CRC LOOKUP TABLE */ - /* ================ */ - /* The following CRC lookup table was generated automagically */ - /* by the Rocksoft^tm Model CRC Algorithm Table Generation */ - /* Program V1.0 using the following model parameters: */ - /* */ - /* Width : 2 bytes. */ - /* Poly : 0x1021 */ - /* Reverse : TRUE. */ - /* */ - /* For more information on the Rocksoft^tm Model CRC Algorithm, */ - /* see the document titled "A Painless Guide to CRC Error */ - /* Detection Algorithms" by Ross Williams */ - /* (ross@guest.adelaide.edu.au.). This document is likely to be */ - /* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ - /* */ - /*****************************************************************/ - - const ACE_UINT16 crc_table[] = - { - 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, - 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, - 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, - 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, - 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, - 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, - 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, - 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, - 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, - 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, - 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, - 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, - 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, - 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, - 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, - 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, - 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, - 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, - 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, - 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, - 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, - 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, - 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, - 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, - 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, - 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, - 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, - 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, - 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, - 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, - 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, - 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 - }; - - /*****************************************************************/ - /* End of CRC Lookup Table */ - /*****************************************************************/ -}; - -#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) - -ACE_UINT16 -ACE::crc_ccitt (const char *string) -{ - ACE_UINT16 crc = 0xFFFF; - - for (const char *p = string; - *p != 0; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT16 -ACE::crc_ccitt (const void *buffer, size_t len) -{ - ACE_UINT16 crc = 0xFFFF; - - for (const char *p = (const char *) buffer, - *e = (const char *) buffer + len; - p != e; - ++p) - { - COMPUTE (crc, *p); - } - - return ~crc; -} - -ACE_UINT16 -ACE::crc_ccitt (const iovec *iov, int len) -{ - ACE_UINT16 crc = 0xFFFF; - - for (int i = 0; i < len; ++i) - { - for (const char *p = (const char *) iov[i].iov_base, - *e = (const char *) iov[i].iov_base + iov[i].iov_len; - p != e; - ++p) - COMPUTE (crc, *p); - } - - return ~crc; -} - -#undef COMPUTE diff --git a/ace/Makefile.am b/ace/Makefile.am index 995bdca054e..0beb8b6a5c8 100644 --- a/ace/Makefile.am +++ b/ace/Makefile.am @@ -245,8 +245,6 @@ libACE_OS_la_SOURCES = \ libACE_Utils_la_SOURCES = \ ACE.cpp \ - ACE_crc32.cpp \ - ACE_crc_ccitt.cpp \ Active_Map_Manager.cpp \ Arg_Shifter.cpp \ Capabilities.cpp \ diff --git a/ace/OS_NS_sys_socket.inl b/ace/OS_NS_sys_socket.inl index 7773e19a778..3d3f9fbd199 100644 --- a/ace/OS_NS_sys_socket.inl +++ b/ace/OS_NS_sys_socket.inl @@ -532,8 +532,8 @@ ACE_OS::sendmsg (ACE_HANDLE handle, else return (ssize_t) bytes_sent; # elif defined (ACE_HAS_NONCONST_SENDMSG) - ACE_SOCKCALL_RETURN (::sendmsg (handle, - const_cast<struct msghdr *>(msg), + ACE_SOCKCALL_RETURN (::sendmsg (handle, + const_cast<struct msghdr *>(msg), flags), int, -1); # else ACE_SOCKCALL_RETURN (::sendmsg (handle, msg, flags), int, -1); @@ -633,8 +633,8 @@ ACE_OS::sendto (ACE_HANDLE handle, for (int i = 0; i < buffer_count; ++i) { result = ACE_OS::sendto (handle, - reinterpret_cast<char *> ( - buffers[i].iov_base), + reinterpret_cast<char *ACE_CAST_CONST> ( + buffers[i].iov_base), buffers[i].iov_len, flags, addr, diff --git a/ace/ace.mpc b/ace/ace.mpc index 7313b68eca5..58bdf1fece2 100644 --- a/ace/ace.mpc +++ b/ace/ace.mpc @@ -76,8 +76,6 @@ project(ACE) : acedefaults, aceversion, core, qt_reactor, other, codecs, token, Utils { ACE.cpp - ACE_crc32.cpp - ACE_crc_ccitt.cpp Active_Map_Manager.cpp Arg_Shifter.cpp Capabilities.cpp diff --git a/ace/config-linux-common.h b/ace/config-linux-common.h index ac59944272c..604afbb7fea 100644 --- a/ace/config-linux-common.h +++ b/ace/config-linux-common.h @@ -29,12 +29,6 @@ # define ACE_HAS_PTHREADS_UNIX98_EXT #endif /* _XOPEN_SOURCE - 0 >= 500 */ -#if defined (__USE_POSIX199309) -# if !defined (ACE_HAS_CLOCK_GETTIME) -# define ACE_HAS_CLOCK_GETTIME -# endif -#endif - // First the machine specific part #if defined (__alpha) diff --git a/ace/config-lite.h b/ace/config-lite.h index e9c16fc294c..026671f9e84 100644 --- a/ace/config-lite.h +++ b/ace/config-lite.h @@ -352,10 +352,6 @@ // conditional statement. NOTE: that may only be true if -O is enabled, // such as with GreenHills (ghs) 1.8.8. # define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0) -#elif defined (__DMC__) - #define ACE_UNUSED_ID(identifier) - template <class T> - inline void ACE_UNUSED_ARG(const T& ACE_UNUSED_ID(t)) { } #else /* ghs || __GNUC__ || ..... */ # define ACE_UNUSED_ARG(a) (a) #endif /* ghs || __GNUC__ || ..... */ diff --git a/apps/JAWS/clients/Blobby/Blob.cpp b/apps/JAWS/clients/Blobby/Blob.cpp index b29004ae960..7c6d41d4554 100644 --- a/apps/JAWS/clients/Blobby/Blob.cpp +++ b/apps/JAWS/clients/Blobby/Blob.cpp @@ -18,7 +18,7 @@ ACE_Blob::~ACE_Blob (void) // initialize address and filename. No network i/o in open int -ACE_Blob::open (const ACE_TCHAR *filename, const ACE_TCHAR *hostname , u_short port) +ACE_Blob::open (ACE_TCHAR *filename, const ACE_TCHAR *hostname , u_short port) { filename_ = ACE_OS::strdup (filename); inet_addr_.set (port, hostname); diff --git a/apps/JAWS/clients/Blobby/Blob.h b/apps/JAWS/clients/Blobby/Blob.h index 9ba35fb0176..afd880bf46c 100644 --- a/apps/JAWS/clients/Blobby/Blob.h +++ b/apps/JAWS/clients/Blobby/Blob.h @@ -49,8 +49,8 @@ public: ACE_Blob (void); ~ACE_Blob (void); - int open (const ACE_TCHAR *filename, - const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST, + int open (ACE_TCHAR *filename, + const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST , u_short port = 80); // initializes the class with the given filename, hostname and port. // it should be called with the filename, before any read/write calls diff --git a/apps/JAWS/clients/Blobby/Blob_Handler.cpp b/apps/JAWS/clients/Blobby/Blob_Handler.cpp index c2e74f38548..093b5fd42f8 100644 --- a/apps/JAWS/clients/Blobby/Blob_Handler.cpp +++ b/apps/JAWS/clients/Blobby/Blob_Handler.cpp @@ -277,12 +277,11 @@ ACE_Blob_Writer::send_request (void) char *mesg; ACE_NEW_RETURN (mesg, char [mesglen], -1); - // Create the header, store the actual length in mesglen. - // NOTE! %lu is really what's wanted. ACE_SIZE_T_FORMAT_SPECIFIER is - // defined in terms of ACE_LIB_TEXT which is NOT what we want here. - mesglen = ACE_OS::sprintf (mesg, "%s /%s %s %lu\n\n", + // Create the header, store the actual length in mesglen + mesglen = ACE_OS::sprintf (mesg, "%s /%s %s " + ACE_SIZE_T_FORMAT_SPECIFIER"\n\n", request_prefix_, filename_, request_suffix_, - (unsigned long)length_); + length_); // Send the header followed by the data diff --git a/apps/JAWS/clients/Blobby/Options.h b/apps/JAWS/clients/Blobby/Options.h index 8396cf5535b..47c0c852036 100644 --- a/apps/JAWS/clients/Blobby/Options.h +++ b/apps/JAWS/clients/Blobby/Options.h @@ -39,7 +39,7 @@ public: void parse_args (int argc, ACE_TCHAR *argv[]); // parses commandline arguments - ACE_TCHAR *hostname_; + char *hostname_; // Hostname to connect to u_short port_; diff --git a/apps/JAWS/clients/Blobby/blobby.cpp b/apps/JAWS/clients/Blobby/blobby.cpp index e614b049c20..56da1046ff8 100644 --- a/apps/JAWS/clients/Blobby/blobby.cpp +++ b/apps/JAWS/clients/Blobby/blobby.cpp @@ -39,8 +39,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Explain what is going to happen if (options->debug_) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("hostname = %C, port = %d, filename = %s, ") - ACE_TEXT ("length = %d, offset = %d, operation = %c\n"), + "hostname = %s, port = %d, filename = %s, length = %d, offset = %d, operation = %c\n", options->hostname_, options->port_, options->filename_, @@ -57,27 +56,16 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_Message_Block mb (0, options->length_); // Open the blob - if (blob.open (options->filename_, - options->hostname_, - options->port_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("open error")), - -1); + if (blob.open (options->filename_, options->hostname_, options->port_) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open error"), -1); // Read from it if (blob.read (&mb, options->length_, options->offset_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("read error")), - -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "read error"), -1); // Write to STDOUT if (ACE_OS::write (ACE_STDOUT, mb.rd_ptr(), mb.length()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("write error")), - -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write error"), -1); } else { @@ -87,24 +75,15 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Open the file to be sent ACE_HANDLE h = ACE_OS::open (options->filename_, O_RDONLY); if (h == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("file open error")), - -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "file open error"), -1); // Open the blob if (blob.open (options->filename_, options->hostname_, options->port_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("connection open error")), - -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connection open error"), -1); // Read from the file if (ACE_OS::read (h, mb.wr_ptr (), total) != total) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("file read error")), - -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "file read error"), -1); // Close the file ACE_OS::close (h); @@ -114,10 +93,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Write to the blob if (blob.write (&mb, options->length_, options->offset_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("network write error")), - -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "network write error"), -1); } blob.close (); diff --git a/apps/JAWS/clients/Caching/http_client.cpp b/apps/JAWS/clients/Caching/http_client.cpp index 66fb2e09887..558e0ca15ee 100644 --- a/apps/JAWS/clients/Caching/http_client.cpp +++ b/apps/JAWS/clients/Caching/http_client.cpp @@ -58,8 +58,8 @@ main (int, char *[]) while (isspace (*s)); // Shell command. - if (ACE_OS::system (ACE_TEXT_CHAR_TO_TCHAR (s)) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT (" ! Error executing: %C\n"), s)); + if (ACE_OS::system (s) == -1) + ACE_ERROR ((LM_ERROR, " ! Error executing: %s\n", s)); } else if (ACE_OS::strncmp (s, "http://", 7) == 0) { @@ -68,12 +68,12 @@ main (int, char *[]) connector.connect (s); } else - ACE_ERROR ((LM_ERROR, ACE_TEXT (" ? I don't understand: %C\n"), s)); + ACE_ERROR ((LM_ERROR, " ? I don't understand: %s\n", s)); - ACE_ERROR ((LM_ERROR, ACE_TEXT ("* "))); + ACE_ERROR ((LM_ERROR, "* ")); } - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nBye!\n"))); + ACE_DEBUG ((LM_DEBUG, "\nBye!\n")); return 0; } diff --git a/apps/JAWS/clients/Caching/http_handler.cpp b/apps/JAWS/clients/Caching/http_handler.cpp index b205451ec9a..d9f626c4d7f 100644 --- a/apps/JAWS/clients/Caching/http_handler.cpp +++ b/apps/JAWS/clients/Caching/http_handler.cpp @@ -137,7 +137,7 @@ HTTP_Handler::svc (void) && (::sscanf (contentlength, "\nContent-%*[lL]ength: %d ", &this->response_size_) == 1)) { - ACE_Filecache_Handle afh (ACE_TEXT_CHAR_TO_TCHAR (this->filename_), + ACE_Filecache_Handle afh (this->filename_, this->response_size_); this->peer ().recv_n (afh.address (), this->response_size_); @@ -189,7 +189,7 @@ HTTP_Connector::connect (const char * url) HTTP_Handler *hhptr = &hh; // First check the cache. - if (ACE_Filecache::instance ()->find (ACE_TEXT_CHAR_TO_TCHAR (hh.filename ())) == 0) + if (ACE_Filecache::instance ()->find (hh.filename ()) == 0) { ACE_DEBUG ((LM_DEBUG, " ``%s'' is already cached.\n", hh.filename ())); diff --git a/apps/JAWS/server/HTTP_Response.cpp b/apps/JAWS/server/HTTP_Response.cpp index 5f5b036989e..e187ba10934 100644 --- a/apps/JAWS/server/HTTP_Response.cpp +++ b/apps/JAWS/server/HTTP_Response.cpp @@ -203,7 +203,7 @@ HTTP_Response::normal_response (void) char *auth = HTTP_Helper::HTTP_decode_base64 (ACE_OS::strcpy (buf, hvv)); - if (mmapfile.map (ACE_TEXT ("jaws.auth")) != -1 + if (mmapfile.map ("jaws.auth") != -1 && auth != 0 && ACE_OS::strstr((const char *) mmapfile.addr (), auth) != 0) this->io_.receive_file (this->request_.path (), diff --git a/apps/JAWS/server/HTTP_Server.cpp b/apps/JAWS/server/HTTP_Server.cpp index a43575db5e3..99aa97e71ff 100644 --- a/apps/JAWS/server/HTTP_Server.cpp +++ b/apps/JAWS/server/HTTP_Server.cpp @@ -34,12 +34,13 @@ public: }; void -HTTP_Server::parse_args (int argc, ACE_TCHAR *argv[]) +HTTP_Server::parse_args (int argc, + char *argv[]) { int c; int thr_strategy = 0; int io_strategy = 0; - const ACE_TCHAR *prog = argc > 0 ? argv[0] : ACE_TEXT ("HTTP_Server"); + const char *prog = argc > 0 ? argv[0] : "HTTP_Server"; // Set some defaults this->port_ = 0; @@ -47,7 +48,7 @@ HTTP_Server::parse_args (int argc, ACE_TCHAR *argv[]) this->backlog_ = 0; this->throttle_ = 0; - ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("p:n:t:i:b:")); + ACE_Get_Opt get_opt (argc, argv, "p:n:t:i:b:"); while ((c = get_opt ()) != -1) switch (c) @@ -62,36 +63,36 @@ HTTP_Server::parse_args (int argc, ACE_TCHAR *argv[]) // POOL -> thread pool // PER_REQUEST -> thread per request // THROTTLE -> thread per request with throttling - if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("POOL")) == 0) + if (ACE_OS::strcmp (get_opt.opt_arg (), "POOL") == 0) thr_strategy = JAWS::JAWS_POOL; - else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("PER_REQUEST")) == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), "PER_REQUEST") == 0) { thr_strategy = JAWS::JAWS_PER_REQUEST; this->throttle_ = 0; } - else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THROTTLE")) == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), "THROTTLE") == 0) { thr_strategy = JAWS::JAWS_PER_REQUEST; this->throttle_ = 1; } break; case 'f': - if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THR_BOUND")) == 0) + if (ACE_OS::strcmp (get_opt.opt_arg (), "THR_BOUND") == 0) { // What happened here? } - else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THR_DAEMON")) == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), "THR_DAEMON") == 0) { } - else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THR_DETACHED")) == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), "THR_DETACHED") == 0) { } case 'i': // SYNCH -> synchronous I/O // ASYNCH -> asynchronous I/O - if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("SYNCH")) == 0) + if (ACE_OS::strcmp (get_opt.opt_arg (), "SYNCH") == 0) io_strategy = JAWS::JAWS_SYNCH; - else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("ASYNCH")) == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), "ASYNCH") == 0) io_strategy = JAWS::JAWS_ASYNCH; break; case 'b': @@ -114,13 +115,12 @@ HTTP_Server::parse_args (int argc, ACE_TCHAR *argv[]) ACE_UNUSED_ARG (prog); ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("in HTTP_Server::init, %s port = %d, ") - ACE_TEXT ("number of threads = %d\n"), + "in HTTP_Server::init, %s port = %d, number of threads = %d\n", prog, this->port_, this->threads_)); } int -HTTP_Server::init (int argc, ACE_TCHAR *argv[]) +HTTP_Server::init (int argc, char *argv[]) // Document this function { // Ignore signals generated when a connection is broken unexpectedly. @@ -161,8 +161,7 @@ HTTP_Server::synch_thread_pool (void) // Main thread opens the acceptor if (this->acceptor_.open (ACE_INET_Addr (this->port_), 1, PF_INET, this->backlog_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("HTTP_Acceptor::open")), -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "HTTP_Acceptor::open"), -1); // Create a pool of threads to handle incoming connections. Synch_Thread_Pool_Task t (this->acceptor_, this->tm_, this->threads_); @@ -178,8 +177,7 @@ Synch_Thread_Pool_Task::Synch_Thread_Pool_Task (HTTP_Acceptor &acceptor, acceptor_ (acceptor) { if (this->activate (THR_DETACHED | THR_NEW_LWP, threads) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("Synch_Thread_Pool_Task::open"))); + ACE_ERROR ((LM_ERROR, "%p\n", "Synch_Thread_Pool_Task::open")); } int @@ -194,8 +192,7 @@ Synch_Thread_Pool_Task::svc (void) // Lock in this accept. When it returns, we have a connection. if (this->acceptor_.accept (stream) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%p\n"), - ACE_TEXT ("HTTP_Acceptor::accept")), -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "HTTP_Acceptor::accept"), -1); ACE_Message_Block *mb; ACE_NEW_RETURN (mb, @@ -210,7 +207,7 @@ Synch_Thread_Pool_Task::svc (void) mb->release (); ACE_DEBUG ((LM_DEBUG, - ACE_TEXT (" (%t) in Synch_Thread_Pool_Task::svc, recycling\n"))); + " (%t) in Synch_Thread_Pool_Task::svc, recycling\n")); } ACE_NOTREACHED(return 0); @@ -225,8 +222,7 @@ HTTP_Server::thread_per_request (void) // Main thread opens the acceptor if (this->acceptor_.open (ACE_INET_Addr (this->port_), 1, PF_INET, this->backlog_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("HTTP_Acceptor::open")), -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "HTTP_Acceptor::open"), -1); ACE_SOCK_Stream stream; @@ -237,8 +233,7 @@ HTTP_Server::thread_per_request (void) for (;;) { if (this->acceptor_.accept (stream) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("HTTP_Acceptor::accept")), -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "HTTP_Acceptor::accept"), -1); Thread_Per_Request_Task *t; // Pass grp_id as a constructor param instead of into open. @@ -249,8 +244,8 @@ HTTP_Server::thread_per_request (void) if (t->open () != 0) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("Thread_Per_Request_Task::open")), + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", "Thread_Per_Request_Task::open"), -1); // Throttling is not allowing too many threads to run away. @@ -291,8 +286,7 @@ Thread_Per_Request_Task::open (void *) 1, 0, -1, this->grp_id_, 0); if (status == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("Thread_Per_Request_Task::open")), + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Thread_Per_Request_Task::open"), -1); return 0; } @@ -314,7 +308,7 @@ int Thread_Per_Request_Task::close (u_long) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT (" (%t) Thread_Per_Request_Task::svc, dying\n"))); + " (%t) Thread_Per_Request_Task::svc, dying\n")); delete this; return 0; } @@ -348,8 +342,8 @@ HTTP_Server::asynch_thread_pool (void) // asynchronous I/O request to the OS. if (acceptor.open (ACE_INET_Addr (this->port_), HTTP_Handler::MAX_REQUEST_SIZE + 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Asynch_Acceptor::open")), -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", + "ACE_Asynch_Acceptor::open"), -1); // Create the thread pool. // Register threads with the proactor and thread manager. @@ -373,8 +367,7 @@ Asynch_Thread_Pool_Task::Asynch_Thread_Pool_Task (ACE_Proactor &proactor, proactor_ (proactor) { if (this->activate () == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("Asynch_Thread_Pool_Task::open"))); + ACE_ERROR ((LM_ERROR, "%p\n", "Asynch_Thread_Pool_Task::open")); } int @@ -382,8 +375,7 @@ Asynch_Thread_Pool_Task::svc (void) { for (;;) if (this->proactor_.handle_events () == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Proactor::handle_events")), + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Proactor::handle_events"), -1); return 0; @@ -395,7 +387,7 @@ Asynch_Thread_Pool_Task::svc (void) ACE_SVC_FACTORY_DEFINE (HTTP_Server) // Define the object that describes the service. -ACE_STATIC_SVC_DEFINE (HTTP_Server, ACE_TEXT ("HTTP_Server"), ACE_SVC_OBJ_T, +ACE_STATIC_SVC_DEFINE (HTTP_Server, "HTTP_Server", ACE_SVC_OBJ_T, &ACE_SVC_NAME (HTTP_Server), ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 0) diff --git a/apps/JAWS/server/HTTP_Server.h b/apps/JAWS/server/HTTP_Server.h index 8d39e193642..a81f34d244e 100644 --- a/apps/JAWS/server/HTTP_Server.h +++ b/apps/JAWS/server/HTTP_Server.h @@ -54,7 +54,7 @@ class ACE_Svc_Export HTTP_Server : public ACE_Service_Object // = DESCRIPTION { public: - virtual int init (int argc, ACE_TCHAR *argv[]); + virtual int init (int argc, char *argv[]); // Initialization virtual int fini (void); @@ -72,7 +72,7 @@ protected: private: // James, comment these data members. - void parse_args (int argc, ACE_TCHAR **argv); + void parse_args (int argc, char **argv); int port_; int threads_; int strategy_; diff --git a/bin/MakeProjectCreator/config/acedefaults.mpb b/bin/MakeProjectCreator/config/acedefaults.mpb index f6b298b72e1..ff74f4e334e 100644 --- a/bin/MakeProjectCreator/config/acedefaults.mpb +++ b/bin/MakeProjectCreator/config/acedefaults.mpb @@ -13,7 +13,6 @@ project: ace_qt, zzip { } specific(automake) { - includes -= $(ACE_ROOT) - includes += $(top_srcdir) + includes += $(ACE_BUILDDIR) } } diff --git a/bin/MakeProjectCreator/config/acelib.mpb b/bin/MakeProjectCreator/config/acelib.mpb index ddd3b08d63b..cfec24468ca 100644 --- a/bin/MakeProjectCreator/config/acelib.mpb +++ b/bin/MakeProjectCreator/config/acelib.mpb @@ -5,9 +5,4 @@ project: acedefaults, aceversion { after += ACE libs += ACE libout = $(ACE_ROOT)/lib - - specific(automake) { - libout -= $(ACE_ROOT)/lib - libout += $(top_builddir)/lib - } } diff --git a/bin/MakeProjectCreator/config/boost_unit_test.mpb b/bin/MakeProjectCreator/config/boost_unit_test.mpb index 7838b8a1ead..6a6ad345224 100644 --- a/bin/MakeProjectCreator/config/boost_unit_test.mpb +++ b/bin/MakeProjectCreator/config/boost_unit_test.mpb @@ -3,9 +3,5 @@ project { requires += boost - verbatim(gnuace,local) { - CPPFLAGS += $(PLATFORM_BOOST_CPPFLAGS) - LDFLAGS += $(PLATFORM_BOOST_LDFLAGS) - LDLIBS += $(PLATFORM_BOOST_UTF_LIBS) - } + lit_libs += boost_unit_test_framework } diff --git a/include/makeinclude/platform_linux.GNU b/include/makeinclude/platform_linux.GNU index 27548f5aa42..cbc26622554 100644 --- a/include/makeinclude/platform_linux.GNU +++ b/include/makeinclude/platform_linux.GNU @@ -46,10 +46,6 @@ PLATFORM_WX_CPPFLAGS= $(shell wx-config --cxxflags) $(PLATFORM_GTK_CPPFLAGS) PLATFORM_WX_LIBS = $(shell wx-config --libs) $(PLATFORM_GTK_LIBS) PLATFORM_WX_LDFLAGS = $(shell wx-config --ldflags) $(PLATFORM_GTK_LDFLAGS) -PLATFORM_BOOST_CPPFLAGS ?= -PLATFORM_BOOST_LDLAGS ?= -PLATFORM_BOOST_UTF_LIBS ?= -lboost_unit_test_framework - PLATFORM_AIO_SUPPORT := \ $(shell test "`ls -L /usr/lib/librt.so* /lib/librt.so*`" && echo -DACE_HAS_AIO_CALLS) diff --git a/performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp b/performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp index 4b9fa5410d1..9ac4bcd71f7 100644 --- a/performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp +++ b/performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp @@ -365,7 +365,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) test_timer.elapsed_time (elapsed_time); double elapsed_time_per_invocation = - static_cast<double> (elapsed_time / number_of_messages); + ACE_UINT64_DBLCAST_ADAPTER (elapsed_time / number_of_messages); /*ACE_DEBUG ((LM_DEBUG, "(%P|%t) Throughput is [%f] \n", diff --git a/performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Benchmarks_Synch_Lib.mpc b/performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Benchmarks_Synch_Lib.mpc index 34f382f3faa..0cf7df2601e 100644 --- a/performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Benchmarks_Synch_Lib.mpc +++ b/performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Benchmarks_Synch_Lib.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(Synch_Lib) : acelib { +project(Synch_Lib) : aceexe { sharedname = Synch_Lib dynamicflags += SYNCHLIB_BUILD_DLL -} +}
\ No newline at end of file diff --git a/protocols/ace/RMCast/Makefile.am b/protocols/ace/RMCast/Makefile.am deleted file mode 100644 index f874ca9a380..00000000000 --- a/protocols/ace/RMCast/Makefile.am +++ /dev/null @@ -1,108 +0,0 @@ -##---------------------------------------------------------------------------- -## $Id$ -## -## Makefile.am for ACE_RMCast library -##---------------------------------------------------------------------------- - -## -## Process this file with automake to create Makefile.in -## - -AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) - -lib_LTLIBRARIES = libACE_RMCast.la - -## ACE_RMCast library version is same as ACE's version. -libACE_RMCast_la_LDFLAGS = -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ - -libACE_RMCast_la_SOURCES = \ - RMCast.cpp \ - RMCast_Ack_Worker.cpp \ - RMCast_Fork.cpp \ - RMCast_Fragment.cpp \ - RMCast_IO_UDP.cpp \ - RMCast_Membership.cpp \ - RMCast_Module.cpp \ - RMCast_Module_Factory.cpp \ - RMCast_Partial_Message.cpp \ - RMCast_Proxy.cpp \ - RMCast_Reassembly.cpp \ - RMCast_Receiver_Module.cpp \ - RMCast_Reliable_Factory.cpp \ - RMCast_Reordering.cpp \ - RMCast_Resend_Handler.cpp \ - RMCast_Resend_Worker.cpp \ - RMCast_Retransmission.cpp \ - RMCast_Sequencer.cpp \ - RMCast_Singleton_Factory.cpp \ - RMCast_UDP_Event_Handler.cpp \ - RMCast_UDP_Proxy.cpp \ - RMCast_UDP_Reliable_Receiver.cpp \ - RMCast_UDP_Reliable_Sender.cpp - -libACE_RMCast_la_LIBADD = $(top_builddir)/ace/libACE.la - -## These are template source files. -TEMPLATE_FILES = \ - RMCast_Copy_On_Write.cpp \ - RMCast_Worker.cpp - -HEADER_FILES = \ - RMCast.h \ - RMCast_Ack_Worker.h \ - RMCast_Copy_On_Write.h \ - RMCast_Export.h \ - RMCast_Fork.h \ - RMCast_Fragment.h \ - RMCast_IO_UDP.h \ - RMCast_Membership.h \ - RMCast_Module.h \ - RMCast_Module_Factory.h \ - RMCast_Partial_Message.h \ - RMCast_Proxy.h \ - RMCast_Reassembly.h \ - RMCast_Receiver_Module.h \ - RMCast_Reliable_Factory.h \ - RMCast_Reordering.h \ - RMCast_Resend_Handler.h \ - RMCast_Resend_Worker.h \ - RMCast_Retransmission.h \ - RMCast_Sequencer.h \ - RMCast_Singleton_Factory.h \ - RMCast_UDP_Event_Handler.h \ - RMCast_UDP_Proxy.h \ - RMCast_UDP_Reliable_Receiver.h \ - RMCast_UDP_Reliable_Sender.h \ - RMCast_Worker.h - -INLINE_FILES = \ - RMCast.i \ - RMCast_Ack_Worker.i \ - RMCast_Copy_On_Write.i \ - RMCast_Fork.i \ - RMCast_Fragment.i \ - RMCast_IO_UDP.i \ - RMCast_Membership.i \ - RMCast_Module.i \ - RMCast_Module_Factory.i \ - RMCast_Partial_Message.i \ - RMCast_Proxy.i \ - RMCast_Reassembly.i \ - RMCast_Receiver_Module.i \ - RMCast_Reliable_Factory.i \ - RMCast_Reordering.i \ - RMCast_Resend_Handler.i \ - RMCast_Resend_Worker.i \ - RMCast_Retransmission.i \ - RMCast_Sequencer.i \ - RMCast_Singleton_Factory.i \ - RMCast_UDP_Event_Handler.i \ - RMCast_UDP_Proxy.i \ - RMCast_UDP_Reliable_Receiver.i \ - RMCast_UDP_Reliable_Sender.i \ - RMCast_Worker.i - -pkginclude_HEADERS = \ - $(HEADER_FILES) \ - $(INLINE_FILES) \ - $(TEMPLATE_FILES) diff --git a/protocols/ace/RMCast/README b/protocols/ace/RMCast/README deleted file mode 100644 index ed6b22bf1c6..00000000000 --- a/protocols/ace/RMCast/README +++ /dev/null @@ -1,57 +0,0 @@ -# $Id$ - - This directory will contain a simple, small-scale reliable -multicast framework for ACE. The framework is based on the ASX -components of the ACE library: the protocol is implemented as a stack -of interchangeable "modules", each one in charge of a very small task. -For example, one module implements fragmentation and reassembly, other -modules implement retransmission, send ACK and NAK messages, and -maintain receiver membership. - - The modules are replaced to achieve different levels of -reliability. For example, the retransmission module can be either the -"Best_Effort", "Semi_Reliable" or "Reliable" implementation. In the -first case no retransmissions are performed, but lost messages are -detected and reported to the receiver. The "Semi_Reliable" case -messages are held for a pre-specified amount of time, and -re-transmited if requested, but it is possible to loose some messages -if multiple re-transmissions fail. As in the "Best_Effort" case the -lost messages are detected and flagged to the application. Finally -in the "Reliable" mode the senders are flowed controlled until enough -messages are successfully transmitted. - - In general the stack looks like this: - - -SENDER: - ----------------------------------------------------------------- -Buffering : Save lost messages -Retransmission : Retransmit ----------------------------------------------------------------- -Fragmentation : Fragment messages in smaller chunks -Reassembly : and ensure that the IOVMAX limit is not - : reached ----------------------------------------------------------------- -Transport : Encapsulate the specific transport media - : such as TCP/IP, ATM, or shared memory - : Demuxes incoming data to the right chain - : Change control messages and data messages - : to the right dynamic types. ----------------------------------------------------------------- - -RECEIVER: - ----------------------------------------------------------------- -Lost detection : Detect lost messages and send control - : messages back ----------------------------------------------------------------- -Reassembly : Reassemble messages, fragment control -Fragmentation : data ----------------------------------------------------------------- -Transport : Group membership, ACT reception, - : handle keep-alive messages... ----------------------------------------------------------------- - - -@@ TODO: Piggybacking... diff --git a/protocols/ace/RMCast/RMCast_Export.h b/protocols/ace/RMCast/RMCast_Export.h deleted file mode 100644 index 51257c4d682..00000000000 --- a/protocols/ace/RMCast/RMCast_Export.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by -// generate_export_file.pl -// ------------------------------ -#if !defined (ACE_RMCAST_EXPORT_H) -#define ACE_RMCAST_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_RMCAST_HAS_DLL) -# define ACE_RMCAST_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_RMCAST_HAS_DLL */ - -#if !defined (ACE_RMCAST_HAS_DLL) -#define ACE_RMCAST_HAS_DLL 1 -#endif /* ! ACE_RMCAST_HAS_DLL */ - -#if defined (ACE_RMCAST_HAS_DLL) -# if (ACE_RMCAST_HAS_DLL == 1) -# if defined (ACE_RMCAST_BUILD_DLL) -# define ACE_RMCast_Export ACE_Proper_Export_Flag -# define ACE_RMCAST_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_RMCAST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else -# define ACE_RMCast_Export ACE_Proper_Import_Flag -# define ACE_RMCAST_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_RMCAST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_RMCAST_BUILD_DLL */ -# else -# define ACE_RMCast_Export -# define ACE_RMCAST_SINGLETON_DECLARATION(T) -# define ACE_RMCAST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ! ACE_RMCAST_HAS_DLL == 1 */ -#else -# define ACE_RMCast_Export -# define ACE_RMCAST_SINGLETON_DECLARATION(T) -# define ACE_RMCAST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_RMCAST_HAS_DLL */ - -#endif /* ACE_RMCAST_EXPORT_H */ - -// End of auto generated file. diff --git a/protocols/ace/TMCast/Export.hpp b/protocols/ace/TMCast/Export.hpp deleted file mode 100644 index f13a69ecefd..00000000000 --- a/protocols/ace/TMCast/Export.hpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl TMCast -// ------------------------------ -#ifndef TMCAST_EXPORT_H -#define TMCAST_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (TMCAST_HAS_DLL) -# define TMCAST_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && TMCAST_HAS_DLL */ - -#if !defined (TMCAST_HAS_DLL) -#define TMCAST_HAS_DLL 1 -#endif /* ! TMCAST_HAS_DLL */ - -#if defined (TMCAST_HAS_DLL) && (TMCAST_HAS_DLL == 1) -# if defined (TMCAST_BUILD_DLL) -# define TMCast_Export ACE_Proper_Export_Flag -# define TMCAST_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define TMCAST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* TMCAST_BUILD_DLL */ -# define TMCast_Export ACE_Proper_Import_Flag -# define TMCAST_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define TMCAST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* TMCAST_BUILD_DLL */ -#else /* TMCAST_HAS_DLL == 1 */ -# define TMCast_Export -# define TMCAST_SINGLETON_DECLARATION(T) -# define TMCAST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* TMCAST_HAS_DLL == 1 */ - -// Set TMCAST_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (TMCAST_NTRACE) -# if (ACE_NTRACE == 1) -# define TMCAST_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define TMCAST_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !TMCAST_NTRACE */ - -#if (TMCAST_NTRACE == 1) -# define TMCAST_TRACE(X) -#else /* (TMCAST_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define TMCAST_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (TMCAST_NTRACE == 1) */ - -#endif /* TMCAST_EXPORT_H */ - -// End of auto generated file. diff --git a/protocols/ace/TMCast/FaultDetector.hpp b/protocols/ace/TMCast/FaultDetector.hpp deleted file mode 100644 index ba476cbd367..00000000000 --- a/protocols/ace/TMCast/FaultDetector.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// file : TMCast/FaultDetector.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#include "Protocol.hpp" - -namespace TMCast -{ - class FaultDetector - { - public: - FaultDetector () - : silence_period_ (-1) - { - } - - public: - class Failed {}; - - - void - insync () - { - silence_period_ = 0; - } - - void - outsync () - { - if (++silence_period_ >= Protocol::FATAL_SILENCE_FRAME) - { - // cerr << "Silence period has been passed." << endl; - // cerr << "Decalring the node failed." << endl; - throw Failed (); - } - } - - private: - short silence_period_; - }; -} diff --git a/protocols/ace/TMCast/Group.cpp b/protocols/ace/TMCast/Group.cpp deleted file mode 100644 index 6cf8c33e47c..00000000000 --- a/protocols/ace/TMCast/Group.cpp +++ /dev/null @@ -1,502 +0,0 @@ -// file : TMCast/Group.cpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#include "Group.hpp" - -#include <typeinfo> - -// OS primitives -#include <ace/OS.h> -#include <ace/Synch.h> -#include <ace/Time_Value.h> -#include <ace/SOCK_Dgram_Mcast.h> - -#include "Messaging.hpp" - -#include "Protocol.hpp" - -// Components - -#include "LinkListener.hpp" -#include "FaultDetector.hpp" -#include "TransactionController.hpp" - -namespace TMCast -{ - bool - operator== (std::type_info const* pa, std::type_info const& b) - { - return *pa == b; - } - - // - // - // - class Terminate : public virtual Message {}; - - - // - // - // - class Failure : public virtual Message {}; - - - // - // - // - class Scheduler - { - public: - Scheduler (ACE_INET_Addr const& addr, - char const* id, - MessageQueue& out_send_data, - MessageQueue& out_recv_data, - MessageQueue& out_control) - - : cond_ (mutex_), - - addr_ (addr), - sock_ (), - - out_control_ (out_control), - - in_data_ (mutex_), - in_link_data_(mutex_), - in_control_ (mutex_), - - sync_schedule (ACE_OS::gettimeofday ()), - - transaction_controller_ (in_data_, out_send_data, out_recv_data) - { - ACE_OS::strncpy (id_, id, Protocol::MEMBER_ID_LENGTH); - id_[Protocol::MEMBER_ID_LENGTH - 1] = '\0'; - - sock_.set_option (IP_MULTICAST_TTL, 32); // @@ ttl is hardcoded - - in_data_.subscribe (cond_); - in_link_data_.subscribe (cond_); - in_control_.subscribe (cond_); - - if (ACE_OS::thr_create (&thread_thunk, - this, - THR_JOINABLE, - &thread_) != 0) ::abort (); - } - - virtual ~Scheduler () - { - { - MessageQueueAutoLock lock (in_control_); - - in_control_.push (MessagePtr (new Terminate)); - } - - if (ACE_OS::thr_join (thread_, &thread_, 0) != 0) ::abort (); - - // cerr << "Scheduler is down." << endl; - } - - public: - MessageQueue& - in_data () - { - return in_data_; - } - - private: - static ACE_THR_FUNC_RETURN - thread_thunk (void* arg) - { - Scheduler* obj = reinterpret_cast<Scheduler*> (arg); - obj->execute (); - return 0; - } - - void - execute () - { - try - { - sock_.join (addr_); - auto_ptr<LinkListener> ll (new LinkListener (sock_, in_link_data_)); - - { - AutoLock lock (mutex_); - - // Loop - // - // - - while (true) - { - cond_.wait (&sync_schedule); - - // "Loop of Fairness" - - bool done = false; - - do - { - // control message - // - // - if (!in_control_.empty ()) - { - done = true; - break; - } - - // outsync - // - // - if (sync_schedule < ACE_OS::gettimeofday ()) - { - // OUTSYNC - - outsync (); - - // schedule next outsync - sync_schedule = - ACE_OS::gettimeofday () + - ACE_Time_Value (0, Protocol::SYNC_PERIOD); - } - - // link message - // - // - if (!in_link_data_.empty ()) - { - MessagePtr m (in_link_data_.front ()); - in_link_data_.pop (); - - std::type_info const* exp = &typeid (*m); - - if (exp == typeid (LinkFailure)) - { - // cerr << "link failure" << endl; - throw false; - } - else if (exp == typeid (LinkData)) - { - - LinkData* data = dynamic_cast<LinkData*> (m.get ()); - - // INSYNC, TL, CT - - // Filter out loopback. - // - if (ACE_OS::strcmp (data->header().member_id.id, id_) != 0) - { - insync (); - transaction_list (); - current_transaction (data->header().current, - data->payload (), - data->size ()); - } - } - else - { - // cerr << "unknown message type from link listener: " - // << typeid (*m).name () << endl; - abort (); - } - } - - // api message - // - // - if (!in_data_.empty ()) - { - // API - - api (); - } - - } while (!in_link_data_.empty() || - sync_schedule < ACE_OS::gettimeofday ()); - - if (done) break; - } - } - } - catch (...) - { - // cerr << "Exception in scheduler loop." << endl; - MessageQueueAutoLock lock (out_control_); - out_control_.push (MessagePtr (new Failure)); - } - } - - // Events - // - // Order: - // - // INSYNC, TSL, VOTE, BEGIN - // API - // OUTSYNC - // - - void - insync () - { - fault_detector_.insync (); - } - - void - outsync () - { - char buf[Protocol::MAX_MESSAGE_SIZE]; - - Protocol::MessageHeader* hdr = - reinterpret_cast<Protocol::MessageHeader*> (buf); - - void* data = buf + sizeof (Protocol::MessageHeader); - - hdr->length = sizeof (Protocol::MessageHeader); - hdr->check_sum = 0; - - ACE_OS::strcpy (hdr->member_id.id, id_); - - size_t size (0); - - transaction_controller_.outsync (hdr->current, data, size); - - hdr->length += size; - - fault_detector_.outsync (); - - // sock_.send (buf, hdr->length, addr_); - sock_.send (buf, hdr->length); - } - - void - transaction_list () - { - } - - void - current_transaction (Protocol::Transaction const& t, - void const* payload, - size_t size) - { - transaction_controller_.current_transaction (t, payload, size); - } - - void - api () - { - transaction_controller_.api (); - } - - private: - ACE_thread_t thread_; - - ACE_Thread_Mutex mutex_; - ACE_Condition<ACE_Thread_Mutex> cond_; - - typedef ACE_Guard<ACE_Thread_Mutex> AutoLock; - - char id_[Protocol::MEMBER_ID_LENGTH]; - - ACE_INET_Addr addr_; - ACE_SOCK_Dgram_Mcast sock_; - - MessageQueue& out_control_; - - MessageQueue in_data_; - MessageQueue in_link_data_; - MessageQueue in_control_; - - // Protocol state - // - // - - ACE_Time_Value sync_schedule; - - FaultDetector fault_detector_; - TransactionController transaction_controller_; - }; - - - // - // - // - class Group::GroupImpl - { - public: - virtual ~GroupImpl () - { - } - - GroupImpl (ACE_INET_Addr const& addr, char const* id) - throw (Group::Failed) - : send_cond_ (mutex_), - recv_cond_ (mutex_), - failed_ (false), - in_send_data_ (mutex_), - in_recv_data_ (mutex_), - in_control_ (mutex_), - scheduler_ (new Scheduler (addr, - id, - in_send_data_, - in_recv_data_, - in_control_)), - out_data_ (scheduler_->in_data ()) - { - in_send_data_.subscribe (send_cond_); - in_recv_data_.subscribe (recv_cond_); - - in_control_.subscribe (send_cond_); - in_control_.subscribe (recv_cond_); - } - - void - send (void const* msg, size_t size) - throw (Group::InvalidArg, Group::Failed, Group::Aborted) - { - if (size > Protocol::MAX_PAYLOAD_SIZE) throw InvalidArg (); - - // Note the potential deadlock if I lock mutex_ and out_data_ in - // reverse order. - - MessageQueueAutoLock l1 (out_data_); - AutoLock l2 (mutex_); - - throw_if_failed (); - - out_data_.push (MessagePtr (new Send (msg, size))); - - l1.unlock (); // no need to keep it locked - - while (true) - { - throw_if_failed (); - - if (!in_send_data_.empty ()) - { - MessagePtr m (in_send_data_.front ()); - in_send_data_.pop (); - - std::type_info const* exp = &typeid (*m); - - if (exp == typeid (TMCast::Aborted)) - { - throw Group::Aborted (); - } - else if (exp == typeid (Commited)) - { - return; - } - else - { - // cerr << "send: group-scheduler messaging protocol violation; " - // << "unexpected message " << typeid (*m).name () - // << " " << typeid (Aborted).name () << endl; - - abort (); - } - } - - // cerr << "send: waiting on condition" << endl; - send_cond_.wait (); - // cerr << "send: wokeup on condition" << endl; - } - } - - - - size_t - recv (void* msg, size_t size) throw (Group::Failed, Group::InsufficienSpace) - { - AutoLock lock (mutex_); - - while (true) - { - throw_if_failed (); - - if (!in_recv_data_.empty ()) - { - MessagePtr m (in_recv_data_.front ()); - in_recv_data_.pop (); - - std::type_info const* exp = &typeid (*m); - - if (exp == typeid (Recv)) - { - Recv* data = dynamic_cast<Recv*> (m.get ()); - - if (size < data->size ()) throw Group::InsufficienSpace (); - - memcpy (msg, data->payload (), data->size ()); - - return data->size (); - } - else - { - // cerr << "recv: group-scheduler messaging protocol violation. " - // << "unexpected message " << typeid (*m).name () << endl; - - abort (); - } - } - - recv_cond_.wait (); - } - } - - private: - void - throw_if_failed () - { - if (!failed_ && !in_control_.empty ()) failed_ = true; - - if (failed_) throw Group::Failed (); - } - - private: - ACE_Thread_Mutex mutex_; - ACE_Condition<ACE_Thread_Mutex> send_cond_; - ACE_Condition<ACE_Thread_Mutex> recv_cond_; - - typedef ACE_Guard<ACE_Thread_Mutex> AutoLock; - - bool failed_; - - MessageQueue in_send_data_; - MessageQueue in_recv_data_; - MessageQueue in_control_; - - auto_ptr<Scheduler> scheduler_; - - MessageQueue& out_data_; - }; - - - // Group - // - // - Group:: - Group (ACE_INET_Addr const& addr, char const* id) - throw (Group::Failed) - : pimpl_ (new GroupImpl (addr, id)) - { - } - - Group:: - ~Group () - { - } - - void - Group::send (void const* msg, size_t size) throw (Group::InvalidArg, Group::Failed, Group::Aborted) - { - pimpl_->send (msg, size); - } - - size_t - Group::recv (void* msg, size_t size) throw (Group::Failed, Group::InsufficienSpace) - { - return pimpl_->recv (msg, size); - } -} diff --git a/protocols/ace/TMCast/Group.hpp b/protocols/ace/TMCast/Group.hpp deleted file mode 100644 index 416cea0a17d..00000000000 --- a/protocols/ace/TMCast/Group.hpp +++ /dev/null @@ -1,51 +0,0 @@ -// file : TMCast/Group.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef TMCAST_GROUP_HPP -#define TMCAST_GROUP_HPP - -#include <ace/Auto_Ptr.h> -#include <ace/INET_Addr.h> - -#include "Export.hpp" - -namespace TMCast -{ - class TMCast_Export Group - { - public: - class Aborted {}; - class Failed {}; - class InvalidArg {}; - class InsufficienSpace {}; - - public: - ~Group (); - - Group (ACE_INET_Addr const& addr, char const* id) throw (Failed); - - public: - void - send (void const* msg, size_t size) throw (InvalidArg, Failed, Aborted); - - size_t - recv (void* msg, size_t size) throw (Failed, InsufficienSpace); - - private: - bool - failed (); - - private: - class GroupImpl; - auto_ptr<GroupImpl> pimpl_; - - private: - Group (Group const&); - - Group& - operator= (Group const&); - }; -} - -#endif // TMCAST_GROUP_HPP diff --git a/protocols/ace/TMCast/GroupFwd.hpp b/protocols/ace/TMCast/GroupFwd.hpp deleted file mode 100644 index beba06df79d..00000000000 --- a/protocols/ace/TMCast/GroupFwd.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// file : TMCast/GroupFwd.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef TMCAST_GROUP_FWD_HPP -#define TMCAST_GROUP_FWD_HPP - -#include "Export.hpp" - -namespace TMCast -{ - class TMCast_Export Group; -} - -#endif // TMCAST_GROUP_FWD_HPP diff --git a/protocols/ace/TMCast/LinkListener.hpp b/protocols/ace/TMCast/LinkListener.hpp deleted file mode 100644 index cbb7fd1d5ce..00000000000 --- a/protocols/ace/TMCast/LinkListener.hpp +++ /dev/null @@ -1,166 +0,0 @@ -// file : TMCast/LinkListener.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -// OS primitives -#include <ace/Synch.h> -#include <ace/SOCK_Dgram_Mcast.h> -#include <ace/Refcounted_Auto_Ptr.h> - - -#include "Messaging.hpp" - -namespace TMCast -{ - // - // - // - class LinkFailure : public virtual Message {}; - - - // - // - // - class LinkData : public virtual Message - { - public: - LinkData (Protocol::MessageHeader const* header, - void* payload, - size_t size) - : size_ (size) - { - ACE_OS::memcpy (&header_, header, sizeof (Protocol::MessageHeader)); - ACE_OS::memcpy (payload_, payload, size_); - } - - Protocol::MessageHeader const& - header () const - { - return header_; - } - - void const* - payload () const - { - return payload_; - } - - size_t - size () const - { - return size_; - } - - private: - Protocol::MessageHeader header_; - char payload_[Protocol::MAX_MESSAGE_SIZE]; - size_t size_; - }; - - typedef - ACE_Refcounted_Auto_Ptr<LinkData, ACE_Null_Mutex> - LinkDataPtr; - - // - // - // - class LinkListener - { - private: - class Terminate : public virtual Message {}; - - public: - LinkListener (ACE_SOCK_Dgram_Mcast& sock, MessageQueue& out) - : sock_(sock), out_ (out) - { - if (ACE_OS::thr_create (&thread_thunk, - this, - THR_JOINABLE, - &thread_) != 0) ::abort (); - } - - ~LinkListener () - { - { - MessageQueueAutoLock lock (control_); - - control_.push (MessagePtr (new Terminate)); - } - - if (ACE_OS::thr_join (thread_, &thread_, 0) != 0) ::abort (); - - // cerr << "Link listener is down." << endl; - } - - - static ACE_THR_FUNC_RETURN - thread_thunk (void* arg) - { - LinkListener* obj = reinterpret_cast<LinkListener*> (arg); - - obj->execute (); - return 0; - } - - void - execute () - { - char msg[Protocol::MAX_MESSAGE_SIZE]; - - ssize_t header_size = sizeof (Protocol::MessageHeader); - - // OS::Time timeout (1000000); // one millisecond - - ACE_Time_Value timeout (0, 1000); // one millisecond - - try - { - while (true) - { - // Check control message queue - - { - MessageQueueAutoLock lock (control_); - - if (!control_.empty ()) break; - } - - ACE_INET_Addr junk; - ssize_t n = sock_.recv (msg, - Protocol::MAX_MESSAGE_SIZE, - junk, - 0, - &timeout); - - if (n != -1) - { - if (n < header_size) throw false; - - Protocol::MessageHeader* header = - reinterpret_cast<Protocol::MessageHeader*> (msg); - - MessageQueueAutoLock lock (out_); - - out_.push (MessagePtr (new LinkData (header, - msg + header_size, - n - header_size))); - } - } - } - catch (...) - { - MessageQueueAutoLock lock (out_); - - out_.push (MessagePtr (new LinkFailure)); - } - } - - private: - typedef ACE_Guard<ACE_Thread_Mutex> AutoLock; - - ACE_thread_t thread_; - ACE_SOCK_Dgram_Mcast& sock_; - MessageQueue& out_; - MessageQueue control_; - }; -} diff --git a/protocols/ace/TMCast/MTQueue.hpp b/protocols/ace/TMCast/MTQueue.hpp deleted file mode 100644 index 429a73d45ba..00000000000 --- a/protocols/ace/TMCast/MTQueue.hpp +++ /dev/null @@ -1,176 +0,0 @@ -// file : TMCast/MTQueue.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef TMCAST_MT_QUEUE_HPP -#define TMCAST_MT_QUEUE_HPP - -#include "ace/Auto_Ptr.h" -#include "ace/Unbounded_Set.h" -#include "ace/Unbounded_Queue.h" -#include "ace/os_include/sys/os_types.h" - -namespace TMCast -{ - template <typename T, - typename M, - typename C, - typename Q = ACE_Unbounded_Queue<T> > - class MTQueue - { - public: - typedef T ElementType; - typedef M MutexType; - typedef C ConditionalType; - typedef Q QueueType; - - public: - - MTQueue () - : mutexp_ (new MutexType), - mutex_ (*mutexp_), - queue_ (), - signal_ (false) - { - } - - MTQueue (MutexType& mutex) - : mutexp_ (), - mutex_ (mutex), - queue_ (), - signal_ (false) - { - } - - public: - bool - empty () const - { - return queue_.is_empty (); - } - - size_t - size () const - { - return queue_.size (); - } - - // typedef typename QueueType::Empty Empty; - - class Empty {}; - - T& - front () - { - ACE_Unbounded_Queue_Iterator<T> f (queue_); - T* tmp; - if (!f.next (tmp)) throw Empty (); - - return *tmp; - } - - - T const& - front () const - { - ACE_Unbounded_Queue_Const_Iterator<T> f (queue_); - T* tmp; - if (!f.next (tmp)) throw Empty (); - - return *tmp; - } - - /* - T& - back () - { - return queue_.back (); - } - - - T const& - back () const - { - return queue_.back (); - } - */ - - void - push (T const& t) - { - signal_ = empty (); - queue_.enqueue_tail (t); - } - - void - pop () - { - T junk; - queue_.dequeue_head (junk); - } - - public: - void - lock () const - { - mutex_.acquire (); - } - - void - unlock () const - { - if (signal_) - { - signal_ = false; - - for (ConditionalSetConstIterator_ i (cond_set_); - !i.done (); - i.advance ()) - { - ConditionalType** c; - - i.next (c); - - (*c)->signal (); - } - } - - mutex_.release (); - } - - void - subscribe (ConditionalType& c) - { - //@@ should check for duplicates - // - cond_set_.insert (&c); - } - - void - unsubscribe (ConditionalType& c) - { - //@@ should check for absence - // - cond_set_.remove (&c); - } - - private: - auto_ptr<MutexType> mutexp_; - MutexType& mutex_; - QueueType queue_; - - typedef - ACE_Unbounded_Set<ConditionalType*> - ConditionalSet_; - - typedef - ACE_Unbounded_Set_Const_Iterator<ConditionalType*> - ConditionalSetConstIterator_; - - ConditionalSet_ cond_set_; - - mutable bool signal_; - }; -} - -#endif // TMCAST_MT_QUEUE_HPP diff --git a/protocols/ace/TMCast/Messaging.hpp b/protocols/ace/TMCast/Messaging.hpp deleted file mode 100644 index 6a1000c3265..00000000000 --- a/protocols/ace/TMCast/Messaging.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// file : TMCast/Messaging.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef TMCAST_MESSAGING_HPP -#define TMCAST_MESSAGING_HPP - -#include <ace/Synch.h> -#include <ace/Refcounted_Auto_Ptr.h> - -#include "MTQueue.hpp" - -namespace TMCast -{ - class Message - { - public: - virtual - ~Message () {} - }; - - typedef - ACE_Refcounted_Auto_Ptr<Message, ACE_Null_Mutex> - MessagePtr; - - typedef - MTQueue<MessagePtr, ACE_Thread_Mutex, ACE_Condition<ACE_Thread_Mutex> > - MessageQueue; - - struct MessageQueueAutoLock - { - MessageQueueAutoLock (MessageQueue& q) - : q_ (q) - { - q_.lock (); - } - - void - unlock () - { - q_.unlock (); - } - - ~MessageQueueAutoLock () - { - q_.unlock (); - } - - private: - MessageQueue& q_; - }; -} - -#endif // TMCAST_MESSAGING_HPP diff --git a/protocols/ace/TMCast/Protocol.cpp b/protocols/ace/TMCast/Protocol.cpp deleted file mode 100644 index 9d57a97f221..00000000000 --- a/protocols/ace/TMCast/Protocol.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// file : TMCast/Protocol.cpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#include "Protocol.hpp" - -namespace TMCast -{ - namespace Protocol - { - /* - namespace - { - char const* labels[] = { - "NONE", "BEGIN", "COMMIT", "ABORT", "COMMITED", "ABORTED"}; - } - - std::string - tslabel (Protocol::TransactionStatus s) - { - return labels[s]; - } - - std::ostream& - operator << (std::ostream& o, Transaction const& t) - { - return o << "{" << t.id << "; " << tslabel (t.status) << "}"; - } - */ - } -} diff --git a/protocols/ace/TMCast/Protocol.hpp b/protocols/ace/TMCast/Protocol.hpp deleted file mode 100644 index d5ae6a50cd6..00000000000 --- a/protocols/ace/TMCast/Protocol.hpp +++ /dev/null @@ -1,107 +0,0 @@ -// file : TMCast/Protocol.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#ifndef TMCAST_PROTOCOL_HPP -#define TMCAST_PROTOCOL_HPP - -namespace TMCast -{ - namespace Protocol - { - // - // - // - unsigned long const MEMBER_ID_LENGTH = 38; - - struct MemberId - { - char id[MEMBER_ID_LENGTH]; - /* - unsigned long ip; - unsigned short port; - */ - }; - - // - // - // - typedef unsigned short TransactionId; - - - - typedef unsigned char TransactionStatus; - - TransactionStatus const TS_BEGIN = 1; - TransactionStatus const TS_COMMIT = 2; - TransactionStatus const TS_ABORT = 3; - TransactionStatus const TS_COMMITED = 4; - TransactionStatus const TS_ABORTED = 5; - - struct Transaction - { - TransactionId id; - TransactionStatus status; - }; - - // Transaction List (TL) - - // unsigned long const TL_LENGTH = 1; - - // typedef Transaction TransactionList[TL_LENGTH]; - - - // - // - // - struct MessageHeader - { - unsigned long length; - - unsigned long check_sum; - - MemberId member_id; - - Transaction current; - - //TransactionList transaction_list; - }; - - - // - // - // - - unsigned long const MAX_MESSAGE_SIZE = 768; - - unsigned long const - MAX_PAYLOAD_SIZE = MAX_MESSAGE_SIZE - sizeof (MessageHeader); - - // Protocol timing - // - // - - unsigned long const SYNC_PERIOD = 30000; // in mks - - unsigned short const VOTING_FRAME = 4; // in SYNC_PERIOD's - unsigned short const SEPARATION_FRAME = 5; // in SYNC_PERIOD's - - // FATAL_SILENCE_FRAME in SYNC_PERIOD's - // Generally it's a good idea to set it to < VOTING_FRAME + SEPARATION_FRAME - // - - short const FATAL_SILENCE_FRAME = VOTING_FRAME + SEPARATION_FRAME - 2; - - // short const FATAL_SILENCE_FRAME = 10000; - - // Helpers - - // std::string - // tslabel (Protocol::TransactionStatus s); - - // std::ostream& - // operator << (std::ostream& o, Transaction const& t); - } -} - -#endif // TMCAST_PROTOCOL_HPP diff --git a/protocols/ace/TMCast/README b/protocols/ace/TMCast/README deleted file mode 100644 index 9600b17fe2c..00000000000 --- a/protocols/ace/TMCast/README +++ /dev/null @@ -1,240 +0,0 @@ - - -Introduction ------------- - -TMCast (stands for Transaction MultiCast) is an implementation of a -transactional multicast protocol. In essence, the idea is to represent -each message delivery to members of a multicast group as a transaction -- an atomic, consistent and isolated action. A multicast transaction -can be viewed as an atomic transition of the group members to a new -state. If we define [Mo] as a set of operational (non-faulty) members -of the group, [Mf] as a set of faulty members of the group, [Ma] as a -set of members that view transition [Tn] as aborted and [Mc] as a set -of members that view transition [Tn] as committed, then this atomic -transition [Tn] should satisfy one of the following equations: - -Mo(Tn-1) = Ma(T) U Mf(T) -Mo(Tn-1) = Mc(T) U Mf(T) - -Or, in other words, after transaction T has been committed (aborted), -all operational (before transaction T) members are either in the -committed (aborted) or failed state. - -Thus, for each member of the group, outcome of the transaction can be -commit, abort or a member failure. It is important for a member to -exhibit a failfast (error latency is less than transaction cycle) -behavior. Or, in other words, if a member transitioned into a wrong -state, it is guaranteed to fail instead of delivering a wrong result. - -In order to achieve such an error detection in a decentralized -environment, certain limitations were imposed. One of the most -user-visible limitation is the fact that the lifetime of the group -with only one member is very short. This is because there is not way -for a member to distinguish "no members yet" case from "my link to the -group is down". In such a situation, the member assumes the latter -case. There is also a military saying that puts it quite nicely: two -is one, one is nothing. - - - -State of Implementation ------------------------ - -The current implementation is in a prototypical stage. The following -parts are not implemented or still under development: - -* Handling of network partitioning (TODO) - -* Redundant network support (TODO) - -* Member failure detection (partial implementation) - - -Examples --------- - -There is a simple example available in examples/TMCast/Member with -the corresponding README. - - -Architecture ------------- - -Primary goals of the protocol are to (1) mask transient failures of the -underlying multicast protocol (or, more precisely, allow to recover -from transient failures) and (2) exhibit failfast behavior in cases of -permanent failures. - -The distinction between transient and permanent failures is based on -timeouts thus what can be a transient failure in one configuration of -the protocol could be a permanent failure in the other. - -[Maybe talk more about a transient/permanent threshold and its effect -on performance/resource utilization/etc.] - -[Maybe add a terminology section.] - -Each member of a multicast group has its unique (group-wise) id: - -struct MemberId -{ - char id[MEMBER_ID_LENGTH]; -}; - -Each payload delivery is part of a transaction. Each transaction is -identified by TransactionId: - -typedef unsigned short TransactionId; - - -Each transaction has a status code which identifies its state, as viewed by -a group member: - - -typedef unsigned char TransactionStatus; - -TransactionStatus const TS_BEGIN = 1; -TransactionStatus const TS_COMMIT = 2; -TransactionStatus const TS_ABORT = 3; -TransactionStatus const TS_COMMITTED = 4; -TransactionStatus const TS_ABORTED = 5; - -Thus each transaction is described by its id and status: - -struct Transaction -{ - TransactionId id; - TransactionStatus status; -}; - -The outcome of some predefined number of recent transactions is stored -in TransactionList: - -typedef Transaction TransactionList[TL_LENGTH]; - - -Each message sent to a multicast group has the following header: - -struct MessageHeader -{ - unsigned long length; - unsigned long check_sum; - MemberId member_id; - Transaction current; - TransactionList transaction_list; -}; - -[Maybe describe each field here.] - -A new member joins the group with transaction id 0 and status -TS_COMMITTED. - -Each member sends a periodic 'pulse' messages with some predefined interval -advertising its current view of the group. This includes the state of the -current transaction and the history of the recent transactions. - - -If a member of the group needs a payload delivery it starts a new -transaction by sending a message with current transaction set to - -{++current_id, TS_BEGIN} - -and payload appended after the header. - - -Each member joins a transaction in one of the following ways: - -* A member that began the transaction joins it 'to commit' (TS_COMMIT) - -* A member that received TS_BEGIN joins current transaction 'to commit' - (TS_COMMIT). - -* A member that received TS_COMMIT or TS_ABORT but did not receive TS_BEGIN - joins current transaction 'to abort' (TS_ABORT). - - -After a member has joined the transaction it starts participating in the -transaction's voting phase. On this phase members of the group decide the -fate of the transaction. Each member sends a predefined number of messages -where it announces its vote. In between those messages the member is receiving -and processing votes from other members and can be influenced by their -'opinion'. - -In their decision-making, members follow the principle of the majority. As -the voting progresses (and comes close to an end) members become more and -more reluctant to deviate from the decision of the majority. - -[Maybe add an equation that measures member's willingness to change -its mind.] - -At the end of the voting phase each member declares the current transaction -either committed (TS_COMMITTED) or aborted (TS_ABORTED). If this decision does -not agree with the majority the member declares itself failed. - -In addition, each member builds a 'majority view' of the transaction history -(based on transaction_list). If it deviates from the member's own history the -member declares itself failed. - -Here are some example scenarios of how the protocol behaves in different -situations. Let's say we have three members of the group S, R1, R2. S -initiates a transaction. R1 and R2 join it. - -Scenario 1. (two-step voting) - -1. S initiates a transaction (TS_BEGIN) -2a. R1 receives TS_BEGIN, joins for commit -2b. R2 receives TS_BEGIN, joins for commit -3a. S announces TS_COMMIT (first vote) -3b. R1 announces TS_COMMIT (first vote) -3c. R2 announces TS_COMMIT (first vote) -4a. S announces TS_COMMIT (second vote) -4b. R1 announces TS_COMMIT (second vote) -4c. R2 announces TS_COMMIT (second vote) -5a. S announces TS_COMMITTED (end of vote) -5b. R1 announces TS_COMMITTED (end of vote) -5c. R2 announces TS_COMMITTED (end of vote) - - -Scenario 2. (two-step voting) - -1. S initiates a transaction (TS_BEGIN) -2a. R1 receives TS_BEGIN, joins for commit -2b. R2 didn't receive TS_BEGIN -3a. S announces TS_COMMIT (first vote) -3b. R1 announces TS_COMMIT (first vote) -3c. R2 received R1's TS_COMMIT announces TS_ABORT (first vote) -4a. S received R2's TS_ABORT announces TS_ABORT (second vote) -4b. R1 received R2's TS_ABORT announces TS_ABORT (second vote) -4c. R2 announces TS_ABORT (second vote) -5a. S announces TS_ABORTED (end of vote) -5b. R1 announces TS_ABORTED (end of vote) -5c. R2 announces TS_ABORTED (end of vote) - - -Scenario 3. (three-step voting) - -1. S initiates a transaction (TS_BEGIN) -2a. R1 receives TS_BEGIN, joins for commit -2b. R2 didn't receive TS_BEGIN -3a. S announces TS_COMMIT (first vote) -3b. R1 announces TS_COMMIT (first vote) -3c. R2 still didn't receive anything -4a. S announces TS_COMMIT (second vote) -4b. R1 announces TS_COMMIT (second vote) -4c. R2 received R1's TS_COMMIT, announces TS_ABORT (first vote) - -5a. S received R2's TS_ABORT but it is the end of the voting phase and - majority (S and R1) vote for commit, announces TS_COMMIT (third vote) -5b. R1 received R2's TS_ABORT but it is the end of the voting phase and - majority (S and R1) vote for commit, announces TS_COMMIT (third vote) -5c. R2 announces TS_ABORT (second vote) - -6a. S announces TS_COMMITTED (end of vote) -6b. R1 announces TS_COMMITTED (end of vote) -6c. R2 discovers that the the majority has declared current transaction - committed and thus declares itself failed. - - --- -Boris Kolpackov <boris@dre.vanderbilt.edu> diff --git a/protocols/ace/TMCast/TMCast.mpc b/protocols/ace/TMCast/TMCast.mpc deleted file mode 100644 index 7826b439836..00000000000 --- a/protocols/ace/TMCast/TMCast.mpc +++ /dev/null @@ -1,8 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project : acelib, core { - requires += exceptions threads - sharedname = TMCast - dynamicflags += TMCAST_BUILD_DLL -} diff --git a/protocols/ace/TMCast/TransactionController.hpp b/protocols/ace/TMCast/TransactionController.hpp deleted file mode 100644 index f1108963ffa..00000000000 --- a/protocols/ace/TMCast/TransactionController.hpp +++ /dev/null @@ -1,387 +0,0 @@ -// file : TMCast/TransactionController.hpp -// author : Boris Kolpackov <boris@dre.vanderbilt.edu> -// cvs-id : $Id$ - -#include "ace/OS_NS_string.h" -#include "ace/Synch.h" -#include "ace/Refcounted_Auto_Ptr.h" - -#include "Protocol.hpp" -#include "Messaging.hpp" - -#include <typeinfo> - -namespace TMCast -{ - - // Messages - // - // - class Send : public virtual Message - { - public: - Send (void const* msg, size_t size) - : size_ (size) - { - ACE_OS::memcpy (payload_, msg, size_); - } - - void const* - payload () const - { - return payload_; - } - - size_t - size () const - { - return size_; - } - - private: - size_t size_; - char payload_[Protocol::MAX_PAYLOAD_SIZE]; - }; - - typedef - ACE_Refcounted_Auto_Ptr<Send, ACE_Null_Mutex> - SendPtr; - - - class Recv : public virtual Message - { - public: - Recv (void const* msg, size_t size) - : size_ (size) - { - ACE_OS::memcpy (payload_, msg, size_); - } - - void const* - payload () const - { - return payload_; - } - - size_t - size () const - { - return size_; - } - - private: - size_t size_; - char payload_[Protocol::MAX_PAYLOAD_SIZE]; - }; - - typedef - ACE_Refcounted_Auto_Ptr<Recv, ACE_Null_Mutex> - RecvPtr; - - class Aborted : public virtual Message {}; - - class Commited : public virtual Message {}; - - - // - // - // - class TransactionController - { - public: - TransactionController (MessageQueue& in, - MessageQueue& send_out, - MessageQueue& recv_out) - : trace_ (false), - voting_duration_ (0), - separation_duration_ (0), - in_ (in), - send_out_ (send_out), - recv_out_ (recv_out) - { - current_.id = 0; - current_.status = Protocol::TS_COMMITED; - } - - public: - class Failure {}; - - - void - outsync (Protocol::Transaction& c, void* payload, size_t& size) - { - if (current_.status == Protocol::TS_COMMIT || - current_.status == Protocol::TS_ABORT) - { - if (++voting_duration_ >= Protocol::VOTING_FRAME) - { - // end of voting frame - - if (current_.status == Protocol::TS_COMMIT) - { - { - if (initiated_) - { - MessageQueueAutoLock lock (send_out_); - send_out_.push (MessagePtr (new Commited)); - } - else // joined transaction - { - MessageQueueAutoLock lock (recv_out_); - recv_out_.push (MessagePtr (recv_.release ())); - recv_ = RecvPtr (); - } - } - - current_.status = Protocol::TS_COMMITED; - - // if (trace_) cerr << "commited transaction with id " - // << current_.id << endl; - } - else // TS_ABORT - { - if (initiated_) - { - MessageQueueAutoLock lock (send_out_); - send_out_.push (MessagePtr (new Aborted)); - } - else - { - // free revc_ buffer if necessary - // - if (recv_.get ()) recv_ = RecvPtr (); - } - - - current_.status = Protocol::TS_ABORTED; - - // if (trace_) cerr << "aborted transaction with id " - // << current_.id << endl; - } - - // start transaction separation frame (counts down) - // +1 because it will be decremented on this iteration - separation_duration_ = Protocol::SEPARATION_FRAME + 1; - } - } - - // Set current outsync info - - c.id = current_.id; - c.status = current_.status; - - - // Do some post-processing - - switch (current_.status) - { - case Protocol::TS_COMMITED: - case Protocol::TS_ABORTED: - { - if (separation_duration_ > 0) --separation_duration_; - break; - } - case Protocol::TS_BEGIN: - { - // transfer payload - - size = send_->size (); - memcpy (payload, send_->payload (), size); - - send_ = SendPtr (); - - // get redy to vote for 'commit' - - current_.status = Protocol::TS_COMMIT; - voting_duration_ = 0; - } - } - } - - void - current_transaction (Protocol::Transaction const& t, - void const* payload, - size_t size) - { - Protocol::TransactionId& id = current_.id; - Protocol::TransactionStatus& s = current_.status; - - if (id == 0 && t.id != 0) // catch up - { - switch (t.status) - { - case Protocol::TS_BEGIN: - case Protocol::TS_COMMIT: - case Protocol::TS_ABORT: - { - id = t.id - 1; - s = Protocol::TS_COMMITED; - break; - } - case Protocol::TS_ABORTED: - case Protocol::TS_COMMITED: - { - id = t.id; - s = t.status; - break; - } - } - - // if (trace_) cerr << "caught up with id " << id << endl; - } - - bool stable (s == Protocol::TS_COMMITED || s == Protocol::TS_ABORTED); - - switch (t.status) - { - case Protocol::TS_BEGIN: - { - if (!stable || t.id != id + 1) - { - // Transaction is in progress or hole in transaction id's - - // cerr << "unexpected request to join " << t - // << " while on " << current_ << endl; - - // if (!stable) cerr << "voting progress is " << voting_duration_ - // << "/" << Protocol::VOTING_FRAME << endl; - - if (t.id == id) // collision - { - if (!stable && s != Protocol::TS_ABORT) - { - // abort both - // cerr << "aborting both transactions" << endl; - - s = Protocol::TS_ABORT; - voting_duration_ = 0; //@@ reset voting frame - } - } - else - { - // @@ delicate case. need to think more - - // cerr << "Declaring node failed." << endl; - throw Failure (); - } - } - else - { - // join the transaction - - initiated_ = false; - - recv_ = RecvPtr (new Recv (payload, size)); - - id = t.id; - s = Protocol::TS_COMMIT; - voting_duration_ = 0; - - // if (trace_) cerr << "joining-for-commit transaction with id " - // << id << endl; - } - break; - } - case Protocol::TS_COMMIT: - { - if (stable && id == t.id - 1) - { - // not begin and and we haven't joined - - // join for abort - - initiated_ = false; - - current_.id = t.id; - current_.status = Protocol::TS_ABORT; - voting_duration_ = 0; - - // if (trace_) cerr << "joining-for-abort transaction with id " - // << current_.id << endl; - } - break; - } - case Protocol::TS_ABORT: - { - if ((!stable && id == t.id && s == Protocol::TS_COMMIT) || - (stable && id == t.id - 1)) // abort current || new transaction - { - // if (trace_) cerr << "voting-for-abort on transaction with id " - // << current_.id << endl; - - id = t.id; - s = Protocol::TS_ABORT; - - voting_duration_ = 0; //@@ reseting voting_duration_ - } - else - { - } - - break; - } - case Protocol::TS_ABORTED: - case Protocol::TS_COMMITED: - { - // nothing for now - break; - } - } - } - - void - api () - { - if ((current_.status == Protocol::TS_COMMITED || - current_.status == Protocol::TS_ABORTED) && - separation_duration_ == 0) // no transaction in progress - { - // start new transaction - - // Note that in_ is already locked by Scheduler - - MessagePtr m (in_.front ()); - in_.pop (); - - if (typeid (*m) == typeid (Send)) - { - send_ = SendPtr (dynamic_cast<Send*> (m.release ())); - } - else - { - // cerr << "Expecting Send but received " << typeid (*m).name () - // << endl; - - ::abort (); - } - - current_.id++; - current_.status = Protocol::TS_BEGIN; - - initiated_ = true; - - // if (trace_) cerr << "starting transaction with id " << current_.id - // << endl; - } - } - - private: - typedef ACE_Guard<ACE_Thread_Mutex> AutoLock; - - bool trace_; - - Protocol::Transaction current_; - - bool initiated_; - - unsigned short voting_duration_; - unsigned short separation_duration_; - - MessageQueue& in_; - MessageQueue& send_out_; - MessageQueue& recv_out_; - - SendPtr send_; - RecvPtr recv_; - }; -} |