From e0f62564ab63e394adc387c1c29556d3ec4ffe89 Mon Sep 17 00:00:00 2001 From: nobody Date: Thu, 9 Mar 2000 01:59:28 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'ini_non_interpretive'. --- STL/ACE_Changes | 53 -- STL/readme2.stl | 272 ---------- TAO/orbsvcs/orbsvcs/AVStreams_Full.idl | 252 --------- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp | 377 ------------- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h | 95 ---- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.i | 2 - TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp | 519 ------------------ TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.h | 176 ------ TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.i | 14 - TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp | 556 ------------------- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h | 200 ------- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp | 169 ------ TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.h | 68 --- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp | 135 ----- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h | 107 ---- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.i | 14 - TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp | 428 --------------- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h | 167 ------ ace/SSL/SSL_Context.cpp | 245 --------- ace/SSL/SSL_Context.h | 187 ------- ace/SSL/SSL_Context.i | 87 --- ace/SSL/SSL_Context.inl | 87 --- ace/SSL/SSL_SOCK_Acceptor.cpp | 254 --------- ace/SSL/SSL_SOCK_Acceptor.h | 156 ------ ace/SSL/SSL_SOCK_Acceptor.i | 113 ---- ace/SSL/SSL_SOCK_Connector.cpp | 318 ----------- ace/SSL/SSL_SOCK_Connector.h | 195 ------- ace/SSL/SSL_SOCK_Connector.i | 33 -- ace/SSL/SSL_SOCK_Stream.cpp | 545 ------------------- ace/SSL/SSL_SOCK_Stream.h | 263 --------- ace/SSL/SSL_SOCK_Stream.i | 238 --------- ace/SSL/sslconf.h | 25 - ace/Timer_Queue.i | 22 - apps/Gateway/Gateway/Concurrency_Strategies.h | 74 --- apps/Gateway/Gateway/Peer_Message.h | 89 --- examples/IPC_SAP/SSL_SAP/Makefile | 595 --------------------- examples/IPC_SAP/SSL_SAP/README | 17 - examples/IPC_SAP/SSL_SAP/SSL-client-simple.cpp | 376 ------------- examples/IPC_SAP/SSL_SAP/SSL-client-simple.h | 98 ---- examples/IPC_SAP/SSL_SAP/SSL-client.cpp | 413 -------------- examples/IPC_SAP/SSL_SAP/SSL-client.h | 110 ---- examples/IPC_SAP/SSL_SAP/SSL-server-fancy.cpp | 585 -------------------- examples/IPC_SAP/SSL_SAP/SSL-server-fancy.h | 44 -- examples/IPC_SAP/SSL_SAP/SSL-server-poll.cpp | 202 ------- examples/IPC_SAP/SSL_SAP/SSL-server-simple.cpp | 365 ------------- examples/IPC_SAP/SSL_SAP/SSL-server.cpp | 389 -------------- examples/IPC_SAP/SSL_SAP/dummy.pem | 19 - examples/IPC_SAP/SSL_SAP/key.pem | 9 - examples/IPC_SAP/SSL_SAP/local_data | 1 - examples/IPC_SAP/SSL_SAP/summarize | 45 -- examples/Reactor/Misc/signal_tester.cpp | 221 -------- examples/Reactor/Misc/test_signals.cpp | 226 -------- .../SV_Semaphores/Semaphore_Client.cpp | 31 -- .../SV_Semaphores/Semaphore_Server.cpp | 42 -- .../System_V_IPC/SV_Semaphores/Semaphore_Test.h | 11 - examples/System_V_IPC/SV_Semaphores/Semaphores.cpp | 94 ---- examples/Threads/test_auto_event.cpp | 113 ---- examples/Threads/test_barrier1.cpp | 84 --- examples/Threads/test_barrier2.cpp | 269 ---------- examples/Threads/test_cancel.cpp | 72 --- examples/Threads/test_future1.cpp | 420 --------------- examples/Threads/test_future2.cpp | 524 ------------------ examples/Threads/test_manual_event.cpp | 108 ---- examples/Threads/test_process_mutex.cpp | 68 --- examples/Threads/test_process_semaphore.cpp | 56 -- examples/Threads/test_reader_writer.cpp | 187 ------- examples/Threads/test_recursive_mutex.cpp | 108 ---- examples/Threads/test_task.cpp | 104 ---- examples/Threads/test_task_four.cpp | 248 --------- examples/Threads/test_task_one.cpp | 104 ---- examples/Threads/test_task_three.cpp | 230 -------- examples/Threads/test_task_two.cpp | 156 ------ examples/Threads/test_thread_manager.cpp | 104 ---- examples/Threads/test_thread_pool.cpp | 214 -------- examples/Threads/test_thread_specific.cpp | 219 -------- examples/Threads/test_token.cpp | 76 --- examples/Threads/test_tss.cpp | 235 -------- examples/Threads/test_tss1.cpp | 164 ------ examples/Threads/test_tss2.cpp | 252 --------- netsvcs/clients/Naming/Dump_Restore/nametest.cpp | 112 ---- netsvcs/clients/Naming/Dump_Restore/nametest.h | 15 - netsvcs/lib/Client_Logging_Handler.i | 4 - netsvcs/lib/Server_Logging_Handler.i | 4 - netsvcs/servers/cli.conf | 11 - netsvcs/servers/ntsvc.conf | 12 - tests/CPP_Test.cpp | 261 --------- tests/Shared_Memory_SV_Test.cpp | 83 --- tests/run_tests.ksh | 6 - 88 files changed, 15051 deletions(-) delete mode 100644 STL/ACE_Changes delete mode 100644 STL/readme2.stl delete mode 100644 TAO/orbsvcs/orbsvcs/AVStreams_Full.idl delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.i delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.h delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.i delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.h delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.i delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h delete mode 100644 ace/SSL/SSL_Context.cpp delete mode 100644 ace/SSL/SSL_Context.h delete mode 100644 ace/SSL/SSL_Context.i delete mode 100644 ace/SSL/SSL_Context.inl delete mode 100644 ace/SSL/SSL_SOCK_Acceptor.cpp delete mode 100644 ace/SSL/SSL_SOCK_Acceptor.h delete mode 100644 ace/SSL/SSL_SOCK_Acceptor.i delete mode 100644 ace/SSL/SSL_SOCK_Connector.cpp delete mode 100644 ace/SSL/SSL_SOCK_Connector.h delete mode 100644 ace/SSL/SSL_SOCK_Connector.i delete mode 100644 ace/SSL/SSL_SOCK_Stream.cpp delete mode 100644 ace/SSL/SSL_SOCK_Stream.h delete mode 100644 ace/SSL/SSL_SOCK_Stream.i delete mode 100644 ace/SSL/sslconf.h delete mode 100644 ace/Timer_Queue.i delete mode 100644 apps/Gateway/Gateway/Concurrency_Strategies.h delete mode 100644 apps/Gateway/Gateway/Peer_Message.h delete mode 100644 examples/IPC_SAP/SSL_SAP/Makefile delete mode 100644 examples/IPC_SAP/SSL_SAP/README delete mode 100644 examples/IPC_SAP/SSL_SAP/SSL-client-simple.cpp delete mode 100644 examples/IPC_SAP/SSL_SAP/SSL-client-simple.h delete mode 100644 examples/IPC_SAP/SSL_SAP/SSL-client.cpp delete mode 100644 examples/IPC_SAP/SSL_SAP/SSL-client.h delete mode 100644 examples/IPC_SAP/SSL_SAP/SSL-server-fancy.cpp delete mode 100644 examples/IPC_SAP/SSL_SAP/SSL-server-fancy.h delete mode 100644 examples/IPC_SAP/SSL_SAP/SSL-server-poll.cpp delete mode 100644 examples/IPC_SAP/SSL_SAP/SSL-server-simple.cpp delete mode 100644 examples/IPC_SAP/SSL_SAP/SSL-server.cpp delete mode 100644 examples/IPC_SAP/SSL_SAP/dummy.pem delete mode 100644 examples/IPC_SAP/SSL_SAP/key.pem delete mode 100644 examples/IPC_SAP/SSL_SAP/local_data delete mode 100755 examples/IPC_SAP/SSL_SAP/summarize delete mode 100644 examples/Reactor/Misc/signal_tester.cpp delete mode 100644 examples/Reactor/Misc/test_signals.cpp delete mode 100644 examples/System_V_IPC/SV_Semaphores/Semaphore_Client.cpp delete mode 100644 examples/System_V_IPC/SV_Semaphores/Semaphore_Server.cpp delete mode 100644 examples/System_V_IPC/SV_Semaphores/Semaphore_Test.h delete mode 100644 examples/System_V_IPC/SV_Semaphores/Semaphores.cpp delete mode 100644 examples/Threads/test_auto_event.cpp delete mode 100644 examples/Threads/test_barrier1.cpp delete mode 100644 examples/Threads/test_barrier2.cpp delete mode 100644 examples/Threads/test_cancel.cpp delete mode 100644 examples/Threads/test_future1.cpp delete mode 100644 examples/Threads/test_future2.cpp delete mode 100644 examples/Threads/test_manual_event.cpp delete mode 100644 examples/Threads/test_process_mutex.cpp delete mode 100644 examples/Threads/test_process_semaphore.cpp delete mode 100644 examples/Threads/test_reader_writer.cpp delete mode 100644 examples/Threads/test_recursive_mutex.cpp delete mode 100644 examples/Threads/test_task.cpp delete mode 100644 examples/Threads/test_task_four.cpp delete mode 100644 examples/Threads/test_task_one.cpp delete mode 100644 examples/Threads/test_task_three.cpp delete mode 100644 examples/Threads/test_task_two.cpp delete mode 100644 examples/Threads/test_thread_manager.cpp delete mode 100644 examples/Threads/test_thread_pool.cpp delete mode 100644 examples/Threads/test_thread_specific.cpp delete mode 100644 examples/Threads/test_token.cpp delete mode 100644 examples/Threads/test_tss.cpp delete mode 100644 examples/Threads/test_tss1.cpp delete mode 100644 examples/Threads/test_tss2.cpp delete mode 100644 netsvcs/clients/Naming/Dump_Restore/nametest.cpp delete mode 100644 netsvcs/clients/Naming/Dump_Restore/nametest.h delete mode 100644 netsvcs/lib/Client_Logging_Handler.i delete mode 100644 netsvcs/lib/Server_Logging_Handler.i delete mode 100644 netsvcs/servers/cli.conf delete mode 100644 netsvcs/servers/ntsvc.conf delete mode 100644 tests/CPP_Test.cpp delete mode 100644 tests/Shared_Memory_SV_Test.cpp delete mode 100755 tests/run_tests.ksh diff --git a/STL/ACE_Changes b/STL/ACE_Changes deleted file mode 100644 index 902fb94c94c..00000000000 --- a/STL/ACE_Changes +++ /dev/null @@ -1,53 +0,0 @@ -This version of STL was obtained from -http://www.rahul.net/terris/. This is a modified version of the -implementation that comes with VC++4.0. Please see readme2.stl for -details. - -The following modification have been made for compilation with VC++4.x - -________________________________________ - -vector.h (line 85) -________________________________________ - - - /* - * This is cause the VC++ compiler sucks - * and does not recognize nested classes properly - * - */ -#if !defined (VC_PLUS_PLUS_NESTED_CLASS_PROBLEM) - vector(size_type n, const T& value = T()) { - start = static_allocator.allocate(n); - uninitialized_fill_n(start, n, value); - finish = start + n; - end_of_storage = finish; - } -#endif /* VC_PLUS_PLUS_NESTED_CLASS_PROBLEM */ - - -________________________________________ - -bstring.h (line 1102) -________________________________________ - - - /* - * This should be correctly scoped - * - * if (cap == ::reserve) - */ - - if (cap == std::reserve) - { - len = 0; - res = size; - ptr = new charT [res]; - } - /* - * This should be correctly scoped - * - * else if ((cap == ::default_size) && (size != NPOS)) - */ - - else if ((cap == std::default_size) && (size != NPOS)) diff --git a/STL/readme2.stl b/STL/readme2.stl deleted file mode 100644 index 5132bc1189b..00000000000 --- a/STL/readme2.stl +++ /dev/null @@ -1,272 +0,0 @@ -STL2.ZIP - -Standard Template Library for Visual C++ 4.0 -and Related Classes - -Revised 10/15/96 - Bug fixes and change to bit_vector. - -This version supports DLLs and threading. You must use critical -sections around code that uses the same container in different -threads. These features come at a price -- since memory -usage is not optimal, this code may use more memory and -may be slower. - -+ General strategy: Remove all statics except the - static allocator objects. -+ Vectors were not affected. -+ Major changes made to tree.h -+ Stability: Very stable. - -This code should be considered for experimental use only. There -are still statics lurking in some functions; these functions -are not thread-safe. - -------------------------- -Fix for bit_vector -------------------------- -This version also has a fix for bit_vector, which doesn't really -work with VC++ 4.x. Please include bvector.cpp in your -project if you use bit_vector. This fixes the linker errors -that occur if you use bector.h in multiple .cpp files. - -------------------------- -Disclaimer -------------------------- -Code is provided without warranty, liability, or technical support. - -STL.H and PTR.H are freely distributable and can be -modified in any way. - --------------------------------- -STRING.H does not compile. --------------------------------- - -"D. Pirzadeh" Explains how to fix: - -First, I got compile errors in "bstring.h" -and changed it as follows to correct: - line 1104 "::reserve" -> "std::reserve" - line 1110 "::default_size" -> "std::default_size" - -Also, I got an INTERNAL COMPILER ERROR with Visual C++ v4.0 when I did the fol- -lowing: - class xyz : public std::string { } - -I fixed it with: - typedef std::string XyzString; - class xyz : public XyzString { } - --------------------------------- -Changes made to STL distribution --------------------------------- - -These files were modified from the STL distribution shipped with -Microsoft Visual C++ 4.0. The files here are a complete, -working version of the STL. These files have been tested with -MFC applications. - -Changes were made to practically all header files. Look for -comments like: - -*Added by... -*Changed by... - ------------------- -Usage Instructions ------------------- - -Set the preprocessor variable NOMINMAX. - -As Microsoft recommends, the STL is compiled in the std namespace. - -When including these files, do **not** do this: - - namespace std - { - #include - } - -Instead, do this: - - #include - -Recommended usage: - - First, include: - - #include - #include - #include - - Then include the STL header files. - -------------------- -Support for CString -------------------- -The stl.h file contains code written by me. The file contains -operators that will allow you to use CString objects with STL -containers and functions. - -!!!! CString will not work with STL unless you include !!!! - -------------------------------------------- -Helper functions for pointers-in-containers -------------------------------------------- -There is a file called stl.h which contains two functions: - SequenceDelete - MapDelete -These functions send "delete" to all of the objects in a container. - -If you don't like this approach, you can use a supplied "pointer -wrapper" class. - -There is a file called ptr.h which contains a class called Ptr -that can be used exactly like a pointer. The object has a pointer -inside it that points to an object of any class. When a Ptr object -is deleted, "delete" is sent to its underlying pointer. Ptr can be -used with any STL container, as it has a copy constructor and -assignment operator, which transfers "ownership" of the pointer from -the source object to the destination object. Ptr is from the book -Design Patterns by Gamma et al -- see the Proxy pattern. - -The Ptr class makes memory leaks impossible, because it deletes -objects automatically when the container is deleted, or when -functions like "delete" are used. - -Example: - - This is a vector of CStrings: - - std::vector< Ptr > StringVector; - - StringVector.push_back( Ptr( new CString( "hello" ) ) ); - StringVector.push_back( Ptr( new CString( "This is another string" ) ) ); - ------------------------- -Common Problems with STL ------------------------- - -1) Compiler error: != is ambiguous - - Solution: put the following line at the beginning of the method - that caused the error: - - using namespace std; - -2) When using maps, the debugger crashes. - - This is because symbols for maps (actually, for the "pair") - get truncated to 255 characters. Solution: Turn off the - variables window in the debugger. Don't try to look at - a symbol that has been truncated. This is not an STL-specific - bug -- It's a bug in the debugger. - -3) All sorts of compile errors in STL header files - - Make sure the preprocessor variable NOMINMAX is defined - - -4) Compiler errors about "operator < is not available", etc. - The class involved has global comparison operators. - - Solution: - Write "routers" in the std namespace to the global namespace. - Example (see also stl.h - this is how CString is able - to work with STL): - - namespace std - { - BOOL operator < ( const MyClass & rLhs, - const AnotherClass & rRhs ) - { - return ::operator < ( rLhs, rRhs ); - } - } - - See also 5. - -5) When you use find() or another algorithm, the compiler - complains that it cannot find the == or < operators. - -If your code compiles without any error messages, then disregard -this section. However, if you get errors like "cannot convert -first argument from const class X" then read on. - -I am assuming that your code is calling an STL algorithm like -std::sort() or std::find(). If you're not, I can't help -you. - -There is apparently a bug in the Microsoft compiler regarding -namespaces. Namespaces cannot locate global -functions that reside in the global namespace. For example, -the binary == operator. - -Maybe this is a bug, maybe it isn't. This is not clear -to me. However, I do know what works and have tried many other -approaches that do not work. If you have a better solution I -would appreciate it if you could let me know about it. - -So, if you declare your own class and want to use algorithms -like find() on an STL container, you have two choices: - -(1) Declare == as a member function. -(2) Declare global operators == and !=. - -(1) simply works. There will come a time, however, when (1) -won't satisfy your needs. If A == B, then B == A. You can't -do this using member functions if A and B are from different -classes. - -If you choose (2), you must add the != operator to the std -namespace. There are two ways to do this. First, you can do -this: - namespace std - { - inline operator != ( const MyClass &rLhs, const MyClass &rRhs ) - { - return ::operator != ( rLhs, rRhs ); - } - } -This "routes" != from the std namespace to the global namespace. - -Note that ( lhs != rhs ) can be derived from the == operator -as !( lhs == rhs ). There is a macro in STL.H, -STL_DECLARE_GLOBAL_NE, that does this derivation. -This derivation will not work when for whatever reason, !(lhs == rhs) -is not the same as ( lhs != rhs ). - -The following example shows what you have to do for find(). Other -algorithms require you to declare <, <=, and >= too. See the -macros STL_DECLARE_GLOBAL_GE, STL_DECLARE_GLOBAL_LT, and -STL_GLOBAL_LE. These macros derive new comparison operators -from "operator <( const T&, const T& )". - -class MyClass -{ - public: - - int units; - CString description; -}; - -// We want to be able to test two MyClass objects against each other -// in STL. Need to create a global operator for this purpose. -// Since we use find(), we need to declare not-equal too. -bool operator == ( const MyClass &, const MyClass & ); -STL_DECLARE_GLOBAL_NE( MyClass, MyClass ) - -// These operators test for a matching description. -// We do A == B and B == A to be consistent. -bool operator == ( const MyClass&, const CString & ); -bool operator == ( const CString&, const MyClass & ); -STL_DECLARE_GLOBAL_NE( MyClass, CString ) -STL_DECLARE_GLOBAL_NE( CString, MyClass ) - -6. Errors when creating vectors that have vectors and deques - that have deques. - - Solution: Provide atruments to the constructor. - - std::vector< std::vector > - TwoDimensional( 0, std::vector() ); - diff --git a/TAO/orbsvcs/orbsvcs/AVStreams_Full.idl b/TAO/orbsvcs/orbsvcs/AVStreams_Full.idl deleted file mode 100644 index 2f04c91261e..00000000000 --- a/TAO/orbsvcs/orbsvcs/AVStreams_Full.idl +++ /dev/null @@ -1,252 +0,0 @@ -// $Id$ - -// IDL for Control and Management of Audio/Video Streams -// Revised Submission - -// Additional IDL for full profile -#include "AVStreams.idl" - -#pragma prefix "omg.org" - -module AVStreams_Full -{ - exception protocolNotSupported{}; - exception formatNotSupported{}; - exception formatMismatch{}; - exception FEPMismatch{}; - exception alreadyConnected{}; - exception invalidSettings{string settings;}; - exception notConnected{}; - exception deviceQosMismatch{}; - exception failedToConnect{string reason;}; - exception failedToListen{string reason;}; - - - interface FlowProducer; - interface FlowConsumer; - interface FlowEndPoint; - interface FDev; - - interface FlowConnection : PropertyService::PropertySet - { - void stop(); - void start(); - void destroy(); - - boolean modify_QoS( - - inout AVStreams::QoS new_qos) - raises (AVStreams::QoSRequestFailed); - - boolean use_flow_protocol( - in string fp_name, - in any fp_settings) - raises (AVStreams::FPError, AVStreams::notSupported); - - oneway void push_event(in AVStreams::streamEvent the_event); - - boolean connect_devs(in FDev a_party, in FDev b_party, - inout AVStreams::QoS the_qos) - raises (AVStreams::streamOpFailed, - AVStreams::streamOpDenied, - AVStreams::QoSRequestFailed); - - boolean connect( - in FlowProducer flow_producer, - in FlowConsumer flow_consumer, - inout AVStreams::QoS the_qos) - raises (formatMismatch, FEPMismatch, alreadyConnected); - - boolean disconnect(); - - // The notSupported exception is raised where - // flow cannot have multiple producers - boolean add_producer(in FlowProducer flow_producer, - inout AVStreams::QoS the_qos) - raises (alreadyConnected, AVStreams::notSupported); - - boolean add_consumer(in FlowConsumer flow_consumer, - inout AVStreams::QoS the_qos) - raises (alreadyConnected); - - boolean drop(in FlowEndPoint target) - raises (notConnected); - }; - - interface FlowEndPoint : PropertyService::PropertySet - { - boolean lock(); - void unlock(); - - void stop(); - void start(); - void destroy(); - - // Default is a nil object reference - attribute AVStreams::StreamEndPoint related_sep; - attribute FlowConnection related_flow_connection; - - FlowEndPoint get_connected_fep() - raises (notConnected, - AVStreams::notSupported); - - // syntax of fp_name is - boolean use_flow_protocol(in string fp_name, - in any fp_settings) - raises (AVStreams::FPError, AVStreams::notSupported); - - // set_format() initializes 'format' - // as current media format e.g. MPEG. - void set_format(in string format) - raises (AVStreams::notSupported); - - void set_dev_params( - in PropertyService::Properties new_settings) - raises (PropertyService::PropertyException, - AVStreams::streamOpFailed); - - void set_protocol_restriction(in AVStreams::protocolSpec - the_spec) - raises (AVStreams::notSupported); - - boolean is_fep_compatible(in FlowEndPoint fep) - raises (formatMismatch, deviceQosMismatch); - - boolean set_peer( - in FlowConnection the_fc, - - in FlowEndPoint the_peer_fep, - inout AVStreams::QoS the_qos) - raises (AVStreams::QoSRequestFailed, - AVStreams::streamOpFailed); - - boolean set_Mcast_peer( - in FlowConnection the_fc, - in AVStreams::MCastConfigIf a_mcastconfigif, - inout AVStreams::QoS the_qos) - raises (AVStreams::QoSRequestFailed); - - }; - - interface FlowProducer : FlowEndPoint - { - boolean connect_to_peer(inout AVStreams::QoS the_qos, - in string address, - - in string use_flow_protocol) // syntax - raises(failedToConnect, - AVStreams::FPError, AVStreams::QoSRequestFailed); - - string connect_mcast(inout AVStreams::QoS the_qos, - out boolean is_met, - in string address, - in string use_flow_protocol) - raises (failedToConnect, - AVStreams::notSupported, - AVStreams::FPError, - AVStreams::QoSRequestFailed); - - string get_rev_channel(in string pcol_name); - - void set_key(in AVStreams::key the_key); - void set_source_id(in long source_id); - }; - - interface FlowConsumer : FlowEndPoint - { - - - // Needs to know its peer to choose its protocol correctly - // Also to ask for a reverse channel for credit-based flow - // control, if one is required - string go_to_listen( - inout AVStreams::QoS the_qos, - in boolean is_mcast, - in FlowProducer peer, - inout string flowProtocol)// syntax - raises(failedToListen, AVStreams::FPError, - AVStreams::QoSRequestFailed); - }; - - interface FDev : PropertyService::PropertySet { - FlowProducer create_producer( - in FlowConnection the_requester, - inout AVStreams::QoS the_qos, - out boolean met_qos, - inout string named_fdev) - raises(AVStreams::streamOpFailed, - AVStreams::streamOpDenied, - AVStreams::notSupported, - AVStreams::QoSRequestFailed); - - FlowConsumer create_consumer( - in FlowConnection the_requester, - inout AVStreams::QoS the_qos, - out boolean met_qos, - inout string named_fdev) - raises(AVStreams::streamOpFailed, - AVStreams::streamOpDenied, - AVStreams::notSupported, - AVStreams::QoSRequestFailed); - - FlowConnection bind(in FDev peer_device, - inout AVStreams::QoS the_qos, - out boolean is_met) - raises (AVStreams::streamOpFailed, - AVStreams::QoSRequestFailed); - - FlowConnection bind_mcast(in FDev first_peer, - inout AVStreams::QoS the_qos, - out boolean is_met) - raises (AVStreams::streamOpFailed, - AVStreams::QoSRequestFailed); - - void destroy(in FlowEndPoint the_ep, in string fdev_name) - // ie FDev not found - raises (AVStreams::notSupported); - }; - - enum PositionOrigin { - AbsolutePosition, RelativePosition, ModuloPosition - }; - - enum PositionKey { - ByteCount, SampleCount, MediaTime - }; - - struct Position { - PositionOrigin origin; - PositionKey key; - long value; - }; - - exception PostionKeyNotSupported { PositionKey key;}; - exception InvalidPosition { PositionKey key;}; - - // MediaControl interface is similar to - // ControlledStream interface in MSS. - // It can be inherited by flow endpoints or - // FlowConnection interfaces. - interface MediaControl{ - - exception PostionKeyNotSupported { PositionKey key;}; - - Position get_media_position( - in PositionOrigin an_origin, - in PositionKey a_key) - raises (PostionKeyNotSupported); - - void set_media_position(in Position a_position) - raises (PostionKeyNotSupported, InvalidPosition); - - void start(in Position a_position) - raises(InvalidPosition); - void pause(in Position a_position) - raises(InvalidPosition); - void resume(in Position a_position) - raises(InvalidPosition); - void stop(in Position a_position) - raises(InvalidPosition); - }; -}; - diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp deleted file mode 100644 index 707612f552a..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp +++ /dev/null @@ -1,377 +0,0 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - -#include "SSLIOP_Acceptor.h" -#include "SSLIOP_Profile.h" -#include "tao/MProfile.h" -#include "tao/ORB_Core.h" -#include "tao/Server_Strategy_Factory.h" -#include "tao/GIOP.h" -#include "tao/debug.h" - -#if !defined(__ACE_INLINE__) -#include "SSLIOP_Acceptor.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(tao, SSLIOP_Acceptor, "$Id$") - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Acceptor; -template class ACE_Strategy_Acceptor; -template class ACE_Accept_Strategy; -template class ACE_Creation_Strategy; -template class ACE_Concurrency_Strategy; -template class ACE_Scheduling_Strategy; -template class TAO_Creation_Strategy; -template class TAO_Concurrency_Strategy; -template class TAO_Accept_Strategy; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Acceptor -#pragma instantiate ACE_Strategy_Acceptor -#pragma instantiate ACE_Accept_Strategy -#pragma instantiate ACE_Creation_Strategy -#pragma instantiate ACE_Concurrency_Strategy -#pragma instantiate ACE_Scheduling_Strategy -#pragma instantiate TAO_Creation_Strategy -#pragma instantiate TAO_Concurrency_Strategy -#pragma instantiate TAO_Accept_Strategy - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -TAO_SSLIOP_Acceptor::TAO_SSLIOP_Acceptor (void) - : TAO_IIOP_Acceptor (), - ssl_acceptor_ (), - creation_strategy_ (0), - concurrency_strategy_ (0), - accept_strategy_ (0) -{ - // Initialize the default SSL port to zero. - this->ssl_component_.port = 0; -} - -TAO_SSLIOP_Acceptor::~TAO_SSLIOP_Acceptor (void) -{ - delete this->creation_strategy_; - delete this->concurrency_strategy_; - delete this->accept_strategy_; -} - -// TODO = -// 2) For V1.[1,2] there are tagged components -// 3) Create multiple profiles for wild carded endpoints (may be multiple -// interfaces over which we can receive requests. Thus a profile -// must be made for each one. - -int -TAO_SSLIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile) -{ - // @@ we only make one for now - int count = mprofile.profile_count (); - if ((mprofile.size () - count) < 1 - && mprofile.grow (count + 1) == -1) - return -1; - - TAO_SSLIOP_Profile *pfile = 0; - ACE_NEW_RETURN (pfile, - TAO_SSLIOP_Profile (this->host_.c_str (), - this->address_.get_port_number (), - object_key, - this->address_, - this->version_, - this->orb_core_, - this->ssl_component_.port) -, - -1); - - if (mprofile.give_profile (pfile) == -1) - { - pfile->_decr_refcnt (); - pfile = 0; - return -1; - } - - if (this->orb_core_->orb_params ()->std_profile_components () == 0) - return 0; - - pfile->tagged_components ().set_orb_type (TAO_ORB_TYPE); - - CONV_FRAME::CodeSetComponentInfo code_set_info; - code_set_info.ForCharData.native_code_set = - TAO_DEFAULT_CHAR_CODESET_ID; - code_set_info.ForWcharData.native_code_set = - TAO_DEFAULT_WCHAR_CODESET_ID; - pfile->tagged_components ().set_code_sets (code_set_info); - - pfile->tagged_components ().set_tao_priority (this->priority ()); - - IOP::TaggedComponent component; - component.tag = IOP::TAG_SSL_SEC_TRANS; - // @@???? Check this code, only intended as guideline... - TAO_OutputCDR cdr; - cdr << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); - cdr << this->ssl_component_; - // TAO extension, replace the contents of the octet sequence with - // the CDR stream - CORBA::ULong length = cdr.total_length (); - component.component_data.length (length); - CORBA::Octet *buf = component.component_data.get_buffer (); - for (const ACE_Message_Block *i = cdr.begin (); - i != 0; - i = i->cont ()) - { - ACE_OS::memcpy (buf, i->rd_ptr (), i->length ()); - buf += i->length (); - } - - pfile->tagged_components ().set_component (component); - - return 0; -} - -int -TAO_SSLIOP_Acceptor::is_collocated (const TAO_Profile *pfile) -{ - const TAO_SSLIOP_Profile *profile = - ACE_dynamic_cast(const TAO_SSLIOP_Profile *, - pfile); - - // compare the port and sin_addr (numeric host address) - return profile->object_addr () == this->address_; -} - -int -TAO_SSLIOP_Acceptor::close (void) -{ - int r = this->ssl_acceptor_.close (); - if (this->TAO_IIOP_Acceptor::close () != 0) - r = -1; - return r; -} - -int -TAO_SSLIOP_Acceptor::open (TAO_ORB_Core *orb_core, - int major, - int minor, - const char *address, - const char *options) -{ - if (this->TAO_IIOP_Acceptor::open (orb_core, - major, - minor, - address, - options) != 0) - return -1; - - // The SSL port is set in the parse_options() method. All we have - // to do is call open_i() - ACE_INET_Addr addr (this->ssl_component_.port, - this->address_.get_host_addr()); - return this->open_i (orb_core, addr); -} - -int -TAO_SSLIOP_Acceptor::open_default (TAO_ORB_Core *orb_core, - const char *options) -{ - if (this->TAO_IIOP_Acceptor::open_default (orb_core, options) == -1) - return -1; - - // @@ Until we can support multihomed machines correctly we must - // pick the "default interface" and only listen on that IP - // address. - - // this->ssl_component_.port is initialized to zero or it is set in - // this->parse_options(). - ACE_INET_Addr addr (this->ssl_component_.port, - this->address_.get_host_addr ()); - - return this->open_i (orb_core, addr); -} - -int -TAO_SSLIOP_Acceptor::open_i (TAO_ORB_Core* orb_core, - const ACE_INET_Addr& addr) -{ - ACE_NEW_RETURN (this->creation_strategy_, - TAO_SSLIOP_CREATION_STRATEGY (this->orb_core_), - -1); - - ACE_NEW_RETURN (this->concurrency_strategy_, - TAO_SSLIOP_CONCURRENCY_STRATEGY (this->orb_core_), - -1); - - ACE_NEW_RETURN (this->accept_strategy_, - TAO_SSLIOP_ACCEPT_STRATEGY (this->orb_core_), - -1); - - if (this->ssl_acceptor_.open (addr, - orb_core->reactor (this), - this->creation_strategy_, - this->accept_strategy_, - this->concurrency_strategy_) == -1) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "\n\nTAO (%P|%t) SSLIOP_Acceptor::open_i - %p\n\n", - "cannot open acceptor")); - return -1; - } - - // @@ Should this be a catastrophic error??? - ACE_INET_Addr ssl_address; - if (this->ssl_acceptor_.acceptor ().get_local_addr (ssl_address) != 0) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "\n\nTAO (%P|%t) SSLIOP_Acceptor::open_i - %p\n\n", - "cannot get local addr")); - return -1; - } - - this->ssl_component_.port = ssl_address.get_port_number (); - - if (TAO_debug_level > 5) - { - ACE_DEBUG ((LM_DEBUG, - "\nTAO (%P|%t) SSLIOP_Acceptor::open_i - " - "listening on: <%s:%u>\n", - this->host_.c_str (), - this->ssl_component_.port)); - } - return 0; -} - -CORBA::ULong -TAO_SSLIOP_Acceptor::endpoint_count (void) -{ - // @@ for now just assume one! - // we should take a look at the local address, if it is zero then - // get the list of available IP interfaces and return this number. - return 1; -} - -int -TAO_SSLIOP_Acceptor::parse_options (const char *str) -{ - // Set the SSL port to the default value... - // @@ Do we really need to do this... - this->ssl_component_.port = 0; - - if (str == 0) - return 0; // No options to parse. Not a problem. - - // Use an option format similar to the one used for CGI scripts in - // HTTP URLs. - // e.g.: option1=foo&option2=bar - - ACE_CString options (str); - - size_t len = options.length (); - - const char option_delimiter = '&'; - - // Count the number of options. - - CORBA::ULong option_count = 1; - // Number of endpoints in the string (initialized to 1). - - // Only check for endpoints after the protocol specification and - // before the object key. - for (size_t i = 0; i < len; ++i) - if (options[i] == option_delimiter) - option_count++; - - // The idea behind the following loop is to split the options into - // (option, name) pairs. - // For example, - // `option1=foo&option2=bar' - // will be parsed into: - // `option1=foo' - // `option2=bar' - - int begin = 0; - int end = -1; - - // @@ We should add options to set the security association options, - // or are those controlled by Policies? - for (CORBA::ULong j = 0; j < option_count; ++j) - { - begin += end + 1; - - if (j < option_count - 1) - end = options.find (option_delimiter, begin); - else - end = len - begin; // Handle last endpoint differently - - if (end == begin) - ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) Zero length IIOP/SSL option.\n"), - -1); - else if (end != ACE_CString::npos) - { - ACE_CString opt = options.substring (begin, end); - - int slot = opt.find ("="); - - if (slot == ACE_static_cast (int, len - 1) - || slot == ACE_CString::npos) - ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) IIOP/SSL option <%s> is " - "missing a value.\n", - opt.c_str ()), - -1); - - ACE_CString name = opt.substring (0, slot); - ACE_CString value = opt.substring (slot + 1); - - if (name.length () == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) Zero length IIOP/SSL " - "option name.\n"), - -1); - - if (name == "priority") - { - CORBA::Short corba_priority = - ACE_static_cast (CORBA::Short, - ACE_OS::atoi (value.c_str ())); - - if (corba_priority >= 0 - /* && corba_priority < 32768 */) - // priority_ and corba_priority will always be less - // than 32768 since CORBA::Short is a signed 16 bit - // integer. - this->priority_ = corba_priority; - else - ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) Invalid IIOP/SSL endpoint " - "priority: <%s>\n", - value.c_str ()), - -1); - } - else if (ACE_OS::strcmp (name.c_str (), "ssl_port") == 0) - { - int ssl_port = ACE_OS::atoi (value.c_str ()); - - if (ssl_port >= 0 && ssl_port < 65536) - this->ssl_component_.port = ssl_port; - else - ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) Invalid IIOP/SSL endpoint " - "port: <%s>\n", - value.c_str ()), - -1); - } - else - ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) Invalid IIOP/SSL option: <%s>\n", - name.c_str ()), - -1); - } - } - return 0; -} diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h deleted file mode 100644 index f1c24d35a94..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h +++ /dev/null @@ -1,95 +0,0 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO -// -// = FILENAME -// SSLIOP_Acceptor.h -// -// = DESCRIPTION -// IIOP/SSL specific acceptor processing -// -// = AUTHOR -// Fred Kuhns -// -// ============================================================================ - -#ifndef TAO_SSLIOP_ACCEPTOR_H -#define TAO_SSLIOP_ACCEPTOR_H - -#include "tao/IIOP_Acceptor.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "SSL_SOCK_Acceptor.h" -#include "SSLIOP_Connect.h" -#include "SSLIOPC.h" - -// TAO SSLIOP_Acceptor concrete call definition - -class TAO_Export TAO_SSLIOP_Acceptor : public TAO_IIOP_Acceptor -{ - // = TITLE - // TAO_SSLIOP_Acceptor - // - // = DESCRIPTION - // The IIOP-specific bridge class for the concrete acceptor. - // -public: - TAO_SSLIOP_Acceptor (void); - // Constructor. - - ~TAO_SSLIOP_Acceptor (void); - // Destructor. - - typedef ACE_Strategy_Acceptor TAO_SSLIOP_BASE_ACCEPTOR; - typedef TAO_Creation_Strategy TAO_SSLIOP_CREATION_STRATEGY; - typedef TAO_Concurrency_Strategy TAO_SSLIOP_CONCURRENCY_STRATEGY; - typedef TAO_Accept_Strategy TAO_SSLIOP_ACCEPT_STRATEGY; - - // = The TAO_Acceptor methods, check the documentation in - // Pluggable.h for details. - virtual int open (TAO_ORB_Core *orb_core, - int version_major, - int version_minor, - const char *address, - const char *options = 0); - virtual int open_default (TAO_ORB_Core *orb_core, - const char *options = 0); - virtual int close (void); - virtual int create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile); - virtual int is_collocated (const TAO_Profile* profile); - virtual CORBA::ULong endpoint_count (void); - -private: - int open_i (TAO_ORB_Core* orb_core, - const ACE_INET_Addr& addr); - // Implement the common part of the open*() methods. - - int parse_options (const char *options); - // Parse protocol specific options. - -private: - TAO_SSLIOP_BASE_ACCEPTOR ssl_acceptor_; - // the concrete acceptor, as a pointer to it's base class. - - TAO_SSLIOP_CREATION_STRATEGY *creation_strategy_; - TAO_SSLIOP_CONCURRENCY_STRATEGY *concurrency_strategy_; - TAO_SSLIOP_ACCEPT_STRATEGY *accept_strategy_; - // Acceptor strategies. - - SSLIOP::SSL ssl_component_; - // The SSL component -}; - -#if defined(__ACE_INLINE__) -#include "SSLIOP_Acceptor.i" -#endif /* __ACE_INLINE__ */ - -#endif /* TAO_SSLIOP_ACCEPTOR_H */ diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.i b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.i deleted file mode 100644 index c130d6682b1..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.i +++ /dev/null @@ -1,2 +0,0 @@ -// -*- C++ -*- -// $Id$ diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp deleted file mode 100644 index fa4a1b4a423..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp +++ /dev/null @@ -1,519 +0,0 @@ -// $Id$ - -#include "SSLIOP_Connect.h" -#include "tao/Timeprobe.h" -#include "tao/debug.h" -#include "tao/ORB_Core.h" -#include "tao/ORB.h" -#include "tao/CDR.h" -#include "tao/GIOP.h" - -#if !defined (__ACE_INLINE__) -# include "SSLIOP_Connect.i" -#endif /* ! __ACE_INLINE__ */ - -ACE_RCSID(tao, SSLIOP_Connect, "$Id$") - -#if defined (ACE_ENABLE_TIMEPROBES) - -static const char *TAO_SSLIOP_Connect_Timeprobe_Description[] = -{ - "SSLIOP_Server_Connection_Handler::handle_input - start", - "SSLIOP_Server_Connection_Handler::handle_input - end", - - "SSLIOP_Server_Connection_Handler::handle_locate - start", - "SSLIOP_Server_Connection_Handler::handle_locate - end", - - "SSLIOP_Server_Connection_Handler::receive_request - end", - - "SSLIOP_Client_Connection_Handler::send_request - start", - "SSLIOP_Client_Connection_Handler::send_request - end"}; - -enum -{ - // Timeprobe description table start key - TAO_SSLIOP_SERVER_CONNECTION_HANDLER_HANDLE_INPUT_START = 300, - TAO_SSLIOP_SERVER_CONNECTION_HANDLER_HANDLE_INPUT_END, - - TAO_SSLIOP_SERVER_CONNECTION_HANDLER_HANDLE_LOCATE_START, - TAO_SSLIOP_SERVER_CONNECTION_HANDLER_HANDLE_LOCATE_END, - - TAO_SSLIOP_SERVER_CONNECTION_HANDLER_RECEIVE_REQUEST_END, - - TAO_SSLIOP_CLIENT_CONNECTION_HANDLER_SEND_REQUEST_START, - TAO_SSLIOP_CLIENT_CONNECTION_HANDLER_SEND_REQUEST_END -}; - -// Setup Timeprobes -ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_SSLIOP_Connect_Timeprobe_Description, - TAO_SSLIOP_SERVER_CONNECTION_HANDLER_HANDLE_INPUT_START); - -#endif /* ACE_ENABLE_TIMEPROBES */ - -TAO_SSLIOP_Handler_Base::TAO_SSLIOP_Handler_Base (TAO_ORB_Core *orb_core) - : TAO_SSL_SVC_HANDLER (orb_core->thr_mgr (), 0, 0) -{ -} - -TAO_SSLIOP_Handler_Base::TAO_SSLIOP_Handler_Base (ACE_Thread_Manager *t) - : TAO_SSL_SVC_HANDLER (t, 0, 0) -{ -} - -// **************************************************************** - -TAO_SSLIOP_Server_Connection_Handler::TAO_SSLIOP_Server_Connection_Handler (ACE_Thread_Manager *t) - : TAO_SSLIOP_Handler_Base (t), - transport_ (this, 0), - orb_core_ (0), - tss_resources_ (0), - refcount_ (1) - -{ - // This constructor should *never* get called, it is just here to - // make the compiler happy: the default implementation of the - // Creation_Strategy requires a constructor with that signature, we - // don't use that implementation, but some (most?) compilers - // instantiate it anyway. - ACE_ASSERT (this->orb_core_ != 0); -} - -TAO_SSLIOP_Server_Connection_Handler::TAO_SSLIOP_Server_Connection_Handler (TAO_ORB_Core *orb_core) - : TAO_SSLIOP_Handler_Base (orb_core), - transport_ (this, orb_core), - orb_core_ (orb_core), - tss_resources_ (orb_core->get_tss_resources ()), - refcount_ (1) -{ -} - -TAO_SSLIOP_Server_Connection_Handler::~TAO_SSLIOP_Server_Connection_Handler (void) -{ -} - -int -TAO_SSLIOP_Server_Connection_Handler::open (void*) -{ -#if !defined (ACE_LACKS_SOCKET_BUFSIZ) - int sndbufsize = - this->orb_core_->orb_params ()->sock_sndbuf_size (); - int rcvbufsize = - this->orb_core_->orb_params ()->sock_rcvbuf_size (); - - if (this->peer ().set_option (SOL_SOCKET, - SO_SNDBUF, - (void *) &sndbufsize, - sizeof (sndbufsize)) == -1 - && errno != ENOTSUP) - return -1; - else if (this->peer ().set_option (SOL_SOCKET, - SO_RCVBUF, - (void *) &rcvbufsize, - sizeof (rcvbufsize)) == -1 - && errno != ENOTSUP) - return -1; -#endif /* !ACE_LACKS_SOCKET_BUFSIZ */ - -#if defined (TCP_NODELAY) - int nodelay = - this->orb_core_->orb_params ()->nodelay (); - - if (this->peer ().set_option (ACE_IPPROTO_TCP, - TCP_NODELAY, - (void *) &nodelay, - sizeof (nodelay)) == -1) - return -1; -#endif /* TCP_NODELAY */ - - (void) this->peer ().enable (ACE_CLOEXEC); - // Set the close-on-exec flag for that file descriptor. If the - // operation fails we are out of luck (some platforms do not support - // it and return -1). - - // Called by the when the handler is completely - // connected. - ACE_INET_Addr addr; - - if (this->peer ().get_remote_addr (addr) == -1) - return -1; - - char client[MAXHOSTNAMELEN + 16]; - (void) addr.addr_to_string (client, sizeof (client)); - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) IIOP connection from client <%s> on %d\n", - client, this->peer ().get_handle ())); - - return 0; -} - -int -TAO_SSLIOP_Server_Connection_Handler::activate (long flags, - int n_threads, - int force_active, - long priority, - int grp_id, - ACE_Task_Base *task, - ACE_hthread_t thread_handles[], - void *stack[], - size_t stack_size[], - ACE_thread_t thread_names[]) -{ - if (TAO_orbdebug) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) SSLIOP_Server_Connection_Handler::activate %d " - "threads, flags = %d\n", - n_threads, - flags, - THR_BOUND)); - - return TAO_SSL_SVC_HANDLER::activate (flags, - n_threads, - force_active, - priority, - grp_id, - task, - thread_handles, - stack, - stack_size, - thread_names); -} - -int -TAO_SSLIOP_Server_Connection_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask rm) -{ - if (TAO_orbdebug) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) SSLIOP_Server_Connection_Handler::handle_close " - "(%d, %d)\n", - handle, - rm)); - - --this->refcount_; - if (this->refcount_ == 0) - return TAO_SSL_SVC_HANDLER::handle_close (handle, rm); - - return 0; -} - -int -TAO_SSLIOP_Server_Connection_Handler::svc (void) -{ - // This method is called when an instance is "activated", i.e., - // turned into an active object. Presumably, activation spawns a - // thread with this method as the "worker function". - int result = 0; - - // Inheriting the ORB_Core tss stuff from the parent thread. - this->orb_core_->inherit_from_parent_thread (this->tss_resources_); - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) SSLIOP_Server_Connection_Handler::svc begin\n")); - - // Here we simply synthesize the "typical" event loop one might find - // in a reactive handler, except that this can simply block waiting - // for input. - - ACE_Time_Value *max_wait_time = 0; - ACE_Time_Value timeout; - ACE_Time_Value current_timeout; - if (this->orb_core_->thread_per_connection_timeout (timeout)) - { - current_timeout = timeout; - max_wait_time = ¤t_timeout; - } - - while (!this->orb_core_->has_shutdown () - && result >= 0) - { - result = handle_input_i (ACE_INVALID_HANDLE, max_wait_time); - if (result == -1 && errno == ETIME) - { - // Ignore timeouts, they are only used to wake up and - // shutdown. - result = 0; - } - current_timeout = timeout; - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) SSLIOP_Server_Connection_Handler::svc - " - "loop <%d>\n", current_timeout.msec ())); - } - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) SSLIOP_Server_Connection_Handler::svc end\n")); - - return result; -} - -int -TAO_SSLIOP_Server_Connection_Handler::handle_input (ACE_HANDLE h) -{ - return this->handle_input_i (h); -} - -int -TAO_SSLIOP_Server_Connection_Handler::handle_input_i (ACE_HANDLE, - ACE_Time_Value *max_wait_time) -{ - this->refcount_++; - - int result = TAO_GIOP::handle_input (this->transport (), - this->orb_core_, - this->transport_.message_state_, - max_wait_time); - - if (result == -1 && TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - %p\n", - "SSLIOP_Server_Connection_Handler::handle_input, " - "handle_input")); - } - - if (result == 0 || result == -1) - { - --this->refcount_; - if (this->refcount_ == 0) - this->TAO_SSL_SVC_HANDLER::handle_close (); - return result; - } - - // - // Take out all the information from the and reset - // it so that nested upcall on the same transport can be handled. - // - - // Notice that the message_state is only modified in one thread at a - // time because the reactor does not call handle_input() for the - // same Event_Handler in two threads at the same time. - - // Copy message type. - TAO_GIOP_Message_State &ms = this->transport_.message_state_; - CORBA::Octet message_type = ms.message_type; - - // Copy version. - TAO_GIOP_Version giop_version = ms.giop_version; - - // Steal the input CDR from the message state. - TAO_InputCDR input_cdr (ACE_InputCDR::Transfer_Contents (ms.cdr), - this->orb_core_); - - // Reset the message state. - this->transport_.message_state_.reset (0); - - result = TAO_GIOP::process_server_message (this->transport (), - this->orb_core_, - input_cdr, - message_type, - giop_version); - if (result != -1) - result = 0; - - --this->refcount_; - if (this->refcount_ == 0) - this->TAO_SSL_SVC_HANDLER::handle_close (); - - return result; -} - -// **************************************************************** - -// transport obj. -TAO_SSLIOP_Client_Connection_Handler:: -TAO_SSLIOP_Client_Connection_Handler (ACE_Thread_Manager *t, - TAO_ORB_Core* orb_core) - : TAO_SSLIOP_Handler_Base (t), - transport_ (this, orb_core), - orb_core_ (orb_core) -{ -} - -TAO_SSLIOP_Client_Connection_Handler::~TAO_SSLIOP_Client_Connection_Handler (void) -{ -} - - -// @@ Should I do something here to enable non-blocking?? (Alex). -// @@ Alex: I don't know if this is the place to do it, but the way to -// do it is: -// if (this->peer ().enable (ACE_NONBLOCK) == -1) -// return -1; -// Probably we will need to use the transport to decide if it is -// needed or not. - -int -TAO_SSLIOP_Client_Connection_Handler::open (void *) -{ - // @@ TODO: This flags should be set using the RT CORBA policies... - - // Here is where we could enable all sorts of things such as - // nonblock I/O, sock buf sizes, TCP no-delay, etc. - -#if !defined (ACE_LACKS_SOCKET_BUFSIZ) - int sndbufsize = - this->orb_core_->orb_params ()->sock_sndbuf_size (); - int rcvbufsize = - this->orb_core_->orb_params ()->sock_rcvbuf_size (); - - if (this->peer ().set_option (SOL_SOCKET, - SO_SNDBUF, - ACE_reinterpret_cast (void *, &sndbufsize), - sizeof (sndbufsize)) == -1 - && errno != ENOTSUP) - return -1; - else if (this->peer ().set_option (SOL_SOCKET, - SO_RCVBUF, - ACE_reinterpret_cast (void *, &rcvbufsize), - sizeof (rcvbufsize)) == -1 - && errno != ENOTSUP) - return -1; -#endif /* ACE_LACKS_SOCKET_BUFSIZ */ - -#if defined (TCP_NODELAY) - int nodelay = - this->orb_core_->orb_params ()->nodelay (); - if (this->peer ().set_option (ACE_IPPROTO_TCP, - TCP_NODELAY, - (void *) &nodelay, - sizeof (nodelay)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "NODELAY failed\n"), - -1); -#endif /* TCP_NODELAY */ - - (void) this->peer ().enable (ACE_CLOEXEC); - // Set the close-on-exec flag for that file descriptor. If the - // operation fails we are out of luck (some platforms do not support - // it and return -1). - - // Called by the when the handler is completely - // connected. - ACE_INET_Addr addr; - - if (this->peer ().get_remote_addr (addr) == -1) - return -1; - - char server[MAXHOSTNAMELEN + 16]; - - (void) addr.addr_to_string (server, sizeof (server)); - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) IIOP connection to server <%s> on %d\n", - server, this->peer ().get_handle ())); - - // Register the handler with the Reactor if necessary. - return this->transport ()->wait_strategy ()->register_handler (); -} - -int -TAO_SSLIOP_Client_Connection_Handler::close (u_long) -{ - this->destroy (); - - return 0; -} - -int -TAO_SSLIOP_Client_Connection_Handler::handle_input (ACE_HANDLE) -{ - // Call the waiter to handle the input. - return this->transport ()->wait_strategy ()->handle_input (); -} - -int -TAO_SSLIOP_Client_Connection_Handler::handle_timeout (const ACE_Time_Value &, - const void *) -{ - // - // This method is called when buffering timer expires. - // - - // Cannot deal with errors, and therefore they are ignored. - this->transport ()->send_buffered_messages (); - - return 0; -} - -int -TAO_SSLIOP_Client_Connection_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask rm) -{ - // @@ Alex: we need to figure out if the transport decides to close - // us or something else. If it is something else (for example - // the cached connector trying to make room for other - // connections) then we should let the transport know, so it can - // in turn take appropiate action (such as sending exceptions to - // all waiting reply handlers). - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) SSLIOP_Client_Connection_Handler::" - "handle_close (%d, %d)\n", handle, rm)); - - if (this->recycler ()) - this->recycler ()->mark_as_closed (this->recycling_act ()); - - // Deregister this handler with the ACE_Reactor. - return this->handle_cleanup (); -} - -int -TAO_SSLIOP_Client_Connection_Handler::handle_close_i (ACE_HANDLE handle, - ACE_Reactor_Mask rm) -{ - // @@ Alex: we need to figure out if the transport decides to close - // us or something else. If it is something else (for example - // the cached connector trying to make room for other - // connections) then we should let the transport know, so it can - // in turn take appropiate action (such as sending exceptions to - // all waiting reply handlers). - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) SSLIOP_Client_Connection_Handler::" - "handle_close_i (%d, %d)\n", handle, rm)); - - if (this->recycler ()) - this->recycler ()->mark_as_closed_i (this->recycling_act ()); - - return this->handle_cleanup (); -} - -int -TAO_SSLIOP_Client_Connection_Handler::handle_cleanup (void) -{ - // Deregister this handler with the ACE_Reactor. - if (this->reactor ()) - { - ACE_Reactor_Mask mask = - ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL; - - // Make sure there are no timers. - this->reactor ()->cancel_timer (this); - - // Remove self from reactor. - this->reactor ()->remove_handler (this, mask); - } - - this->peer ().close (); - - return 0; -} - -// **************************************************************** - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Svc_Handler; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Svc_Handler - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.h deleted file mode 100644 index 68653ca6af1..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.h +++ /dev/null @@ -1,176 +0,0 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO -// -// = FILENAME -// SSLIOP_Connect.h -// -// = AUTHOR -// Chris Cleeland -// -// ============================================================================ - -#ifndef TAO_SSLIOP_CONNECT_H -#define TAO_SSLIOP_CONNECT_H - -#include "ace/Reactor.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "SSL_SOCK_Stream.h" -#include "ace/Synch.h" -#include "ace/Svc_Handler.h" - -#include "tao/corbafwd.h" -#include "tao/Wait_Strategy.h" - -#include "SSLIOP_Transport.h" - -// Forward Decls -class TAO_ORB_Core; -class TAO_ORB_Core_TSS_Resources; - - -typedef ACE_Svc_Handler - TAO_SSL_SVC_HANDLER; - -// **************************************************************** - -class TAO_SSLIOP_Handler_Base : public TAO_SSL_SVC_HANDLER -{ -public: - TAO_SSLIOP_Handler_Base (ACE_Thread_Manager *t); - TAO_SSLIOP_Handler_Base (TAO_ORB_Core *orb_core); - - virtual TAO_Transport *transport (void) = 0; -}; - -class TAO_Export TAO_SSLIOP_Client_Connection_Handler : public TAO_SSLIOP_Handler_Base -{ - // = TITLE - // used on the client side and returned by the - // . -public: - // = Intialization method. - TAO_SSLIOP_Client_Connection_Handler (ACE_Thread_Manager *t = 0, - TAO_ORB_Core* orb_core = 0); - - virtual ~TAO_SSLIOP_Client_Connection_Handler (void); - - // = hook. - virtual int open (void *); - // Activation template method. - - // = Event Handler overloads - - virtual int handle_input (ACE_HANDLE = ACE_INVALID_HANDLE); - // Called when a response from a twoway invocation is available. - - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - // Called when buffering timer expires. - - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::NULL_MASK); - // Perform appropriate closing. - - virtual int handle_close_i (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::NULL_MASK); - // Perform appropriate closing but without grabbing any locks. - - virtual int close (u_long flags = 0); - // Object termination hook. - - virtual TAO_Transport *transport (void); - // Return the transport objects - -protected: - int handle_cleanup (void); - // This method deregisters the handler from the reactor and closes it. - - TAO_SSLIOP_Client_Transport transport_; - // Reference to the transport object, it is owned by this class. - - TAO_ORB_Core *orb_core_; - // Cached ORB Core. -}; - -// **************************************************************** - -class TAO_Export TAO_SSLIOP_Server_Connection_Handler : public TAO_SSLIOP_Handler_Base -{ - // = TITLE - // Handles requests on a single connection in a server. - -public: - TAO_SSLIOP_Server_Connection_Handler (ACE_Thread_Manager* t = 0); - TAO_SSLIOP_Server_Connection_Handler (TAO_ORB_Core *orb_core); - ~TAO_SSLIOP_Server_Connection_Handler (void); - // Constructor. - - virtual int open (void *); - // Called by the when the handler is completely - // connected. Argument is unused. - - // = Active object activation method. - virtual int activate (long flags = THR_NEW_LWP, - int n_threads = 1, - int force_active = 0, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - int grp_id = -1, - ACE_Task_Base *task = 0, - ACE_hthread_t thread_handles[] = 0, - void *stack[] = 0, - size_t stack_size[] = 0, - ACE_thread_t thread_names[] = 0); - - virtual int svc (void); - // Only used when the handler is turned into an active object by - // calling . This serves as the event loop in such cases. - - // = Template Methods Called by - - TAO_Transport *transport (void); - -protected: - - // = Event Handler overloads - - virtual int handle_input (ACE_HANDLE = ACE_INVALID_HANDLE); - virtual int handle_input_i (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Time_Value *max_wait_time = 0); - // Reads a message from the , dispatching and servicing it - // appropriately. - // handle_input() just delegates on handle_input_i() which timeouts - // after , this is used in thread-per-connection to - // ensure that server threads eventually exit. - - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::NULL_MASK); - // Perform appropriate closing. - -protected: - TAO_SSLIOP_Server_Transport transport_; - // @@ New transport object reference. - - TAO_ORB_Core *orb_core_; - // Cached ORB Core. - - TAO_ORB_Core_TSS_Resources *tss_resources_; - // Cached tss resources of the ORB that activated this object. - - u_long refcount_; - // Reference count, to avoid early deletes... -}; - -#if defined (__ACE_INLINE__) -#include "SSLIOP_Connect.i" -#endif /* __ACE_INLINE__ */ - -#endif /* TAO_SSLIOP_CONNECT_H */ diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.i b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.i deleted file mode 100644 index 5ffc4050b9f..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.i +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// $Id$ - -ACE_INLINE TAO_Transport * -TAO_SSLIOP_Server_Connection_Handler::transport (void) -{ - return &(this->transport_); -} - -ACE_INLINE TAO_Transport * -TAO_SSLIOP_Client_Connection_Handler::transport (void) -{ - return &(this->transport_); -} diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp deleted file mode 100644 index af284077f7f..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp +++ /dev/null @@ -1,556 +0,0 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - -#include "SSLIOP_Connector.h" -#include "SSLIOP_Profile.h" -#include "tao/GIOP.h" -#include "tao/debug.h" -#include "tao/ORB_Core.h" -#include "tao/Client_Strategy_Factory.h" -#include "tao/Environment.h" -#include "ace/Auto_Ptr.h" - -ACE_RCSID(tao, SSLIOP_Connector, "$Id$") - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) -int -TAO_SSLIOP_Connector::purge_connections (void) -{ - return this->cached_connect_strategy_->purge_connections (); -} - -#define TAO_HANDLER TAO_SSLIOP_Client_Connection_Handler -#define TAO_SVC_TUPLE ACE_Svc_Tuple -#define TAO_ADDR TAO_SSLIOP_Connector::TAO_IADDR -#define TAO_HASH_KEY TAO_SSLIOP_Connector::TAO_HASH_KEY -#define TAO_COMPARE_KEYS TAO_SSLIOP_Connector::TAO_COMPARE_KEYS -#define TAO_ATTRIBUTES TAO_SSLIOP_Connector::TAO_ATTRIBUTES -#define TAO_CACHED_HANDLER TAO_SSLIOP_Connector::TAO_CACHED_HANDLER -#define TAO_HASH_MAP TAO_SSLIOP_Connector::TAO_HASH_MAP -#define TAO_HASH_MAP_ITERATOR TAO_SSLIOP_Connector::TAO_HASH_MAP_ITERATOR -#define TAO_HASH_MAP_REVERSE_ITERATOR TAO_SSLIOP_Connector::TAO_HASH_MAP_REVERSE_ITERATOR -#define TAO_CACHING_UTILITY TAO_SSLIOP_Connector::TAO_CACHING_UTILITY -#define TAO_CACHING_STRATEGY TAO_SSLIOP_Connector::TAO_CACHING_STRATEGY -#define TAO_CACHED_CONNECT_STRATEGY TAO_SSLIOP_Connector::TAO_CACHED_CONNECT_STRATEGY - -typedef ACE_LRU_Caching_Strategy - TAO_SSLIOP_LRU_CACHING_STRATEGY; - -#if defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES) -typedef TAO_SSLIOP_LRU_CACHING_STRATEGY - TAO_SSLIOP_CACHING_STRATEGY; -#else -typedef ACE_Caching_Strategy - TAO_SSLIOP_CACHING_STRATEGY; -typedef ACE_LFU_Caching_Strategy - TAO_SSLIOP_LFU_CACHING_STRATEGY; -typedef ACE_FIFO_Caching_Strategy - TAO_SSLIOP_FIFO_CACHING_STRATEGY; -typedef ACE_Null_Caching_Strategy - TAO_SSLIOP_NULL_CACHING_STRATEGY; -typedef ACE_Caching_Strategy_Adapter - TAO_SSLIOP_LRU_CACHING_STRATEGY_ADAPTER; -typedef ACE_Caching_Strategy_Adapter - TAO_SSLIOP_LFU_CACHING_STRATEGY_ADAPTER; -typedef ACE_Caching_Strategy_Adapter - TAO_SSLIOP_FIFO_CACHING_STRATEGY_ADAPTER; -typedef ACE_Caching_Strategy_Adapter - TAO_SSLIOP_NULL_CACHING_STRATEGY_ADAPTER; -#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */ - -int -TAO_SSLIOP_Connector::make_caching_strategy (void) -{ - if (this->TAO_IIOP_Connector::make_caching_strategy () == -1) - return -1; - - TAO_Resource_Factory *resource_factory = - this->orb_core_->resource_factory (); - -#if defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES) - ACE_NEW_RETURN (this->caching_strategy_, - TAO_SSLIOP_CACHING_STRATEGY, - -1); -#else - switch (resource_factory->connection_caching_strategy_type ()) - { - case TAO_Resource_Factory::NOOP: - ACE_NEW_RETURN (this->caching_strategy_, - TAO_SSLIOP_NULL_CACHING_STRATEGY_ADAPTER, - -1); - break; - - default: - case TAO_Resource_Factory::LRU: - ACE_NEW_RETURN (this->caching_strategy_, - TAO_SSLIOP_LRU_CACHING_STRATEGY_ADAPTER, - -1); - break; - - case TAO_Resource_Factory::LFU: - ACE_NEW_RETURN (this->caching_strategy_, - TAO_SSLIOP_LFU_CACHING_STRATEGY_ADAPTER, - -1); - break; - - case TAO_Resource_Factory::FIFO: - ACE_NEW_RETURN (this->caching_strategy_, - TAO_SSLIOP_FIFO_CACHING_STRATEGY_ADAPTER, - -1); - break; - } - -#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */ - - this->caching_strategy_->purge_percent (resource_factory->purge_percentage ()); - return 0; -} -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -// The TAO_Cached_Connector_Lock template instantiations are in -// Resource_Factory.cpp. - -#if !defined (TAO_USES_ROBUST_CONNECTION_MGMT) -#define TAO_SVC_TUPLE ACE_Svc_Tuple -#define CACHED_CONNECT_STRATEGY ACE_Cached_Connect_Strategy -#define TAO_ADDR ACE_Refcounted_Hash_Recyclable -#define TAO_HANDLER TAO_SSLIOP_Client_Connection_Handler -#define TAO_HASH_KEY ACE_Hash -#define TAO_COMPARE_KEYS ACE_Equal_To -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ - defined (ACE_HAS_GNU_REPO) - -template class ACE_Auto_Basic_Array_Ptr; -template class ACE_Auto_Basic_Array_Ptr; -template class auto_ptr; -template class ACE_Auto_Basic_Ptr; - -template class ACE_Node; -template class ACE_Unbounded_Stack; -template class ACE_Unbounded_Stack_Iterator; - -#if !defined (TAO_USES_ROBUST_CONNECTION_MGMT) -template class CACHED_CONNECT_STRATEGY; -template class TAO_ADDR; -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -template class ACE_Svc_Handler; -template class ACE_Refcounted_Hash_Recyclable; -template class ACE_NOOP_Creation_Strategy; -template class ACE_Concurrency_Strategy; -template class ACE_Connect_Strategy; -template class ACE_Connector; -template class ACE_Creation_Strategy; -template class ACE_Hash_Map_Entry; -template class ACE_Hash >; -template class ACE_Equal_To >; -template class ACE_Map_Entry; -template class ACE_Map_Manager; -template class ACE_Map_Iterator_Base; -template class ACE_Map_Iterator; -template class ACE_Map_Reverse_Iterator; -template class ACE_NOOP_Concurrency_Strategy; -template class ACE_Recycling_Strategy; -template class ACE_Strategy_Connector; -template class TAO_SVC_TUPLE; - -template class ACE_Hash_Map_Manager; -template class ACE_Hash_Map_Iterator; -template class ACE_Hash_Map_Reverse_Iterator; -template class ACE_Hash_Map_Manager_Ex; -template class ACE_Hash_Map_Iterator_Ex; -template class ACE_Hash_Map_Reverse_Iterator_Ex; -template class ACE_Hash_Map_Iterator_Base_Ex; -template class ACE_Hash_Map_Bucket_Iterator; - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) -template class ACE_Pair; -template class ACE_Reference_Pair; -template class ACE_Hash_Map_Entry; - -template class ACE_Hash_Map_Manager; -template class ACE_Hash_Map_Iterator; -template class ACE_Hash_Map_Reverse_Iterator; -template class ACE_Hash_Map_Manager_Ex; -template class ACE_Hash_Map_Iterator_Ex; -template class ACE_Hash_Map_Reverse_Iterator_Ex; -template class ACE_Hash_Map_Iterator_Base_Ex; -template class ACE_Hash_Map_Bucket_Iterator; - -// = Caching_Strategy -template class ACE_Hash_Cache_Map_Manager; - -template class ACE_LRU_Caching_Strategy; - -#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES) - -template class ACE_Caching_Strategy; -template class ACE_LFU_Caching_Strategy; -template class ACE_FIFO_Caching_Strategy; -template class ACE_Null_Caching_Strategy; - -template class ACE_Caching_Strategy_Adapter; -template class ACE_Caching_Strategy_Adapter; -template class ACE_Caching_Strategy_Adapter; -template class ACE_Caching_Strategy_Adapter; - -template class ACE_Cache_Map_Manager; -template class ACE_Cache_Map_Iterator; -template class ACE_Cache_Map_Reverse_Iterator; - -#else - -template class ACE_Cache_Map_Manager; - -#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */ - -template class ACE_Cached_Connect_Strategy_Ex; -template class ACE_Cached_Connect_Strategy; - -template class ACE_Cleanup_Strategy; -template class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy; -template class ACE_Refcounted_Recyclable_Handler_Caching_Utility; -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Auto_Basic_Array_Ptr -#pragma instantiate ACE_Auto_Basic_Array_Ptr -#pragma instantiate auto_ptr -#pragma instantiate ACE_Auto_Basic_Ptr - -#pragma instantiate ACE_Node -#pragma instantiate ACE_Unbounded_Stack -#pragma instantiate ACE_Unbounded_Stack_Iterator - -#if !defined (TAO_USES_ROBUST_CONNECTION_MGMT) -#pragma instantiate CACHED_CONNECT_STRATEGY; -#pragma instantiate TAO_ADDR; -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -#pragma instantiate ACE_Svc_Handler -#pragma instantiate ACE_Refcounted_Hash_Recyclable -#pragma instantiate ACE_NOOP_Creation_Strategy -#pragma instantiate ACE_Concurrency_Strategy -#pragma instantiate ACE_Connect_Strategy -#pragma instantiate ACE_Connector -#pragma instantiate ACE_Creation_Strategy -#pragma instantiate ACE_Hash_Map_Entry -#pragma instantiate ACE_Hash > -#pragma instantiate ACE_Equal_To > -#pragma instantiate ACE_Map_Entry -#pragma instantiate ACE_Map_Manager -#pragma instantiate ACE_Map_Iterator_Base -#pragma instantiate ACE_Map_Iterator -#pragma instantiate ACE_Map_Reverse_Iterator -#pragma instantiate ACE_NOOP_Concurrency_Strategy -#pragma instantiate ACE_Recycling_Strategy -#pragma instantiate ACE_Strategy_Connector -#pragma instantiate TAO_SVC_TUPLE - -#pragma instantiate ACE_Hash_Map_Manager -#pragma instantiate ACE_Hash_Map_Iterator -#pragma instantiate ACE_Hash_Map_Reverse_Iterator -#pragma instantiate ACE_Hash_Map_Manager_Ex -#pragma instantiate ACE_Hash_Map_Iterator_Ex -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex -#pragma instantiate ACE_Hash_Map_Bucket_Iterator - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) -#pragma instantiate ACE_Pair -#pragma instantiate ACE_Reference_Pair -#pragma instantiate ACE_Hash_Map_Entry - -#pragma instantiate ACE_Hash_Map_Manager -#pragma instantiate ACE_Hash_Map_Iterator -#pragma instantiate ACE_Hash_Map_Reverse_Iterator -#pragma instantiate ACE_Hash_Map_Manager_Ex -#pragma instantiate ACE_Hash_Map_Iterator_Ex -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex -#pragma instantiate ACE_Hash_Map_Bucket_Iterator - -// = Caching_Strategy -#pragma instantiate ACE_Hash_Cache_Map_Manager - -#pragma instantiate ACE_LRU_Caching_Strategy - -#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES) - -#pragma instantiate ACE_Caching_Strategy -#pragma instantiate ACE_LFU_Caching_Strategy -#pragma instantiate ACE_FIFO_Caching_Strategy -#pragma instantiate ACE_Null_Caching_Strategy - -#pragma instantiate ACE_Caching_Strategy_Adapter -#pragma instantiate ACE_Caching_Strategy_Adapter -#pragma instantiate ACE_Caching_Strategy_Adapter -#pragma instantiate ACE_Caching_Strategy_Adapter - -#pragma instantiate ACE_Cache_Map_Manager -#pragma instantiate ACE_Cache_Map_Iterator -#pragma instantiate ACE_Cache_Map_Reverse_Iterator - -#else - -#pragma instantiate ACE_Cache_Map_Manager - -#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */ - -#pragma instantiate ACE_Cached_Connect_Strategy_Ex -#pragma instantiate ACE_Cached_Connect_Strategy - -#pragma instantiate ACE_Cleanup_Strategy -#pragma instantiate ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy -#pragma instantiate ACE_Refcounted_Recyclable_Handler_Caching_Utility -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -TAO_SSLIOP_Connect_Creation_Strategy:: - TAO_SSLIOP_Connect_Creation_Strategy (ACE_Thread_Manager* t, - TAO_ORB_Core *orb_core) - : ACE_Creation_Strategy (t), - orb_core_ (orb_core) -{ -} - -int -TAO_SSLIOP_Connect_Creation_Strategy::make_svc_handler - (TAO_SSLIOP_Client_Connection_Handler *&sh) -{ - if (sh == 0) - ACE_NEW_RETURN (sh, - TAO_SSLIOP_Client_Connection_Handler - (this->orb_core_->thr_mgr (), - this->orb_core_), - -1); - return 0; -} - -// **************************************************************** - -#if !defined (TAO_USES_ROBUST_CONNECTION_MGMT) -typedef ACE_Cached_Connect_Strategy - TAO_CACHED_CONNECT_STRATEGY; -#endif /* ! TAO_USES_ROBUST_CONNECTION_MGMT */ - -TAO_SSLIOP_Connector::TAO_SSLIOP_Connector (int default_is_ssl) - : TAO_IIOP_Connector (), - default_is_ssl_ (default_is_ssl), - base_connector_ () -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) - , - cached_connect_strategy_ (0), - caching_strategy_ (0) -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ -{ -} - -int -TAO_SSLIOP_Connector::open (TAO_ORB_Core *orb_core) -{ - if (this->TAO_IIOP_Connector::open (orb_core) == -1) - return -1; - - TAO_SSLIOP_Connect_Creation_Strategy *connect_creation_strategy = 0; - - ACE_NEW_RETURN (connect_creation_strategy, - TAO_SSLIOP_Connect_Creation_Strategy - (this->orb_core_->thr_mgr (), - this->orb_core_), - -1); - - auto_ptr - new_connect_creation_strategy (connect_creation_strategy); - - TAO_Cached_Connector_Lock *connector_lock = 0; - ACE_NEW_RETURN (connector_lock, - TAO_Cached_Connector_Lock (this->orb_core_), - -1); - - auto_ptr new_connector_lock (connector_lock); - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) - ACE_NEW_RETURN (this->cached_connect_strategy_, - TAO_CACHED_CONNECT_STRATEGY (*this->caching_strategy_, - new_connect_creation_strategy.get (), - 0, - 0, - new_connector_lock.get (), - 1), - -1); -#else /* TAO_USES_ROBUST_CONNECTION_MGMT */ - TAO_CACHED_CONNECT_STRATEGY *cached_connect_strategy = 0; - ACE_NEW_RETURN (cached_connect_strategy, - TAO_CACHED_CONNECT_STRATEGY - (new_connect_creation_strategy.get (), - 0, - 0, - new_connector_lock.get (), - 1), - -1); -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - - // Finally everything is fine. Make sure to take ownership away - // from the auto pointer. - connect_creation_strategy = - new_connect_creation_strategy.release (); - connector_lock = - new_connector_lock.release (); - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) - return this->base_connector_.open (this->orb_core_->reactor (), - &this->null_creation_strategy_, - this->cached_connect_strategy_, - &this->null_activation_strategy_); -#else /* TAO_USES_ROBUST_CONNECTION_MGMT */ - return this->base_connector_.open (this->orb_core_->reactor (), - &this->null_creation_strategy_, - cached_connect_strategy, - &this->null_activation_strategy_); -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ -} - -int -TAO_SSLIOP_Connector::close (void) -{ - this->base_connector_.close (); - - // Zap the creation strategy that we created earlier -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) - delete this->cached_connect_strategy_->creation_strategy (); - delete this->cached_connect_strategy_; - delete this->caching_strategy_; -#else /* TAO_USES_ROBUST_CONNECTION_MGMT */ - TAO_CACHED_CONNECT_STRATEGY *cached_connect_strategy = - ACE_dynamic_cast (TAO_CACHED_CONNECT_STRATEGY *, - this->base_connector_.connect_strategy ()); - - delete cached_connect_strategy->creation_strategy (); - delete cached_connect_strategy; -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - - return 0; -} - -int -TAO_SSLIOP_Connector::connect (TAO_Profile *pfile, - TAO_Transport *&transport, - ACE_Time_Value *max_wait_time) -{ - // @@ Use the policies to decide if SSL is the right protocol... - if (!this->default_is_ssl_) - return this->TAO_IIOP_Connector::connect (pfile, - transport, - max_wait_time); - - if (pfile->tag () != TAO_TAG_IIOP_PROFILE) - return -1; - - TAO_SSLIOP_Profile *profile = - ACE_dynamic_cast (TAO_SSLIOP_Profile *, - pfile); - if (profile == 0) - return -1; - - if (profile->ssl_port () == 0) - return this->TAO_IIOP_Connector::connect (pfile, - transport, - max_wait_time); - - ACE_INET_Addr oa = - profile->object_addr (); - oa.set_port_number (profile->ssl_port ()); - - ACE_Synch_Options synch_options; - if (max_wait_time != 0) - synch_options.set (ACE_Synch_Options::USE_TIMEOUT, - *max_wait_time); - - TAO_SSLIOP_Client_Connection_Handler* result; - - // The connect call will set the hint () stored in the Profile - // object; but we obtain the transport in the - // variable. Other threads may modify the hint, but we are not - // affected. - if (this->base_connector_.connect (profile->ssl_hint (), - result, - oa, - synch_options) == -1) - { // Give users a clue to the problem. - if (TAO_orbdebug) - { - char buffer [MAXHOSTNAMELEN + 6 + 1]; - profile->addr_to_string (buffer, - sizeof(buffer) - 1); - ACE_DEBUG ((LM_ERROR, - "(%P|%t) %s:%u, connection to " - "%s failed (%p)\n", - __FILE__, - __LINE__, - buffer, - "errno")); - } - // @@ Without this reset_hint() call the ORB crashes after - // several attempts to reconnect, apparently because the cached - // connector already destroyed the object. Using reset_hint() - // seems to eliminate the problem, and actually purify is happy - // with it, but i have some doubts about it: wasn't the hint - // destroyed already by the connector? We (Fred and Carlos) - // thought about just setting the hint to 0, but that would not - // be thread-safe (other threads may be touching the same - // profile). At this point (the day before 1.0) i'm reluctant - // to change ACE, and this fix passes all the TAO tests - // (including the new ping/pong test in the tests/Faults - // directory). - profile->reset_hint (); - return -1; - } - - transport = result->transport (); - return 0; -} - -TAO_Profile * -TAO_SSLIOP_Connector::create_profile (TAO_InputCDR& cdr) -{ - TAO_Profile *pfile; - ACE_NEW_RETURN (pfile, - TAO_SSLIOP_Profile (this->orb_core_), - 0); - - int r = pfile->decode (cdr); - if (r == -1) - { - pfile->_decr_refcnt (); - pfile = 0; - } - - return pfile; -} - -void -TAO_SSLIOP_Connector::make_profile (const char *endpoint, - TAO_Profile *&profile, - CORBA::Environment &ACE_TRY_ENV) -{ - // The endpoint should be of the form: - // N.n@host:port/object_key - // or: - // host:port/object_key - - ACE_NEW_THROW_EX (profile, - TAO_SSLIOP_Profile (endpoint, - this->orb_core_, - 0, // @@ ssl_port - ACE_TRY_ENV), - CORBA::NO_MEMORY ()); - - ACE_CHECK; -} diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h deleted file mode 100644 index fe39f31968a..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h +++ /dev/null @@ -1,200 +0,0 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO -// -// = FILENAME -// SSLIOP_Connector.h -// -// = DESCRIPTION -// IIOP specific connector processing -// -// = AUTHOR -// Carlos O'Ryan & -// Ossama Othman -// -// ============================================================================ - -#ifndef TAO_SSLIOP_CONNECTOR_H -#define TAO_SSLIOP_CONNECTOR_H - -#include "tao/IIOP_Connector.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "SSL_SOCK_Connector.h" -#include "SSLIOP_Connect.h" -#include "tao/Resource_Factory.h" - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) -#if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ < 8 -#define ACE_HAS_BROKEN_EXTENDED_TEMPLATES -#endif /* __GNUC__ */ - -#include "ace/Cached_Connect_Strategy_T.h" -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -typedef ACE_Strategy_Connector - TAO_SSLIOP_BASE_CONNECTOR; - -// **************************************************************** - -class TAO_Export TAO_SSLIOP_Connect_Creation_Strategy : public ACE_Creation_Strategy -{ - // = TITLE - // Helper creation strategy - // - // = DESCRIPTION - // Creates UIOP_Client_Connection_Handler objects but satisfies - // the interface required by the - // ACE_Creation_Strategy - // -public: - TAO_SSLIOP_Connect_Creation_Strategy (ACE_Thread_Manager * = 0, - TAO_ORB_Core* orb_core = 0); - - virtual int make_svc_handler (TAO_SSLIOP_Client_Connection_Handler *&sh); - // Makes TAO_SSLIOP_Client_Connection_Handlers - -private: - TAO_ORB_Core* orb_core_; - // The ORB -}; - -// **************************************************************** - -class TAO_Export TAO_SSLIOP_Connector : public TAO_IIOP_Connector -{ - // = TITLE - // IIOP-specific Connector bridge for pluggable protocols. - // - // = DESCRIPTION - // Concrete instance of the TAO_Connector class. Responsible - // for establishing a connection with a server and is called from the - // Connector_Registory. - // -public: - // = Initialization and termination methods. - TAO_SSLIOP_Connector (int default_is_ssl = 0); - // Constructor. - - // = The TAO_Connector methods, please check the documentation on - // Pluggable.h - virtual int open (TAO_ORB_Core *orb_core); - virtual int close (void); - virtual int connect (TAO_Profile *profile, - TAO_Transport *&transport, - ACE_Time_Value *max_wait_time); - virtual TAO_Profile *create_profile (TAO_InputCDR& cdr); - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) - virtual int purge_connections (void); - // Purge "old" connections. -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -protected: - // = More TAO_Connector methods, please check the documentation on - // Pluggable.h - virtual void make_profile (const char *endpoint, - TAO_Profile *&, - CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()); - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) - virtual int make_caching_strategy (void); - // According to the option specified, create the appropriate caching - // strategy used for purging unused connections from the connection - // cache. -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -public: - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) - // = Connection Caching Strategy. - typedef size_t TAO_ATTRIBUTES; - typedef ACE_Pair - TAO_CACHED_HANDLER; - typedef ACE_Refcounted_Hash_Recyclable - TAO_IADDR; - typedef ACE_Hash TAO_HASH_KEY; - typedef ACE_Equal_To TAO_COMPARE_KEYS; - - typedef ACE_Hash_Map_Manager_Ex - TAO_HASH_MAP; - typedef ACE_Hash_Map_Iterator_Ex - TAO_HASH_MAP_ITERATOR; - typedef ACE_Hash_Map_Reverse_Iterator_Ex - TAO_HASH_MAP_REVERSE_ITERATOR; - - typedef ACE_Refcounted_Recyclable_Handler_Caching_Utility - TAO_CACHING_UTILITY; - -#if defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES) - typedef ACE_LRU_Caching_Strategy - TAO_CACHING_STRATEGY; -#else - typedef ACE_Caching_Strategy - TAO_CACHING_STRATEGY; -#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */ - - typedef ACE_Cached_Connect_Strategy_Ex - TAO_CACHED_CONNECT_STRATEGY; -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - - typedef ACE_NOOP_Concurrency_Strategy - TAO_NULL_ACTIVATION_STRATEGY; - - typedef ACE_NOOP_Creation_Strategy - TAO_NULL_CREATION_STRATEGY; - -private: - int default_is_ssl_; - // If not zero it tries to use SSL by default. - - TAO_NULL_ACTIVATION_STRATEGY null_activation_strategy_; - TAO_NULL_CREATION_STRATEGY null_creation_strategy_; - - TAO_SSLIOP_BASE_CONNECTOR base_connector_; - // The connector initiating connection requests for IIOP. - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) - TAO_CACHED_CONNECT_STRATEGY *cached_connect_strategy_; - // Cached connect strategy. - - TAO_CACHING_STRATEGY *caching_strategy_; - // Caching strategy which decides the order of removal of entries - // from the connection cache. -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -}; - -#endif /* TAO_SSLIOP_CONNECTOR_H */ diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp deleted file mode 100644 index d1c770c1b82..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// $Id$ - -#include "SSLIOP_Factory.h" -#include "SSLIOP_Acceptor.h" -#include "SSLIOP_Connector.h" -#include "SSL_Context.h" -#include "ace/Dynamic_Service.h" - -ACE_RCSID(tao, SSLIOP_Factory, "$Id$") - -static const char prefix_[] = "iiop"; - -TAO_SSLIOP_Protocol_Factory::TAO_SSLIOP_Protocol_Factory (void) - : major_ (TAO_DEF_GIOP_MAJOR), - minor_ (TAO_DEF_GIOP_MINOR), - use_ssl_ (1) -{ -} - -TAO_SSLIOP_Protocol_Factory::~TAO_SSLIOP_Protocol_Factory (void) -{ -} - -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); -} - -const char * -TAO_SSLIOP_Protocol_Factory::prefix (void) const -{ - return ::prefix_; -} - -char -TAO_SSLIOP_Protocol_Factory::options_delimiter (void) const -{ - return '/'; -} - -TAO_Acceptor * -TAO_SSLIOP_Protocol_Factory::make_acceptor (void) -{ - TAO_Acceptor *acceptor = 0; - - ACE_NEW_RETURN (acceptor, - TAO_SSLIOP_Acceptor (), - 0); - - return acceptor; -} - -int -TAO_SSLIOP_Protocol_Factory::init (int argc, - char* argv[]) -{ - for (int curarg = 0; curarg != argc; ++curarg) - { - if (ACE_OS::strcasecmp (argv[curarg], - "-SSLDisable") == 0) - { - this->use_ssl_ = 0; - } - - else if (ACE_OS::strcasecmp (argv[curarg], - "-SSLCertificate") == 0) - { - curarg++; - if (curarg < argc) - { - char *lasts = 0; - const char *type_name = - ACE_OS::strtok_r (argv[curarg], ":", &lasts); - const char *path = - ACE_OS::strtok_r (0, ":", &lasts); - int type = -1; - if (ACE_OS::strcasecmp (type_name, "ASN1") == 0) - { - type = SSL_FILETYPE_ASN1; - } - else if (ACE_OS::strcasecmp (type_name, "PEM") == 0) - { - type = SSL_FILETYPE_PEM; - } - ACE_SSL_Context::instance ()->certificate (path, type); - } - } - - else if (ACE_OS::strcasecmp (argv[curarg], - "-SSLPrivateKey") == 0) - { - curarg++; - if (curarg < argc) - { - char *lasts = 0; - const char *type_name = - ACE_OS::strtok_r (argv[curarg], ":", &lasts); - const char *path = - ACE_OS::strtok_r (0, ":", &lasts); - int type = -1; - if (ACE_OS::strcasecmp (type_name, "ASN1") == 0) - { - type = SSL_FILETYPE_ASN1; - } - else if (ACE_OS::strcasecmp (type_name, "PEM") == 0) - { - type = SSL_FILETYPE_PEM; - } - ACE_SSL_Context::instance ()->private_key (path, type); - } - } - - else if (ACE_OS::strcasecmp (argv[curarg], - "-SSLAuthenticate") == 0) - { - curarg++; - if (curarg < argc) - { - int mode = SSL_VERIFY_NONE; - if (ACE_OS::strcasecmp (argv[curarg], "NONE") == 0) - { - mode = SSL_VERIFY_NONE; - } - else if (ACE_OS::strcasecmp (argv[curarg], "SERVER") == 0) - { - mode = SSL_VERIFY_PEER; - } - else if (ACE_OS::strcasecmp (argv[curarg], "CLIENT") == 0 - || ACE_OS::strcasecmp (argv[curarg], - "SERVER_AND_CLIENT") == 0) - { - mode = SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT; - } - ACE_SSL_Context::instance ()->default_verify_mode (mode); - } - } - } - - return 0; -} - -TAO_Connector * -TAO_SSLIOP_Protocol_Factory::make_connector (void) -{ - TAO_Connector *connector = 0; - - ACE_NEW_RETURN (connector, - TAO_SSLIOP_Connector (this->use_ssl_), - 0); - return connector; -} - -int -TAO_SSLIOP_Protocol_Factory::requires_explicit_endpoint (void) const -{ - return 0; -} - -ACE_STATIC_SVC_DEFINE (TAO_SSLIOP_Protocol_Factory, - ASYS_TEXT ("SSLIOP_Factory"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_SSLIOP_Protocol_Factory), - ACE_Service_Type::DELETE_THIS | - ACE_Service_Type::DELETE_OBJ, - 0) - -ACE_FACTORY_DEFINE (TAO, TAO_SSLIOP_Protocol_Factory) diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.h deleted file mode 100644 index f1d363bdc83..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.h +++ /dev/null @@ -1,68 +0,0 @@ -// -*- C++ -*- -// $Id$ -// ============================================================================ -// -// = LIBRARY -// TAO -// -// = FILENAME -// Protocol_Factory.h -// -// = AUTHOR -// Fred Kuhns -// -// ============================================================================ - -#ifndef TAO_SSLIOP_FACTORY_H -#define TAO_SSLIOP_FACTORY_H - -#include "tao/Protocol_Factory.h" - -#include "SSL_Context.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -class TAO_Acceptor; -class TAO_Connector; - -class TAO_Export TAO_SSLIOP_Protocol_Factory : public TAO_Protocol_Factory -{ -public: - TAO_SSLIOP_Protocol_Factory (void); - virtual ~TAO_SSLIOP_Protocol_Factory (void); - - // = Service Configurator hooks. - virtual int init (int argc, char* argv[]); - // Dynamic linking hook - - virtual int match_prefix (const ACE_CString &prefix); - // Verify prefix is a match - - virtual const char *prefix (void) const; - // Returns the prefix used by the protocol. - - virtual char options_delimiter (void) const; - // Return the character used to mark where an endpoint ends and - // where its options begin. - - // = Check Protocol_Factory.h for a description of these methods. - virtual TAO_Acceptor *make_acceptor (void); - virtual TAO_Connector *make_connector (void); - virtual int requires_explicit_endpoint (void) const; - -private: - int major_; - int minor_; - // Changing the version number can be used to provide backwards - // compatibility with old clients. - - int use_ssl_; - // Use SSL when establishing connections -}; - -ACE_STATIC_SVC_DECLARE (TAO_SSLIOP_Protocol_Factory) -ACE_FACTORY_DECLARE (TAO, TAO_SSLIOP_Protocol_Factory) - -#endif /* TAO_SSLIOP_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp deleted file mode 100644 index 9f582a9ad9b..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - -#include "SSLIOP_Profile.h" -#include "SSLIOP_Connect.h" -#include "tao/GIOP.h" -#include "tao/CDR.h" -#include "tao/Environment.h" -#include "tao/ORB.h" -#include "tao/ORB_Core.h" -#include "tao/debug.h" - -ACE_RCSID(tao, SSLIOP_Profile, "$Id$") - -#if !defined (__ACE_INLINE__) -# include "SSLIOP_Profile.i" -#endif /* __ACE_INLINE__ */ - -TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (const ACE_INET_Addr &addr, - const TAO_ObjectKey &object_key, - const TAO_GIOP_Version &version, - TAO_ORB_Core *orb_core, - u_short ssl_port) - : TAO_IIOP_Profile (addr, - object_key, - version, - orb_core), - ssl_hint_ (0) -{ - this->ssl_component_.port = ssl_port; -} - -TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (const char* host, - CORBA::UShort port, - const TAO_ObjectKey &object_key, - const ACE_INET_Addr &addr, - const TAO_GIOP_Version &version, - TAO_ORB_Core *orb_core, - u_short ssl_port) - : TAO_IIOP_Profile (host, - port, - object_key, - addr, - version, - orb_core), - ssl_hint_ (0) -{ - this->ssl_component_.port = ssl_port; -} - -TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (const char *string, - TAO_ORB_Core *orb_core, - u_short ssl_port, - CORBA::Environment &ACE_TRY_ENV) - : TAO_IIOP_Profile (string, orb_core, ACE_TRY_ENV), - ssl_hint_ (0) -{ - this->ssl_component_.port = ssl_port; -} - -TAO_SSLIOP_Profile::TAO_SSLIOP_Profile (TAO_ORB_Core *orb_core) - : TAO_IIOP_Profile (orb_core), - ssl_hint_ (0) -{ - this->ssl_component_.port = 0; -} - -TAO_SSLIOP_Profile::~TAO_SSLIOP_Profile (void) -{ -} - -void -TAO_SSLIOP_Profile::reset_hint (void) -{ - this->TAO_IIOP_Profile::reset_hint (); - // @@ Who is doing the locking here! - if (this->ssl_hint_) - { - this->ssl_hint_->cleanup_hint (); - this->ssl_hint_ = 0; - } -} - -// return codes: -// -1 -> error -// 0 -> can't understand this version -// 1 -> success. -int -TAO_SSLIOP_Profile::decode (TAO_InputCDR& cdr) -{ - int r = this->TAO_IIOP_Profile::decode (cdr); - if (r != 1) - return r; - - IOP::TaggedComponent component; - component.tag = IOP::TAG_SSL_SEC_TRANS; - if (this->tagged_components ().get_component (component) == 0) - { - this->ssl_component_.port = 0; - return 1; - } - else - { - TAO_InputCDR cdr ( - ACE_reinterpret_cast (const char*, - component.component_data.get_buffer ()), - component.component_data.length ()); - CORBA::Boolean byte_order; - if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) - return -1; - cdr.reset_byte_order (ACE_static_cast(int,byte_order)); - - cdr >> this->ssl_component_; - } - - return 1; -} - -CORBA::Boolean -TAO_SSLIOP_Profile::is_equivalent (const TAO_Profile *other_profile) -{ - if (this->TAO_IIOP_Profile::is_equivalent (other_profile) == 0) - return 0; - - const TAO_SSLIOP_Profile *op = - ACE_dynamic_cast (const TAO_SSLIOP_Profile *, other_profile); - - if (this->ssl_component_.port != 0 - && op->ssl_component_.port != 0 - && this->ssl_component_.port != op->ssl_component_.port) - return 0; - // @@ Anything else to check???? - - return 1; -} diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h deleted file mode 100644 index ef72901dacb..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h +++ /dev/null @@ -1,107 +0,0 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO -// -// = FILENAME -// SSLIOP_Profile.h -// -// = DESCRIPTION -// IIOP profile specific processing -// -// = AUTHOR -// Fred Kuhns -// -// ============================================================================ - -#ifndef TAO_SSLIOP_PROFILE_H -#define TAO_SSLIOP_PROFILE_H - -#include "tao/IIOP_Profile.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "SSLIOPC.h" - -class TAO_SSLIOP_Client_Connection_Handler; - -// TAO SSLIOP_Profile concrete Profile definitions -class TAO_Export TAO_SSLIOP_Profile : public TAO_IIOP_Profile -{ - // = TITLE - // This class defines the protocol specific attributes required - // for locating ORBs over a TCP/IP network, using either IIOP or - // IIOP/SSL for communication. - // - // = DESCRIPTION - // This class extends TAO_IIOP_Profile to support secure - // communication using SSL. - // -public: - TAO_SSLIOP_Profile (const ACE_INET_Addr &addr, - const TAO_ObjectKey &object_key, - const TAO_GIOP_Version &version, - TAO_ORB_Core *orb_core, - u_short ssl_port = 0); - // Profile constructor, same as above except the object_key has - // already been marshaled. - - TAO_SSLIOP_Profile (const char *host, - CORBA::UShort port, - const TAO_ObjectKey &object_key, - const ACE_INET_Addr &addr, - const TAO_GIOP_Version &version, - TAO_ORB_Core *orb_core, - u_short ssl_port = 0); - // Profile constructor, this is the most efficient since it - // doesn't require any address resolution processing. - - TAO_SSLIOP_Profile (const char *string, - TAO_ORB_Core *orb_core, - u_short ssl_port, - CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()); - // Create object using a string ior. - - TAO_SSLIOP_Profile (TAO_ORB_Core *orb_core); - // Profile constructor, default. - - ~TAO_SSLIOP_Profile (void); - // Destructor is to be called only through <_decr_refcnt>. - - CORBA::UShort ssl_port (void) const; - // The port used for SSL communication. - - TAO_SSLIOP_Client_Connection_Handler *&ssl_hint (void); - // This is a hint for which connection handler to use. - - // = Please see Profile.h for the documentation of these methods. - virtual int decode (TAO_InputCDR& cdr); - virtual CORBA::Boolean is_equivalent (const TAO_Profile *other_profile); - virtual void reset_hint (void); - -private: - TAO_SSLIOP_Profile (const TAO_SSLIOP_Profile &pfile); - TAO_SSLIOP_Profile &operator= (const TAO_SSLIOP_Profile &src); - // private & undefined - -private: - SSLIOP::SSL ssl_component_; - // Cache the SSL tagged component in a decoded format. Notice that - // we do not need to marshal this object! - - TAO_SSLIOP_Client_Connection_Handler *ssl_hint_; - // Pointer to a connection handler which we successfully used - // already. -}; - -#if defined (__ACE_INLINE__) -# include "SSLIOP_Profile.i" -#endif /* __ACE_INLINE__ */ - -#endif /* TAO_SSLIOP_PROFILE_H */ diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.i b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.i deleted file mode 100644 index dccef239ec9..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.i +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// $Id$ - -ACE_INLINE CORBA::UShort -TAO_SSLIOP_Profile::ssl_port (void) const -{ - return this->ssl_component_.port; -} - -ACE_INLINE TAO_SSLIOP_Client_Connection_Handler *& -TAO_SSLIOP_Profile::ssl_hint(void) -{ - return this->ssl_hint_; -} diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp deleted file mode 100644 index b50e02dfd8e..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp +++ /dev/null @@ -1,428 +0,0 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - -#include "SSLIOP_Transport.h" -#include "SSLIOP_Connect.h" -#include "SSLIOP_Profile.h" -#include "tao/Timeprobe.h" -#include "tao/CDR.h" -#include "tao/Transport_Mux_Strategy.h" -#include "tao/Wait_Strategy.h" -#include "tao/Sync_Strategies.h" -#include "tao/Stub.h" -#include "tao/ORB_Core.h" -#include "tao/debug.h" - -#if defined (ACE_ENABLE_TIMEPROBES) - -static const char *TAO_Transport_Timeprobe_Description[] = - { - "SSLIOP_Transport::send - start", - "SSLIOP_Transport::send - end", - - "SSLIOP_Transport::receive - start", - "SSLIOP_Transport::receive - end", - - "SSLIOP_Client_Transport::start_request - start", - "SSLIOP_Client_Transport::start_request - end" - }; - -enum - { - TAO_SSLIOP_TRANSPORT_SEND_START = 2200, - TAO_SSLIOP_TRANSPORT_SEND_END, - - TAO_SSLIOP_TRANSPORT_RECEIVE_START, - TAO_SSLIOP_TRANSPORT_RECEIVE_END, - - TAO_SSLIOP_CLIENT_TRANSPORT_START_REQUEST_START, - TAO_SSLIOP_CLIENT_TRANSPORT_START_REQUEST_END - }; - - -// Setup Timeprobes -ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Transport_Timeprobe_Description, - TAO_SSLIOP_TRANSPORT_SEND_START); - -#endif /* ACE_ENABLE_TIMEPROBES */ - -TAO_SSLIOP_Transport::TAO_SSLIOP_Transport (TAO_SSLIOP_Handler_Base *handler, - TAO_ORB_Core *orb_core) - : TAO_Transport (TAO_TAG_IIOP_PROFILE, - orb_core), - handler_ (handler) -{ -} - -TAO_SSLIOP_Transport::~TAO_SSLIOP_Transport (void) -{ -} - -TAO_SSLIOP_Handler_Base *& -TAO_SSLIOP_Transport::handler (void) -{ - return this->handler_; -} - -int -TAO_SSLIOP_Transport::idle (void) -{ - return this->handler_->idle(); -} - -void -TAO_SSLIOP_Transport::close_connection (void) -{ - this->handler_->handle_close (); -} - -ACE_HANDLE -TAO_SSLIOP_Transport::handle (void) -{ - return this->handler_->get_handle (); -} - -ACE_Event_Handler * -TAO_SSLIOP_Transport::event_handler (void) -{ - return this->handler_; -} - -// **************************************************************** - -TAO_SSLIOP_Server_Transport:: - TAO_SSLIOP_Server_Transport (TAO_SSLIOP_Server_Connection_Handler *handler, - TAO_ORB_Core* orb_core) - : TAO_SSLIOP_Transport (handler, orb_core), - server_handler_ (handler), - message_state_ (orb_core) -{ -} - -TAO_SSLIOP_Server_Transport::~TAO_SSLIOP_Server_Transport (void) -{ -} - -// **************************************************************** - -TAO_SSLIOP_Client_Transport:: - TAO_SSLIOP_Client_Transport (TAO_SSLIOP_Client_Connection_Handler *handler, - TAO_ORB_Core *orb_core) - : TAO_SSLIOP_Transport (handler, - orb_core), - client_handler_ (handler) -{ -} - -TAO_SSLIOP_Client_Transport::~TAO_SSLIOP_Client_Transport (void) -{ -} - -TAO_SSLIOP_Client_Connection_Handler * -TAO_SSLIOP_Client_Transport::client_handler (void) -{ - return this->client_handler_; -} - -void -TAO_SSLIOP_Client_Transport::start_request (TAO_ORB_Core *orb_core, - const TAO_Profile* pfile, - TAO_OutputCDR &output, - CORBA::Environment &ACE_TRY_ENV) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - TAO_FUNCTION_PP_TIMEPROBE (TAO_SSLIOP_CLIENT_TRANSPORT_START_REQUEST_START); - - const TAO_SSLIOP_Profile* profile = - ACE_dynamic_cast(const TAO_SSLIOP_Profile*, pfile); - - // @@ This should be implemented in the transport object, which - // would query the profile to obtain the version... - if (TAO_GIOP::start_message (profile->version (), - TAO_GIOP::Request, - output, - orb_core) == 0) - ACE_THROW (CORBA::MARSHAL ()); -} - -void -TAO_SSLIOP_Client_Transport::start_locate (TAO_ORB_Core *orb_core, - const TAO_Profile* pfile, - CORBA::ULong request_id, - TAO_OutputCDR &output, - CORBA::Environment &ACE_TRY_ENV) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - const TAO_SSLIOP_Profile* profile = - ACE_dynamic_cast(const TAO_SSLIOP_Profile*, pfile); - - // Obtain object key. - const TAO_ObjectKey& key = profile->object_key (); - - // @@ This should be implemented in the transport object, which - // would query the profile to obtain the version... - if (TAO_GIOP::start_message (profile->version (), - TAO_GIOP::LocateRequest, - output, - orb_core) == 0) - ACE_THROW (CORBA::MARSHAL ()); - - - if (TAO_GIOP::write_locate_request_header (request_id, - key, - output) == 0) - ACE_THROW (CORBA::MARSHAL ()); -} - -int -TAO_SSLIOP_Client_Transport::send_request (TAO_Stub *stub, - TAO_ORB_Core *orb_core, - TAO_OutputCDR &stream, - int two_way, - ACE_Time_Value *max_wait_time) -{ - if (this->ws_->sending_request (orb_core, - two_way) == -1) - return -1; - - if (TAO_GIOP::send_message (this, - stream, - orb_core, - max_wait_time, - stub) == -1) - return -1; - - return this->idle_after_send (); -} - -// Return 0, when the reply is not read fully, 1 if it is read fully. -// @@ This code should go in the TAO_Transport class is repeated for -// each transport!! -int -TAO_SSLIOP_Client_Transport::handle_client_input (int /* block */, - ACE_Time_Value *max_wait_time) -{ - - // Notice that the message_state is only modified in one thread at a - // time because the reactor does not call handle_input() for the - // same Event_Handler in two threads at the same time. - - // Get the message state from the Transport Mux Strategy. - TAO_GIOP_Message_State* message_state = - this->tms_->get_message_state (); - - if (message_state == 0) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) SSLIOP_Transport::handle_client_input -" - " nil message state\n")); - return -1; - } - - int result = TAO_GIOP::handle_input (this, - this->orb_core_, - *message_state, - max_wait_time); - if (result == -1) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - %p\n", - "SSLIOP_Transport::handle_client_input, handle_input")); - return -1; - } - if (result == 0) - return result; - - // OK, the complete message is here... - - IOP::ServiceContextList reply_ctx; - CORBA::ULong request_id; - CORBA::ULong reply_status; - - result = TAO_GIOP::parse_reply (this, - this->orb_core_, - *message_state, - reply_ctx, - request_id, - reply_status); - if (result == -1) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - %p\n", - "SSLIOP_Transport::handle_client_input, parse reply")); - message_state->reset (); - return -1; - } - - result = - this->tms_->dispatch_reply (request_id, - reply_status, - message_state->giop_version, - reply_ctx, - message_state); - - if (result == -1) - { - if (TAO_debug_level > 0) - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) : SSLIOP_Client_Transport::" - "handle_client_input - " - "dispatch reply failed\n")); - message_state->reset (); - return -1; - } - - if (result == 0) - { - message_state->reset (); - return 0; - } - - // This is a NOOP for the Exclusive request case, but it actually - // destroys the stream in the muxed case. - this->tms_->destroy_message_state (message_state); - - return result; -} - -int -TAO_SSLIOP_Client_Transport::register_handler (void) -{ - // @@ It seems like this method should go away, the right reactor is - // picked at object creation time. - ACE_Reactor *r = this->orb_core ()->reactor (); - if (r == this->client_handler ()->reactor ()) - return 0; - - return r->register_handler (this->client_handler (), - ACE_Event_Handler::READ_MASK); -} - -// ********************************************************************* - -ssize_t -TAO_SSLIOP_Transport::send (TAO_Stub *stub, - int two_way, - const ACE_Message_Block *message_block, - const ACE_Time_Value *max_wait_time) -{ - if (stub == 0 || two_way) - { - return this->send (message_block, - max_wait_time); - } - else - { - TAO_Sync_Strategy &sync_strategy = stub->sync_strategy (); - - return sync_strategy.send (*this, - *stub, - message_block, - max_wait_time); - } -} - -ssize_t -TAO_SSLIOP_Transport::send (const ACE_Message_Block *message_block, - const ACE_Time_Value *max_wait_time) -{ - TAO_FUNCTION_PP_TIMEPROBE (TAO_SSLIOP_TRANSPORT_SEND_START); - - // @@ This code should be refactored into ACE.cpp or something - // similar! - - // For the most part this was copied from GIOP::send_request and - // friends. - - iovec iov[IOV_MAX]; - int iovcnt = 0; - ssize_t n = 0; - ssize_t nbytes = 0; - - for (const ACE_Message_Block *i = message_block; - i != 0; - i = i->cont ()) - { - // Make sure there is something to send! - if (i->length () > 0) - { - iov[iovcnt].iov_base = i->rd_ptr (); - iov[iovcnt].iov_len = i->length (); - iovcnt++; - - // The buffer is full make a OS call. @@ TODO this should - // be optimized on a per-platform basis, for instance, some - // platforms do not implement writev() there we should copy - // the data into a buffer and call send_n(). In other cases - // there may be some limits on the size of the iovec, there - // we should set IOV_MAX to that limit. - if (iovcnt == IOV_MAX) - { - if (max_wait_time == 0) - n = this->handler_->peer ().sendv_n (iov, - iovcnt); - else - // @@ No timeouts!!! - n = this->handler_->peer ().sendv_n (iov, - iovcnt - /*, max_wait_time */); - - if (n <= 0) - return n; - - nbytes += n; - iovcnt = 0; - } - } - } - - // Check for remaining buffers to be sent! - if (iovcnt != 0) - { - n = this->handler_->peer ().sendv_n (iov, - iovcnt); - if (n < 1) - return n; - - nbytes += n; - } - - return nbytes; -} - -ssize_t -TAO_SSLIOP_Transport::send (const u_char *buf, - size_t len, - const ACE_Time_Value *) -{ - TAO_FUNCTION_PP_TIMEPROBE (TAO_SSLIOP_TRANSPORT_SEND_START); - - return this->handler_->peer ().send_n (buf, len); -} - -ssize_t -TAO_SSLIOP_Transport::recv (char *buf, - size_t len, - const ACE_Time_Value * /* max_wait_time */) -{ - TAO_FUNCTION_PP_TIMEPROBE (TAO_SSLIOP_TRANSPORT_RECEIVE_START); - - // @@ No timeouts! - return this->handler_->peer ().recv_n (buf, - len - /* , max_wait_time */); -} - -// Default action to be taken for send request. -int -TAO_SSLIOP_Transport::send_request (TAO_Stub *, - TAO_ORB_Core * /* orb_core */, - TAO_OutputCDR & /* stream */, - int /* twoway */, - ACE_Time_Value * /* max_wait_time */) -{ - return -1; -} diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h deleted file mode 100644 index ba77618ece2..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h +++ /dev/null @@ -1,167 +0,0 @@ -// This may look like C, but it's really -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO -// -// = FILENAME -// SSLIOP_Transport.h -// -// = DESCRIPTION -// IIOP Transport specific processing -// -// = AUTHOR -// Fred Kuhns -// -// ============================================================================ - -#ifndef TAO_SSLIOP_TRANSPORT_H -#define TAO_SSLIOP_TRANSPORT_H - -#include "tao/Pluggable.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/GIOP.h" - -// Forward decls. -class TAO_SSLIOP_Handler_Base; -class TAO_SSLIOP_Client_Connection_Handler; -class TAO_SSLIOP_Server_Connection_Handler; -class TAO_ORB_Core; - -class TAO_Export TAO_SSLIOP_Transport : public TAO_Transport -{ - // = TITLE - // This class acts as a bridge class to the transport specific - // connection handler (handler_). - // - // = DESCRIPTION - // Specialization of the base TAO_Transport class to handle the IIOP - // protocol. This class in turn will be further specialized for - // the client and server side. -public: - TAO_SSLIOP_Transport (TAO_SSLIOP_Handler_Base *handler, - TAO_ORB_Core *orb_core); - // Base object's creator method. - - ~TAO_SSLIOP_Transport (void); - // Default destructor. - - TAO_SSLIOP_Handler_Base *&handler (void); - // Return a reference to the corresponding connection handler. - - // = The TAO_Transport methods, please check the documentation in - // "tao/Pluggable.h" for more details. - virtual void close_connection (void); - virtual int idle (void); - virtual ACE_HANDLE handle (void); - virtual ACE_Event_Handler *event_handler (void); - virtual ssize_t send (TAO_Stub *stub, - int two_way, - const ACE_Message_Block *mblk, - const ACE_Time_Value *s = 0); - virtual ssize_t send (const ACE_Message_Block *mblk, - const ACE_Time_Value *s = 0); - virtual ssize_t send (const u_char *buf, - size_t len, - const ACE_Time_Value *s = 0); - virtual ssize_t recv (char *buf, - size_t len, - const ACE_Time_Value *s = 0); - virtual int send_request (TAO_Stub *stub, - TAO_ORB_Core *orb_core , - TAO_OutputCDR &stream, - int twoway, - ACE_Time_Value *max_wait_time); - -protected: - TAO_SSLIOP_Handler_Base *handler_; - // the connection service handler used for accessing lower layer - // communication protocols. -}; - -class TAO_Export TAO_SSLIOP_Client_Transport : public TAO_SSLIOP_Transport -{ - // = TITLE - // The Transport class used for Client side communication with a - // server. - // - // = DESCRIPTION - // Specialization of the TAO_SSLIOP_Transport class for client - // side. Methods related to sending one and two way requests - // lives here. -public: - TAO_SSLIOP_Client_Transport (TAO_SSLIOP_Client_Connection_Handler *handler, - TAO_ORB_Core *orb_core); - // Constructor. Note, TAO_SSLIOP_Handler_Base is the base class for - // both TAO_SSLIOP_Client_Connection_Handler and - // TAO_SSLIOP_Server_Connection_Handler. - - ~TAO_SSLIOP_Client_Transport (void); - // destructor - - TAO_SSLIOP_Client_Connection_Handler *client_handler (void); - // return a pointer to the client's connection handler. - - // = The TAO_Transport methods, please check the documentation in - // "tao/Pluggable.h" for more details. - virtual void start_request (TAO_ORB_Core *orb_core, - const TAO_Profile *profile, - TAO_OutputCDR &output, - CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void start_locate (TAO_ORB_Core *orb_core, - const TAO_Profile *profile, - CORBA::ULong request_id, - TAO_OutputCDR &output, - CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()) - ACE_THROW_SPEC ((CORBA::SystemException)); - virtual int send_request (TAO_Stub *stub, - TAO_ORB_Core *orb_core, - TAO_OutputCDR &stream, - int twoway, - ACE_Time_Value *max_wait_time); - virtual int handle_client_input (int block = 0, - ACE_Time_Value *max_time_value = 0); - virtual int register_handler (void); - -private: - TAO_SSLIOP_Client_Connection_Handler *client_handler_; - // pointer to the corresponding client side connection handler. -}; - -// **************************************************************** - -class TAO_Export TAO_SSLIOP_Server_Transport : public TAO_SSLIOP_Transport -{ - // = TITLE - // The Transport class used for server communication with a - // connected client. - // - // = DESCRIPTION - // Specialization of the TAO_SSLIOP_Transport class for the server side. - // methods for reading messages (requests) and sending replies live - // here. -public: - - TAO_SSLIOP_Server_Transport (TAO_SSLIOP_Server_Connection_Handler *handler, - TAO_ORB_Core *orb_core); - // Default creator method. - - ~TAO_SSLIOP_Server_Transport (void); - // Default destructor - - TAO_SSLIOP_Server_Connection_Handler *server_handler_; - // Pointer to the corresponding connection handler. - - TAO_GIOP_Message_State message_state_; - // This keep the state of the current message, to enable - // non-blocking reads, fragment reassembly, etc. -}; - -#endif /* TAO_SSLIOP_TRANSPORT_H */ diff --git a/ace/SSL/SSL_Context.cpp b/ace/SSL/SSL_Context.cpp deleted file mode 100644 index 6c45b938c69..00000000000 --- a/ace/SSL/SSL_Context.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// SSL_Context.cpp -// -// = AUTHOR -// Chris Zimman -// Carlos O'Ryan -// Ossama Othman -// -// ============================================================================ - -#if defined (ACE_HAS_SSL) - -#include "SSL_Context.h" -#include "sslconf.h" - -#if !defined(__ACE_INLINE__) -#include "SSL_Context.i" -#endif /* __ACE_INLINE__ */ - -#include "ace/Synch.h" -#include "ace/Object_Manager.h" - -#include -#include - -int ACE_SSL_Context::library_init_count_ = 0; - -ACE_SSL_Context::ACE_SSL_Context () - : context_ (0), - mode_ (-1), - default_verify_mode_ (SSL_VERIFY_NONE) -{ - ACE_SSL_Context::ssl_library_init (); -} - -ACE_SSL_Context::~ACE_SSL_Context () -{ - if (this->context_) - { - ::SSL_CTX_free(this->context_); - this->context_ = 0; - } - ACE_SSL_Context::ssl_library_fini (); -} - -void -ACE_SSL_Context::ssl_library_init () -{ - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, - ace_ssl_mon, - *ACE_Static_Object_Lock::instance ())); - - if (ACE_SSL_Context::library_init_count_ == 0) - { - ::SSL_library_init (); - ::SSL_load_error_strings (); - ::SSLeay_add_ssl_algorithms (); - } - ACE_SSL_Context::library_init_count_++; -} - -void -ACE_SSL_Context::ssl_library_fini () -{ - ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, - ace_ssl_mon, - *ACE_Static_Object_Lock::instance ())); - - ACE_SSL_Context::library_init_count_--; - if (ACE_SSL_Context::library_init_count_ == 0) - { - // @@ What should we do here??? - } -} - -int -ACE_SSL_Context::set_mode (int mode) -{ - if (this->context_ != 0) - return -1; - - SSL_METHOD *method = 0; - - switch (mode) - { - case ACE_SSL_Context::SSLv2_client: - method = ::SSLv2_client_method (); - break; - case ACE_SSL_Context::SSLv2_server: - method = ::SSLv2_server_method (); - break; - case ACE_SSL_Context::SSLv2: - method = ::SSLv2_method (); - break; - case ACE_SSL_Context::SSLv3_client: - method = ::SSLv3_client_method (); - break; - case ACE_SSL_Context::SSLv3_server: - method = ::SSLv3_server_method (); - break; - case ACE_SSL_Context::SSLv3: - method = ::SSLv3_method (); - break; - case ACE_SSL_Context::SSLv23_client: - method = ::SSLv23_client_method (); - break; - case ACE_SSL_Context::SSLv23_server: - method = ::SSLv23_server_method (); - break; - case ACE_SSL_Context::SSLv23: - method = ::SSLv23_method (); - break; - case ACE_SSL_Context::TLSv1_client: - method = ::TLSv1_client_method (); - break; - case ACE_SSL_Context::TLSv1_server: - method = ::TLSv1_server_method (); - break; - case ACE_SSL_Context::TLSv1: - method = ::TLSv1_method (); - break; - default: - method = ::SSLv3_method (); - break; - } - - this->context_ = ::SSL_CTX_new (method); - if (this->context_ == 0) - { - ::ERR_print_errors_fp (stderr); - return -1; - } - - this->mode_ = mode; - - const char *cert_file = ACE_OS::getenv (ACE_SSL_CERT_FILE_ENV); - if (cert_file == 0) - cert_file = ACE_DEFAULT_SSL_CERT_FILE; - const char *cert_dir = ACE_OS::getenv (ACE_SSL_CERT_DIR_ENV); - if (cert_dir == 0) - cert_dir = ACE_DEFAULT_SSL_CERT_DIR; - - ::SSL_CTX_load_verify_locations (this->context_, - cert_file, - cert_dir); - ::ERR_print_errors_fp (stderr); - - if (this->certificate_.type () != -1 - && ::SSL_CTX_use_certificate_file (this->context_, - this->certificate_.file_name (), - this->certificate_.type ()) <= 0) - { - // ERR_print_errors_fp (stderr); - return -1; - } - if (this->private_key_.type () != -1 - && SSL_CTX_use_PrivateKey_file (this->context_, - this->private_key_.file_name (), - this->private_key_.type ()) <= 0) - { - // ERR_print_errors_fp (stderr); - return -1; - } - - if (!::SSL_CTX_check_private_key (this->context_)) - { - // ACE_ERROR ((LM_ERROR, "Mismatch in key/certificate\n")); - return -1; - } - return 0; -} - -int -ACE_SSL_Context::get_mode (void) const -{ - return this->mode_; -} - -int -ACE_SSL_Context::private_key (const char *file_name, - int type) -{ - if (this->private_key_.type () != -1) - return 0; - - this->private_key_ = ACE_SSL_Data_File (file_name, type); - - if (this->context_ == 0) - return 0; - - int status = - ::SSL_CTX_use_PrivateKey_file (this->context_, - this->private_key_.file_name (), - this->private_key_.type ()); - return status; -} - -int -ACE_SSL_Context::verify_private_key (void) -{ - this->check_context (); - - return ::SSL_CTX_check_private_key (this->context_); -} - -int -ACE_SSL_Context::certificate (const char *file_name, - int type) -{ - if (this->certificate_.type () != -1) - return 0; - - this->certificate_ = ACE_SSL_Data_File (file_name, type); - - if (this->context_ == 0) - return 0; - - int status = - ::SSL_CTX_use_certificate_file (this->context_, - this->certificate_.file_name (), - this->certificate_.type ()); - return status; -} - -// **************************************************************** - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Singleton; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Singleton - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/SSL_Context.h b/ace/SSL/SSL_Context.h deleted file mode 100644 index c2fe08542ba..00000000000 --- a/ace/SSL/SSL_Context.h +++ /dev/null @@ -1,187 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// SSL_Context.h -// -// = AUTHOR -// Carlos O'Ryan -// -// ============================================================================ - -#ifndef ACE_SSL_CONTEXT_H -#define ACE_SSL_CONTEXT_H - -#include "ace/SString.h" - -#if defined (ACE_HAS_SSL) - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Singleton.h" -#include "ace/Synch.h" - -#include - -// @@ We need another export for this library! -class ACE_Export ACE_SSL_Data_File -{ -public: - ACE_SSL_Data_File (); - // Default constructor - - ACE_SSL_Data_File (const char *file_name, - int type = SSL_FILETYPE_PEM); - // Contructor from a file name and the file type. - - // Default dtor, cpy ctor and operator= - - const char *file_name (void) const; - // The file name - - int type (void) const; - // The type - -private: - ACE_CString file_name_; - // The file name - - int type_; - // The type, used by the SSL library to parse the file contents. -}; - -// **************************************************************** - -class ACE_Export ACE_SSL_Context -{ - // = TITLE - // A wrapper for the ACE_SSL_Context class. - // - // = DESCRIPTION - // This class provides a wrapper for the SSL_CTX data structure. - // Since most applications have a single SSL_CTX structure, this - // class can be used as a singleton. - -public: - - enum { - INVALID_METHOD = -1, - SSLv2_client = 1, - SSLv2_server, - SSLv2, - SSLv3_client, - SSLv3_server, - SSLv3, - SSLv23_client, - SSLv23_server, - SSLv23, - TLSv1_client, - TLSv1_server, - TLSv1 - }; - - ACE_SSL_Context (); - // Constructor - - ~ACE_SSL_Context (void); - // Destructor - - static ACE_SSL_Context *instance (void); - // The Singleton context, the SSL components use the singleton if - // nothing else is available. - - int set_mode (int mode = ACE_SSL_Context::SSLv3); - // Set the CTX mode. The mode can be set only once, afterwards the - // function has no effect and returns -1. - // Once the mode is set the underlying SSL_CTX is initialized and - // the class can be used. - // If the mode is not set, the the class automatically initializes - // itself to the default mode. - - int get_mode (void) const; - // @@ John, you need to document each function or at least each - // group of functions. Also remember to follow the ACE guidelines, - // this includes: - // - a space between the function name and the '(' starting its - // argument list. - // - a single space after the return value - // - Using const where appropriate - // - // You may not like the style (i don't) but it is more important - // that we all use the same than keeping each one of us happy. - - SSL_CTX *context (void); - // Get the SSL context - - int private_key_type (void) const; - const char *private_key_file_name (void) const; - // Get the file name and file format used for the private key - - int private_key (const char *file_name, - int type = SSL_FILETYPE_PEM); - // Set the private key file. - - int verify_private_key (void); - // Verify if the private key is valid - - int certificate_type (void) const; - const char *certificate_file_name (void) const; - // Get the file name and file format used for the certificate file - - int certificate (const char *file_name, - int type = SSL_FILETYPE_PEM); - // Set the certificate file. - - void default_verify_mode (int mode); - int default_verify_mode (void) const; - // Set and query the default verify mode for this context, it is - // inherited by all the ACE_SSL objects created using the context. - // It can be overriden on a per-ACE_SSL object. - -private: - void check_context (void); - // Verify if the context has been initialized or not. - - void ssl_library_init (); - void ssl_library_fini (); - // @@ More to document - -private: - // @@ Carlos, I protected this variable with an ACE_GUARD, just like - // what we do for the orb_init_count_ variable in - // tao/ORB.cpp. The code isn't pretty but it should suffice - // until the SSL context is stored in a Singleton. - // -Ossama - - SSL_CTX *context_; - // The SSL_CTX structure - - int mode_; - // Cache the mode so we can answer fast - - ACE_SSL_Data_File private_key_; - ACE_SSL_Data_File certificate_; - // The private key and certificate file - - int default_verify_mode_; - // The default verify mode. - - static int library_init_count_; - // @@ This should also be done with a singleton, otherwise it is not - // thread safe and/or portable to some weird platforms... -}; - -#if defined(__ACE_INLINE__) -#include "SSL_Context.i" -#endif /* __ACE_INLINE__ */ - -#endif /* ACE_HAS_SSL */ - -#endif /* ACE_SSL_CONTEXT_H */ diff --git a/ace/SSL/SSL_Context.i b/ace/SSL/SSL_Context.i deleted file mode 100644 index 02a0f7efddb..00000000000 --- a/ace/SSL/SSL_Context.i +++ /dev/null @@ -1,87 +0,0 @@ -// -// $Id$ -// - -ACE_INLINE -ACE_SSL_Data_File::ACE_SSL_Data_File (void) - : type_ (-1) -{ -} - -ACE_INLINE -ACE_SSL_Data_File::ACE_SSL_Data_File (const char *file_name, - int type) - : file_name_ (file_name), - type_ (type) -{ -} - -ACE_INLINE const char* -ACE_SSL_Data_File::file_name (void) const -{ - return this->file_name_.c_str (); -} - -ACE_INLINE int -ACE_SSL_Data_File::type (void) const -{ - return this->type_; -} - -// **************************************************************** - -ACE_INLINE ACE_SSL_Context* -ACE_SSL_Context::instance (void) -{ - return ACE_Singleton::instance (); -} - -ACE_INLINE void -ACE_SSL_Context::check_context () -{ - if (this->context_ == 0) - this->set_mode (); -} - -ACE_INLINE SSL_CTX * -ACE_SSL_Context::context (void) -{ - this->check_context (); - return this->context_; -} - -ACE_INLINE int -ACE_SSL_Context::private_key_type (void) const -{ - return this->private_key_.type (); -} - -ACE_INLINE const char* -ACE_SSL_Context::private_key_file_name (void) const -{ - return this->private_key_.file_name (); -} - -ACE_INLINE int -ACE_SSL_Context::certificate_type (void) const -{ - return this->certificate_.type (); -} - -ACE_INLINE const char* -ACE_SSL_Context::certificate_file_name (void) const -{ - return this->certificate_.file_name (); -} - -ACE_INLINE void -ACE_SSL_Context::default_verify_mode (int mode) -{ - this->default_verify_mode_ = mode; -} - -ACE_INLINE int -ACE_SSL_Context::default_verify_mode (void) const -{ - return this->default_verify_mode_; -} diff --git a/ace/SSL/SSL_Context.inl b/ace/SSL/SSL_Context.inl deleted file mode 100644 index 02a0f7efddb..00000000000 --- a/ace/SSL/SSL_Context.inl +++ /dev/null @@ -1,87 +0,0 @@ -// -// $Id$ -// - -ACE_INLINE -ACE_SSL_Data_File::ACE_SSL_Data_File (void) - : type_ (-1) -{ -} - -ACE_INLINE -ACE_SSL_Data_File::ACE_SSL_Data_File (const char *file_name, - int type) - : file_name_ (file_name), - type_ (type) -{ -} - -ACE_INLINE const char* -ACE_SSL_Data_File::file_name (void) const -{ - return this->file_name_.c_str (); -} - -ACE_INLINE int -ACE_SSL_Data_File::type (void) const -{ - return this->type_; -} - -// **************************************************************** - -ACE_INLINE ACE_SSL_Context* -ACE_SSL_Context::instance (void) -{ - return ACE_Singleton::instance (); -} - -ACE_INLINE void -ACE_SSL_Context::check_context () -{ - if (this->context_ == 0) - this->set_mode (); -} - -ACE_INLINE SSL_CTX * -ACE_SSL_Context::context (void) -{ - this->check_context (); - return this->context_; -} - -ACE_INLINE int -ACE_SSL_Context::private_key_type (void) const -{ - return this->private_key_.type (); -} - -ACE_INLINE const char* -ACE_SSL_Context::private_key_file_name (void) const -{ - return this->private_key_.file_name (); -} - -ACE_INLINE int -ACE_SSL_Context::certificate_type (void) const -{ - return this->certificate_.type (); -} - -ACE_INLINE const char* -ACE_SSL_Context::certificate_file_name (void) const -{ - return this->certificate_.file_name (); -} - -ACE_INLINE void -ACE_SSL_Context::default_verify_mode (int mode) -{ - this->default_verify_mode_ = mode; -} - -ACE_INLINE int -ACE_SSL_Context::default_verify_mode (void) const -{ - return this->default_verify_mode_; -} diff --git a/ace/SSL/SSL_SOCK_Acceptor.cpp b/ace/SSL/SSL_SOCK_Acceptor.cpp deleted file mode 100644 index 6753c2eb67a..00000000000 --- a/ace/SSL/SSL_SOCK_Acceptor.cpp +++ /dev/null @@ -1,254 +0,0 @@ -// -// $Id$ -// - -#define ACE_BUILD_DLL - -#include "SSL_SOCK_Acceptor.h" -#include "SSL.h" - -#include "ace/Synch.h" - -#if defined (ACE_HAS_SSL) - -ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Acceptor) - -#if defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "SSL_SOCK_Acceptor.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ - -int -ACE_SSL_SOCK_Acceptor::shared_accept_start (ACE_Time_Value *timeout, - int restart, - int &in_blocking_mode) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::shared_accept_start"); - - ACE_HANDLE handle = this->get_handle (); - - // Handle the case where we're doing a timed . - if (timeout != 0) - { - if (ACE::handle_timed_accept (handle, - timeout, - restart) == -1) - return -1; - else - { - in_blocking_mode = ACE_BIT_DISABLED (ACE::get_flags (handle), - ACE_NONBLOCK); - // Set the handle into non-blocking mode if it's not already - // in it. - if (in_blocking_mode - && ACE::set_flags (handle, - ACE_NONBLOCK) == -1) - return -1; - } - } - - return 0; -} - -int -ACE_SSL_SOCK_Acceptor::shared_accept_finish (ACE_SSL_SOCK_Stream& new_stream, - int in_blocking_mode, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::shared_accept_finish ()"); - - ACE_HANDLE new_handle = new_stream.get_handle (); - - // Check to see if we were originally in blocking mode, and if so, - // set the 's handle and handle to be in blocking - // mode. - if (in_blocking_mode) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - - // Only disable ACE_NONBLOCK if we weren't in non-blocking mode - // originally. - ACE::clr_flags (this->get_handle (), - ACE_NONBLOCK); - ACE::clr_flags (new_handle, - ACE_NONBLOCK); - } - -#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - if (reset_new_handle) - // Reset the event association inherited by the new handle. - ::WSAEventSelect ((SOCKET) new_handle, 0, 0); -#else - ACE_UNUSED_ARG (reset_new_handle); -#endif /* ACE_WIN32 */ - - return new_handle == ACE_INVALID_HANDLE ? -1 : 0; -} - -// General purpose routine for accepting new connections. -int -ACE_SSL_SOCK_Acceptor::accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::accept"); - - int in_blocking_mode = 0; - if (this->shared_accept_start (timeout, - restart, - in_blocking_mode) == -1) - return -1; - else - { - // On Win32 the third parameter to must be a NULL - // pointer if we want to ignore the client's address. - int *len_ptr = 0; - sockaddr *addr = 0; - int len = 0; - - if (remote_addr != 0) - { - len = remote_addr->get_size (); - len_ptr = &len; - addr = (sockaddr *) remote_addr->get_addr (); - } - - do - new_stream.set_handle (ACE_OS::accept (this->get_handle (), - addr, - len_ptr)); - while (new_stream.get_handle () == ACE_INVALID_HANDLE - && restart != 0 - && errno == EINTR - && timeout == 0); - - // Reset the size of the addr, which is only necessary for UNIX - // domain sockets. - if (new_stream.get_handle () != ACE_INVALID_HANDLE - && remote_addr != 0) - remote_addr->set_size (len); - } - - if(!new_stream.ssl_init_finished () - && new_stream.get_SSL_fd() != new_stream.get_handle ()) - { - if (new_stream.set_SSL_fd ((int)new_stream.get_handle ()) - == ACE_INVALID_HANDLE) - return -1; - } - - return (((new_stream.accept () == -1) - && errno == EAGAIN - && timeout == 0) ? - -1 : - this->shared_accept_finish (new_stream, - in_blocking_mode, - reset_new_handle)); -} - -int -ACE_SSL_SOCK_Acceptor::accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Accept_QoS_Params qos_params, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, - int reset_new_handle) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::accept"); - - int in_blocking_mode = 0; - if (this->shared_accept_start (timeout, - restart, - in_blocking_mode) == -1) - return -1; - else - { - // On Win32 the third parameter to must be a NULL - // pointer if we want to ignore the client's address. - int *len_ptr = 0; - sockaddr *addr = 0; - int len = 0; - - if (remote_addr != 0) - { - len = remote_addr->get_size (); - len_ptr = &len; - addr = (sockaddr *) remote_addr->get_addr (); - } - - do - new_stream.set_handle (ACE_OS::accept (this->get_handle (), - addr, - len_ptr, - qos_params)); - while (new_stream.get_handle () == ACE_INVALID_HANDLE - && restart != 0 - && errno == EINTR - && timeout == 0); - - // Reset the size of the addr, which is only necessary for UNIX - // domain sockets. - if (new_stream.get_handle () != ACE_INVALID_HANDLE - && remote_addr != 0) - remote_addr->set_size (len); - } - - if(!new_stream.ssl_init_finished () - && new_stream.get_SSL_fd () != new_stream.get_handle ()) - { - if (new_stream.set_SSL_fd ((int)new_stream.get_handle ()) - == ACE_INVALID_HANDLE) - return -1; - } - - return (((new_stream.accept() == -1) - && errno == EAGAIN - && timeout == 0) ? - -1 : - this->shared_accept_finish (new_stream, - in_blocking_mode, - reset_new_handle)); -} - -int -ACE_SSL_SOCK_Acceptor::enable (int value) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::enable"); - switch (value) - { - case SIGURG: - case ACE_SIGURG: - case SIGIO: - case ACE_SIGIO: - case ACE_CLOEXEC: - ACE_NOTSUP_RETURN (-1); - case ACE_NONBLOCK: - return this->acceptor_.enable (value); - default: - return -1; - } - return 0; -} -int -ACE_SSL_SOCK_Acceptor::disable (int value) const -{ - ACE_TRACE("ACE_SSL_SOCK_Acceptor::disable"); - switch (value) - { - case SIGURG: - case ACE_SIGURG: - case SIGIO: - case ACE_SIGIO: - case ACE_CLOEXEC: - ACE_NOTSUP_RETURN (-1); - case ACE_NONBLOCK: - return this->acceptor_.disable (value); - default: - return -1; - } - return 0; -} - -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/SSL_SOCK_Acceptor.h b/ace/SSL/SSL_SOCK_Acceptor.h deleted file mode 100644 index fb2fb5a08fb..00000000000 --- a/ace/SSL/SSL_SOCK_Acceptor.h +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// SSL_SOCK_Acceptor.h -// -// = AUTHOR -// John Heitmann and Chris Zimman -// -// ============================================================================ - -#ifndef ACE_SSL_SOCK_ACCEPTOR_H -#define ACE_SSL_SOCK_ACCEPTOR_H - -#include "SSL_SOCK_Stream.h" -#include "ace/SOCK_Acceptor.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_SSL) - -class ACE_Export ACE_SSL_SOCK_Acceptor -{ - // = TITLE - // Defines a factory that creates new s passively. - // - // = DESCRIPTION - // The has its own which - // handles virtually all of the socket acceptance. This class is a wrapper - // which only adds the ssl acceptance. -public: - // = Initialization and termination methods. - ACE_SSL_SOCK_Acceptor (void); - // Default constructor. - - ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_INET, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - // Initiate a passive mode ssl/BSD-style acceptor socket. - // is the address that we-re going to listen for - // connections on. - - ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - // Initialize a passive-mode QoS-enabled acceptor socket. Returns 0 - // on success and -1 on failure. - - int open (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_INET, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - // Initiate a passive mode ssl/BSD-style acceptor socket. - // is the address that we-re going to listen for - // connections on. - - int close (void); - - ~ACE_SSL_SOCK_Acceptor (void); - // Default dtor. - - // = Passive connection methods. - int accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0) const; - // Accept a new connection. A of 0 - // means block forever, a of {0, 0} means poll. - // == 1 means "restart if interrupted," i.e., if errno == EINTR. - - int accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Accept_QoS_Params qos_params, - ACE_Addr *remote_addr = 0, - ACE_Time_Value *timeout = 0, - int restart = 1, - int reset_new_handle = 0) const; - // Accept a new connection using the RVSP QoS - // information in . A of 0 means block - // forever, a of {0, 0} means poll. == 1 means - // "restart if interrupted," i.e., if errno == EINTR. - - int control (int cmd, void *) const; - // Interface for ioctl. - - // = Common I/O handle options related to sockets. - - int enable (int value) const; - // Enable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), - // non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), - // which is passed as the . - - int disable (int value) const; - // Disable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), - // non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), - // which is passed as the . - - ACE_HANDLE get_handle (void) const; - // Get the underlying handle. - - void set_handle (ACE_HANDLE handle); - // Set the underlying handle. - - int get_local_addr (ACE_Addr &) const; - // Gets the address which is being listened on. - - // = Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_SSL_SOCK_Stream PEER_STREAM; - - void dump (void) const; - // Dump the state of an object. - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -protected: - - int shared_accept_start (ACE_Time_Value *timeout, - int restart, - int &in_blocking_mode) const; - // Perform operations that must occur before is - // called. - - int shared_accept_finish (ACE_SSL_SOCK_Stream& new_stream, - int in_blocking_mode, - int reset_new_handle) const; - // Perform operations that must occur after is - // called. - -private: - ACE_SOCK_Acceptor acceptor_; - // The BSD-socket workhorse -}; - -#if !defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "SSL_SOCK_Acceptor.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ - -#endif /* ACE_SSL_SOCK_ACCEPTOR_H */ -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/SSL_SOCK_Acceptor.i b/ace/SSL/SSL_SOCK_Acceptor.i deleted file mode 100644 index 3f7f2cbf726..00000000000 --- a/ace/SSL/SSL_SOCK_Acceptor.i +++ /dev/null @@ -1,113 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// SSL_SOCK_Acceptor.i - -#if defined (ACE_HAS_SSL) - -// Do nothing routine for constructor. - -ACE_INLINE -ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor"); -} - -ACE_INLINE -ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) - : acceptor_ (local_sap, reuse_addr, protocol_family, backlog, protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor"); -} -// Performs the timed accept operation. - -ACE_INLINE -ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0) - : acceptor_ (local_sap, - protocolinfo, - g, - flags, - reuse_addr, - protocol_family, - backlog, - protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor"); -} - -ACE_INLINE int -ACE_SSL_SOCK_Acceptor::open (const ACE_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::open"); - return this->acceptor_.open (local_sap, - reuse_addr, - protocol_family, - backlog, - protocol); -} - -ACE_INLINE int -ACE_SSL_SOCK_Acceptor::close (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::close ()"); - return this->acceptor_.close (); -} - - -ACE_INLINE -ACE_SSL_SOCK_Acceptor::~ACE_SSL_SOCK_Acceptor (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::~ACE_SSL_SOCK_Acceptor"); -} - -ACE_INLINE int -ACE_SSL_SOCK_Acceptor::control (int cmd, void* dummy) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::control"); - return this->acceptor_.control (cmd, dummy); -} - -ACE_INLINE ACE_HANDLE -ACE_SSL_SOCK_Acceptor::get_handle (void) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::get_handle"); - return this->acceptor_.get_handle (); -} - -ACE_INLINE void -ACE_SSL_SOCK_Acceptor::set_handle (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::set_handle"); - this->acceptor_.set_handle (handle); -} - -ACE_INLINE int -ACE_SSL_SOCK_Acceptor::get_local_addr (ACE_Addr &addr) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::get_local_addr"); - return this->acceptor_.get_local_addr (addr); -} - -ACE_INLINE void -ACE_SSL_SOCK_Acceptor::dump (void) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::dump"); - this->acceptor_.dump (); -} - -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/SSL_SOCK_Connector.cpp b/ace/SSL/SSL_SOCK_Connector.cpp deleted file mode 100644 index 446afe9a430..00000000000 --- a/ace/SSL/SSL_SOCK_Connector.cpp +++ /dev/null @@ -1,318 +0,0 @@ -// SSL_SOCK_Connector.cpp -// $Id$ - - -#include "SSL_SOCK_Connector.h" - -#if defined (ACE_HAS_SSL) - -#include "ace/Handle_Set.h" -#include "ace/INET_Addr.h" - -#include - -#if defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "SSL_SOCK_Connector.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ - - -ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Connector) - -int -ACE_SSL_SOCK_Connector::shared_connect_start (ACE_SSL_SOCK_Stream &new_stream, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::shared_connect_start"); - - if (local_sap != ACE_Addr::sap_any) - { - sockaddr *laddr = ACE_reinterpret_cast (sockaddr *, - local_sap.get_addr ()); - size_t size = local_sap.get_size (); - - if (ACE_OS::bind (new_stream.get_handle (), - laddr, - size) == -1) - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - new_stream.close (); - return -1; - } - } - - // Enable non-blocking, if required. - if (timeout != 0 && new_stream.disable (ACE_NONBLOCK) == -1) - return -1; - else - return 0; -} - -int -ACE_SSL_SOCK_Connector::shared_connect_finish (ACE_SSL_SOCK_Stream &new_stream, - ACE_Time_Value *timeout, - int result) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::shared_connect_finish"); - // Save/restore errno. - ACE_Errno_Guard error (errno); - - if (result == -1 && timeout != 0) - { - // Check whether the connection is in progress. - if (error == EINPROGRESS || error == EWOULDBLOCK) - { - // This expression checks if we were polling. - if (timeout->sec () == 0 - && timeout->usec () == 0) - error = EWOULDBLOCK; - // Wait synchronously using timeout. - else if (this->complete (new_stream, - 0, - timeout) == -1) - error = errno; - else - return 0; - } - } - - // EISCONN is treated specially since this routine may be used to - // check if we are already connected. - if (result != -1 || error == EISCONN) - // Start out with non-blocking disabled on the . - new_stream.disable (ACE_NONBLOCK); - else if (!(error == EWOULDBLOCK || error == ETIMEDOUT)) - new_stream.close (); - - return result; - -} - -int -ACE_SSL_SOCK_Connector::connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::connect"); - if ((new_stream.get_handle () == ACE_INVALID_HANDLE) && - this->connector_.connect (new_stream.peer (), - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms, - protocol_family, - protocol) == -1) { - return -1; - } - - if (new_stream.get_SSL_fd () != new_stream.get_handle ()) - { - new_stream.set_SSL_fd (new_stream.get_handle ()); - - if (timeout) - new_stream.disable (ACE_NONBLOCK); - } - - return new_stream.connect (); - -} - -int -ACE_SSL_SOCK_Connector::connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int perms, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::connect"); - if ((new_stream.get_handle () == ACE_INVALID_HANDLE) && - connector_.connect (new_stream.peer (), - remote_sap, - qos_params, - timeout, - local_sap, - protocolinfo, - g, - flags, - reuse_addr, - perms, - protocol_family, - protocol) == -1) { - return -1; - } - - if (new_stream.get_SSL_fd () != new_stream.get_handle ()) - { - new_stream.set_SSL_fd (new_stream.get_handle ()); - - if (timeout) - new_stream.disable (ACE_NONBLOCK); - } - - return new_stream.connect (); -} - -// Try to complete a non-blocking connection. - -int -ACE_SSL_SOCK_Connector::complete (ACE_SSL_SOCK_Stream &new_stream, - ACE_Addr *remote_sap, - ACE_Time_Value *tv) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::complete"); - if (this->connector_.complete (new_stream.peer (), - remote_sap, - tv) == -1) { - return -1; - } - - if (new_stream.get_SSL_fd () != new_stream.get_handle ()) - { - new_stream.set_SSL_fd (new_stream.get_handle ()); - - if (tv) - new_stream.disable (ACE_NONBLOCK); - } - - return new_stream.connect (); -} - - -ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector ( - ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector"); - if (this->connect (new_stream, - remote_sap, - timeout, - local_sap, - reuse_addr, - flags, - perms, - protocol_family, - protocol) == -1 - && timeout != 0 - && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("%p\n"), - ASYS_TEXT ( - "ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector" - ))); - else - { - if (new_stream.get_SSL_fd () != new_stream.get_handle ()) - { - if (new_stream.set_SSL_fd (new_stream.get_handle ()) - == ACE_INVALID_HANDLE) - ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("ACE_SSL_SOCK_Connector::" - "ACE_SSL_SOCK_Connector: " - "invalid handle\n"))); - - if (timeout) - new_stream.disable (ACE_NONBLOCK); - } - - if (new_stream.connect () != 0) - { -// ACE_ERROR ((LM_ERROR, -// ASYS_TEXT ("%p\n"), -// ASYS_TEXT ("ACE_SSL_SOCK_Connector::" -// "ACE_SSL_SOCK_Connector" -// ))); - - ::ERR_print_errors_fp (stderr); - } - } -} - - - -ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector ( - ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo = 0, - ACE_SOCK_GROUP g = 0, - u_long flags, - int reuse_addr, - int perms, - int protocol_family, - int protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector"); - - if (this->connect (new_stream, - remote_sap, - qos_params, - timeout, - local_sap, - protocolinfo, - g, - flags, - reuse_addr, - perms, - protocol_family, - protocol) == -1 - && timeout != 0 - && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("%p\n"), - ASYS_TEXT ( - "ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector" - ))); - else - { - if (new_stream.get_SSL_fd () != new_stream.get_handle()) - { - if (new_stream.set_SSL_fd (new_stream.get_handle ()) - == ACE_INVALID_HANDLE) - ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("ACE_SSL_SOCK_Connector::" - "ACE_SSL_SOCK_Connector: " - "invalid handle\n"))); - - if (timeout) - new_stream.disable (ACE_NONBLOCK); - } - - if (new_stream.connect () != 0) - { -// ACE_ERROR ((LM_ERROR, -// ASYS_TEXT ("%p\n"), -// ASYS_TEXT ("ACE_SSL_SOCK_Connector::" -// "ACE_SSL_SOCK_Connector" -// ))); - - ::ERR_print_errors_fp (stderr); - } - } -} - -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/SSL_SOCK_Connector.h b/ace/SSL/SSL_SOCK_Connector.h deleted file mode 100644 index d87902e3518..00000000000 --- a/ace/SSL/SSL_SOCK_Connector.h +++ /dev/null @@ -1,195 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// SSL_SOCK_Connector.h -// -// = AUTHOR -// John Heitmann -// Chris Zimman -// Carlos O'Ryan -// Ossama Othman -// -// ============================================================================ - -#ifndef ACE_SSL_SOCK_CONNECTOR_H -#define ACE_SSL_SOCK_CONNECTOR_H - -#include "SSL_SOCK_Stream.h" -#include "ace/SOCK_Connector.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if defined (ACE_HAS_SSL) - -class ACE_Export ACE_SSL_SOCK_Connector -{ - // = TITLE - // Defines a factory that creates new s actively. - // - // = DESCRIPTION - // The doesn't have a socket of its own, - // i.e., it simply "borrows" the one from the ACE_SOCK_Stream - // that's being connected. The reason for this is that the - // underlying socket API doesn't use a "factory" socket to connect - // "data-mode" sockets. Therefore, there's no need to inherit - // from . A nice side-effect of - // this is that 's do not store state so they - // can be used reentrantly in multi-threaded programs. -public: - // = Initialization and termination methods. - ACE_SSL_SOCK_Connector (void); - // Default constructor. - - ACE_SSL_SOCK_Connector (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0, - int protocol_family = PF_INET, - int protocol = 0); - // Actively connect and produce a if things go well. - // The is the address that we are trying to connect - // with. The is the amount of time to wait to connect. - // If it's 0 then we block indefinitely. If *timeout == {0, 0} then - // the connection is done using non-blocking mode. In this case, if - // the connection can't be made immediately the value of -1 is - // returned with . If *timeout > {0, 0} then - // this is the amount of time to wait before timing out. If the - // time expires before the connection is made . The - // is the value of local address to bind to. If it's - // the default value of then the user is letting - // the OS do the binding. If == 1 then the - // is reused, even if it hasn't been cleanedup yet. - - ACE_SSL_SOCK_Connector (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - ACE_Protocol_Info *protocolinfo = 0, - ACE_SOCK_GROUP g = 0, - u_long flags = 0, - int reuse_addr = 0, - int perms = 0, - int protocol_family = PF_INET, - int protocol = 0); - // Actively connect and produce a if things go well. - // The is the address that we are trying to connect - // with. The contains QoS parameters that are passed - // to RSVP. The is the amount of time to wait to connect. - // If it's 0 then we block indefinitely. If *timeout == {0, 0} then - // the connection is done using non-blocking mode. In this case, if - // the connection can't be made immediately the value of -1 is - // returned with . If *timeout > {0, 0} then - // this is the amount of time to wait before timing out. If the - // time expires before the connection is made . The - // is the value of local address to bind to. If it's - // the default value of then the user is letting - // the OS do the binding. If == 1 then the - // is reused, even if it hasn't been cleanedup yet. - - int connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0, - int protocol_family = PF_INET, - int protocol = 0); - // Actively connect and produce a if things go well. - // The is the address that we are trying to connect - // with. The is the amount of time to wait to connect. - // If it's 0 then we block indefinitely. If *timeout == {0, 0} then - // the connection is done using non-blocking mode. In this case, if - // the connection can't be made immediately the value of -1 is - // returned with . If *timeout > {0, 0} then - // this is the amount of time to wait before timing out. If the - // time expires before the connection is made . The - // is the value of local address to bind to. If it's - // the default value of then the user is letting - // the OS do the binding. If == 1 then the - // is reused, even if it hasn't been cleanedup yet. - - int connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - ACE_Protocol_Info *protocolinfo = 0, - ACE_SOCK_GROUP g = 0, - u_long flags = 0, - int reuse_addr = 0, - int perms = 0, - int protocol_family = PF_INET, - int protocol = 0); - // Actively connect and produce a if things go well. - // The is the address that we are trying to connect - // with. The contains QoS parameters that are passed - // to RSVP. The is the amount of time to wait to connect. - // If it's 0 then we block indefinitely. If *timeout == {0, 0} then - // the connection is done using non-blocking mode. In this case, if - // the connection can't be made immediately the value of -1 is - // returned with . If *timeout > {0, 0} then - // this is the amount of time to wait before timing out. If the - // time expires before the connection is made . The - // is the value of local address to bind to. If it's - // the default value of then the user is letting - // the OS do the binding. If == 1 then the - // is reused, even if it hasn't been cleanedup yet. - - ~ACE_SSL_SOCK_Connector (void); - // Default dtor. - - // = Completion routine. - int complete (ACE_SSL_SOCK_Stream &new_stream, - ACE_Addr *remote_sap = 0, - ACE_Time_Value *timeout = 0); - // Try to complete a non-blocking connection. - // If connection completion is successful then contains - // the connected ACE_SOCK_Stream. If is non-NULL then it - // will contain the address of the connected peer. - - int reset_new_handle (ACE_HANDLE handle); - // Resets any event associations on this handle - - // = Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_SSL_SOCK_Stream PEER_STREAM; - - void dump (void) const; - // Dump the state of an object. - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. -protected: - int shared_connect_start(ACE_SSL_SOCK_Stream &new_stream, - ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = 0); - - int shared_connect_finish(ACE_SSL_SOCK_Stream &new_stream, - ACE_Time_Value *timeout = 0, - int result = 0); - -private: - ACE_SOCK_Connector connector_; - // The class that does all of the non-secure socket connection. - // It is default contructed, and susequently used by connect(). -}; - -#if !defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "SSL_SOCK_Connector.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ - -#endif /* ACE_SSL_SOCK_CONNECTOR_H */ -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/SSL_SOCK_Connector.i b/ace/SSL/SSL_SOCK_Connector.i deleted file mode 100644 index b27cecf5f6f..00000000000 --- a/ace/SSL/SSL_SOCK_Connector.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// SSL_SOCK_Connector.i - -#if defined (ACE_HAS_SSL) - -ASYS_INLINE -ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector"); -} - -ASYS_INLINE -ACE_SSL_SOCK_Connector::~ACE_SSL_SOCK_Connector (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::~ACE_SSL_SOCK_Connector"); -} - -ASYS_INLINE int -ACE_SSL_SOCK_Connector::reset_new_handle (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::reset_new_handle"); - return this->connector_.reset_new_handle (handle); -} - -ASYS_INLINE void -ACE_SSL_SOCK_Connector::dump (void) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::dump"); -} - -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/SSL_SOCK_Stream.cpp b/ace/SSL/SSL_SOCK_Stream.cpp deleted file mode 100644 index d9ffe36c740..00000000000 --- a/ace/SSL/SSL_SOCK_Stream.cpp +++ /dev/null @@ -1,545 +0,0 @@ -// SSL_SOCK_Stream.cpp -// $Id$ - -#define ACE_BUILD_DLL - -#include "SSL_SOCK_Stream.h" -#include "ace/Handle_Set.h" - -#if defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "SSL_SOCK_Stream.i" -#endif - -#if defined (ACE_HAS_SSL) - -ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Stream) - -ssize_t -ACE_SSL_SOCK_Stream::sendv (const iovec iov[], - size_t n) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::sendv"); - - // Mimics ACE_OS::sendv. - int result = 0; - ssize_t bytes_sent = 0; - for (size_t i = 0; i < n && result != -1; i++) - { - result = this->send (iov[i].iov_base, - iov[i].iov_len); - bytes_sent += iov[i].iov_len; // Gets ignored on error anyway - } - - if (result == -1) bytes_sent = -1; - return bytes_sent; -} - -ssize_t -ACE_SSL_SOCK_Stream::recvv (iovec *io_vec, - const ACE_Time_Value *timeout = 0) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recvv"); - - // From . -#if defined (FIONREAD) - ACE_Handle_Set handle_set; - handle_set.reset (); - handle_set.set_bit (this->get_handle ()); - - io_vec->iov_base = 0; - - // Check the status of the current socket. - switch (ACE_OS::select (int (this->get_handle ()) + 1, - handle_set, - 0, 0, - timeout)) - { - case -1: - return -1; - /* NOTREACHED */ - case 0: - errno = ETIME; - return -1; - /* NOTREACHED */ - default: - // Goes fine, fallthrough to get data - break; - } - - u_long inlen; - - - if (ACE_OS::ioctl (this->get_handle (), - FIONREAD, - (u_long *) &inlen) == -1) - return -1; - else if (inlen > 0) - { - ACE_NEW_RETURN (io_vec->iov_base, - char[inlen], - -1); - io_vec->iov_len = this->recv (io_vec->iov_base, - inlen); - return io_vec->iov_len; - } - else - return 0; -#else - ACE_UNUSED_ARG (io_vec); - ACE_UNUSED_ARG (timeout); - ACE_NOTSUP_RETURN (-1); -#endif /* FIONREAD */ -} - -ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - - if (flags) - ACE_NOTSUP_RETURN (-1); - - // Mimics . - if (timeout == 0) - return this->send (buf, len); - - int val = 0; - if (ACE::enter_send_timedwait (this->get_handle (), - timeout, - val) == -1) - return -1; - else - { - ssize_t bytes_transferred = this->send (buf, len); - ACE::restore_non_blocking_mode (this->get_handle (), val); - return bytes_transferred; - } -} - -ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - - // Mimics code in . - int peek = 0; - - if (flags) - { - if ((flags | MSG_PEEK) == MSG_PEEK) - peek = 1; - else - ACE_NOTSUP_RETURN (-1); - } - - if (timeout == 0) - return this->recv (buf, n, flags); - { - int val = 0; - if (ACE::enter_recv_timedwait (this->get_handle (), - timeout, - val) == -1) - return -1; - else - { - ssize_t bytes_transferred = this->recv (buf, n, flags); - ACE::restore_non_blocking_mode (this->get_handle (), val); - return bytes_transferred; - } - } -} - - -ssize_t -ACE_SSL_SOCK_Stream::send (size_t n, - ...) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - - // Mimics . - va_list argp; - size_t total_tuples = n / 2; - iovec *iovp; -#if defined (ACE_HAS_ALLOCA) - iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); -#else - ACE_NEW_RETURN (iovp, - iovec[total_tuples], - -1); -#endif /* !defined (ACE_HAS_ALLOCA) */ - - va_start (argp, n); - - for (size_t i = 0; i < total_tuples; i++) - { - iovp[i].iov_base = va_arg (argp, char *); - iovp[i].iov_len = va_arg (argp, ssize_t); - } - - ssize_t result = this->sendv (iovp, - total_tuples); -#if !defined (ACE_HAS_ALLOCA) - delete [] iovp; -#endif /* !defined (ACE_HAS_ALLOCA) */ - va_end (argp); - return result; -} - -ssize_t -ACE_SSL_SOCK_Stream::recv (size_t n, - ...) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - size_t total_tuples = n / 2; - va_list argp; - va_start (argp, n); - - ssize_t result = 0; - ssize_t bytes_recv = 0; - for (size_t i = 0; i < total_tuples; i++) - { - result = this->recv_n (va_arg (argp, char *), va_arg (argp, ssize_t)); - if (result == -1) - return -1; - bytes_recv += result; - } - - va_end (argp); - return bytes_recv; -} - -ssize_t -ACE_SSL_SOCK_Stream::send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send_n"); - - //no support for send flags in SSL - if (flags != 0) - ACE_NOTSUP_RETURN (-1); - - /* This code mimics ACE::send_n */ - // Total number of bytes written. - size_t bytes_transferred = 0; - - // Actual number of bytes written in each attempt - ssize_t n = 0; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - n = this->send ((const char*) buf + bytes_transferred, - len - bytes_transferred, - flags, - timeout); -// if (n == -1) -// if (errno == EWOULDBLOCK) -// n = 0; // Keep trying to send -// else -// return -1; - if (n == -1) - { - // If blocked, try again. - if (errno == EWOULDBLOCK) - n = 0; - - // - // No timeouts in this version. - // - - // Other errors. - return -1; - } - else if (n == 0) - return 0; - } - - return bytes_transferred; -} - -ssize_t -ACE_SSL_SOCK_Stream::recv_n (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv_n"); - - if (flags != 0) - { - if ((flags | MSG_PEEK) != MSG_PEEK) - ACE_NOTSUP_RETURN (-1); - } - - size_t bytes_transferred = 0; - ssize_t n = 0; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - n = this->recv ((char*) buf + bytes_transferred, - len - bytes_transferred, - flags, - timeout); -// if (n == -1 || n == 0) -// break; - if (n == -1) - { - // If blocked, try again. - if (errno == EWOULDBLOCK) - n = 0; - - // - // No timeouts in this version. - // - - // Other errors. - return -1; - } - else if (n == 0) - return 0; - } - - return bytes_transferred; -} - -ssize_t -ACE_SSL_SOCK_Stream::recv_n (void *buf, int len, int flags) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv_n"); - - if (flags != 0) - { - if ((flags | MSG_PEEK) != MSG_PEEK) - ACE_NOTSUP_RETURN (-1); - } - - ssize_t bytes_transferred = 0; - ssize_t n = 0; - - for (bytes_transferred = 0; - bytes_transferred < len; - bytes_transferred += n) - { - n = this->recv ((char*) buf + bytes_transferred, - len - bytes_transferred, - flags); -// if (n == -1) -// { -// if (errno == EWOULDBLOCK) -// n = 0; //Keep trying -// else -// return -1; -// } -// else if (n == 0) -// break; - if (n == -1) - { - // If blocked, try again. - if (errno == EWOULDBLOCK) - n = 0; - - // - // No timeouts in this version. - // - - // Other errors. - return -1; - } - else if (n == 0) - return 0; - } - - return bytes_transferred; -} - -ssize_t -ACE_SSL_SOCK_Stream::send_n (const void *buf, int len, int flags) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send_n"); - - // Send flags are unsupported in SSL - if (flags != 0) - ACE_NOTSUP_RETURN (-1); - - /* The following code mimics */ - size_t bytes_transferred = 0; - ssize_t n = 0; - - for (bytes_transferred = 0; - bytes_transferred < (size_t) len; - bytes_transferred += n) - { - n = this->send ((const char*) buf + bytes_transferred, - len - bytes_transferred, - flags); -// if (n == -1) -// { -// if (errno == EWOULDBLOCK) -// n = 0; //Keep trying to send. -// else -// return -1; -// } - if (n == -1) - { - // If blocked, try again. - if (errno == EWOULDBLOCK) - n = 0; - - // - // No timeouts in this version. - // - - // Other errors. - return -1; - } - else if (n == 0) - return 0; - } - - return bytes_transferred; -} - - -//Taken from OS.cpp, writev () -ssize_t -ACE_SSL_SOCK_Stream::sendv_n (const iovec iov[], size_t n) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::sendv_n"); - size_t length = 0; - size_t i; - - // Determine the total length of all the buffers in . - for (i = 0; i < n; i++) - if (ACE_static_cast (int, iov[i].iov_len) < 0) - return -1; - else - length += iov[i].iov_len; - - char *buf; - -# if defined (ACE_HAS_ALLOCA) - buf = (char *) alloca (length); -# else - ACE_NEW_RETURN (buf, - char[length], - -1); -# endif /* !defined (ACE_HAS_ALLOCA) */ - - char *ptr = buf; - - for (i = 0; i < n; i++) - { - ACE_OS::memcpy (ptr, iov[i].iov_base, iov[i].iov_len); - ptr += iov[i].iov_len; - } - - ssize_t result = this->send_n (buf, length); -# if !defined (ACE_HAS_ALLOCA) - delete [] buf; -# endif /* !defined (ACE_HAS_ALLOCA) */ - return result; -} - -// Taken straight from OS.cpp, readv () -ssize_t -ACE_SSL_SOCK_Stream::recvv_n (iovec iov[], size_t n) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recvv_n"); - ssize_t length = 0; - size_t i; - - for (i = 0; i < n; i++) - if (ACE_static_cast (int, iov[i].iov_len) < 0) - return -1; - else - length += iov[i].iov_len; - - char *buf; -# if defined (ACE_HAS_ALLOCA) - buf = (char *) alloca (length); -# else - ACE_NEW_RETURN (buf, - char[length], - -1); -# endif /* !defined (ACE_HAS_ALLOCA) */ - - length = this->recv_n (buf, length); - - if (length != -1) - { - char *ptr = buf; - int copyn = length; - - for (i = 0; - i < n && copyn > 0; - i++) - { - ACE_OS::memcpy (iov[i].iov_base, ptr, - // iov_len is int on some platforms, size_t on others - copyn > (int) iov[i].iov_len - ? (size_t) iov[i].iov_len - : (size_t) copyn); - ptr += iov[i].iov_len; - copyn -= iov[i].iov_len; - } - } - -# if !defined (ACE_HAS_ALLOCA) - delete [] buf; -# endif /* !defined (ACE_HAS_ALLOCA) */ - return length; -} - - -int -ACE_SSL_SOCK_Stream::enable (int value) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::enable"); - switch (value) - { - case SIGURG: - case ACE_SIGURG: - case SIGIO: - case ACE_SIGIO: - case ACE_CLOEXEC: - ACE_NOTSUP_RETURN (-1); - case ACE_NONBLOCK: - return this->stream_.enable (value); - default: - return -1; - } - return 0; -} - -int -ACE_SSL_SOCK_Stream::disable (int value) const -{ - ACE_TRACE("ACE_SSL_SOCK_Stream::disable"); - switch (value) - { - case SIGURG: - case ACE_SIGURG: - case SIGIO: - case ACE_SIGIO: - case ACE_CLOEXEC: - ACE_NOTSUP_RETURN (-1); - case ACE_NONBLOCK: - return this->stream_.disable (value); - default: - return -1; - } - return 0; -} - -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/SSL_SOCK_Stream.h b/ace/SSL/SSL_SOCK_Stream.h deleted file mode 100644 index eb535e5a36a..00000000000 --- a/ace/SSL/SSL_SOCK_Stream.h +++ /dev/null @@ -1,263 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// SSL_SOCK_Stream.h -// -// = AUTHOR -// John Heitmann -// Carlos O'Ryan -// Ossama Othman -// -// ============================================================================ - -#ifndef ACE_SSL_SOCK_STREAM_H -#define ACE_SSL_SOCK_STREAM_H - -#include "SSL.h" - -#if defined (ACE_HAS_SSL) - -#include "ace/SOCK_Stream.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -class ACE_Export ACE_SSL_SOCK_Stream : public ACE_SSL -{ - // = TITLE - // Defines methods in the abstraction. - // - // = DESCRIPTION - // This adds ssl functionality to an interface by - // wrapping around an implementation. - // -public: - // = Initializtion and termination functions. - - ACE_SSL_SOCK_Stream (void); - // Constructor (sets the underlying with , and - // with ). If the handle in does not - // match , it will set handle to . - - ACE_SSL_SOCK_Stream (ACE_HANDLE h); - // Constructor (sets with the handle in - // and the underlying with session. - - ~ACE_SSL_SOCK_Stream (void); - //Destructor - - ssize_t send (const void *buf, - size_t n, - int flags) const; - // Send an byte buffer to the ssl socket using - // the semantics of . ACE+SSL supports no - // flags for sending at this time. - - ssize_t recv (void *buf, - size_t n, - int flags) const; - // Recv an byte buffer from the ssl socket using - // the semantics of . ACE+SSL supports MSG_PEEK, - // but no other flags at this time. - - - ssize_t send (const void *buf, - size_t n) const; - // Send an byte buffer to the ssl socket using - // the semantics of . - - ssize_t recv (void *buf, - size_t n) const; - // Recv an byte buffer from the ssl socket using - // the semantics of . - - ssize_t sendv (const iovec iov[], - size_t n) const; - // Send an of size to the ssl socket. - - - ssize_t recvv (iovec *io_vec, - const ACE_Time_Value *timeout = 0) const; - // Allows a client to read from a socket without having to provide a - // buffer to read. This method determines how much data is in the - // socket, allocates a buffer of this size, reads in the data, and - // returns the number of bytes read. The caller is responsible for - // deleting the member in the field of using - // delete [] io_vec->iov_base. - - - ssize_t send (const void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const; - // Wait to to amount of time to send up to bytes into - // (uses the call). If times out - // a -1 is returned with . If it succeeds the - // number of bytes sent is returned. No flags are supported. - - ssize_t recv (void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const; - // Wait up to amount of time to receive up to bytes - // into (uses the call). If times - // out a -1 is returned with . If it succeeds the - // number of bytes received is returned. MSG_PEEK is the only - // supported flag. - - ssize_t send (const void *buf, - size_t n, - const ACE_Time_Value *timeout) const; - // Wait to to amount of time to send up to bytes into - // (uses the call). If times out - // a -1 is returned with . If it succeeds the - // number of bytes sent is returned. - - ssize_t recv (void *buf, - size_t n, - const ACE_Time_Value *timeout) const; - // Wait up to amount of time to receive up to bytes - // into (uses the call). If times - // out a -1 is returned with . If it succeeds the - // number of bytes received is returned. - - ssize_t send (size_t n, - ...) const; - // Send varargs messages to the connected ssl socket. - - ssize_t recv (size_t n, - ...) const; - // Recv varargs messages to the connected ssl socket. - - ssize_t send_n (const void *buf, int n) const; - // Send bytes, keep trying until are sent. - - ssize_t recv_n (void *buf, int n) const; - // Recv bytes, keep trying until are received. - - // = In the following four methods, only MSG_PEEK is supported - // for recv_n, and no flags are supported for send_n. - ssize_t send_n (const void *buf, int n, int flags) const; - // Send bytes, keep trying until are sent. - - ssize_t recv_n (void *buf, int n, int flags) const; - // Recv bytes, keep trying until are sent. - - ssize_t send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) const; - // Try to send exactly bytes into (uses - // the call). If blocks for longer than the - // number of bytes actually sent is returned with . - // If a timeout does not occur, return (i.e., the - // number of bytes requested to be sent). - - ssize_t recv_n (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) const; - // Try to recv exactly bytes into (uses - // the call). The indicates how long - // to blocking trying to receive. If == 0, the caller - // will block until action is possible, else will wait until the - // relative time specified in * elapses). If blocks - // for longer than the number of bytes actually read is - // returned with . If a timeout does not occur, - // return (i.e., the number of bytes requested to be - // read). - - ssize_t sendv_n (const iovec iov[], - size_t n) const; - // Send an of size to the connected socket. - // Will block until all bytes are sent or an error - // occurs. - - ssize_t recvv_n (iovec iov[], - size_t n) const; - // Receive an of size to the connected socket. - - - // = Selectively close endpoints. - int close_reader (void); - // Close down the reader. - - int close_writer (void); - // Close down the writer. - - int close (void); - //Close down the socket. - - // = Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - - void dump (void) const; - // Dump the state of an object. - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - - int set_option (int level, - int option, - void *optval, - int optlen) const; - // Wrapper around the setsockopt() system call. - - int get_option (int level, - int option, - void *optval, - int *optlen) const; - // Wrapper around the getsockopt() system call. - - int control (int cmd, void *) const; - // Interface for ioctl. - - // = Common I/O handle options related to sockets. - - int enable (int value) const; - // Enable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), - // non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), - // which is passed as the . - - int disable (int value) const; - // Disable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), - // non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), - // which is passed as the . - - int get_local_addr (ACE_Addr &) const; - // Return the local endpoint address in the referenced . - - int get_remote_addr (ACE_Addr &) const; - // Return the address of the remotely connected peer (if there is - // one), in the referenced ACE_Addr. Returns 0 if successful, else -1. - - ACE_HANDLE get_handle (void) const; - // Get the underlying handle - - void set_handle (ACE_HANDLE handle); - // Set the underlying handle - - friend class ACE_SSL_SOCK_Connector; - friend class ACE_SSL_SOCK_Acceptor; - -private: - ACE_SOCK_Stream& peer (void); - // Return the underlying which ssl runs on top of. - - ACE_SOCK_Stream stream_; - // The stream which works under the ssl connection. -}; - -#if !defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "SSL_SOCK_Stream.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ - -#endif /* ACE_SSL_SOCK_STREAM_H */ -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/SSL_SOCK_Stream.i b/ace/SSL/SSL_SOCK_Stream.i deleted file mode 100644 index 14955943823..00000000000 --- a/ace/SSL/SSL_SOCK_Stream.i +++ /dev/null @@ -1,238 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// SOCK_Stream.i - -#if defined (ACE_HAS_SSL) - -ASYS_INLINE -ACE_SSL_SOCK_Stream::ACE_SSL_SOCK_Stream (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::ACE_SSL_SOCK_Stream"); -} - -ASYS_INLINE -ACE_SSL_SOCK_Stream::ACE_SSL_SOCK_Stream (ACE_HANDLE h) - : stream_ (h) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::ACE_SSL_SOCK_Stream"); -} - -ASYS_INLINE -ACE_SSL_SOCK_Stream::~ACE_SSL_SOCK_Stream (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::~ACE_SSL_SOCK_Stream"); -} - -ASYS_INLINE ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t n, - int flags) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - - if (!this->ssl_init_finished ()) - { - ACE_DEBUG ((LM_DEBUG, "ACE_SSL_SOCK_Stream::send - init\n")); - return -1; - } - - // No send flags are supported in SSL. - if (flags != 0) - ACE_NOTSUP_RETURN (-1); - - int r = - ::SSL_write (this->ssl_, ACE_static_cast (const char*, buf), n); - - // ACE_DEBUG ((LM_DEBUG, "ACE_SSL_SOCK_Stream::send - %d/%d\n", - // r, n)); - return r; -} - -ASYS_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n, - int flags) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - - if (!this->ssl_init_finished ()) - { - ACE_DEBUG ((LM_DEBUG, "ACE_SSL_SOCK_Stream::recv - init\n")); - return -1; - } - - if (flags) - { - if (ACE_BIT_ENABLED (flags, MSG_PEEK)) - return ::SSL_peek (this->ssl_, ACE_static_cast (char*, buf), n); - ACE_NOTSUP_RETURN (-1); - } - int r = - ::SSL_read (this->ssl_, ACE_static_cast (char *, buf), n); - - // ACE_DEBUG ((LM_DEBUG, "ACE_SSL_SOCK_Stream::recv - %d/%d\n", - // r, n)); - return r; -} - -ASYS_INLINE ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t n) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - - if (!this->ssl_init_finished ()) - { - ACE_DEBUG ((LM_DEBUG, "ACE_SSL_SOCK_Stream::send - init\n")); - return -1; - } - - int r = ::SSL_write (this->ssl_, ACE_static_cast (const char *, buf), n); - ACE_DEBUG ((LM_DEBUG, "ACE_SSL_SOCK_Stream::send - %d/%d\n", - r, n)); - return r; -} - -ASYS_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - if (!this->ssl_init_finished ()) - { - ACE_DEBUG ((LM_DEBUG, "ACE_SSL_SOCK_Stream::recv - init\n")); - return -1; - } - - int r = ::SSL_read (this->ssl_, ACE_static_cast (char*, buf), n); - ACE_DEBUG ((LM_DEBUG, "ACE_SSL_SOCK_Stream::recv - %d/%d\n", - r, n)); - return r; -} - -ASYS_INLINE ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t len, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - return this->send (buf, len, 0, timeout); -} - -ASYS_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - return this->recv (buf, n, 0, timeout); -} - -ASYS_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv_n (void *buf, int buf_size) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv_n"); - return this->recv_n (buf, buf_size, 0); -} - -ASYS_INLINE ssize_t -ACE_SSL_SOCK_Stream::send_n (const void *buf, int len) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send_n"); - return this->send_n (buf, len, 0); -} - -ASYS_INLINE int -ACE_SSL_SOCK_Stream::close_reader (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::close_reader"); - return this->stream_.close_reader (); -} - -ASYS_INLINE int -ACE_SSL_SOCK_Stream::close_writer (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::close_writer"); - return this->stream_.close_writer (); -} - -ASYS_INLINE int -ACE_SSL_SOCK_Stream::close (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::close"); - - (void) this->ssl_close (); - - return this->stream_.close (); -} - -ASYS_INLINE void -ACE_SSL_SOCK_Stream::dump (void) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::dump"); - this->stream_.dump (); -} - -ASYS_INLINE ACE_SOCK_Stream& -ACE_SSL_SOCK_Stream::peer () { - ACE_TRACE ("ACE_SSL_SOCK_Stream::peer"); - return this->stream_; -} - -ASYS_INLINE int -ACE_SSL_SOCK_Stream::control (int cmd, void* dummy) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::control"); - return this->stream_.control (cmd, dummy); -} - -ASYS_INLINE int -ACE_SSL_SOCK_Stream::set_option (int level, - int option, - void *optval, - int optlen) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::set_option"); - return this->stream_.set_option (level, option, optval, optlen); -} - -ASYS_INLINE int -ACE_SSL_SOCK_Stream::get_option (int level, - int option, - void *optval, - int *optlen) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::get_option"); - return this->stream_.get_option (level, option, optval, optlen); -} - -ASYS_INLINE int -ACE_SSL_SOCK_Stream::get_local_addr (ACE_Addr &addr) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::get_local_addr"); - return this->stream_.get_local_addr (addr); -} - -ASYS_INLINE int -ACE_SSL_SOCK_Stream::get_remote_addr (ACE_Addr &addr) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::get_remote_addr"); - return this->stream_.get_remote_addr (addr); -} - -ASYS_INLINE ACE_HANDLE -ACE_SSL_SOCK_Stream::get_handle (void) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::get_handle"); - return this->stream_.get_handle (); -} - -ASYS_INLINE void -ACE_SSL_SOCK_Stream::set_handle (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::set_handle"); - this->stream_.set_handle (handle); -} - -#endif /* ACE_HAS_SSL */ diff --git a/ace/SSL/sslconf.h b/ace/SSL/sslconf.h deleted file mode 100644 index 2073b3251b1..00000000000 --- a/ace/SSL/sslconf.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// $Id$ -// - -#ifndef ACE_SSLCONF_H -#define ACE_SSLCONF_H - -#if !defined (ACE_DEFAULT_SSL_CERT_FILE) -#define ACE_DEFAULT_SSL_CERT_FILE "/etc/ssl/cert.pem" -#endif /* ACE_DEFAULT_SSL_CERT_FILE */ - -#if !defined (ACE_DEFAULT_SSL_CERT_DIR) -#define ACE_DEFAULT_SSL_CERT_DIR "/etc/ssl/certs" -#endif /* ACE_DEFAULT_SSL_CERT_DIR */ - -#if !defined (ACE_SSL_CERT_FILE_ENV) -#define ACE_SSL_CERT_FILE_ENV "SSL_CERT_FILE" -#endif /* ACE_SSL_CERT_FILE_ENV */ - -#if !defined (ACE_SSL_CERT_DIR_ENV) -#define ACE_SSL_CERT_DIR_ENV "SSL_CERT_DIR" -#endif /* ACE_SSL_CERT_DIR_ENV */ - -#endif /* ACE_SSLCONF_H */ - diff --git a/ace/Timer_Queue.i b/ace/Timer_Queue.i deleted file mode 100644 index 41e4324e61e..00000000000 --- a/ace/Timer_Queue.i +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- C++ -*- */ - -template ACE_INLINE void -ACE_Timer_Queue_T::timer_skew (const ACE_Time_Value &skew) -{ - timer_skew_ = skew; -} - -template ACE_INLINE const ACE_Time_Value & -ACE_Timer_Queue_T::timer_skew (void) const -{ - return timer_skew_; -} - -template ACE_INLINE int -ACE_Timer_Queue_T::expire (void) -{ - if (!this->is_empty ()) - return this->expire (this->gettimeofday () + timer_skew_); - else - return 0; -} diff --git a/apps/Gateway/Gateway/Concurrency_Strategies.h b/apps/Gateway/Gateway/Concurrency_Strategies.h deleted file mode 100644 index 28e59a4b2e6..00000000000 --- a/apps/Gateway/Gateway/Concurrency_Strategies.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// apps -// -// = FILENAME -// Concurrency_strategies.h -// -// = AUTHOR -// Doug Schmidt -// -// ============================================================================ - -#if !defined (_CONCURRENCY_STRATEGIES) -#define _CONCURRENCY_STRATEGIES - -#include "ace/Synch.h" - -// The following typedefs are used in order to parameterize the -// synchronization policies without changing the source code! - -// If we don't have threads then use the single-threaded synchronization. -#if !defined (ACE_HAS_THREADS) -#define SYNCH_STRATEGY ACE_NULL_SYNCH -typedef ACE_Null_Mutex MAP_MUTEX; -#else /* ACE_HAS_THREADS */ - -// Note that we only need to make the ACE_Task thread-safe if we are -// using the multi-threaded Thr_Consumer_Proxy... -#if defined (USE_OUTPUT_MT) -#define SYNCH_STRATEGY ACE_MT_SYNCH -#else -#define SYNCH_STRATEGY ACE_NULL_SYNCH -#endif /* USE_OUTPUT_MT || USE_INPUT_MT */ - -// Note that we only need to make the ACE_Map_Manager thread-safe if -// we are using the multi-threaded Thr_Supplier_Proxy. In this -// case, we use an RW_Mutex since we'll lookup Consumers far more -// often than we'll update them. -#if defined (USE_INPUT_MT) -typedef ACE_RW_Mutex MAP_MUTEX; -#else -typedef ACE_Null_Mutex MAP_MUTEX; -#endif /* USE_INPUT_MT */ -#endif /* ACE_HAS_THREADS */ - -// = Forward decls -class Thr_Consumer_Proxy; -class Thr_Supplier_Proxy; -class Consumer_Proxy; -class Supplier_Proxy; - -#if defined (ACE_HAS_THREADS) && (defined (USE_OUTPUT_MT) || defined (USE_INPUT_MT)) -#if defined (USE_OUTPUT_MT) -typedef Thr_Consumer_Proxy CONSUMER_PROXY; -#else -typedef Consumer_Proxy CONSUMER_PROXY; -#endif /* USE_OUTPUT_MT */ - -#if defined (USE_INPUT_MT) -typedef Thr_Supplier_Proxy SUPPLIER_PROXY; -#else -typedef Supplier_Proxy SUPPLIER_PROXY; -#endif /* USE_INPUT_MT */ -#else -// Instantiate a non-multi-threaded Gateway. -typedef Supplier_Proxy SUPPLIER_PROXY; -typedef Consumer_Proxy CONSUMER_PROXY; -#endif /* ACE_HAS_THREADS */ - -#endif /* _CONCURRENCY_STRATEGIES */ diff --git a/apps/Gateway/Gateway/Peer_Message.h b/apps/Gateway/Gateway/Peer_Message.h deleted file mode 100644 index d9e65650095..00000000000 --- a/apps/Gateway/Gateway/Peer_Message.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - - -// ============================================================================ -// -// = LIBRARY -// apps -// -// = FILENAME -// Peer_Message.h -// -// = AUTHOR -// Doug Schmidt -// -// ============================================================================ - -#if !defined (PEER_MESSAGE) -#define PEER_MESSAGE - -// This is the unique connection identifier that denotes a particular -// Channel in the Gateway. -typedef short CONN_ID; - -class Peer_Addr - // = TITLE - // Peer address is used to identify the source/destination of a - // routing message. -{ -public: - Peer_Addr (CONN_ID cid = -1, u_char lid = 0, u_char pay = 0) - : conn_id_ (cid), logical_id_ (lid), payload_ (pay) {} - - int operator== (const Peer_Addr &pa) const - { - return this->conn_id_ == pa.conn_id_ - && this->logical_id_ == pa.logical_id_ - && this->payload_ == pa.payload_; - } - - CONN_ID conn_id_; - // Unique connection identifier that denotes a particular Channel. - - u_char logical_id_; - // Logical ID. - - u_char payload_; - // Payload type. -}; - - -class Peer_Header - // = TITLE - // Fixed sized header. -{ -public: - typedef u_short ROUTING_ID; - // Type used to route messages from gatewayd. - - enum - { - INVALID_ID = -1 // No peer can validly use this number. - }; - - ROUTING_ID routing_id_; - // Source ID. - - size_t len_; - // Length of the message in bytes. -}; - -class Peer_Message - // = TITLE - // Variable-sized message (buf_ may be variable-sized between - // 0 and MAX_PAYLOAD_SIZE). -{ -public: - enum { MAX_PAYLOAD_SIZE = 1024 }; - // The maximum size of an Peer message (see Peer protocol specs for - // exact #). - - Peer_Header header_; - // Message header. - - char buf_[MAX_PAYLOAD_SIZE]; - // Message payload. -}; - -#endif /* PEER_MESSAGE */ diff --git a/examples/IPC_SAP/SSL_SAP/Makefile b/examples/IPC_SAP/SSL_SAP/Makefile deleted file mode 100644 index b87c10abf2e..00000000000 --- a/examples/IPC_SAP/SSL_SAP/Makefile +++ /dev/null @@ -1,595 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Makefile for SSL_SAP example -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -INFO = README - -BIN = SSL-client \ - SSL-client-simple \ - SSL-server \ - SSL-server-fancy \ - SSL-server-simple \ - SSL-server-poll - -LSRC = $(addsuffix .cpp,$(BIN)) - -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -BUILD = $(VBIN) - -LDLIBS = -lTAO_SSL - -CPPFLAGS += -I../../SSL_PP -DACE_HAS_SSL - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -# To build multiple executables in the same directory on AIX, it works -# best to wipe out any previously-created tempinc directory. -# The compiler/linker isn't too smart about instantiating templates... -ifdef TEMPINCDIR -COMPILE.cc := $(RM) -rf tempinc; $(COMPILE.cc) -endif - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - -.obj/SSL-client.o .obj/SSL-client.so .shobj/SSL-client.o .shobj/SSL-client.so: SSL-client.cpp \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Addr.h \ - $(ACE_ROOT)/ace/Addr.i \ - $(ACE_ROOT)/ace/INET_Addr.i \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Synch.h \ - $(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/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(ACE_ROOT)/ace/Malloc.h \ - $(ACE_ROOT)/ace/Malloc.i \ - $(ACE_ROOT)/ace/Malloc_T.h \ - $(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/Signal.h \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/Memory_Pool.i \ - $(ACE_ROOT)/ace/Thread_Manager.i \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/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 \ - $(ACE_ROOT)/ace/Get_Opt.h \ - $(ACE_ROOT)/ace/Get_Opt.i \ - $(ACE_ROOT)/ace/High_Res_Timer.h \ - $(ACE_ROOT)/ace/High_Res_Timer.i \ - ../../SSL_PP/SSL_SOCK_Connector.h ../../SSL_PP/SSL_SOCK_Stream.h \ - ../../SSL_PP/SSL.h ../../SSL_PP/SSL_Context.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - ../../SSL_PP/SSL_Context.i ../../SSL_PP/SSL.i \ - $(ACE_ROOT)/ace/SOCK_Stream.h \ - $(ACE_ROOT)/ace/SOCK_IO.h \ - $(ACE_ROOT)/ace/SOCK.h \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_IO.i \ - $(ACE_ROOT)/ace/SOCK_Stream.i \ - ../../SSL_PP/SSL_SOCK_Stream.i \ - $(ACE_ROOT)/ace/SOCK_Connector.h \ - $(ACE_ROOT)/ace/Time_Value.h \ - $(ACE_ROOT)/ace/SOCK_Connector.i \ - ../../SSL_PP/SSL_SOCK_Connector.i SSL-client.h - -.obj/SSL-client-simple.o .obj/SSL-client-simple.so .shobj/SSL-client-simple.o .shobj/SSL-client-simple.so: SSL-client-simple.cpp \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Addr.h \ - $(ACE_ROOT)/ace/Addr.i \ - $(ACE_ROOT)/ace/INET_Addr.i \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Synch.h \ - $(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/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/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 \ - $(ACE_ROOT)/ace/Get_Opt.h \ - $(ACE_ROOT)/ace/Get_Opt.i \ - $(ACE_ROOT)/ace/High_Res_Timer.h \ - $(ACE_ROOT)/ace/High_Res_Timer.i \ - ../../SSL_PP/SSL_SOCK_Connector.h ../../SSL_PP/SSL_SOCK_Stream.h \ - ../../SSL_PP/SSL.h ../../SSL_PP/SSL_Context.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - ../../SSL_PP/SSL_Context.i ../../SSL_PP/SSL.i \ - $(ACE_ROOT)/ace/SOCK_Stream.h \ - $(ACE_ROOT)/ace/SOCK_IO.h \ - $(ACE_ROOT)/ace/SOCK.h \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_IO.i \ - $(ACE_ROOT)/ace/SOCK_Stream.i \ - ../../SSL_PP/SSL_SOCK_Stream.i \ - $(ACE_ROOT)/ace/SOCK_Connector.h \ - $(ACE_ROOT)/ace/Time_Value.h \ - $(ACE_ROOT)/ace/SOCK_Connector.i \ - ../../SSL_PP/SSL_SOCK_Connector.i SSL-client-simple.h - -.obj/SSL-server.o .obj/SSL-server.so .shobj/SSL-server.o .shobj/SSL-server.so: SSL-server.cpp \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Synch.h \ - $(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/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(ACE_ROOT)/ace/Malloc.h \ - $(ACE_ROOT)/ace/Malloc.i \ - $(ACE_ROOT)/ace/Malloc_T.h \ - $(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/Signal.h \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/Memory_Pool.i \ - $(ACE_ROOT)/ace/Thread_Manager.i \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Profile_Timer.h \ - $(ACE_ROOT)/ace/Time_Value.h \ - $(ACE_ROOT)/ace/High_Res_Timer.h \ - $(ACE_ROOT)/ace/High_Res_Timer.i \ - $(ACE_ROOT)/ace/Profile_Timer.i \ - ../../SSL_PP/SSL_SOCK_Acceptor.h ../../SSL_PP/SSL_SOCK_Stream.h \ - ../../SSL_PP/SSL.h ../../SSL_PP/SSL_Context.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/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 \ - ../../SSL_PP/SSL_Context.i ../../SSL_PP/SSL.i \ - $(ACE_ROOT)/ace/SOCK_Stream.h \ - $(ACE_ROOT)/ace/SOCK_IO.h \ - $(ACE_ROOT)/ace/SOCK.h \ - $(ACE_ROOT)/ace/Addr.h \ - $(ACE_ROOT)/ace/Addr.i \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_IO.i \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/INET_Addr.i \ - $(ACE_ROOT)/ace/SOCK_Stream.i \ - ../../SSL_PP/SSL_SOCK_Stream.i \ - $(ACE_ROOT)/ace/SOCK_Acceptor.h \ - $(ACE_ROOT)/ace/SOCK_Acceptor.i \ - ../../SSL_PP/SSL_SOCK_Acceptor.i - -.obj/SSL-server-fancy.o .obj/SSL-server-fancy.so .shobj/SSL-server-fancy.o .shobj/SSL-server-fancy.so: SSL-server-fancy.cpp \ - $(ACE_ROOT)/ace/Svc_Handler.h \ - $(ACE_ROOT)/ace/Synch_Options.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Synch_Options.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/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Service_Object.i \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Synch.h \ - $(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/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(ACE_ROOT)/ace/Malloc.h \ - $(ACE_ROOT)/ace/Malloc.i \ - $(ACE_ROOT)/ace/Malloc_T.h \ - $(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/Signal.h \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/Memory_Pool.i \ - $(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/Message_Block.h \ - $(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/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/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(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/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/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.i \ - $(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/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.i \ - $(ACE_ROOT)/ace/Stream_Modules.cpp \ - $(ACE_ROOT)/ace/Svc_Handler.i \ - $(ACE_ROOT)/ace/Svc_Handler.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 \ - $(ACE_ROOT)/ace/Dynamic.h \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/Singleton.cpp \ - $(ACE_ROOT)/ace/Dynamic.i \ - $(ACE_ROOT)/ace/Profile_Timer.h \ - $(ACE_ROOT)/ace/Time_Value.h \ - $(ACE_ROOT)/ace/High_Res_Timer.h \ - $(ACE_ROOT)/ace/High_Res_Timer.i \ - $(ACE_ROOT)/ace/Profile_Timer.i \ - $(ACE_ROOT)/ace/Get_Opt.h \ - $(ACE_ROOT)/ace/Get_Opt.i \ - ../../SSL_PP/SSL_SOCK_Acceptor.h ../../SSL_PP/SSL_SOCK_Stream.h \ - ../../SSL_PP/SSL.h ../../SSL_PP/SSL_Context.h \ - ../../SSL_PP/SSL_Context.i ../../SSL_PP/SSL.i \ - $(ACE_ROOT)/ace/SOCK_Stream.h \ - $(ACE_ROOT)/ace/SOCK_IO.h \ - $(ACE_ROOT)/ace/SOCK.h \ - $(ACE_ROOT)/ace/Addr.h \ - $(ACE_ROOT)/ace/Addr.i \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_IO.i \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/INET_Addr.i \ - $(ACE_ROOT)/ace/SOCK_Stream.i \ - ../../SSL_PP/SSL_SOCK_Stream.i \ - $(ACE_ROOT)/ace/SOCK_Acceptor.h \ - $(ACE_ROOT)/ace/SOCK_Acceptor.i \ - ../../SSL_PP/SSL_SOCK_Acceptor.i SSL-server-fancy.h - -.obj/SSL-server-simple.o .obj/SSL-server-simple.so .shobj/SSL-server-simple.o .shobj/SSL-server-simple.so: SSL-server-simple.cpp \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Synch.h \ - $(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/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(ACE_ROOT)/ace/Malloc.h \ - $(ACE_ROOT)/ace/Malloc.i \ - $(ACE_ROOT)/ace/Malloc_T.h \ - $(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/Signal.h \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/Memory_Pool.i \ - $(ACE_ROOT)/ace/Thread_Manager.i \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Profile_Timer.h \ - $(ACE_ROOT)/ace/Time_Value.h \ - $(ACE_ROOT)/ace/High_Res_Timer.h \ - $(ACE_ROOT)/ace/High_Res_Timer.i \ - $(ACE_ROOT)/ace/Profile_Timer.i \ - ../../SSL_PP/SSL_SOCK_Acceptor.h ../../SSL_PP/SSL_SOCK_Stream.h \ - ../../SSL_PP/SSL.h ../../SSL_PP/SSL_Context.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/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 \ - ../../SSL_PP/SSL_Context.i ../../SSL_PP/SSL.i \ - $(ACE_ROOT)/ace/SOCK_Stream.h \ - $(ACE_ROOT)/ace/SOCK_IO.h \ - $(ACE_ROOT)/ace/SOCK.h \ - $(ACE_ROOT)/ace/Addr.h \ - $(ACE_ROOT)/ace/Addr.i \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_IO.i \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/INET_Addr.i \ - $(ACE_ROOT)/ace/SOCK_Stream.i \ - ../../SSL_PP/SSL_SOCK_Stream.i \ - $(ACE_ROOT)/ace/SOCK_Acceptor.h \ - $(ACE_ROOT)/ace/SOCK_Acceptor.i \ - ../../SSL_PP/SSL_SOCK_Acceptor.i - -.obj/SSL-server-poll.o .obj/SSL-server-poll.so .shobj/SSL-server-poll.o .shobj/SSL-server-poll.so: SSL-server-poll.cpp \ - $(ACE_ROOT)/ace/INET_Addr.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/inc_user_config.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(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/ACE.i \ - $(ACE_ROOT)/ace/Addr.h \ - $(ACE_ROOT)/ace/Addr.i \ - $(ACE_ROOT)/ace/INET_Addr.i \ - ../../SSL_PP/SSL_SOCK_Acceptor.h ../../SSL_PP/SSL_SOCK_Stream.h \ - ../../SSL_PP/SSL.h ../../SSL_PP/SSL_Context.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Synch.h \ - $(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/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/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 \ - ../../SSL_PP/SSL_Context.i ../../SSL_PP/SSL.i \ - $(ACE_ROOT)/ace/SOCK_Stream.h \ - $(ACE_ROOT)/ace/SOCK_IO.h \ - $(ACE_ROOT)/ace/SOCK.h \ - $(ACE_ROOT)/ace/IPC_SAP.h \ - $(ACE_ROOT)/ace/IPC_SAP.i \ - $(ACE_ROOT)/ace/SOCK.i \ - $(ACE_ROOT)/ace/SOCK_IO.i \ - $(ACE_ROOT)/ace/SOCK_Stream.i \ - ../../SSL_PP/SSL_SOCK_Stream.i \ - $(ACE_ROOT)/ace/SOCK_Acceptor.h \ - $(ACE_ROOT)/ace/Time_Value.h \ - $(ACE_ROOT)/ace/SOCK_Acceptor.i \ - ../../SSL_PP/SSL_SOCK_Acceptor.i - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/IPC_SAP/SSL_SAP/README b/examples/IPC_SAP/SSL_SAP/README deleted file mode 100644 index 43f4640e75a..00000000000 --- a/examples/IPC_SAP/SSL_SAP/README +++ /dev/null @@ -1,17 +0,0 @@ -# $Id$ - -This directory contains groups of client and server test programs that -exercise the various C++ wrappers for SSL sockets. In general, the -test programs do more or less the same thing -- the client establishes -a connection with the server and then transfers data to the server, -which keeps printing the data until EOF is reached (e.g., user types -^D). - -Unless noted differently, the server is implemented as an "iterative -server," i.e., it only deals with one client at a time. The following -describes each set of tests in more detail: - - . SSL-{client,server}.cpp -- This test allows you to test - oneway and twoway socket communication latency and - throughput over SSL between two processes on the same - machine or on different machines. diff --git a/examples/IPC_SAP/SSL_SAP/SSL-client-simple.cpp b/examples/IPC_SAP/SSL_SAP/SSL-client-simple.cpp deleted file mode 100644 index 1687678499e..00000000000 --- a/examples/IPC_SAP/SSL_SAP/SSL-client-simple.cpp +++ /dev/null @@ -1,376 +0,0 @@ -// $Id$ - -// This tests the features of the and -// classes. In addition, it can be used to test the -// oneway and twoway latency and throughput at the socket-level. This -// is useful as a baseline to compare against ORB-level performance -// for the same types of data. - -#include "ace/INET_Addr.h" -#include "ace/Singleton.h" -#include "ace/Get_Opt.h" -#include "ace/High_Res_Timer.h" - -#include "SSL_SOCK_Connector.h" - -#include "SSL-client-simple.h" - -ACE_RCSID(SSL_SAP, SSL_client_simple, "$Id$") - -Options::Options (void) - : host_ (ACE_DEFAULT_SERVER_HOST), - port_ (ACE_DEFAULT_SERVER_PORT), - sleep_time_ (0, 0), // By default, don't sleep between calls. - quit_string_ ("q"), - message_len_ (0), - message_buf_ (0), - io_source_ (ACE_INVALID_HANDLE), // Defaults to using the generator. - iterations_ (10000), - oneway_ (1) // Make oneway calls the default. -{ -} - -Options::~Options (void) -{ - delete [] this->message_buf_; -} - -// Options Singleton. -typedef ACE_Singleton OPTIONS; - -int -Options::init (void) -{ - // Check for default case. - if (this->message_len_ == 0) - this->message_len_ = ACE_OS::strlen ("TAO"); - - this->message_len_ += sizeof (ACE_UINT32); - - ACE_NEW_RETURN (this->message_buf_, - char[this->message_len_], - -1); - - // Copy the length into the beginning of the message. - ACE_UINT32 length = ntohl (this->message_len_); - ACE_OS::memcpy ((void *) this->message_buf_, - (void *) &length, - sizeof length); - - ACE_OS::memset ((void *) (this->message_buf_ + sizeof (ACE_UINT32)), - 'a', - this->message_len_ - sizeof (ACE_UINT32)); - - return 0; -} - -size_t -Options::message_len (void) const -{ - return this->message_len_; -} - -const void * -Options::message_buf (void) const -{ - return this->message_buf_; -} - -ssize_t -Options::read (void *buf, size_t len, size_t &iteration) -{ - ACE_UNUSED_ARG (len); - - if (this->io_source_ == ACE_STDIN) - return ACE_OS::read (ACE_STDIN, buf, len); - else if (iteration >= this->iterations_) - return 0; - else - { - ACE_OS::memcpy (buf, - this->message_buf (), - len); - iteration++; - return len; - } -} - -int -Options::parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt getopt (argc, argv, "2h:i:m:p:q:sT:", 1); - - for (int c; (c = getopt ()) != -1; ) - switch (c) - { - case '2': // Disable the oneway client. - this->oneway_ = 0; - break; - case 'h': - this->host_ = getopt.optarg; - break; - case 'i': - this->iterations_ = ACE_OS::atoi (getopt.optarg); - break; - case 'm': - this->message_len_ = ACE_OS::atoi (getopt.optarg); - break; - case 'p': - this->port_ = ACE_OS::atoi (getopt.optarg); - break; - case 'q': - this->quit_string_ = getopt.optarg; - break; - case 's': - this->io_source_ = ACE_STDIN; - break; - case 'T': - this->sleep_time_.set (0, ACE_OS::atoi (getopt.optarg)); - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) usage: %n [-2] [-h ] " - "[-i iterations] [-m message-size] " - "[-p ] [-q ] " - "[-s] [-T ]\n"), - -1); - } - - return this->init (); -} - -u_short -Options::port (void) const -{ - return this->port_; -} - -const char * -Options::host (void) const -{ - return this->host_; -} - -const char * -Options::quit_string (void) const -{ - return this->quit_string_; -} - -const ACE_Time_Value & -Options::sleep_time (void) const -{ - return this->sleep_time_; -} - -char * -Options::shared_client_test (u_short port, - ACE_SSL_SOCK_Stream &cli_stream) -{ - ACE_INET_Addr remote_addr (port, this->host_); - - ACE_SSL_SOCK_Connector con; - - if (con.connect (cli_stream, - remote_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "connection failed"), - 0); - else - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) connected to %s at port %d\n", - remote_addr.get_host_name (), - remote_addr.get_port_number ())); - - ACE_INT32 len = htonl (this->message_len ()); - - // Allocate the transmit buffer. - char *buf; - ACE_NEW_RETURN (buf, - char[len], - 0); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) waiting...\n")); - - return buf; -} -// Static function entry point to the oneway client service. - -void -Options::oneway_client_test (void) -{ - ACE_SSL_SOCK_Stream cli_stream; - - // Add 1 to the port to trigger the oneway test! - char *request = this->shared_client_test (this->port () + 1, - cli_stream); - if (request == 0) - return; - - // This variable is allocated off the stack to obviate the need for - // locking. - size_t iteration = 0; - - // Keep track of return value. - int result = 0; - ACE_INT32 len = this->message_len (); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting oneway transmission\n")); - - // Perform oneway transmission of data to server (correctly handles - // "incomplete writes"). - - for (ssize_t r_bytes; - (r_bytes = this->read (request, len, iteration)) > 0; - // Transmit at the proper rate. - ACE_OS::sleep (this->sleep_time ())) - if (ACE_OS::memcmp (request, - this->quit_string (), - ACE_OS::strlen (this->quit_string ())) == 0) - break; - else if (cli_stream.send_n (request, r_bytes) == -1) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "send_n")); - result = -1; - break; - } - - // Close the connection. - cli_stream.close (); - - delete [] request; -} - -// Static function entry point to the twoway client service. - -void -Options::twoway_client_test (void) -{ - ACE_SSL_SOCK_Stream cli_stream; - - char *request = this->shared_client_test (this->port (), - cli_stream); - if (request == 0) - return; - - // This variable is allocated off the stack to obviate the need for - // locking. - size_t iteration = 0; - - // Keep track of return value. - int result = 0; - - // Timer business. - ACE_High_Res_Timer timer; - - ACE_INT32 len = this->message_len (); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting twoway transmission\n")); - - // Perform twoway transmission of data to server (correctly handles - // "incomplete writes"). - - for (ssize_t r_bytes; - (r_bytes = this->read (request, len, iteration)) > 0; - // Transmit at the proper rate. - ACE_OS::sleep (this->sleep_time ())) - if (ACE_OS::memcmp (request, - this->quit_string (), - ACE_OS::strlen (this->quit_string ())) == 0) - break; - - // Transmit to the server. - else - { - // Note that we use the incremental feature of the - // so that we don't get "charged" for the - // used to control the rate at which requests - // are sent. - timer.start_incr (); - - if (cli_stream.send_n (request, r_bytes) == -1) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "send_n")); - result = -1; - break; - } - // Receive the reply from the server. Normally, it just sends - // back 24 bytes, which is typical for an IIOP reply. - else if (cli_stream.recv (request, r_bytes) <= 0) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "recv")); - result = -1; - break; - } - - timer.stop_incr (); - } - - ACE_Time_Value tv; - - timer.elapsed_time_incr (tv); - double real_time = tv.sec () * ACE_ONE_SECOND_IN_USECS + tv.usec (); - double messages_per_sec = iteration * double (ACE_ONE_SECOND_IN_USECS) / real_time; - - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("(%t) messages = %d\n(%t) usec-per-message = %f\n(%t) messages-per-second = %0.00f\n"), - iteration, - real_time / double (iteration), - messages_per_sec < 0 ? 0 : messages_per_sec)); - - // Close the connection. - cli_stream.close (); - - delete [] request; -} - -void -Options::run (void) -{ - if (this->oneway_ == 0) - this->twoway_client_test (); - else - this->oneway_client_test (); -} - -static int -run_client (void) -{ - // Raise the socket handle limit to the maximum. - ACE::set_handle_limit (); - - OPTIONS::instance ()->run (); - - return 0; -} - -int -main (int argc, char *argv[]) -{ - // Initialize the logger. - ACE_LOG_MSG->open (argv[0]); - - if (OPTIONS::instance ()->parse_args (argc, argv) == -1) - return -1; - - // Run the client - run_client (); - - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/IPC_SAP/SSL_SAP/SSL-client-simple.h b/examples/IPC_SAP/SSL_SAP/SSL-client-simple.h deleted file mode 100644 index f71eac5b5b5..00000000000 --- a/examples/IPC_SAP/SSL_SAP/SSL-client-simple.h +++ /dev/null @@ -1,98 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// This file defines the Options class for SSL-client-simple. IBM C++ -// compiler's template auto-instantiator needs this in a separate file. - -#ifndef ACE_SSL_CLIENT_SIMPLE_H -#define ACE_SSL_CLIENT_SIMPLE_H - -#include "ace/OS.h" - -#include "SSL_SOCK_Stream.h" - -class Options - // = TITLE - // Define the options for this test. -{ -public: - Options (void); - // Constructor. - - ~Options (void); - // Destructor. - - int parse_args (int argc, char *argv[]); - // Parse the command-line arguments. - - const ACE_Time_Value &sleep_time (void) const; - // Return the amount of time to sleep in order to implement the - // proper transmission rates. - - u_short port (void) const; - // Port of the server. - - const char *host (void) const; - // Host of the server. - - const char *quit_string (void) const; - // String that shuts down the client/server. - - ssize_t read (void *buf, size_t len, size_t &iterations); - // Read from the appropriate location. - - size_t message_len (void) const; - // Returns the length of the message to send. - - const void *message_buf (void) const; - // Returns a pointer to the message. - - void run (void); - // Run the test - -private: - int init (void); - // Initialize the message we're sending to the user and set up the - // barrier. - - char *shared_client_test (u_short port, - ACE_SSL_SOCK_Stream &cli_stream); - // Performs the shared behavior of the oneway and twoway client - // tests. - - void twoway_client_test (void); - // Performs the twoway test. - - void oneway_client_test (void); - // Performs the oneway test. - - const char *host_; - // Host of the server. - - u_short port_; - // Port of the server. - - ACE_Time_Value sleep_time_; - // Sleep_Time value. - - const char *quit_string_; - // String that shuts down the client/server. - - size_t message_len_; - // Size of the message we send to the server. - - char *message_buf_; - // Pointer to the message we send to the server. - - ACE_HANDLE io_source_; - // Are we reading I/O from ACE_STDIN or from our generator? - - size_t iterations_; - // Number of iterations. - - char oneway_; - // Are we running oneway or twoway? - -}; - -#endif /* ACE_SSL_CLIENT_SIMPLE_H */ diff --git a/examples/IPC_SAP/SSL_SAP/SSL-client.cpp b/examples/IPC_SAP/SSL_SAP/SSL-client.cpp deleted file mode 100644 index 733bbcd8e1e..00000000000 --- a/examples/IPC_SAP/SSL_SAP/SSL-client.cpp +++ /dev/null @@ -1,413 +0,0 @@ -// $Id$ - -// This tests the features of the and -// classes. In addition, it can be used to test the -// oneway and twoway latency and throughput at the socket-level. This -// is useful as a baseline to compare against ORB-level performance -// for the same types of data. - -#include "ace/INET_Addr.h" -#include "ace/Thread_Manager.h" -#include "ace/Singleton.h" -#include "ace/Get_Opt.h" -#include "ace/High_Res_Timer.h" -#include "ace/Synch.h" - -#include "SSL_SOCK_Connector.h" - -#include "SSL-client.h" - -ACE_RCSID(SSL_SAP, SSL_client, "$Id$") - -Options::Options (void) - : host_ (ACE_DEFAULT_SERVER_HOST), - port_ (ACE_DEFAULT_SERVER_PORT), - sleep_time_ (0, 0), // By default, don't sleep between calls. - threads_ (10), - quit_string_ ("q"), - message_len_ (0), - message_buf_ (0), - io_source_ (ACE_INVALID_HANDLE), // Defaults to using the generator. - iterations_ (10000), - oneway_ (1) // Make oneway calls the default. -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - , barrier_ (0) -#endif /* ACE_MT_SAFE */ -{ -} - -Options::~Options (void) -{ - ACE_MT (delete this->barrier_); - delete [] this->message_buf_; -} - -// Options Singleton. -typedef ACE_Singleton OPTIONS; - -int -Options::init (void) -{ - // Check for default case. - if (this->message_len_ == 0) - this->message_len_ = ACE_OS::strlen ("TAO"); - - this->message_len_ += sizeof (ACE_UINT32); - - ACE_NEW_RETURN (this->message_buf_, - char[this->message_len_], - -1); - - // Copy the length into the beginning of the message. - ACE_UINT32 length = ntohl (this->message_len_); - ACE_OS::memcpy ((void *) this->message_buf_, - (void *) &length, - sizeof length); - - ACE_OS::memset ((void *) (this->message_buf_ + sizeof (ACE_UINT32)), - 'a', - this->message_len_ - sizeof (ACE_UINT32)); - - // Allocate the barrier with the correct count. - ACE_MT (ACE_NEW_RETURN (this->barrier_, - ACE_Barrier (this->threads_), - -1)); - return 0; -} - -size_t -Options::message_len (void) const -{ - return this->message_len_; -} - -const void * -Options::message_buf (void) const -{ - return this->message_buf_; -} - -ssize_t -Options::read (void *buf, size_t len, size_t &iteration) -{ - ACE_UNUSED_ARG (len); - - if (this->io_source_ == ACE_STDIN) - return ACE_OS::read (ACE_STDIN, buf, len); - else if (iteration >= this->iterations_) - return 0; - else - { - ACE_OS::memcpy (buf, - this->message_buf (), - len); - iteration++; - return len; - } -} - -int -Options::parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt getopt (argc, argv, "2h:i:m:p:q:st:T:", 1); - - for (int c; (c = getopt ()) != -1; ) - switch (c) - { - case '2': // Disable the oneway client. - this->oneway_ = 0; - break; - case 'h': - this->host_ = getopt.optarg; - break; - case 'i': - this->iterations_ = ACE_OS::atoi (getopt.optarg); - break; - case 'm': - this->message_len_ = ACE_OS::atoi (getopt.optarg); - break; - case 'p': - this->port_ = ACE_OS::atoi (getopt.optarg); - break; - case 'q': - this->quit_string_ = getopt.optarg; - break; - case 's': - this->io_source_ = ACE_STDIN; - break; - case 't': - this->threads_ = (size_t) ACE_OS::atoi (getopt.optarg); - break; - case 'T': - this->sleep_time_.set (0, ACE_OS::atoi (getopt.optarg)); - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) usage: %n [-2] [-h ] " - "[-i iterations] [-m message-size] " - "[-p ] [-q ] " - "[-s] [-t ] [-T ]\n"), - -1); - } - - return this->init (); -} - -u_short -Options::port (void) const -{ - return this->port_; -} - -const char * -Options::host (void) const -{ - return this->host_; -} - -const char * -Options::quit_string (void) const -{ - return this->quit_string_; -} - -size_t -Options::threads (void) const -{ - return this->threads_; -} - -const ACE_Time_Value & -Options::sleep_time (void) const -{ - return this->sleep_time_; -} - -char * -Options::shared_client_test (u_short port, - ACE_SSL_SOCK_Stream &cli_stream) -{ - ACE_INET_Addr remote_addr (port, this->host_); - - ACE_SSL_SOCK_Connector con; - - if (con.connect (cli_stream, - remote_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "connection failed"), - 0); - else - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) connected to %s at port %d\n", - remote_addr.get_host_name (), - remote_addr.get_port_number ())); - - ACE_INT32 len = htonl (this->message_len ()); - - // Allocate the transmit buffer. - char *buf; - ACE_NEW_RETURN (buf, - char[len], - 0); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) waiting...\n")); - - // Wait for all other threads to finish initialization. - ACE_MT (this->barrier_->wait ()); - return buf; -} -// Static function entry point to the oneway client service. - -void * -Options::oneway_client_test (void *) -{ - Options *options = OPTIONS::instance (); - ACE_SSL_SOCK_Stream cli_stream; - - // Add 1 to the port to trigger the oneway test! - char *request = options->shared_client_test (options->port () + 1, - cli_stream); - if (request == 0) - return 0; - - // This variable is allocated off the stack to obviate the need for - // locking. - size_t iteration = 0; - - // Keep track of return value. - int result = 0; - ACE_INT32 len = options->message_len (); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting oneway transmission\n")); - - // Perform oneway transmission of data to server (correctly handles - // "incomplete writes"). - - for (ssize_t r_bytes; - (r_bytes = options->read (request, len, iteration)) > 0; - // Transmit at the proper rate. - ACE_OS::sleep (options->sleep_time ())) - if (ACE_OS::memcmp (request, - options->quit_string (), - ACE_OS::strlen (options->quit_string ())) == 0) - break; - else if (cli_stream.send_n (request, r_bytes) == -1) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "send_n")); - result = -1; - break; - } - - // Close the connection. - cli_stream.close (); - - delete [] request; - return (void *) result; -} - -// Static function entry point to the twoway client service. - -void * -Options::twoway_client_test (void *) -{ - Options *options = OPTIONS::instance (); - - ACE_SSL_SOCK_Stream cli_stream; - - char *request = options->shared_client_test (options->port (), - cli_stream); - if (request == 0) - return 0; - - // This variable is allocated off the stack to obviate the need for - // locking. - size_t iteration = 0; - - // Keep track of return value. - int result = 0; - - // Timer business. - ACE_High_Res_Timer timer; - - ACE_INT32 len = options->message_len (); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting twoway transmission\n")); - - // Perform twoway transmission of data to server (correctly handles - // "incomplete writes"). - - for (ssize_t r_bytes; - (r_bytes = options->read (request, len, iteration)) > 0; - // Transmit at the proper rate. - ACE_OS::sleep (options->sleep_time ())) - if (ACE_OS::memcmp (request, - options->quit_string (), - ACE_OS::strlen (options->quit_string ())) == 0) - break; - - // Transmit to the server. - else - { - // Note that we use the incremental feature of the - // so that we don't get "charged" for the - // used to control the rate at which requests - // are sent. - timer.start_incr (); - - if (cli_stream.send_n (request, r_bytes) == -1) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "send_n")); - result = -1; - break; - } - // Receive the reply from the server. Normally, it just sends - // back 24 bytes, which is typical for an IIOP reply. - else if (cli_stream.recv (request, r_bytes) <= 0) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "recv")); - result = -1; - break; - } - - timer.stop_incr (); - } - - ACE_Time_Value tv; - - timer.elapsed_time_incr (tv); - double real_time = tv.sec () * ACE_ONE_SECOND_IN_USECS + tv.usec (); - double messages_per_sec = iteration * double (ACE_ONE_SECOND_IN_USECS) / real_time; - - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("(%t) messages = %d\n(%t) usec-per-message = %f\n(%t) messages-per-second = %0.00f\n"), - iteration, - real_time / double (iteration), - messages_per_sec < 0 ? 0 : messages_per_sec)); - - // Close the connection. - cli_stream.close (); - - delete [] request; - return (void *) result; -} - -ACE_THR_FUNC -Options::thr_func (void) -{ - if (this->oneway_ == 0) - return ACE_THR_FUNC (&Options::twoway_client_test); - else - return ACE_THR_FUNC (&Options::oneway_client_test); -} - -static int -run_client (void) -{ - // Raise the socket handle limit to the maximum. - ACE::set_handle_limit (); - -#if defined (ACE_HAS_THREADS) - if (ACE_Thread_Manager::instance ()->spawn_n (OPTIONS::instance ()->threads (), - OPTIONS::instance ()->thr_func ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "spawn_n"), - 1); - else - ACE_Thread_Manager::instance ()->wait (); -#else - *(OPTIONS::instance ()->thr_func) (); -#endif /* ACE_HAS_THREADS */ - return 0; -} - -int -main (int argc, char *argv[]) -{ - // Initialize the logger. - ACE_LOG_MSG->open (argv[0]); - - if (OPTIONS::instance ()->parse_args (argc, argv) == -1) - return -1; - - // Run the client - run_client (); - - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/IPC_SAP/SSL_SAP/SSL-client.h b/examples/IPC_SAP/SSL_SAP/SSL-client.h deleted file mode 100644 index 384108a6688..00000000000 --- a/examples/IPC_SAP/SSL_SAP/SSL-client.h +++ /dev/null @@ -1,110 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// This file defines the Options class for SSL-client. IBM C++ compiler'd -// template auto-instantiator needs this in a separate file. - -#ifndef __ACE_SSL_CLIENT_H -#define __ACE_SSL_CLIENT_H - -#include "ace/OS.h" -#include "ace/Synch.h" - -#include "SSL_SOCK_Stream.h" - -class Options - // = TITLE - // Define the options for this test. -{ -public: - Options (void); - // Constructor. - - ~Options (void); - // Destructor. - - int parse_args (int argc, char *argv[]); - // Parse the command-line arguments. - - const ACE_Time_Value &sleep_time (void) const; - // Return the amount of time to sleep in order to implement the - // proper transmission rates. - - u_short port (void) const; - // Port of the server. - - const char *host (void) const; - // Host of the server. - - size_t threads (void) const; - // Number of threads. - - const char *quit_string (void) const; - // String that shuts down the client/server. - - ssize_t read (void *buf, size_t len, size_t &iterations); - // Read from the appropriate location. - - size_t message_len (void) const; - // Returns the length of the message to send. - - const void *message_buf (void) const; - // Returns a pointer to the message. - - ACE_THR_FUNC thr_func (void); - // Returns a pointer to the entry point into the thread that runs - // the client test function. - -private: - int init (void); - // Initialize the message we're sending to the user and set up the - // barrier. - - char *shared_client_test (u_short port, - ACE_SSL_SOCK_Stream &cli_stream); - // Performs the shared behavior of the oneway and twoway client - // tests. - - static void *twoway_client_test (void *); - // Performs the twoway test. - - static void *oneway_client_test (void *); - // Performs the oneway test. - - const char *host_; - // Host of the server. - - u_short port_; - // Port of the server. - - ACE_Time_Value sleep_time_; - // Sleep_Time value. - - size_t threads_; - // Number of threads. - - const char *quit_string_; - // String that shuts down the client/server. - - size_t message_len_; - // Size of the message we send to the server. - - char *message_buf_; - // Pointer to the message we send to the server. - - ACE_HANDLE io_source_; - // Are we reading I/O from ACE_STDIN or from our generator? - - size_t iterations_; - // Number of iterations. - - char oneway_; - // Are we running oneway or twoway? - - // Please leave the ; inside the parenthesis to avoid Green Hills - // (and probably other) compiler warning about extra ;. - ACE_MT (ACE_Barrier *barrier_;) - // Barrier used to synchronize the start of all the threads. -}; - -#endif /* __ACE_SSL_CLIENT_H */ diff --git a/examples/IPC_SAP/SSL_SAP/SSL-server-fancy.cpp b/examples/IPC_SAP/SSL_SAP/SSL-server-fancy.cpp deleted file mode 100644 index 370813eb372..00000000000 --- a/examples/IPC_SAP/SSL_SAP/SSL-server-fancy.cpp +++ /dev/null @@ -1,585 +0,0 @@ -// $Id$ - -// This example tests the features of the , -// , and classes. If the platform -// supports threads it uses a thread-per-connection concurrency model. -// Otherwise, it uses a single-threaded iterative server model. - -#include "ace/Svc_Handler.h" -#include "ace/Singleton.h" -#include "ace/Synch.h" -#include "ace/Profile_Timer.h" -#include "ace/Get_Opt.h" - -#include "SSL_SOCK_Acceptor.h" - -#include "SSL-server-fancy.h" - -ACE_RCSID(SSL_SAP, SSL_server_fancy, "$Id$") - -// Forward declaration. -class Handler; - -class Handler_Factory -{ - // = TITLE - // Creates the oneway or twoway handlers. -public: - Handler_Factory (void); - // Constructor. - - ~Handler_Factory (void); - // Destructor. - - int handle_events (void); - // Run the main event loop. - -private: - int init_acceptors (void); - // Initialize the acceptors. - - int create_handler (ACE_SSL_SOCK_Acceptor &acceptor, - Handler *(*handler_factory) (ACE_HANDLE), - const char *handler_type); - // Factory that creates the right kind of . - - // = Factory functions. - static Handler *make_twoway_handler (ACE_HANDLE); - // Create a twoway handler. - - static Handler *make_oneway_handler (ACE_HANDLE); - // Create a oneway handler. - - ACE_SSL_SOCK_Acceptor twoway_acceptor_; - // Twoway acceptor factory. - - ACE_SSL_SOCK_Acceptor oneway_acceptor_; - // Oneway acceptor factory. -}; - -class Handler : public ACE_Svc_Handler -{ - // = TITLE - // Base class for the oneway and twoway handlers. - - friend class Handler_Factory; - // The factory has special permission. (to access svc ()). - -public: - virtual int open (void * = 0); - // Generic initialization method. - - virtual int close (u_long); - // Close down and delete this. - -protected: - Handler (ACE_HANDLE handle); - // Constructor. - - int parse_header_and_allocate_buffer (char *&buf, - ACE_INT32 *len); - // Implement the generic code that's called from any of the subclass - // methods to get the header and the buffer to read the data. - // This method factors out common code. - - virtual int run (void) = 0; - // Hook method called by the template method to do the actual - // protocol. Must be overridden by the subclass. - - virtual int svc (void); - // Template method entry point into the handler task. - - virtual void print_results (void); - // Print the results. - - size_t total_bytes_; - // Total number of bytes received. - - size_t message_count_; - // Number of messages received. - - ACE_Profile_Timer timer_; - // Keeps track of how much time we're using. -}; - -class Twoway_Handler : public Handler -{ - // = TITLE - // Performs the twoway protocol. -public: - Twoway_Handler (ACE_HANDLE handle); - // Constructor. - -private: - virtual int run (void); - // Template Method hook called by . -}; - -class Oneway_Handler : public Handler -{ - // = TITLE -public: - Oneway_Handler (ACE_HANDLE handle); - // Constructor. - -private: - virtual int run (void); - // Template Method hook called by . - - virtual void print_results (void); - // Print the results. -}; - -u_short -Options::port (void) const -{ - return this->port_; -} - -int -Options::verbose (void) const -{ - return this->verbose_; -} - -int -Options::reply_message_len (void) const -{ - return this->reply_message_len_; -} - -Options::~Options (void) -{ -} - -Options::Options (void) - : verbose_ (0), - port_ (ACE_DEFAULT_SERVER_PORT), - reply_message_len_ (24) // Default to the approximate size of an - // GIOP reply message. -{ -} - -int -Options::parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt getopt (argc, argv, "p:r:v", 1); - - for (int c; (c = getopt ()) != -1; ) - switch (c) - { - case 'p': - this->port_ = ACE_OS::atoi (getopt.optarg); - break; - case 'r': - this->reply_message_len_ = ACE_OS::atoi (getopt.optarg); - break; - case 'v': - this->verbose_ = 1; - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) usage: %n [-p ] [-v]"), - -1); - } - - return 0; -} - -// Options Singleton. -typedef ACE_Singleton OPTIONS; - -Handler::Handler (ACE_HANDLE handle) - : total_bytes_ (0), - message_count_ (0) -{ - this->peer ().set_handle (handle); -} - -int -Handler::open (void *) -{ - ACE_INET_Addr cli_addr; - - // Make sure we're not in non-blocking mode. - if (this->peer ().disable (ACE_NONBLOCK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "disable"), - 0); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) client %s connected from %d on handle %d\n", - cli_addr.get_host_name (), - cli_addr.get_port_number (), - this->peer ().get_handle ())); - return 0; -} - -int -Handler::close (u_long) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) closing down %x\n", - this)); - delete this; - return 0; -} - -int -Handler::svc (void) -{ - // Timer logic. - this->timer_.start (); - - // Invoke the hook method to run the specific test. - int result = this->run (); - - this->timer_.stop (); - - this->print_results (); - - return result; -} - -int -Handler::parse_header_and_allocate_buffer (char *&request, - ACE_INT32 *len) -{ - ssize_t result = this->peer ().recv_n ((void *) len, - sizeof (ACE_INT32)); - if (result == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) connected closed\n")); - return -1; - } - else if (result == -1 || result != sizeof (ACE_INT32)) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "recv_n failed"), - -1); - else - { - *len = ntohl (*len); - ACE_NEW_RETURN (request, - char[*len], - -1); - } - - return 0; -} - -void -Handler::print_results (void) -{ -} - -Twoway_Handler::Twoway_Handler (ACE_HANDLE handle) - : Handler (handle) -{ -} - -// Function entry point into the twoway server task. - -int -Twoway_Handler::run (void) -{ - // Read data from client (terminate on error). - - char *request = 0; - - for (;;) - { - ACE_INT32 len = 0; - - if (parse_header_and_allocate_buffer (request, - &len) == -1) - return -1; - - // Subtract off the sizeof the length prefix. - ssize_t r_bytes = this->peer ().recv_n (request, - len - sizeof (ACE_UINT32)); - - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (OPTIONS::instance ()->verbose () - && ACE::write_n (ACE_STDOUT, - request, - r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, - "%p\n", - "ACE::write_n")); - else - { - ssize_t s_bytes = (ssize_t) OPTIONS::instance ()->reply_message_len (); - - // Don't try to send more than is in the request buffer! - if (s_bytes > r_bytes) - s_bytes = r_bytes; - - if (this->peer ().send_n (request, - s_bytes) != s_bytes) - ACE_ERROR ((LM_ERROR, - "%p\n", - "send_n")); - } - this->total_bytes_ += size_t (r_bytes); - this->message_count_++; - - delete [] request; - request = 0; - } - - delete [] request; - return 0; -} - -Oneway_Handler::Oneway_Handler (ACE_HANDLE handle) - : Handler (handle) -{ -} - -void -Oneway_Handler::print_results (void) -{ - ACE_Profile_Timer::ACE_Elapsed_Time et; - this->timer_.elapsed_time (et); - - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\t\treal time = %f secs \n\t\tuser time = %f secs \n\t\tsystem time = %f secs\n"), - et.real_time, - et.user_time, - et.system_time)); - - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\t\tmessages = %d\n\t\ttotal bytes = %d\n\t\tmbits/sec = %f\n\t\tusec-per-message = %f\n"), - this->message_count_, - this->total_bytes_, - (((double) this->total_bytes_ * 8) / et.real_time) / (double) (1024 * 1024), - ((et.user_time + et.system_time) / (double) this->message_count_) * ACE_ONE_SECOND_IN_USECS)); -} - -// Function entry point into the oneway server task. - -int -Oneway_Handler::run (void) -{ - // Read data from client (terminate on error). - - char *request = 0; - - for (;;) - { - ACE_INT32 len = 0; - - if (parse_header_and_allocate_buffer (request, - &len) == -1) - return -1; - - // Subtract off the sizeof the length prefix. - ssize_t r_bytes = this->peer ().recv_n (request, - len - sizeof (ACE_UINT32)); - - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (OPTIONS::instance ()->verbose () - && ACE::write_n (ACE_STDOUT, - request, - r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, - "%p\n", - "ACE::write_n")); - - this->total_bytes_ += size_t (r_bytes); - this->message_count_++; - delete [] request; - request = 0; - } - - delete [] request; - return 0; -} - -// Create a twoway handler. - -Handler * -Handler_Factory::make_twoway_handler (ACE_HANDLE handle) -{ - return new Twoway_Handler (handle); -} - -// Create a oneway handler. - -Handler * -Handler_Factory::make_oneway_handler (ACE_HANDLE handle) -{ - return new Oneway_Handler (handle); -} - -int -Handler_Factory::init_acceptors (void) -{ - // Create the oneway and twoway server addresses. - ACE_INET_Addr twoway_server_addr (OPTIONS::instance ()->port ()); - ACE_INET_Addr oneway_server_addr (OPTIONS::instance ()->port () + 1); - - // Create acceptors, reuse the address. - if (this->twoway_acceptor_.open (twoway_server_addr, 1) == -1 - || this->oneway_acceptor_.open (oneway_server_addr, 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "open"), - -1); - else if (this->twoway_acceptor_.get_local_addr (twoway_server_addr) == -1 - || this->oneway_acceptor_.get_local_addr (oneway_server_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "get_local_addr"), - -1); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting twoway server at port %d and oneway server at port %d\n", - twoway_server_addr.get_port_number (), - oneway_server_addr.get_port_number ())); - return 0; -} - -int -Handler_Factory::create_handler (ACE_SSL_SOCK_Acceptor &acceptor, - Handler * (*handler_factory) (ACE_HANDLE), - const char *handler_type) -{ - ACE_SSL_SOCK_Stream new_stream; - - if (acceptor.accept (new_stream) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "accept"), - -1); - - Handler *handler; - - ACE_ALLOCATOR_RETURN (handler, - (*handler_factory) (new_stream.get_handle ()), - -1); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) spawning %s handler\n", - handler_type)); - - if (handler->open () == -1) - return -1; - -#if defined (ACE_MT_SAFE) - // Spawn a new thread and run the new connection in that thread of - // control using the function as the entry point. - return handler->activate (); -#else - handler->svc (); - handler->close (0); - return 0; -#endif /* ACE_HAS_THREADS */ -} - -Handler_Factory::Handler_Factory (void) -{ -} - -Handler_Factory::~Handler_Factory (void) -{ - this->twoway_acceptor_.close (); - this->oneway_acceptor_.close (); -} - -// Run the main event loop. - -int -Handler_Factory::handle_events (void) -{ - if (this->init_acceptors () == -1) - return -1; - - fd_set handles; - - FD_ZERO (&handles); - FD_SET (this->twoway_acceptor_.get_handle (), - &handles); - FD_SET (this->oneway_acceptor_.get_handle (), - &handles); - - // Performs the iterative server activities. - - for (;;) - { - ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT); - fd_set temp = handles; - - int result = ACE_OS::select (int (this->oneway_acceptor_.get_handle ()) + 1, - (fd_set *) &temp, - 0, - 0, - timeout); - if (result == -1) - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "select")); - else if (result == 0 && OPTIONS::instance ()->verbose ()) - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) select timed out\n")); - else - { - if (FD_ISSET (this->twoway_acceptor_.get_handle (), - &temp)) - this->create_handler (this->twoway_acceptor_, - &Handler_Factory::make_twoway_handler, - "twoway"); - if (FD_ISSET (this->oneway_acceptor_.get_handle (), - &temp)) - this->create_handler (this->oneway_acceptor_, - &Handler_Factory::make_oneway_handler, - "oneway"); - } - } - - ACE_NOTREACHED (return 0;) -} - -int -main (int argc, char *argv[]) -{ - OPTIONS::instance ()->parse_args (argc, argv); - - Handler_Factory server; - - return server.handle_events (); -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton; -template class ACE_Svc_Handler; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton -#pragma instantiate ACE_Svc_Handler -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/IPC_SAP/SSL_SAP/SSL-server-fancy.h b/examples/IPC_SAP/SSL_SAP/SSL-server-fancy.h deleted file mode 100644 index 295875ca153..00000000000 --- a/examples/IPC_SAP/SSL_SAP/SSL-server-fancy.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// This file defines the Options class for SSL-server-fancy. -// IBM C++ compiler'd template auto-instantiator needs this in a separate file. - -#ifndef __ACE_SSL_SERVER_FANCY_H -#define __ACE_SSL_SERVER_FANCY_H - -class Options - // = TITLE - // Define the options for this test. -{ -public: - Options (void); - // Constructor. - - ~Options (void); - // Destructor. - - int parse_args (int argc, char *argv[]); - // Parse the command-line arguments. - - int verbose (void) const; - // Are we running in verbose mode? - - u_short port (void) const; - // Port number that we are listening at. - - int reply_message_len (void) const; - // Size of the reply message. - -private: - int verbose_; - // Are we running in verbose mode? - - u_short port_; - // Port number we listen at. - - size_t reply_message_len_; - // Size of the reply message. -}; - -#endif /* __ACE_SSL_SERVER_FANCY_H */ diff --git a/examples/IPC_SAP/SSL_SAP/SSL-server-poll.cpp b/examples/IPC_SAP/SSL_SAP/SSL-server-poll.cpp deleted file mode 100644 index e29931fec52..00000000000 --- a/examples/IPC_SAP/SSL_SAP/SSL-server-poll.cpp +++ /dev/null @@ -1,202 +0,0 @@ -// $Id$ - -// IPC_SAP/poll server, which illustrates how to integrate the ACE -// SSL socket wrappers with the SVR4 system call to create a -// single-threaded concurrent server. This server program can be -// driven by the oneway test mode of SSL-client.cpp. - -#include "ace/INET_Addr.h" - -#include "SSL_SOCK_Acceptor.h" -#include "SSL_SOCK_Stream.h" - -ACE_RCSID(SSL_SAP, SSL_server_poll, "$Id$") - -#if defined (ACE_HAS_POLL) - -// Should we be verbose? -static int verbose = 0; - -// Max number of open handles. -static const int MAX_HANDLES = 200; - -struct Buffer_Info -{ - void *buf_; - // Pointer to the buffer. - - size_t len_; - // Length of the buffer. -}; - -// Array of 's. -static struct pollfd poll_array[MAX_HANDLES]; - -// Array of . -static Buffer_Info buffer_array[MAX_HANDLES]; - -static void -init_poll_array (void) -{ - int i; - - for (i = 0; i < MAX_HANDLES; i++) - { - poll_array[i].fd = ACE_INVALID_HANDLE; - poll_array[i].events = POLLIN; - } -} - -static int -init_buffer (size_t index) -{ - ACE_INT32 len; - - if (ACE::recv_n (poll_array[index].fd, - (void *) &len, - sizeof (ACE_INT32)) != sizeof (ACE_INT32)) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "recv_n failed"), - -1); - else - { - len = ntohl (len); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reading messages of size %d from handle %d\n", - len, - poll_array[index].fd)); - - ACE_ALLOCATOR_RETURN (buffer_array[index].buf_, - ACE_OS::malloc (len), - -1); - buffer_array[index].len_ = len; - } - return 0; -} - -static void -handle_data (size_t &n_handles) -{ - // Handle pending logging messages first (s_handle + 1 is guaranteed - // to be lowest client descriptor). - - for (size_t index = 1; index < n_handles; index++) - { - if (ACE_BIT_ENABLED (poll_array[index].revents, POLLIN)) - { - // First time in, we need to initialize the buffer. - if (buffer_array[index].buf_ == 0 - && init_buffer (index) == -1) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "init_buffer")); - continue; - } - - // Read data from client (terminate on error). - - ssize_t n = ACE::recv (poll_array[index].fd, - buffer_array[index].buf_, - buffer_array[index].len_); - // will not block in this case! - - if (n == -1) - ACE_ERROR ((LM_ERROR, - "%p\n", - "read failed")); - else if (n == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) closing oneway server at handle %d\n", - poll_array[index].fd)); - - // Handle client connection shutdown. - ACE_OS::close (poll_array[index].fd); - poll_array[index].fd = poll_array[--n_handles].fd; - - ACE_OS::free ((void *) buffer_array[index].buf_); - buffer_array[index].buf_ = 0; - buffer_array[index].len_ = 0; - } - else if (verbose) - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) %*s", - n, - buffer_array[index].buf_)); - } - } -} - -static void -handle_connections (ACE_SSL_SOCK_Acceptor &peer_acceptor, - size_t &n_handles) -{ - if (ACE_BIT_ENABLED (poll_array[0].revents, POLLIN)) - { - ACE_SSL_SOCK_Stream new_stream; - - ACE_INET_Addr client; - ACE_Time_Value nonblock (0, 0); - - // Handle all pending connection requests (note use of "polling" - // feature that doesn't block). - - while (ACE_OS::poll (poll_array, 1, nonblock) > 0) - if (peer_acceptor.accept (new_stream, &client) == -1) - ACE_OS::perror ("accept"); - else - { - const char *s = client.get_host_name (); - - ACE_ASSERT (s != 0); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) client %s\n", - s)); - poll_array[n_handles++].fd = new_stream.get_handle (); - } - } -} - -int -main (int, char *[]) -{ - u_short port = ACE_DEFAULT_SERVER_PORT + 1; - - // Create a server end-point. - ACE_INET_Addr addr (port); - ACE_SSL_SOCK_Acceptor peer_acceptor (addr); - - ACE_HANDLE s_handle = peer_acceptor.get_handle (); - - init_poll_array (); - - poll_array[0].fd = s_handle; - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting oneway server at port %d\n", - port)); - - for (size_t n_handles = 1;;) - { - // Wait for client I/O events (handle interrupts). - while (ACE_OS::poll (poll_array, n_handles) == -1 - && errno == EINTR) - continue; - - handle_data (n_handles); - handle_connections (peer_acceptor, n_handles); - } - - /* NOTREACHED */ - return 0; -} -#else -#include -int main (int, char *[]) -{ - ACE_OS::fprintf (stderr, "This feature is not supported\n"); - return 0; -} -#endif /* ACE_HAS_POLL */ diff --git a/examples/IPC_SAP/SSL_SAP/SSL-server-simple.cpp b/examples/IPC_SAP/SSL_SAP/SSL-server-simple.cpp deleted file mode 100644 index 1c5050c13ef..00000000000 --- a/examples/IPC_SAP/SSL_SAP/SSL-server-simple.cpp +++ /dev/null @@ -1,365 +0,0 @@ -// $Id$ - -// This example tests the features of the , -// , and classes. - -#include "ace/Thread_Manager.h" -#include "ace/Handle_Set.h" -#include "ace/Profile_Timer.h" - -#include "SSL_SOCK_Acceptor.h" - -ACE_RCSID(SSL_SAP, SSL_server_simple, "$Id$") - -// Are we running verbosely? -static int verbose = 1; - -// Function entry point into the twoway server task. - -int -twoway_server (ACE_SSL_SOCK_Stream &stream) -{ - ACE_INET_Addr cli_addr; - - // Make sure we're not in non-blocking mode. - if (stream.disable (ACE_NONBLOCK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "disable"), - 0); - else if (stream.get_remote_addr (cli_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "get_remote_addr"), - 0); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) client %s connected from %d\n", - cli_addr.get_host_name (), - cli_addr.get_port_number ())); - - size_t total_bytes = 0; - size_t message_count = 0; - - char *request = 0; - - // Read data from client (terminate on error). - - for (;;) - { - ACE_INT32 len; - - ssize_t r_bytes = stream.recv_n ((void *) &len, - sizeof (ACE_INT32)); - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (r_bytes != sizeof (ACE_INT32)) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "recv_n failed")); - break; - } - else - { - len = ntohl (len); - ACE_NEW_RETURN (request, - char [len], - 0); - } - - // Subtract off the sizeof the length prefix. - r_bytes = stream.recv_n (request, - len - sizeof (ACE_UINT32)); - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (verbose - && ACE::write_n (ACE_STDOUT, - request, - r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, - "%p\n", - "ACE::write_n")); - else if (stream.send_n (request, - r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, - "%p\n", - "send_n")); - - total_bytes += size_t (r_bytes); - message_count++; - - delete [] request; - request = 0; - } - - // Close new endpoint (listening endpoint stays open). - stream.close (); - - delete [] request; - return 0; -} - -// Function entry point into the oneway server task. - -static int -oneway_server (ACE_SSL_SOCK_Stream &stream) -{ - ACE_INET_Addr cli_addr; - - // Make sure we're not in non-blocking mode. - if (stream.disable (ACE_NONBLOCK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "disable"), - 0); - else if (stream.get_remote_addr (cli_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "get_remote_addr"), - 0); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) client %s connected from %d\n", - cli_addr.get_host_name (), - cli_addr.get_port_number ())); - - // Timer business - ACE_Profile_Timer timer; - timer.start (); - - size_t total_bytes = 0; - size_t message_count = 0; - - char *request = 0; - - // Read data from client (terminate on error). - - for (;;) - { - ACE_INT32 len; - - ssize_t r_bytes = stream.recv_n ((void *) &len, - sizeof (ACE_INT32)); - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (r_bytes != sizeof (ACE_INT32)) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "recv_n failed")); - break; - } - else - { - len = ntohl (len); - ACE_NEW_RETURN (request, - char [len], - 0); - } - - // Subtract off the sizeof the length prefix. - r_bytes = stream.recv_n (request, - len - sizeof (ACE_UINT32)); - - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (verbose - && ACE::write_n (ACE_STDOUT, request, r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, - "%p\n", - "ACE::write_n")); - - total_bytes += size_t (r_bytes); - message_count++; - - delete [] request; - request = 0; - } - - timer.stop (); - - ACE_Profile_Timer::ACE_Elapsed_Time et; - timer.elapsed_time (et); - - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\t\treal time = %f secs \n\t\tuser time = %f secs \n\t\tsystem time = %f secs\n"), - et.real_time, - et.user_time, - et.system_time)); - - double messages_per_sec = double (message_count) / et.real_time; - - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\t\tmessages = %d\n\t\ttotal bytes = %d\n\t\tmbits/sec = %f\n\t\tusec-per-message = %f\n\t\tmessages-per-second = %0.00f\n"), - message_count, - total_bytes, - (((double) total_bytes * 8) / et.real_time) / (double) (1024 * 1024), - (et.real_time / (double) message_count) * 1000000, - messages_per_sec < 0 ? 0 : messages_per_sec)); - - // Close new endpoint (listening endpoint stays open). - stream.close (); - - delete [] request; - return 0; -} - -static int -run_event_loop (u_short port) -{ - // Raise the socket handle limit to the maximum. - ACE::set_handle_limit (); - - // Create the oneway and twoway acceptors. - ACE_SSL_SOCK_Acceptor twoway_acceptor; - ACE_SSL_SOCK_Acceptor oneway_acceptor; - - // Create the oneway and twoway server addresses. - ACE_INET_Addr twoway_server_addr (port); - ACE_INET_Addr oneway_server_addr (port + 1); - - // Create acceptors, reuse the address. - if (twoway_acceptor.open (twoway_server_addr, 1) == -1 - || oneway_acceptor.open (oneway_server_addr, 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "open"), - 1); - else if (twoway_acceptor.get_local_addr (twoway_server_addr) == -1 - || oneway_acceptor.get_local_addr (oneway_server_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "get_local_addr"), - 1); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting twoway server at port %d and oneway server at port %d\n", - twoway_server_addr.get_port_number (), - oneway_server_addr.get_port_number ())); - - // Keep these objects out here to prevent excessive constructor - // calls within the loop. - ACE_SSL_SOCK_Stream new_stream; - - ACE_Handle_Set handle_set; - handle_set.set_bit (twoway_acceptor.get_handle ()); - handle_set.set_bit (oneway_acceptor.get_handle ()); - - // Performs the iterative server activities. - - for (;;) - { - ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT); - ACE_Handle_Set temp = handle_set; - - int maxfd = int(oneway_acceptor.get_handle ()); - if (maxfd < int(twoway_acceptor.get_handle ())) - maxfd = int(twoway_acceptor.get_handle ()); - int result = ACE_OS::select (maxfd + 1, - (fd_set *) temp, - 0, - 0, - timeout); - if (result == -1) - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "select")); - else if (result == 0 && verbose) - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) select timed out\n")); - else - { - if (temp.is_set (twoway_acceptor.get_handle ())) - { - int r = twoway_acceptor.accept (new_stream); - while (r == -1 && errno == EAGAIN) - r = twoway_acceptor.accept (new_stream); - if (r == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "accept")); - continue; - } - else - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) spawning twoway server\n")); - - // Run the twoway server. - twoway_server (new_stream); - } - if (temp.is_set (oneway_acceptor.get_handle ())) - { - if (oneway_acceptor.accept (new_stream) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "accept")); - continue; - } - else - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) spawning oneway server\n")); - - // Run the oneway server. - oneway_server (new_stream); - } - } - } - - /* NOTREACHED */ -} - -int -main (int argc, char *argv[]) -{ - u_short port = ACE_DEFAULT_SERVER_PORT; - - if (argc > 1) - port = ACE_OS::atoi (argv[1]); - - return run_event_loop (port); -} diff --git a/examples/IPC_SAP/SSL_SAP/SSL-server.cpp b/examples/IPC_SAP/SSL_SAP/SSL-server.cpp deleted file mode 100644 index 27ce9c8c957..00000000000 --- a/examples/IPC_SAP/SSL_SAP/SSL-server.cpp +++ /dev/null @@ -1,389 +0,0 @@ -// $Id$ - -// This example tests the features of the , -// , and classes. If the platform -// supports threads it uses a thread-per-connection concurrency model. -// Otherwise, it uses a single-threaded iterative server model. - -#include "ace/Thread_Manager.h" -#include "ace/Handle_Set.h" -#include "ace/Profile_Timer.h" - -#include "SSL_SOCK_Acceptor.h" - -ACE_RCSID(SSL_SAP, SSL_server, "$Id$") - -// Are we running verbosely? -static int verbose = 0; - -static void -run_server (ACE_THR_FUNC server, - ACE_HANDLE handle) -{ -#if defined (ACE_HAS_THREADS) - // Spawn a new thread and run the new connection in that thread of - // control using the function as the entry point. - if (ACE_Thread_Manager::instance ()->spawn (server, - (void *) handle, - THR_DETACHED) == -1) - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "spawn")); -#else - (*server) ((void *) handle); -#endif /* ACE_HAS_THREADS */ -} - -// Function entry point into the twoway server task. - -static void * -twoway_server (void *arg) -{ - ACE_INET_Addr cli_addr; - ACE_SSL_SOCK_Stream new_stream; - ACE_HANDLE handle = (ACE_HANDLE) (long) arg; - - new_stream.set_handle (handle); - - // Make sure we're not in non-blocking mode. - if (new_stream.disable (ACE_NONBLOCK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "disable"), - 0); - else if (new_stream.get_remote_addr (cli_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "get_remote_addr"), - 0); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) client %s connected from %d\n", - cli_addr.get_host_name (), - cli_addr.get_port_number ())); - - size_t total_bytes = 0; - size_t message_count = 0; - - char *request = 0; - - // Read data from client (terminate on error). - - for (;;) - { - ACE_INT32 len; - - ssize_t r_bytes = new_stream.recv_n ((void *) &len, - sizeof (ACE_INT32)); - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (r_bytes != sizeof (ACE_INT32)) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "recv_n failed")); - break; - } - else - { - len = ntohl (len); - ACE_NEW_RETURN (request, - char [len], - 0); - } - - // Subtract off the sizeof the length prefix. - r_bytes = new_stream.recv_n (request, - len - sizeof (ACE_UINT32)); - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (verbose - && ACE::write_n (ACE_STDOUT, - request, - r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, - "%p\n", - "ACE::write_n")); - else if (new_stream.send_n (request, - r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, - "%p\n", - "send_n")); - - total_bytes += size_t (r_bytes); - message_count++; - - delete [] request; - request = 0; - } - - // Close new endpoint (listening endpoint stays open). - new_stream.close (); - - delete [] request; - return 0; -} - -// Function entry point into the oneway server task. - -static void * -oneway_server (void *arg) -{ - ACE_INET_Addr cli_addr; - ACE_SSL_SOCK_Stream new_stream; - ACE_HANDLE handle = (ACE_HANDLE) (long) arg; - - new_stream.set_handle (handle); - - // Make sure we're not in non-blocking mode. - if (new_stream.disable (ACE_NONBLOCK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "disable"), - 0); - else if (new_stream.get_remote_addr (cli_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "get_remote_addr"), - 0); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) client %s connected from %d\n", - cli_addr.get_host_name (), - cli_addr.get_port_number ())); - - // Timer business - ACE_Profile_Timer timer; - timer.start (); - - size_t total_bytes = 0; - size_t message_count = 0; - - char *request = 0; - - // Read data from client (terminate on error). - - for (;;) - { - ACE_INT32 len; - - ssize_t r_bytes = new_stream.recv_n ((void *) &len, - sizeof (ACE_INT32)); - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (r_bytes != sizeof (ACE_INT32)) - { - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "recv_n failed")); - break; - } - else - { - len = ntohl (len); - ACE_NEW_RETURN (request, - char [len], - 0); - } - - // Subtract off the sizeof the length prefix. - r_bytes = new_stream.recv_n (request, - len - sizeof (ACE_UINT32)); - - if (r_bytes == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "recv")); - break; - } - else if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - break; - } - else if (verbose - && ACE::write_n (ACE_STDOUT, request, r_bytes) != r_bytes) - ACE_ERROR ((LM_ERROR, - "%p\n", - "ACE::write_n")); - - total_bytes += size_t (r_bytes); - message_count++; - - delete [] request; - request = 0; - } - - timer.stop (); - - ACE_Profile_Timer::ACE_Elapsed_Time et; - timer.elapsed_time (et); - - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\t\treal time = %f secs \n\t\tuser time = %f secs \n\t\tsystem time = %f secs\n"), - et.real_time, - et.user_time, - et.system_time)); - - double messages_per_sec = double (message_count) / et.real_time; - - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\t\tmessages = %d\n\t\ttotal bytes = %d\n\t\tmbits/sec = %f\n\t\tusec-per-message = %f\n\t\tmessages-per-second = %0.00f\n"), - message_count, - total_bytes, - (((double) total_bytes * 8) / et.real_time) / (double) (1024 * 1024), - (et.real_time / (double) message_count) * 1000000, - messages_per_sec < 0 ? 0 : messages_per_sec)); - - // Close new endpoint (listening endpoint stays open). - new_stream.close (); - - delete [] request; - return 0; -} - -static int -run_event_loop (u_short port) -{ - // Raise the socket handle limit to the maximum. - ACE::set_handle_limit (); - - // Create the oneway and twoway acceptors. - ACE_SSL_SOCK_Acceptor twoway_acceptor; - ACE_SSL_SOCK_Acceptor oneway_acceptor; - - // Create the oneway and twoway server addresses. - ACE_INET_Addr twoway_server_addr (port); - ACE_INET_Addr oneway_server_addr (port + 1); - - // Create acceptors, reuse the address. - if (twoway_acceptor.open (twoway_server_addr, 1) == -1 - || oneway_acceptor.open (oneway_server_addr, 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "open"), - 1); - else if (twoway_acceptor.get_local_addr (twoway_server_addr) == -1 - || oneway_acceptor.get_local_addr (oneway_server_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "get_local_addr"), - 1); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) starting twoway server at port %d and oneway server at port %d\n", - twoway_server_addr.get_port_number (), - oneway_server_addr.get_port_number ())); - - // Keep these objects out here to prevent excessive constructor - // calls within the loop. - ACE_SSL_SOCK_Stream new_stream; - - ACE_Handle_Set handle_set; - handle_set.set_bit (twoway_acceptor.get_handle ()); - handle_set.set_bit (oneway_acceptor.get_handle ()); - - // Performs the iterative server activities. - - for (;;) - { - ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT); - ACE_Handle_Set temp = handle_set; - - int result = ACE_OS::select (int (oneway_acceptor.get_handle ()) + 1, - (fd_set *) temp, - 0, - 0, - timeout); - if (result == -1) - ACE_ERROR ((LM_ERROR, - "(%P|%t) %p\n", - "select")); - else if (result == 0 && verbose) - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) select timed out\n")); - else - { - if (temp.is_set (twoway_acceptor.get_handle ())) - { - if (twoway_acceptor.accept (new_stream) == -1) - { - ACE_ERROR ((LM_ERROR, - "%p\n", - "accept")); - continue; - } - else - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) spawning twoway server\n")); - - // Run the twoway server. - run_server (twoway_server, - new_stream.get_handle ()); - } - if (temp.is_set (oneway_acceptor.get_handle ())) - { - if (oneway_acceptor.accept (new_stream) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "accept")); - continue; - } - else - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) spawning oneway server\n")); - - // Run the oneway server. - run_server (oneway_server, - new_stream.get_handle ()); - } - } - } - - /* NOTREACHED */ -} - -int -main (int argc, char *argv[]) -{ - u_short port = ACE_DEFAULT_SERVER_PORT; - - if (argc > 1) - port = ACE_OS::atoi (argv[1]); - - return run_event_loop (port); -} diff --git a/examples/IPC_SAP/SSL_SAP/dummy.pem b/examples/IPC_SAP/SSL_SAP/dummy.pem deleted file mode 100644 index db80d7be4cc..00000000000 --- a/examples/IPC_SAP/SSL_SAP/dummy.pem +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDDTCCAregAwIBAgIBADANBgkqhkiG9w0BAQQFADCBkzELMAkGA1UEBhMCVVMx -ETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYDVQQHEwlTdC4gTG91aXMxHjAcBgNVBAoT -FVdhc2hpbmd0b24gVW5pdmVyc2l0eTEOMAwGA1UECxMFRGVwdC4xFjAUBgNVBAMT -DUNhcmxvcyBPJ1J5YW4xFTATBgkqhkiG9w0BCQEWBmNvcnlhbjAeFw05OTExMjMx -ODM1NThaFw05OTEyMjMxODM1NThaMIGTMQswCQYDVQQGEwJVUzERMA8GA1UECBMI -TWlzc291cmkxEjAQBgNVBAcTCVN0LiBMb3VpczEeMBwGA1UEChMVV2FzaGluZ3Rv -biBVbml2ZXJzaXR5MQ4wDAYDVQQLEwVEZXB0LjEWMBQGA1UEAxMNQ2FybG9zIE8n -UnlhbjEVMBMGCSqGSIb3DQEJARYGY29yeWFuMFwwDQYJKoZIhvcNAQEBBQADSwAw -SAJBALb2aQitjvskGobtP9PwTImvXa1g+YQHAiKkzHR72JeprOKdmwqJTSvOzNzc -6gdNogajqyclPrm2GmyrCOrZQucCAwEAAaOB8zCB8DAdBgNVHQ4EFgQUdM3+LFDZ -SDd4L/BI7eQyZ41vEuYwgcAGA1UdIwSBuDCBtYAUdM3+LFDZSDd4L/BI7eQyZ41v -EuahgZmkgZYwgZMxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhNaXNzb3VyaTESMBAG -A1UEBxMJU3QuIExvdWlzMR4wHAYDVQQKExVXYXNoaW5ndG9uIFVuaXZlcnNpdHkx -DjAMBgNVBAsTBURlcHQuMRYwFAYDVQQDEw1DYXJsb3MgTydSeWFuMRUwEwYJKoZI -hvcNAQkBFgZjb3J5YW6CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAANB -AC6wIXIWU0J56pcfeOJmRxfdOqKM1ot/9fEz1JtW/bOx9ybgd1zN3mPQUblCoEGm -FLdQXN0RYMYqlpZBN52f29k= ------END CERTIFICATE----- diff --git a/examples/IPC_SAP/SSL_SAP/key.pem b/examples/IPC_SAP/SSL_SAP/key.pem deleted file mode 100644 index f6b0e4959b7..00000000000 --- a/examples/IPC_SAP/SSL_SAP/key.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBALb2aQitjvskGobtP9PwTImvXa1g+YQHAiKkzHR72JeprOKdmwqJ -TSvOzNzc6gdNogajqyclPrm2GmyrCOrZQucCAwEAAQJBAIND2GmEc5+U8H87Od7p -eVATBAd/GqTxjkOirpknvWZY+jUeHSDZng6SdYdEHJkFlZNAQFsUOckIW1lraVpT -KKkCIQDxLo3i7kvJbLYUcSoWdXfEIAc/BctN5UlTjyyMVSOgnQIhAMI0JkT3y6Qk -Dv2GcGAxOEkk51psMJLHOfXQtiG8zfBTAiAavzL1C8BT4j5/Hd2xB+30Tij/kEDv -rpHnNmWWWorM8QIhAL/Ocd28P80mMAgGOAdJlaXoZPfR00ekrYIzWS+JIn0xAiBt -8FXXgRw8uUDs9TLDKvWFjX69fs8OGU9WL4Em01RmRA== ------END RSA PRIVATE KEY----- diff --git a/examples/IPC_SAP/SSL_SAP/local_data b/examples/IPC_SAP/SSL_SAP/local_data deleted file mode 100644 index c0119859a28..00000000000 --- a/examples/IPC_SAP/SSL_SAP/local_data +++ /dev/null @@ -1 +0,0 @@ -I am Iron man! diff --git a/examples/IPC_SAP/SSL_SAP/summarize b/examples/IPC_SAP/SSL_SAP/summarize deleted file mode 100755 index ee8ffd2df25..00000000000 --- a/examples/IPC_SAP/SSL_SAP/summarize +++ /dev/null @@ -1,45 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' - & eval 'exec perl -w -S $0 $argv:q' - if 0; - -# $Id$ -# -# Summarizes results from a series of runs of run_test, with -# different numbers of clients. Example usage: -# -# $ for i in 1 2 5 10 15 20 25 30 35 40 45 50; do ./run_test $i; done -# $ ./summarize -# -# The first three lines above let this script run without specifying the -# full path to perl, as long as it is in the user's PATH. -# Taken from perlrun man page. - -@files = glob 'client-*.log'; -@total_threads = (); - -foreach $file (@files) { - my ($i); - ($i = $file) =~ s/client-(\d+).log/$1/; - push @total_threads, $i; -} - -print "No.of threads\t\tAverage Latency\n\n"; - -foreach $total_threads (sort {$a <=> $b} @total_threads) { - undef $high_latency; - - $high_latency = 0; - open (FILE, "client-${total_threads}.log") || - die "$0: unable to open \"client-${total_threads}.log\"\n"; - while ($line = ) { - if ($line =~ /.*usec-per-message = ([\d\.]+)/) - { - $high_latency += $1 ; - $number++; - } - } - close FILE; - - printf "%3d\t\t\t%8f\n", - $total_threads, $high_latency/$number; -} diff --git a/examples/Reactor/Misc/signal_tester.cpp b/examples/Reactor/Misc/signal_tester.cpp deleted file mode 100644 index 37613f14f38..00000000000 --- a/examples/Reactor/Misc/signal_tester.cpp +++ /dev/null @@ -1,221 +0,0 @@ -// Perform an extensive test of the ACE_Reactor's event dispatching -// $Id$ - -// mechanisms. These mechanisms illustrate how signals, I/O, and -// timeout events can all be handled within the same framework. In -// addition, this example illustrates how to use the ACE_Reactor for -// devices that perform I/O via signals (such as SVR4 message queues). - - -#include "ace/Service_Config.h" - -// Used to shut down the event loop. -static sig_atomic_t done = 0; - -// This class illustrates how to handle signal-driven I/O using the -// ACE_Reactor framework. Note that signals may be caught and -// processed without requiring the use of global signal handler -// functions or global signal handler data. - -class Sig_Handler : public ACE_Event_Handler -{ -public: - Sig_Handler (void); - virtual ACE_HANDLE get_handle (void) const; - virtual int handle_input (ACE_HANDLE); - virtual int shutdown (ACE_HANDLE, ACE_Reactor_Mask); - virtual int handle_signal (ACE_HANDLE signum, siginfo_t * = 0, - ucontext_t * = 0); - -private: - ACE_HANDLE handle_; -}; - -// A dummy_handle is required to reserve a slot in the ACE_Reactor's -// descriptor table. - -Sig_Handler::Sig_Handler (void) -{ - // Assign the Sig_Handler a dummy I/O descriptor. Note that even - // though we open this file "Write Only" we still need to use the - // ACE_Event_Handler::NULL_MASK when registering this with the - // ACE_Reactor (see below). - this->handle_ = ACE_OS::open (ACE_DEV_NULL, O_WRONLY); - ACE_ASSERT (this->handle_ != -1); - - // Register signal handler object. Note that NULL_MASK is used to - // keep the ACE_Reactor from calling us back on the "/dev/null" - // descriptor. - if (ACE_Service_Config::reactor ()->register_handler - (this, ACE_Event_Handler::NULL_MASK) == -1) - ACE_ERROR ((LM_ERROR, "%p\n%a", "register_handler", 1)); - - // Create a sigset_t corresponding to the signals we want to catch. - ACE_Sig_Set sig_set; - - sig_set.sig_add (SIGINT); - sig_set.sig_add (SIGQUIT); - sig_set.sig_add (SIGALRM); - - // Register the signal handler object to catch the signals. - if (ACE_Service_Config::reactor ()->register_handler (sig_set, this) == -1) - ACE_ERROR ((LM_ERROR, "%p\n%a", "register_handler", 1)); -} - -// Called by the ACE_Reactor to extract the fd. - -ACE_HANDLE -Sig_Handler::get_handle (void) const -{ - return this->handle_; -} - -// In a real application, this method would be where the read on the -// signal-driven I/O device would occur asynchronously. For now we'll -// just print a greeting to let you know that everything is working -// properly! - -int -Sig_Handler::handle_input (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, "handling asynchonrous input...\n")); - return 0; -} - -// In a real application, this method would do any cleanup activities -// required when shutting down the I/O device. - -int -Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask) -{ - ACE_DEBUG ((LM_DEBUG, "closing down Sig_Handler...\n")); - return 0; -} - -// This method handles all the signals that are being caught by this -// object. In our simple example, we are simply catching SIGALRM, -// SIGINT, and SIGQUIT. Anything else is logged and ignored. -// -// There are several advantages to using this approach. First, -// the behavior triggered by the signal is handled in the main event -// loop, rather than in the signal handler. Second, the ACE_Reactor's -// signal handling mechanism eliminates the need to use global signal -// handler functions and data. - -int -Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - ACE_DEBUG ((LM_DEBUG, "received signal %S\n", signum)); - - switch (signum) - { - case SIGALRM: - // Rearm the alarm. - ACE_OS::alarm (4); - break; - case SIGINT: - // Tell the ACE_Reactor to enable the ready bit for - // this->handle_. The ACE_Reactor will subsequently call the - // Sig_Handler::handle_input method from within its event loop. - return ACE_Service_Config::reactor ()->ready_ops - (this->handle_, ACE_Event_Handler::READ_MASK, ACE_Reactor::ADD_MASK); - case SIGQUIT: - ACE_DEBUG ((LM_DEBUG, "%S: shutting down signal tester\n", signum)); - ACE_Service_Config::end_reactor_event_loop (); - break; - default: - ACE_DEBUG ((LM_DEBUG, - "%S: not handled, returning to program\n", signum)); - break; - } - return 0; -} - -// This class illustrates that the ACE_Reactor can handle signals, -// STDIO, and timeouts using the same mechanisms. - -class STDIN_Handler : public ACE_Event_Handler -{ -public: - STDIN_Handler (void); - virtual int handle_input (ACE_HANDLE); - virtual int handle_timeout (const ACE_Time_Value &, - const void *arg); -}; - -STDIN_Handler::STDIN_Handler (void) -{ - if (ACE::register_stdin_handler (this, - ACE_Service_Config::reactor (), - ACE_Service_Config::thr_mgr ()) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "register_stdin_handler")); - - // Register the STDIN_Handler to be dispatched once every second. - else if (ACE_Service_Config::reactor ()->schedule_timer - (this, 0, ACE_Time_Value (1), ACE_Time_Value (1)) == -1) - ACE_ERROR ((LM_ERROR, "%p\n%a", "schedule_timer", 1)); -} - -int -STDIN_Handler::handle_timeout (const ACE_Time_Value &tv, - const void *) -{ - ACE_DEBUG ((LM_DEBUG, "timeout occurred at %d sec, %d usec\n", - tv.sec (), tv.usec ())); - return 0; -} - -// Read from input descriptor and write to stdout descriptor. - -int -STDIN_Handler::handle_input (ACE_HANDLE handle) -{ - ssize_t n; - char buf[BUFSIZ]; - - switch (n = ACE_OS::read (handle, buf, sizeof buf)) - { - case -1: - if (errno == EINTR) - return 0; - /* NOTREACHED */ - else - ACE_ERROR ((LM_ERROR, "%p\n", "read")); - /* FALLTHROUGH */ - case 0: - ACE_Service_Config::end_reactor_event_loop (); - break; - default: - { - ssize_t result = ACE::write_n (ACE_STDOUT, buf, n); - - if (result != n) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write"), - result == -1 && errno == EINTR ? 0 : -1); - } - } - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_Service_Config daemon (argv [0]); - - // Signal handler. - Sig_Handler sh; - - // Define an I/O handler object. - STDIN_Handler ioh; - - // Optionally start the alarm. - if (argc > 1) - ACE_OS::alarm (4); - - // Loop handling signals and I/O events until SIGQUIT occurs. - - while (daemon.reactor_event_loop_done () == 0) - daemon.run_reactor_event_loop (); - - return 0; -} diff --git a/examples/Reactor/Misc/test_signals.cpp b/examples/Reactor/Misc/test_signals.cpp deleted file mode 100644 index 6493667de12..00000000000 --- a/examples/Reactor/Misc/test_signals.cpp +++ /dev/null @@ -1,226 +0,0 @@ -// Test the ability of the Reactor/Signal_Handler to register multiple -// $Id$ - -// handler per-signal. - -/* This test works as follows: - - 1. To test the "original" semantics of ACE (i.e., only one - ACE_Event_Handler can be registered per signal), you don't - need to do anything special. Existing programs work the - same since giving the Reactor's constructor a 0 value - (which is the default argument, BTW) instructs it to behave - as before. When a 0 is given, the ACE_Reactor's - constructor/open method creates an instance of - ACE_Sig_Handler and assigns this to an internal pointer. - This pointer is then used to dispatch all signal-related - methods within the Reactor. The default ACE_Sig_Handler - only allows *one* ACE_Event_Handler to be registered - per-signal. - - To run this version of the test do the following: - - % ./test-signal - ./test_signals - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in Sig_Handler_2 (fruity, 0, 0) with count = 1 - waiting for SIGINT or SIGQUIT - ^\ - signal Quit occurred in Sig_Handler_2 (fruity, 0, 0) with count = 2 - shutting down SIGQUIT in Sig_Handler_2 (fruity, 0, 0) - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in Sig_Handler_2 (fruity, 0, 0) with count = 3 - waiting for SIGINT or SIGQUIT - ^\Quit (core dumped) - - Note that in this test only one handler (the last one -- - "Sig_Handler_2 (fruity)") is actually registered. BTW, the - core dump is the expected behavior since the default - disposition is restored when there are no more handlers - (see the code below). - - 2. To test the "multiple handlers per-signal semantics", you - need to pass the constructor/open method of the ACE_Reactor - a pointer to a an instance of ACE_Sig_Handlers (note the - plural "s"). ACE_Sig_Handlers is a class that derives from - ACE_Sig_Handler. The difference between these two classes - is that (1) ACE_Sig_Handlers::register_signal allows - multiple ACE_Event_Handlers to be registered per-signal and - (2) it enables SA_RESTART by default. This class also - implements Detlef Becker's algorithm for integrating ACE - signal handling with 3rd party libraries. - - To run this version of the test do the following: - - % ./test_signals 1 - - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in external handler! - signal Interrupt occurred in Sig_Handler_1 (howdy, 3, 1) with count = 1 - shutting down SIGINT in Sig_Handler_1 (howdy, 3, 1) - signal Interrupt occurred in Sig_Handler_1 (doody, 5, 4) with count = 1 - shutting down SIGINT in Sig_Handler_1 (doody, 5, 4) - signal Interrupt occurred in Sig_Handler_2 (tutty, 7, 6) with count = 1 - signal Interrupt occurred in Sig_Handler_2 (fruity, 9, 8) with count = 1 - waiting for SIGINT or SIGQUIT - ^\ - signal Quit occurred in Sig_Handler_1 (howdy, 3, 1) with count = 2 - shutting down SIGQUIT in Sig_Handler_1 (howdy, 3, 1) - signal Quit occurred in Sig_Handler_1 (doody, 5, 4) with count = 2 - shutting down SIGQUIT in Sig_Handler_1 (doody, 5, 4) - signal Quit occurred in Sig_Handler_2 (tutty, 7, 6) with count = 2 - shutting down SIGQUIT in Sig_Handler_2 (tutty, 7, 6) - signal Quit occurred in Sig_Handler_2 (fruity, 9, 8) with count = 2 - shutting down SIGQUIT in Sig_Handler_2 (fruity, 9, 8) - waiting for SIGINT or SIGQUIT - ^C - signal Interrupt occurred in external handler! - signal Interrupt occurred in Sig_Handler_2 (tutty, 7, 6) with count = 3 - signal Interrupt occurred in Sig_Handler_2 (fruity, 9, 8) with count = 3 - waiting for SIGINT or SIGQUIT - ^\Quit (core dumped) - - When this test begins all four handlers are registered and - dispatched when a SIGINT or SIGQUIT occurs. After the - first SIGINT, the handle_signal method of the Sig_Handler_1 - objects unregister themselves. At that point there are 4 - SIGQUIT handlers left, but only 2 of our SIGINT handlers - left (and the 1 external handler). After the first - SIGQUIT, there are no SIGQUIT handlers left since they all - deregister themselves (which restores the "SIG_DFL" - disposition). On the second SIGINT there are only 3 - handlers left (2 of ours and 1 external). Finally, on the - second SIGQUIT we exit and dump core since that's what - happens with the default disposition for SIGQUIT. */ - -#include "ace/Log_Msg.h" -#include "ace/Reactor.h" - -class Sig_Handler_1 : public ACE_Event_Handler -{ -public: - Sig_Handler_1 (ACE_Reactor &reactor, char *msg) - : msg_ (msg), - count_ (0), - reactor_ (reactor) - { - // Register the signal handlers. - this->quit_sigkey_ = reactor.register_handler (SIGQUIT, this); - this->int_sigkey_ = reactor.register_handler (SIGINT, this); - - if (this->quit_sigkey_ == -1 || this->int_sigkey_ == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "register_handler")); - } - - virtual int handle_signal (int signum, siginfo_t *, ucontext_t *) - { - this->count_++; - ACE_DEBUG ((LM_DEBUG, - "\nsignal %S occurred in Sig_Handler_1 (%s, %d, %d) with count = %d", - signum, this->msg_, this->int_sigkey_, this->quit_sigkey_, this->count_)); - if (this->count_ != 1 && signum == SIGQUIT) - { - if (this->reactor_.remove_handler (SIGQUIT, 0, 0, - this->quit_sigkey_) == -1) - ACE_ERROR ((LM_ERROR, "\n%p", "remove_handler")); - else - ACE_DEBUG ((LM_DEBUG, "\nshutting down SIGQUIT in Sig_Handler_1 (%s, %d, %d)", - this->msg_, this->int_sigkey_, this->quit_sigkey_)); - } - else if (this->count_ != 2 && signum == SIGINT) - { - if (this->reactor_.remove_handler (SIGINT, 0, 0, - this->int_sigkey_) == -1) - ACE_ERROR ((LM_ERROR, "\n%p", "remove_handler")); - else - ACE_DEBUG ((LM_DEBUG, "\nshutting down SIGINT in Sig_Handler_1 (%s, %d, %d)", - this->msg_, this->int_sigkey_, this->quit_sigkey_)); - } - return 0; - } - -protected: - char *msg_; - int count_; - int int_sigkey_; - int quit_sigkey_; - ACE_Reactor &reactor_; -}; - -class Sig_Handler_2 : public Sig_Handler_1 -{ -public: - Sig_Handler_2 (ACE_Reactor &reactor, char *msg) - : Sig_Handler_1 (reactor, msg) - { - } - - virtual int handle_signal (int signum, siginfo_t *, ucontext_t *) - { - this->count_++; - ACE_DEBUG ((LM_DEBUG, - "\nsignal %S occurred in Sig_Handler_2 (%s, %d, %d) with count = %d", - signum, this->msg_, this->int_sigkey_, this->quit_sigkey_, this->count_)); - if (this->count_ != 0 && signum == SIGQUIT) - { - if (this->reactor_.remove_handler (SIGQUIT, 0, 0, - this->quit_sigkey_) == -1) - ACE_ERROR ((LM_ERROR, "\n%p", "remove_handler")); - else - ACE_DEBUG ((LM_DEBUG, "\nshutting down SIGQUIT in Sig_Handler_2 (%s, %d, %d)", - this->msg_, this->int_sigkey_, this->quit_sigkey_)); - } - else - return 0; - } -}; - -static void -external_handler (int signum) -{ - ACE_DEBUG ((LM_DEBUG, "\nsignal %S occurred in external handler!", signum)); -} - -#if !defined (HPUX) -int -main (int argc, char *argv) -{ - // If argc > 1 then allow multiple handlers per-signal, else just - // allow 1 handler per-signal. - ACE_Sig_Handlers multi_handlers; - - ACE_Reactor reactor (argc > 1 ? &multi_handlers: 0); - - if (argc > 1) - { - // Register an "external" signal handler so that the - // ACE_Sig_Handlers code will have something to incorporate! - ACE_SignalHandler eh = ACE_SignalHandler (external_handler); - ACE_Sig_Action sa (eh); - - sa.register_action (SIGINT); - } - - // Create a bevy of handlers. - Sig_Handler_1 h1 (reactor, "howdy"), h2 (reactor, "doody"); - Sig_Handler_2 h3 (reactor, "tutty"), h4 (reactor, "fruity"); - - // Wait for user to type SIGINT and SIGQUIT. - - for (;;) - { - ACE_DEBUG ((LM_DEBUG, "\nwaiting for SIGINT or SIGQUIT\n")); - reactor.handle_events (); - } - return 0; -} -#else -int -main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, "The HP C++ compiler is too lame to support this feature\n"), -1); -} -#endif /* HPUX */ diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphore_Client.cpp b/examples/System_V_IPC/SV_Semaphores/Semaphore_Client.cpp deleted file mode 100644 index b7fe34725e7..00000000000 --- a/examples/System_V_IPC/SV_Semaphores/Semaphore_Client.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "Semaphore_Test.h" -// $Id$ - -#include "ace/SV_Shared_Memory.h" -#include "ace/SV_Semaphore_Simple.h" - -int -main (void) -{ - ACE_SV_Shared_Memory shm_client (SHM_KEY, - SHMSZ, - ACE_SV_Shared_Memory::ACE_OPEN); - ACE_SV_Semaphore_Simple sem (SEM_KEY_1, - ACE_SV_Semaphore_Simple::ACE_OPEN, 0, 2); - - char *s = (char *) shm_client.get_segment_ptr (); - - if (sem.acquire (0) < 0) - ACE_OS::perror ("client sem.acquire"), ACE_OS::exit (1); - - while (*s != '\0') - putchar (*s++); - - putchar ('\n'); - - if (sem.release (1) < 0) - ACE_OS::perror ("client sem.release"), ACE_OS::exit (1); - - return 0; -} - diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphore_Server.cpp b/examples/System_V_IPC/SV_Semaphores/Semaphore_Server.cpp deleted file mode 100644 index f9931705c26..00000000000 --- a/examples/System_V_IPC/SV_Semaphores/Semaphore_Server.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - - -#include "ace/SV_Shared_Memory.h" -#include "ace/SV_Semaphore_Simple.h" -#include "ace/Signal.h" -#include "Semaphore_Test.h" - -static ACE_SV_Shared_Memory shm_server (SHM_KEY, SHMSZ, ACE_SV_Shared_Memory::ACE_CREATE); -static ACE_SV_Semaphore_Simple sem (SEM_KEY_1, ACE_SV_Semaphore_Simple::ACE_CREATE, 0, 2); - -extern "C" void -cleanup (int) -{ - if (shm_server.remove () < 0 || sem.remove () < 0) - ACE_ERROR ((LM_ERROR, "%p\n%a", "remove", 1)); - ACE_OS::exit (0); -} - -int -main (void) -{ - // Register a signal handler. - ACE_Sig_Action sa ((ACE_SignalHandler) cleanup, SIGINT); - - char *s = (char *) shm_server.get_segment_ptr (); - - for (char c = 'a'; c <= 'z'; c++) - *s++ = c; - - *s = '\0'; - - if (sem.release (0) < 0) - ESD ("server sem.release", done); - - if (sem.acquire (1) < 0) - ESD ("server sem.acquire", done); - -done: - cleanup (); - return 0; -} diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphore_Test.h b/examples/System_V_IPC/SV_Semaphores/Semaphore_Test.h deleted file mode 100644 index 72aab815ff8..00000000000 --- a/examples/System_V_IPC/SV_Semaphores/Semaphore_Test.h +++ /dev/null @@ -1,11 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#include "ace/Log_Msg.h" - -#define SHMSZ 27 -#define SEM_KEY_1 2345 -#define SEM_KEY_2 4321 -#define SHM_KEY 5678 - -#define ESD(MSG,LABEL) do { ACE_ERROR ((LM_ERROR, MSG)); goto LABEL; } while (0) diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp b/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp deleted file mode 100644 index c5e96ed0416..00000000000 --- a/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// Illustrates the use of the Semaphore_Complex class. Note that it -// $Id$ - -// doesn't matter whether the parent or the child creates the -// semaphore since Semaphore_Complex will correctly serialize the -// intialization of the mutex and synch objects. -#include "ace/Malloc.h" -#include "ace/SV_Semaphore_Complex.h" -#include "Semaphore_Test.h" - -ACE_Malloc allocator; -ACE_SV_Semaphore_Complex *mutex = 0; -ACE_SV_Semaphore_Complex *synch = 0; - -/* Pointer to memory shared by both the client and server. */ -static char *shm; - -static int -do_parent (void) -{ - char *s = shm; - - mutex = new ACE_SV_Semaphore_Complex (SEM_KEY_1, ACE_SV_Semaphore_Complex::ACE_CREATE, 0); - synch = new ACE_SV_Semaphore_Complex (SEM_KEY_2, ACE_SV_Semaphore_Complex::ACE_CREATE, 0); - - for (char c = 'a'; c <= 'z'; c++) - *s++ = c; - - *s = '\0'; - - if (mutex->release () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p", "server mutex.release"), 1); - - if (synch->acquire () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p", "server synch.acquire"), 1); - return 0; -} - -static int -do_child (void) -{ - mutex = new ACE_SV_Semaphore_Complex (SEM_KEY_1, ACE_SV_Semaphore_Complex::ACE_CREATE, 0); - synch = new ACE_SV_Semaphore_Complex (SEM_KEY_2, ACE_SV_Semaphore_Complex::ACE_CREATE, 0); - - while (mutex->tryacquire () == -1) - if (errno == EAGAIN) - ACE_DEBUG ((LM_DEBUG, "spinning in client!\n")); - else - ACE_ERROR_RETURN ((LM_ERROR, "client mutex.tryacquire"), 1); - - for (char *s = (char *) shm; *s != '\0'; s++) - putchar (*s); - - putchar ('\n'); - - if (synch->release () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "client synch.release"), 1); - return 0; -} - -int -main (void) -{ - shm = (char *) allocator.malloc (27); - - switch (ACE_OS::fork ()) - { - case -1: - ACE_ERROR_RETURN ((LM_ERROR, "fork failed\n"), -1); - /* NOTREACHED */ - case 0: - return do_child (); - default: - { - int result = do_parent (); - - if (wait (0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "wait"), -1); - - allocator.remove (); - - if (mutex->remove () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "mutex.remove"), -1); - else if (synch->remove () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "synch.remove"), -1); - return result; - } - } -} - -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_Malloc; -template class ACE_Malloc_T; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/examples/Threads/test_auto_event.cpp b/examples/Threads/test_auto_event.cpp deleted file mode 100644 index 4f83d50db71..00000000000 --- a/examples/Threads/test_auto_event.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// $Id$ - -// This test shows the use of an ACE_Auto_Event as a signaling -// mechanism. Two threads are created (one a reader, the other a -// writer). The reader waits till the writer has completed -// calculations. Upon waking up the reader prints the data calculated -// by the writer. The writer thread calculates the value and signals -// the reader when the calculation completes. - -#include "ace/Service_Config.h" -#include "ace/Synch.h" -#include "ace/Singleton.h" -#include "ace/Thread_Manager.h" - -#if defined (ACE_HAS_THREADS) -// Shared event between reader and writer. The ACE_Thread_Mutex is -// necessary to make sure that only one ACE_Auto_Event is created. -// The default constructor for ACE_Auto_Event sets it initially into -// the non-signaled state. - -typedef ACE_Singleton EVENT; - -// work time for writer -static int work_time; - -// Reader thread. -static void * -reader (void *arg) -{ - // Shared data via a reference. - int& data = *(int *) arg; - - ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); - - // Wait for writer to complete. - - ACE_DEBUG ((LM_DEBUG, "(%t) reader: waiting...... \n")); - - if (EVENT::instance ()->wait () == -1) - { - ACE_ERROR ((LM_ERROR, "thread wait failed")); - ACE_OS::exit (0); - } - - // Read shared data. - ACE_DEBUG ((LM_DEBUG, "(%t) reader: value of data is: %d \n", data)); - - return 0; -} - -// Writer thread. -static void * -writer (void *arg) -{ - int& data = *(int *) arg; - - ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); - - // Calculate (work). - ACE_DEBUG ((LM_DEBUG, "(%t) writer: working for %d secs\n", work_time)); - ACE_OS::sleep (work_time); - - // Write shared data. - data = 42; - - // Wake up reader. - ACE_DEBUG ((LM_DEBUG, "(%t) writer: calculation complete, waking reader\n")); - - if (EVENT::instance ()->signal () == -1) - { - ACE_ERROR ((LM_ERROR, "thread wait failed")); - ACE_OS::exit (0); - } - - return 0; -} - -int -main (int argc, char **argv) -{ - // Shared data: set by writer, read by reader. - int data; - - // Work time for writer. - work_time = argc == 2 ? atoi (argv[1]) : 5; - - // threads manager - ACE_Thread_Manager& tm = *ACE_Service_Config::thr_mgr (); - - // Create reader thread. - if (tm.spawn (reader, (void *) &data) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "thread create for reader failed"), -1); - - // Create writer thread. - if (tm.spawn (writer, (void *) &data) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "thread create for writer failed"), -1); - - // Wait for both. - if (tm.wait () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "thread wait failed"), -1); - else - ACE_DEBUG ((LM_ERROR, "graceful exit\n")); - - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_barrier1.cpp b/examples/Threads/test_barrier1.cpp deleted file mode 100644 index 6b213819ca0..00000000000 --- a/examples/Threads/test_barrier1.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// This test program illustrates how the ACE barrier synchronization -// $Id$ - -// mechanisms work. - - -#include "ace/Synch.h" -#include "ace/Thread_Manager.h" -#include "ace/Service_Config.h" - -#if defined (ACE_HAS_THREADS) - -struct Tester_Args - // = TITLE - // These arguments are passed into each test thread. -{ - Tester_Args (ACE_Barrier &tb, int i) - : tester_barrier_ (tb), - n_iterations_ (i) {} - - ACE_Barrier &tester_barrier_; - // Reference to the tester barrier. This controls each miteration of - // the tester function running in every thread. - - int n_iterations_; - // Number of iterations to run. -}; - -// Iterate time printing off a message and "waiting" -// for all other threads to complete this iteration. - -static void * -tester (Tester_Args *args) -{ - // Keeps track of thread exit. - ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); - - for (int iterations = 1; - iterations <= args->n_iterations_; - iterations++) - { - ACE_DEBUG ((LM_DEBUG, "(%t) in iteration %d\n", iterations)); - - // Block until all other threads have waited, then continue. - args->tester_barrier_.wait (); - } - - return 0; -} - -// Default number of threads to spawn. -static const int DEFAULT_ITERATIONS = 5; - -int -main (int argc, char *argv[]) -{ - ACE_Service_Config daemon (argv[0]); - - int n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_THREADS; - int n_iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS; - - ACE_Barrier tester_barrier (n_threads); - - Tester_Args args (tester_barrier, n_iterations); - - if (ACE_Service_Config::thr_mgr ()->spawn_n - (n_threads, ACE_THR_FUNC (tester), - (void *) &args, THR_NEW_LWP | THR_DETACHED) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1); - - // Wait for all the threads to reach their exit point. - ACE_Service_Config::thr_mgr ()->wait (); - - ACE_DEBUG ((LM_DEBUG, "(%t) done\n")); - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_barrier2.cpp b/examples/Threads/test_barrier2.cpp deleted file mode 100644 index 30190ace443..00000000000 --- a/examples/Threads/test_barrier2.cpp +++ /dev/null @@ -1,269 +0,0 @@ -// $Id$ - -// generic_worker_task.cpp -// -// This test program illustrates how the ACE task workers/barrier -// synchronization mechanisms work in conjunction with the ACE_Task -// and the ACE_Thread_Manager. The manual flag not set simulates -// user input, if set input comes from stdin until RETURN only is -// entered which stops all workers via a message block of length -// 0. This is an alernative shutdown of workers compared to queue -// deactivate. The delay_put flag simulates a delay between the -// shutdown puts. All should work with this flag disabled! The -// BARRIER_TYPE is supposed to enable/disable barrier sync on each svc -// a worker has done. - -#include -#include "ace/Task.h" -#include "ace/Service_Config.h" - -#if defined (ACE_HAS_THREADS) - -#define BARRIER_TYPE ACE_Null_Barrier -//#define BARRIER_TYPE ACE_Barrier -//#ifdef delay_put -//#define manual - -template -class Worker_Task : public ACE_Task -{ -public: - - Worker_Task (ACE_Thread_Manager *thr_mgr, - int n_threads, - int inp_serialize = 1); - - virtual int Producer (void); - // produce input for workers - - virtual int input (ACE_Message_Block *mb); - // Fill one message block via a certain input strategy. - - virtual int output (ACE_Message_Block *mb); - // Forward one message block via a certain output strategy to the - // next task if any. - - virtual int service (ACE_Message_Block *mb, int iter); - // Perform one message block dependant service. - -private: - virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv=0); - - virtual int svc (void); - // Iterate time printing off a message and "waiting" - // for all other threads to complete this iteration. - - // = Not needed for this test. - virtual int open (void *) { return 0; } - virtual int close (u_long) {ACE_DEBUG ((LM_DEBUG,"(%t) in close of worker\n")); return 0; } - - int nt_; - // Number of worker threads to run. - int inp_serialize_; - - BARRIER barrier_; -}; - -template -Worker_Task::Worker_Task (ACE_Thread_Manager *thr_mgr, - int n_threads, - int inp_serialize) - : ACE_Task (thr_mgr), - barrier_ (n_threads) -{ - nt_ = n_threads; - // Create worker threads. - inp_serialize_ = inp_serialize; - - // Use the task's message queue for serialization (default) or run - // service in the context of the caller thread. - - if (nt_ > 0 && inp_serialize == 1) - if (this->activate (THR_NEW_LWP, n_threads) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "activate failed")); -} - -// Simply enqueue the Message_Block into the end of the queue. - -template int -Worker_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv) -{ - int result; - if (this->inp_serialize_) - result = this->putq (mb, tv); - else - { - static int iter = 0; - result = this->service (mb, iter++); - - if (this->output (mb) < 0) - ACE_DEBUG ((LM_DEBUG, "(%t) output not connected!\n")); - - delete mb; - } - return result; -} - -template int -Worker_Task::service (ACE_Message_Block *mb, int iter) -{ - int length = mb->length (); - - if (length > 0) - { - ACE_DEBUG ((LM_DEBUG,"(%t) in iteration %d len=%d text got:\n",iter,length)); - ACE_OS::write (ACE_STDOUT, mb->rd_ptr (), length); - ACE_DEBUG ((LM_DEBUG,"\n")); - } - return 0; -} - -// Iterate time printing off a message and "waiting" -// for all other threads to complete this iteration. - -template int -Worker_Task::svc (void) -{ - // Note that the ACE_Task::svc_run () method automatically adds us - // to the Thread_Manager when the thread begins. - - // Keep looping, reading a message out of the queue, until we get a - // message with a length == 0, which signals us to quit. - - for (int iter = 1; ;iter++) - { - ACE_Message_Block *mb = 0; - - int result = this->getq (mb); - - if (result == -1) - { - ACE_ERROR ((LM_ERROR, - "(%t) in iteration %d\n", "error waiting for message in iteration", iter)); - break; - } - - int length = mb->length (); - this->service (mb,iter); - - if (length == 0) - { - ACE_DEBUG ((LM_DEBUG, "(%t) in iteration %d got quit, exit!\n", iter)); - delete mb; - break; - } - - this->barrier_.wait (); - this->output (mb); - - delete mb; - } - - // Note that the ACE_Task::svc_run () method automatically removes - // us from the Thread_Manager when the thread exits. - - return 0; -} - -template int -Worker_Task::Producer (void) -{ - // Keep reading stdin, until we reach EOF. - - for (;;) - { - // Allocate a new message. - ACE_Message_Block *mb = new ACE_Message_Block (BUFSIZ); - - if (this->input (mb) == -1) - return -1; - } - - return 0; -} - -template int -Worker_Task::output (ACE_Message_Block *mb) -{ - return this->put_next (mb); -} - -template int -Worker_Task::input (ACE_Message_Block *mb) -{ - ACE_Message_Block *mb1; - -#ifndef manual - static int l= 0; - char str[]="kalle"; - strcpy (mb->rd_ptr (),str); - int n=strlen (str); - if (l==1000) - n=1; - l++; - if (l==0 || (l%100 == 0)) ACE_OS::sleep (5); - if (n <= 1) -#else - ACE_DEBUG ((LM_DEBUG,"(%t) press chars and enter to put a new message into task queue ...\n")); - if ((n = read (0, mb->rd_ptr (), mb->size ())) <= 1) -#endif // manual - { - // Send a shutdown message to the waiting threads and exit. - // cout << "\nvor loop, dump of task msg queue:\n" << endl; - // this->msg_queue ()->dump (); - for (int i=0;ilength (0); - if (this->put (mb1) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "put")); -#ifdef delay_put - ACE_OS::sleep (1); // this sleep helps to shutdown correctly -> was an error! -#endif /* delay_put */ - } - // cout << "\nnach loop, dump of task msg queue:\n" << endl; - // this->msg_queue ()->dump (); - return (-1); - } - else - { - // Send a normal message to the waiting threads and continue producing. - mb->wr_ptr (n); - if (this->put (mb) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "put")); - } - return 0; -} - -int -main (int argc, char *argv[]) -{ - int n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_THREADS; - - ACE_DEBUG ((LM_DEBUG,"(%t) worker threads running=%d\n",n_threads)); - - - Worker_Task *worker_task = - new Worker_Task (ACE_Service_Config::thr_mgr (), - /*n_threads*/ 0,0); - - worker_task->Producer (); - - // Wait for all the threads to reach their exit point. - ACE_DEBUG ((LM_DEBUG,"(%t) waiting with thread manager ...\n")); - ACE_Service_Config::thr_mgr ()->wait (); - ACE_DEBUG ((LM_DEBUG,"(%t) delete worker task ...\n")); - - delete worker_task; - ACE_DEBUG ((LM_DEBUG,"(%t) done correct!\n")); - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_cancel.cpp b/examples/Threads/test_cancel.cpp deleted file mode 100644 index a9d12bea579..00000000000 --- a/examples/Threads/test_cancel.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Test out the cooperative thread cancellation mechanisms provided by -// $Id$ - -// the ACE_Thread_Manager. - -#include "ace/Service_Config.h" -#include "ace/Thread_Manager.h" - -#if defined (ACE_HAS_THREADS) - -static void * -worker (int iterations) -{ - for (int i = 0; i < iterations; i++) - { - if ((i % 10) == 0 - && (ACE_Service_Config::thr_mgr ()->testcancel (ACE_Thread::self ()) != 0)) - { - ACE_DEBUG ((LM_DEBUG, "(%t) has been cancelled before iteration!\n", i)); - break; - } - } - - return 0; -} - -static const int DEFAULT_THREADS = ACE_DEFAULT_THREADS; -static const int DEFAULT_ITERATIONS = 100000; - -int -main (int argc, char *argv[]) -{ - ACE_Service_Config daemon; - - daemon.open (argv[0]); - - int n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : DEFAULT_THREADS; - int n_iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS; - - ACE_Thread_Manager *thr_mgr = ACE_Service_Config::thr_mgr (); - - int grp_id = thr_mgr->spawn_n (n_threads, ACE_THR_FUNC (worker), - (void *) n_iterations, - THR_NEW_LWP | THR_DETACHED); - - // Wait for 2 seconds and then suspend every thread in the group. - ACE_OS::sleep (2); - thr_mgr->suspend_grp (grp_id); - - // Wait for 2 more seconds and then resume every thread in the - // group. - ACE_OS::sleep (ACE_Time_Value (2)); - thr_mgr->resume_grp (grp_id); - - // Wait for 2 more seconds and then send a SIGINT to every thread in - // the group. - ACE_OS::sleep (ACE_Time_Value (2)); - thr_mgr->kill_grp (grp_id, SIGINT); - - // Wait for 2 more seconds and then exit (which should kill all the - // threads)! - ACE_OS::sleep (ACE_Time_Value (2)); - - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, "threads not supported on this platform\n"), -1); -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_future1.cpp b/examples/Threads/test_future1.cpp deleted file mode 100644 index 79cf0a42b36..00000000000 --- a/examples/Threads/test_future1.cpp +++ /dev/null @@ -1,420 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// tests -// -// = FILENAME -// Test_Future.cpp -// -// = DESCRIPTION -// This example tests the ACE Future. -// -// = AUTHOR -// Andres Kruse and Douglas C. Schmidt -// -// -// ============================================================================ - -#include -#include "ace/Task.h" - -#include "ace/Synch.h" -#include "ace/Message_Queue.h" -#include "ace/Future.h" -#include "ace/Method_Object.h" -#include "ace/Activation_Queue.h" -#include "ace/Auto_Ptr.h" - -#if defined (ACE_HAS_THREADS) - -typedef ACE_Atomic_Op ATOMIC_INT; - -// a counter for the tasks.. -static ATOMIC_INT task_count (0); - -// a counter for the futures.. -static ATOMIC_INT future_count (0); -static ATOMIC_INT future_no (0); - -// a counter for the capsules.. -static ATOMIC_INT capsule_count (0); -static ATOMIC_INT capsule_no (0); - -// a counter for the method objects... -static ATOMIC_INT methodobject_count (0); -static ATOMIC_INT methodobject_no (0); - -class Scheduler : public ACE_Task - // = TITLE - // Active Object Scheduler. -{ - friend class Method_ObjectWork; -public: - Scheduler (const char *, Scheduler * = 0); - ~Scheduler (void); - - virtual int open (void *args = 0); - virtual int close (u_long flags = 0); - virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); - virtual int svc (void); - - ACE_Future work (float param, int count); - ACE_Future name (void); - void end (void); - - float work_i (float, int); - const char *name_i (void); - -private: - char *name_; - ACE_Activation_Queue activation_queue_; - Scheduler *scheduler_; - -}; - -class Method_Object_work : public ACE_Method_Object - // = TITLE - // Reification of the method. -{ -public: - Method_Object_work (Scheduler *, float, int, ACE_Future &); - ~Method_Object_work (void); - virtual int call (void); - -private: - Scheduler *scheduler_; - float param_; - int count_; - ACE_Future future_result_; -}; - -Method_Object_work::Method_Object_work (Scheduler* new_Scheduler, - float new_param, - int new_count, - ACE_Future &new_result) - : scheduler_ (new_Scheduler), - param_ (new_param), - count_ (new_count), - future_result_ (new_result) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) Method_Object_work created\n")); -} - -Method_Object_work::~Method_Object_work (void) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) Method_Object_work will be deleted.\n")); -} - - -int -Method_Object_work::call (void) -{ - return this->future_result_.set (this->scheduler_->work_i (this->param_, this->count_)); -} - -class Method_Object_name : public ACE_Method_Object - // = TITLE - // Reification of the method. -{ -public: - Method_Object_name (Scheduler *, ACE_Future &); - ~Method_Object_name (void); - virtual int call (void); - -private: - Scheduler *scheduler_; - ACE_Future future_result_; -}; - -Method_Object_name::Method_Object_name (Scheduler *new_scheduler, - ACE_Future &new_result) - : scheduler_ (new_scheduler), - future_result_ (new_result) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) Method_Object_name created\n")); -}; - -Method_Object_name::~Method_Object_name (void) -{ - ACE_DEBUG ((LM_DEBUG, - "(%t) Method_Object_name will be deleted.\n")); -} - -int -Method_Object_name::call (void) -{ - return future_result_.set (scheduler_->name_i ()); -} - -class Method_Object_end : public ACE_Method_Object - // = TITLE - // Reification of the method. -{ -public: - Method_Object_end (Scheduler *new_Scheduler): scheduler_ (new_Scheduler) {} - ~Method_Object_end (void) {} - virtual int call (void) { this->scheduler_->close (); return -1; } - -private: - Scheduler *scheduler_; -}; - -// constructor -Scheduler::Scheduler (const char *newname, Scheduler *new_Scheduler) -{ - ACE_NEW (this->name_, char[ACE_OS::strlen (newname) + 1]); - ACE_OS::strcpy ((char *) this->name_, newname); - this->scheduler_ = new_Scheduler; - ACE_DEBUG ((LM_DEBUG, "(%t) Scheduler %s created\n", this->name_)); -} - -// Destructor -Scheduler::~Scheduler (void) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) Scheduler %s will be destroyed\n", this->name_)); -} - -// open -int -Scheduler::open (void *) -{ - task_count++; - ACE_DEBUG ((LM_DEBUG, "(%t) Scheduler %s open\n", this->name_)); - return this->activate (THR_BOUND); -} - -// close -int -Scheduler::close (u_long) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) Scheduler %s close\n", this->name_)); - task_count--; - return 0; -} - -// put... ?? -int -Scheduler::put (ACE_Message_Block *, ACE_Time_Value *) -{ - return 0; -} - -// service.. -int -Scheduler::svc (void) -{ - for (;;) - { - // Dequeue the next method object (we use an auto pointer in - // case an exception is thrown in the ). - ACE_Auto_Ptr mo (this->activation_queue_.dequeue ()); - - ACE_DEBUG ((LM_DEBUG, "(%t) calling method object\n")); - // Call it. - if (mo->call () == -1) - break; - // Destructor automatically deletes it. - } - - /* NOTREACHED */ - return 0; -} - -void -Scheduler::end (void) -{ - this->activation_queue_.enqueue (new Method_Object_end (this)); -} - - -// Here's where the Work takes place. -float -Scheduler::work_i (float param, - int count) -{ - float x = 0, y = 0; - - // @@ We should probably do something fun here, like compute the - // Fibonacci sequence or something. - - for (int j = 0; j < count; j++) - { - x = x + param; - y = y + ::sin (x); - } - - return y; -} - -const char * -Scheduler::name_i (void) -{ - char *the_name; - - the_name = new char[ACE_OS::strlen (this->name_) + 1]; - ACE_OS::strcpy (the_name, this->name_); - - return the_name; -} - -ACE_Future -Scheduler::name (void) -{ - if (this->scheduler_) - // Delegate to the Scheduler. - return this->scheduler_->name (); - else - { - ACE_Future new_future; - - // @@ What happens if new fails here? - this->activation_queue_.enqueue - (new Method_Object_name (this, new_future)); - - return new_future; - } -} - -ACE_Future -Scheduler::work (float newparam, int newcount) -{ - if (this->scheduler_) { - return this->scheduler_->work (newparam, newcount); - } - else { - ACE_Future new_future; - - this->activation_queue_.enqueue - (new Method_Object_work (this, newparam, newcount, new_future)); - return new_future; - } -} - -// @@ These values should be set by the command line options! - -// Total number of iterations to -static int n_iterations = 50000; - -// Total number of loops. -static int n_loops = 100; - -int -main (int, char *[]) -{ - Scheduler *andres, *peter, *helmut, *matias; - - // Create active objects.. - // @@ Should "open" be subsumed within the constructor of - // Scheduler()? - andres = new Scheduler ("andres"); - andres->open (); - peter = new Scheduler ("peter"); - peter->open (); - helmut = new Scheduler ("helmut"); - helmut->open (); - - // Matias passes all asynchronous method calls on to Andres... - matias = new Scheduler ("matias", andres); - matias->open (); - - for (int i = 0; i < n_loops; i++) - { - { - ACE_Future fresulta, fresultb, fresultc, fresultd, fresulte; - ACE_Future fname; - - ACE_DEBUG ((LM_DEBUG, "(%t) going to do a non-blocking call\n")); - - fresulta = andres->work (0.01, 100 + (n_iterations * (i % 2))); - fresultb = peter->work (0.01, 100 + (n_iterations * (i % 2))); - fresultc = helmut->work (0.01, 100 + (n_iterations * (i % 2))); - fresultd = matias->work (0.02, 100 + (n_iterations * (i % 2))); - fname = andres->name (); - - // see if the result is available... - if (fresulta.ready ()) - ACE_DEBUG ((LM_DEBUG, "(%t) wow.. work is ready.....\n")); - - ACE_DEBUG ((LM_DEBUG, "(%t) non-blocking call done... now blocking...\n")); - - // Save the result of fresulta. - - fresulte = fresulta; - - if (i % 3 == 0) - { - // Every 3rd time... disconnect the futures... - // but "fresulte" should still contain the result... - fresulta.cancel (10.0); - fresultb.cancel (20.0); - fresultc.cancel (30.0); - fresultd.cancel (40.0); - } - - float resulta = 0, resultb = 0, resultc = 0, resultd = 0, resulte = 0; - - fresulta.get (resulta); - fresultb.get (resultb); - fresultc.get (resultc); - fresultd.get (resultd); - fresulte.get (resulte); - - ACE_DEBUG ((LM_DEBUG, "(%t) result a %f\n", resulte)); - ACE_DEBUG ((LM_DEBUG, "(%t) result b %f\n", resulta)); - ACE_DEBUG ((LM_DEBUG, "(%t) result c %f\n", resultb)); - ACE_DEBUG ((LM_DEBUG, "(%t) result d %f\n", resultc)); - ACE_DEBUG ((LM_DEBUG, "(%t) result e %f\n", resultd)); - - const char *name; - - fname.get (name); - - ACE_DEBUG ((LM_DEBUG, "(%t) name %s\n", name)); - - } - - ACE_DEBUG ((LM_DEBUG, - "(%t) task_count %d future_count %d capsule_count %d methodobject_count %d\n", - (u_long) task_count, - (u_long) future_count, - (u_long) capsule_count, - (u_long) methodobject_count)); - } - - // Close things down. - andres->end (); - peter->end (); - helmut->end (); - matias->end (); - - ACE_OS::sleep (2); - - ACE_DEBUG ((LM_DEBUG, - "(%t) task_count %d future_count %d capsule_count %d methodobject_count %d\n", - (u_long) task_count, - (u_long) future_count, - (u_long) capsule_count, - (u_long) methodobject_count)); - - ACE_DEBUG ((LM_DEBUG,"(%t) th' that's all folks!\n")); - - ACE_OS::sleep (5); - return 0; -} - -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_Atomic_Op; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ - -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_future2.cpp b/examples/Threads/test_future2.cpp deleted file mode 100644 index 19431072202..00000000000 --- a/examples/Threads/test_future2.cpp +++ /dev/null @@ -1,524 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// tests -// -// = FILENAME -// Test_Future.cpp -// -// = DESCRIPTION -// This example tests the ACE Future. -// -// = AUTHOR -// Andres Kruse and Douglas C. Schmidt -// -// -// Modification History -// Aug. 96; A.Kruse; dev. -// Aug. 96; D.Schmidt; complete workover -// 08/27/96; A.Kruse; - the friends of Scheduler are "Method_Object_name" -// and "Method_Object_work". -// - make the methods "work_i" and "name_i" private -// 09/2/96; D.Schmidt; Integrate with new ACE_Future API and rearrange -// the tests so they are more modular. -// ============================================================================ - -#include -#include "ace/Task.h" - -#include "ace/Synch.h" -#include "ace/Message_Queue.h" -#include "ace/Future.h" -#include "ace/Method_Object.h" -#include "ace/Activation_Queue.h" -#include "ace/Auto_Ptr.h" - -#if defined (ACE_HAS_THREADS) - -typedef ACE_Atomic_Op ATOMIC_INT; - -// a counter for the tasks.. -static ATOMIC_INT scheduler_open_count (0); - -// forward declarations -class Method_Object_work; -class Method_Object_name; - -class Scheduler : public ACE_Task - // = TITLE - // Active Object Scheduler. -{ - // Every method object has to be able to access the private methods. - - friend class Method_Object_work; - friend class Method_Object_name; - friend class Method_Object_end; -public: - - Scheduler (const char *, Scheduler * = 0); - ~Scheduler (void); - - virtual int open (void *args = 0); - // The method that is used to start the active object. - - // = Here are the methods exported by the class. They return an - // . - ACE_Future work (float param, int count); - ACE_Future name (void); - void end (void); - -private: - virtual int close (u_long flags = 0); - // Should not be accessible from outside... (use end () instead). - - virtual int put (ACE_Message_Block *, ACE_Time_Value * = 0) - { return 0; }; - // Doesn't have any use for this example. - - virtual int svc (void); - // Here the actual servicing of all requests is happening.. - - // = Implementation methods. - float work_i (float, int); - char *name_i (void); - - char *name_; - ACE_Activation_Queue activation_queue_; - Scheduler *scheduler_; -}; - -class Method_Object_work : public ACE_Method_Object - // = TITLE - // Reification of the method. -{ -public: - Method_Object_work (Scheduler *, float, int, ACE_Future &); - ~Method_Object_work (void); - virtual int call (void); - -private: - Scheduler *scheduler_; - float param_; - int count_; - ACE_Future future_result_; -}; - -Method_Object_work::Method_Object_work (Scheduler* new_Scheduler, - float new_param, - int new_count, - ACE_Future &new_result) - : scheduler_ (new_Scheduler), - param_ (new_param), - count_ (new_count), - future_result_ (new_result) -{ -} - -Method_Object_work::~Method_Object_work (void) -{ -} - -int -Method_Object_work::call (void) -{ - return this->future_result_.set (this->scheduler_->work_i (this->param_, this->count_)); -} - -class Method_Object_name : public ACE_Method_Object - // = TITLE - // Reification of the method. -{ -public: - Method_Object_name (Scheduler *, ACE_Future &); - ~Method_Object_name (void); - virtual int call (void); - -private: - Scheduler *scheduler_; - ACE_Future future_result_; -}; - - -Method_Object_name::Method_Object_name (Scheduler *new_scheduler, - ACE_Future &new_result) - : scheduler_ (new_scheduler), - future_result_ (new_result) -{ - ACE_DEBUG ((LM_DEBUG, - " (%t) Method_Object_name created\n")); -}; - -Method_Object_name::~Method_Object_name (void) -{ - ACE_DEBUG ((LM_DEBUG, - " (%t) Method_Object_name will be deleted.\n")); -} - -int -Method_Object_name::call (void) -{ - return future_result_.set (scheduler_->name_i ()); -} - -class Method_Object_end : public ACE_Method_Object - // = TITLE - // Reification of the method. -{ -public: - Method_Object_end (Scheduler *new_Scheduler): scheduler_ (new_Scheduler) {} - ~Method_Object_end (void) {} - virtual int call (void) { this->scheduler_->close (); return -1; } - -private: - Scheduler *scheduler_; -}; - -// constructor -Scheduler::Scheduler (const char *newname, Scheduler *new_Scheduler) -{ - ACE_NEW (this->name_, char[ACE_OS::strlen (newname) + 1]); - ACE_OS::strcpy ((char *) this->name_, newname); - this->scheduler_ = new_Scheduler; - ACE_DEBUG ((LM_DEBUG, " (%t) Scheduler %s created\n", this->name_)); -} - -// Destructor -Scheduler::~Scheduler (void) -{ - ACE_DEBUG ((LM_DEBUG, " (%t) Scheduler %s will be destroyed\n", this->name_)); -} - -int -Scheduler::open (void *) -{ - scheduler_open_count++; - ACE_DEBUG ((LM_DEBUG, " (%t) Scheduler %s open\n", this->name_)); - return this->activate (THR_BOUND); -} - -int -Scheduler::close (u_long) -{ - ACE_DEBUG ((LM_DEBUG, " (%t) Scheduler %s close\n", this->name_)); - scheduler_open_count--; - return 0; -} - -int -Scheduler::svc (void) -{ - // Main event loop for this active object. - for (;;) - { - // Dequeue the next method object (we use an auto pointer in - // case an exception is thrown in the ). - ACE_Auto_Ptr mo (this->activation_queue_.dequeue ()); - - ACE_DEBUG ((LM_DEBUG, " (%t) calling method object\n")); - // Call it. - if (mo->call () == -1) - break; - // Smart pointer destructor automatically deletes mo. - } - - /* NOTREACHED */ - return 0; -} - -void -Scheduler::end (void) -{ - this->activation_queue_.enqueue (new Method_Object_end (this)); -} - -// Here's where the Work takes place. -float -Scheduler::work_i (float param, - int count) -{ - float x = 0, y = 0; - - for (int j = 0; j < count; j++) - { - x = x + param; - y = y + ::sin (x); - } - - return y; -} - -char * -Scheduler::name_i (void) -{ - char *the_name; - - the_name = new char[ACE_OS::strlen (this->name_) + 1]; - ACE_OS::strcpy (the_name, this->name_); - - return the_name; -} - -ACE_Future -Scheduler::name (void) -{ - if (this->scheduler_) - // Delegate to the other scheduler - return this->scheduler_->name (); - else - { - ACE_Future new_future; - - if (this->thr_count () == 0) - { - // This scheduler is inactive... so we execute the user - // request right away... - - ACE_Auto_Ptr mo (new Method_Object_name (this, new_future)); - - mo->call (); - // Smart pointer destructor automatically deletes mo. - } - else - // @@ What happens if new fails here? - this->activation_queue_.enqueue - (new Method_Object_name (this, new_future)); - - return new_future; - } -} - -ACE_Future -Scheduler::work (float newparam, int newcount) -{ - if (this->scheduler_) - return this->scheduler_->work (newparam, newcount); - else - { - ACE_Future new_future; - - if (this->thr_count () == 0) - { - ACE_Auto_Ptr mo - (new Method_Object_work (this, newparam, newcount, new_future)); - mo->call (); - // Smart pointer destructor automatically deletes it. - } - else - this->activation_queue_.enqueue - (new Method_Object_work (this, newparam, newcount, new_future)); - - return new_future; - } -} - -static int -determine_iterations (void) -{ - int n_iterations; - - ACE_DEBUG ((LM_DEBUG," (%t) determining the number of iterations...\n")); - Scheduler *worker_a = new Scheduler ("worker A"); - - ACE_Time_Value tstart (ACE_OS::gettimeofday ()); - ACE_Time_Value tend (ACE_OS::gettimeofday ()); - - // Determine the number of iterations... we want so many that the - // work () takes about 1 second... - - for (n_iterations = 1; - (tend.sec () - tstart.sec ()) < 1; - n_iterations *= 2) - { - tstart = ACE_OS::gettimeofday (); - - worker_a->work (0.1, n_iterations); - - tend = ACE_OS::gettimeofday (); - } - - ACE_DEBUG ((LM_DEBUG," (%t) n_iterations %d\n", - (u_long) n_iterations)); - - worker_a->end (); - // @@ Can we safely delete worker_a here? - return n_iterations; -} - -static void -test_active_object (int n_iterations) -{ - ACE_DEBUG ((LM_DEBUG," (%t) testing active object pattern...\n")); - // A simple example for the use of the active object pattern and - // futures to return values from an active object. - - Scheduler *worker_a = new Scheduler ("worker A"); - Scheduler *worker_b = new Scheduler ("worker B"); - - // Have worker_c delegate his work to worker_a. - Scheduler *worker_c = new Scheduler ("worker C", worker_a); - - // loop 0: - // test the Schedulers when they are not active. - // now the method objects will be created but since - // there is no active thread they will also be - // immediately executed, in the "main" thread. - // loop 1: - // do the same test but with the schedulers - // activated - for (int i = 0; i < 2; i++) - { - if (i == 1) - { - worker_a->open (); - worker_b->open (); - worker_c->open (); - } - - ACE_Future fresulta = worker_a->work (0.01, n_iterations); - ACE_Future fresultb = worker_b->work (0.02, n_iterations); - ACE_Future fresultc = worker_c->work (0.03, n_iterations); - - if (i == 0) - { - if (!fresulta.ready ()) - ACE_DEBUG ((LM_DEBUG," (%t) ERROR: worker A is should be ready!!!\n")); - if (!fresultb.ready ()) - ACE_DEBUG ((LM_DEBUG," (%t) ERROR: worker B is should be ready!!!\n")); - if (!fresultc.ready ()) - ACE_DEBUG ((LM_DEBUG," (%t) ERROR: worker C is should be ready!!!\n")); - } - - // When the workers are active we will block here until the - // results are available. - - float resulta = fresulta; - float resultb = fresultb; - float resultc = fresultc; - - ACE_Future fnamea = worker_a->name (); - ACE_Future fnameb = worker_b->name (); - ACE_Future fnamec = worker_c->name (); - - char *namea = fnamea; - char *nameb = fnameb; - char *namec = fnamec; - - ACE_DEBUG ((LM_DEBUG, " (%t) result from %s %f\n", - namea, resulta)); - ACE_DEBUG ((LM_DEBUG, " (%t) result from %s %f\n", - nameb, resultb)); - ACE_DEBUG ((LM_DEBUG, " (%t) result from %s %f\n", - namec, resultc)); - } - - ACE_DEBUG ((LM_DEBUG, " (%t) scheduler_open_count %d before end ()\n", - (u_long) scheduler_open_count)); - - worker_a->end (); - worker_b->end (); - worker_c->end (); - - ACE_DEBUG ((LM_DEBUG, " (%t) scheduler_open_count %d immediately after end ()\n", - (u_long) scheduler_open_count)); - - ACE_OS::sleep (2); - - ACE_DEBUG ((LM_DEBUG, " (%t) scheduler_open_count %d after waiting\n", - (u_long) scheduler_open_count)); - // @@ Can we safely delete worker_a, worker_b, and worker_c? -} - -static void -test_cancellation (int n_iterations) -{ - ACE_DEBUG ((LM_DEBUG," (%t) testing cancellation of a future...\n")); - - // Now test the cancelling a future. - - Scheduler *worker_a = new Scheduler ("worker A"); - worker_a->open (); - - ACE_Future fresulta = worker_a->work (0.01, n_iterations); - - // save the result by copying the future - ACE_Future fresultb = fresulta; - - // now we cancel the first future.. but the - // calculation will still go on... - fresulta.cancel (10.0); - - if (!fresulta.ready ()) - ACE_DEBUG ((LM_DEBUG," (%t) ERROR: future A is should be ready!!!\n")); - - float resulta = fresulta; - - ACE_DEBUG ((LM_DEBUG, " (%t) cancelled result %f\n", resulta)); - - if (resulta != 10.0) - ACE_DEBUG ((LM_DEBUG, " (%t) cancelled result should be 10.0!!\n", resulta)); - - resulta = fresultb; - - ACE_DEBUG ((LM_DEBUG, " (%t) true result %f\n", resulta)); - - worker_a->end (); - // @@ Can we safely delete worker_a here? -} - -static void -test_timeout (int n_iterations) -{ - ACE_DEBUG ((LM_DEBUG," (%t) testing timeout on waiting for the result...\n")); - Scheduler *worker_a = new Scheduler ("worker A"); - worker_a->open (); - - ACE_Future fresulta = worker_a->work (0.01, 2 * n_iterations); - - // Should immediately return... and we should see an error... - ACE_Time_Value *delay = new ACE_Time_Value (1); - - float resulta; - fresulta.get (resulta, delay); - - if (fresulta.ready ()) - ACE_DEBUG ((LM_DEBUG," (%t) ERROR: future A is should not be ready!!!\n")); - else - ACE_DEBUG ((LM_DEBUG," (%t) timed out on future A\n")); - - // now we wait until we are done... - fresulta.get (resulta); - ACE_DEBUG ((LM_DEBUG, " (%t) result %f\n", resulta)); - - worker_a->end (); - // @@ Can we safely delete worker_a here? -} - -int -main (int, char *[]) -{ - int n_iterations = determine_iterations (); - - test_active_object (n_iterations); - test_cancellation (n_iterations); - test_timeout (n_iterations); - - ACE_DEBUG ((LM_DEBUG," (%t) that's all folks!\n")); - - ACE_OS::sleep (5); - return 0; -} - -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_Atomic_Op; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ - -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_manual_event.cpp b/examples/Threads/test_manual_event.cpp deleted file mode 100644 index 26d477fabc0..00000000000 --- a/examples/Threads/test_manual_event.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// The test shows the use of an ACE_Manual_Event to create a -// $Id$ - -// Pseudo_Barrier. Multiple threads are created which do the -// following: -// -// 1. work -// 2. synch with other threads -// 3. more work -// -// ACE_Manual_Event is use to synch with other -// threads. ACE_Manual_Event::signal() is used for broadcasting. - -#include "ace/Service_Config.h" -#include "ace/Synch.h" -#include "ace/Thread_Manager.h" - -#if defined (ACE_HAS_THREADS) -static ACE_Atomic_Op amount_of_work = (u_long) 0; - -class Pseudo_Barrier - // = TITLE - // A barrier class using ACE manual-reset events. - // - // = DESCRIPTION - // This is *not* a real barrier. - // Pseudo_Barrier is more like a ``one shot'' barrier. - // All waiters after the Nth waiter are allowed to go. - // The barrier does not reset after the Nth waiter. - // For an example of a real barrier, please see class ACE_Barrier. -{ -public: - Pseudo_Barrier (u_long count); - - int wait (void); - -private: - ACE_Atomic_Op counter_; - ACE_Manual_Event event_; -}; - -Pseudo_Barrier::Pseudo_Barrier (u_long count) - : counter_ (count) -{ -} - -int -Pseudo_Barrier::wait (void) -{ - if (--this->counter_ == 0) - return this->event_.signal (); - else - return this->event_.wait (); -} - -static void * -worker (void *arg) -{ - ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); - Pseudo_Barrier &barrier = *(Pseudo_Barrier *) arg; - - // work - ACE_DEBUG ((LM_DEBUG, "(%t) working (%d secs)\n", ++::amount_of_work)); - ACE_OS::sleep (::amount_of_work); - - // synch with everybody else - ACE_DEBUG ((LM_DEBUG, "(%t) waiting to synch with others \n")); - barrier.wait (); - - // more work - ACE_DEBUG ((LM_DEBUG, "(%t) more work (%d secs)\n", ++::amount_of_work)); - ACE_OS::sleep (amount_of_work); - - ACE_DEBUG ((LM_DEBUG, "(%t) dying \n")); - - return 0; -} - -int -main (int argc, char **argv) -{ - int n_threads = argc == 2 ? atoi (argv[1]) : 5; - - ACE_Thread_Manager &tm = *ACE_Service_Config::thr_mgr (); - - // synch object shared by all threads - Pseudo_Barrier barrier (n_threads); - - // create workers - if (tm.spawn_n (n_threads, worker, &barrier) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "thread creates for worker failed"), -1); - - // wait for all workers to exit - if (tm.wait () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "thread wait failed"), -1); - else - ACE_DEBUG ((LM_ERROR, "graceful exit\n")); - - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_process_mutex.cpp b/examples/Threads/test_process_mutex.cpp deleted file mode 100644 index fb23c8b73be..00000000000 --- a/examples/Threads/test_process_mutex.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// $Id$ - -// This program tests ACE_Process_Mutexes. To run it, open 3 or 4 -// windows and run this program in each window... - -#include "ace/Synch.h" -#include "ace/Signal.h" - -#if defined (ACE_HAS_THREADS) - -static sig_atomic_t done; - -extern "C" void -handler (int) -{ - done = 1; -} - -int -main (int argc, char *argv[]) -{ - char *name = argc > 1 ? argv[1] : "hello"; - int iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : 100; - - ACE_Process_Mutex pm (name); - - // Register a signal handler. - ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); - - for (int i = 0; i < iterations && !done; i++) - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquiring\n")); - if (pm.acquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "acquire failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquired\n")); - - ACE_OS::sleep (3); - - if (pm.release () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); - - if (pm.tryacquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "tryacquire failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = tryacquire\n")); - - if (pm.release () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); - } - - if (argc > 2) - pm.remove (); - return 0; -} -#else -int -main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "ACE doesn't support support threads on this platform (yet)\n"), - -1); -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_process_semaphore.cpp b/examples/Threads/test_process_semaphore.cpp deleted file mode 100644 index d7933897f8e..00000000000 --- a/examples/Threads/test_process_semaphore.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -// This program tests ACE_Process_Semaphore. To run it, open 3 or 4 -// windows and run this program in each window... - -#include "ace/Synch.h" -#include "ace/Signal.h" - -static sig_atomic_t done; - -extern "C" void -handler (int) -{ - done = 1; -} - -int -main (int argc, char *argv[]) -{ - char *name = argc == 1 ? "hello" : argv[1]; - - ACE_Process_Semaphore pm (1, name); - - ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); - - for (int i = 0; i < 100 && !done; i++) - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquiring\n")); - if (pm.acquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "acquire failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = acquired\n")); - - ACE_OS::sleep (3); - - if (pm.release () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); - - if (pm.tryacquire () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "tryacquire failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = tryacquire\n")); - - if (pm.release () == -1) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = %p\n", "release failed")); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) = released\n")); - } - - if (argc > 2) - pm.remove (); - return 0; -} - diff --git a/examples/Threads/test_reader_writer.cpp b/examples/Threads/test_reader_writer.cpp deleted file mode 100644 index ef888133d83..00000000000 --- a/examples/Threads/test_reader_writer.cpp +++ /dev/null @@ -1,187 +0,0 @@ -// This test program verifies the functionality of the ACE_OS -// $Id$ - -// implementation of readers/writer locks on Win32 and Posix pthreads. - - -#include "ace/Synch.h" -#include "ace/Thread.h" -#include "ace/Thread_Manager.h" -#include "ace/Get_Opt.h" - -#if defined (ACE_HAS_THREADS) - -// Default number of iterations. -static size_t n_iterations = 1000; - -// Default number of loops. -static size_t n_loops = 100; - -// Default number of readers. -static size_t n_readers = 6; - -// Default number of writers. -static size_t n_writers = 2; - -// Thread id of last writer. -volatile static int shared_data; - -// Lock for shared_data. -static ACE_RW_Mutex rw_mutex; - -// Count of the number of readers and writers. -ACE_Atomic_Op current_readers, current_writers; - -// Thread manager -static ACE_Thread_Manager thr_mgr; - -// Explain usage and exit. -static void -print_usage_and_die (void) -{ - ACE_DEBUG ((LM_DEBUG, - "usage: %n [-r n_readers] [-w n_writers] [-n iteration_count]\n")); - ACE_OS::exit (1); -} - -// Parse the command-line arguments and set options. -static void -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, "r:w:n:l:"); - - int c; - - while ((c = get_opt ()) != -1) - switch (c) - { - case 'r': - n_readers = ACE_OS::atoi (get_opt.optarg); - break; - case 'w': - n_writers = ACE_OS::atoi (get_opt.optarg); - break; - case 'n': - n_iterations = ACE_OS::atoi (get_opt.optarg); - break; - case 'l': - n_loops = ACE_OS::atoi (get_opt.optarg); - break; - default: - print_usage_and_die (); - break; - } -} - -// Iterate each time checking that nobody modifies the data -// while we have a read lock. - -static void * -reader (void *) -{ - ACE_Thread_Control tc (&thr_mgr); - ACE_DEBUG ((LM_DEBUG, "(%t) reader starting\n")); - - for (int iterations = 1; iterations <= n_iterations; iterations++) - { - ACE_Read_Guard g(rw_mutex); - int n = ++current_readers; - //ACE_DEBUG ((LM_DEBUG, "(%t) I'm reader number %d\n", n)); - - if (current_writers > 0) - ACE_DEBUG ((LM_DEBUG, "(%t) writers found!!!\n")); - - int data = shared_data; - - for (int loop = 1; loop <= n_loops; loop++) - { - ACE_Thread::yield(); - if (shared_data != data) - ACE_DEBUG ((LM_DEBUG, - "(%t) somebody changed %d to %d\n", - data, shared_data)); - } - - --current_readers; - //ACE_DEBUG ((LM_DEBUG, "(%t) done with reading guarded data\n")); - - ACE_Thread::yield (); - } - return 0; -} - -// Iterate each time modifying the global data -// and checking that nobody steps on it while we can write it. - -static void * -writer (void *) -{ - ACE_Thread_Control tc (&thr_mgr); - ACE_DEBUG ((LM_DEBUG, "(%t) writer starting\n")); - - for (int iterations = 1; iterations <= n_iterations; iterations++) - { - ACE_Write_Guard g(rw_mutex); - - ++current_writers; - //ACE_DEBUG ((LM_DEBUG, "(%t) writing to guarded data\n")); - - if (current_writers > 1) - ACE_DEBUG ((LM_DEBUG, "(%t) other writers found!!!\n")); - - if (current_readers > 0) - ACE_DEBUG ((LM_DEBUG, "(%t) readers found!!!\n")); - - int self = (int) ACE_Thread::self (); - shared_data = self; - - for (int loop = 1; loop <= n_loops; loop++) - { - ACE_Thread::yield(); - if (shared_data != self) - ACE_DEBUG ((LM_DEBUG, "(%t) somebody wrote on my data %d\n", shared_data)); - } - - --current_writers; - - //ACE_DEBUG ((LM_DEBUG, "(%t) done with guarded data\n")); - ACE_Thread::yield (); - } - return 0; -} - -// Spawn off threads. - -int main (int argc, char *argv[]) -{ - ACE_LOG_MSG->open (argv[0]); - parse_args (argc, argv); - - current_readers = 0; // Possibly already done - current_writers = 0; // Possibly already done - - ACE_DEBUG ((LM_DEBUG, "(%t) main thread starting\n")); - - if (thr_mgr.spawn_n (n_readers, reader, 0, THR_NEW_LWP) == -1 || - thr_mgr.spawn_n (n_writers, writer, 0, THR_NEW_LWP) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1); - - thr_mgr.wait (); - - ACE_DEBUG ((LM_DEBUG, "(%t) exiting main thread\n")); - return 0; -} - -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_Atomic_Op; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ - -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ - diff --git a/examples/Threads/test_recursive_mutex.cpp b/examples/Threads/test_recursive_mutex.cpp deleted file mode 100644 index 1cc2892b2a8..00000000000 --- a/examples/Threads/test_recursive_mutex.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// $Id$ - -// This test program verifies the functionality of the ACE_OS -// implementation of recursive mutexes on Win32 and Posix pthreads. - -#include "ace/Service_Config.h" -#include "ace/Get_Opt.h" -#include "ace/Synch.h" - -#if defined (ACE_HAS_THREADS) - -// Total number of iterations. -static size_t n_iterations = 1000; -static size_t n_threads = 4; - -// Explain usage and exit. -static void -print_usage_and_die (void) -{ - ACE_DEBUG ((LM_DEBUG, - "usage: %n [-t n_threads] [-n iteration_count]\n")); - ACE_OS::exit (1); -} - -// Parse the command-line arguments and set options. - -static void -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, "n:t:"); - - int c; - - while ((c = get_opt ()) != -1) - switch (c) - { - case 'n': - n_iterations = ACE_OS::atoi (get_opt.optarg); - break; - case 't': - n_threads = ACE_OS::atoi (get_opt.optarg); - break; - default: - print_usage_and_die (); - break; - } -} - -static void -recursive_worker (size_t nesting_level, - ACE_Recursive_Thread_Mutex *rm) -{ - if (nesting_level < n_iterations) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) = trying to acquire, nesting = %d, thread id = %u\n", - rm->get_nesting_level (), rm->get_thread_id ())); - { - // This illustrates the use of the ACE_Guard with an - // ACE_Recursive_Thread_Mutex. - ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, *rm); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) = acquired, nesting = %d, thread id = %u\n", - rm->get_nesting_level (), rm->get_thread_id ())); - - recursive_worker (nesting_level + 1, rm); - } - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) = released, nesting = %d, thread id = %u\n", - rm->get_nesting_level (), rm->get_thread_id ())); - } -} - -static void * -worker (void *arg) -{ - ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); - - ACE_Recursive_Thread_Mutex *rm = (ACE_Recursive_Thread_Mutex *) arg; - - recursive_worker (0, rm); - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_Service_Config daemon (argv[0]); - - parse_args (argc, argv); - ACE_Recursive_Thread_Mutex rm; - - ACE_Service_Config::thr_mgr ()->spawn_n (n_threads, - ACE_THR_FUNC (worker), - (void *) &rm); - - ACE_Service_Config::thr_mgr ()->wait (); - return 0; -} -#else -int -main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "ACE doesn't support support process mutexes on this platform (yet)\n"), - -1); -} -#endif /* ACE_WIN32 */ diff --git a/examples/Threads/test_task.cpp b/examples/Threads/test_task.cpp deleted file mode 100644 index 7cd7976d2bb..00000000000 --- a/examples/Threads/test_task.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// This test program illustrates how the ACE barrier synchronization -// $Id$ - -// mechanisms work in conjunction with the ACE_Task and the -// ACE_Thread_Manager. It is instructive to compare this with the -// test_barrier.cpp test to see how they differ. - -#include "ace/Task.h" -#include "ace/Service_Config.h" -#include "ace/Log_Msg.h" - -#if defined (ACE_HAS_THREADS) - -#include "ace/Task.h" - -class Barrier_Task : public ACE_Task -{ -public: - Barrier_Task (ACE_Thread_Manager *thr_mgr, - int n_threads, - int n_iterations); - - virtual int svc (void); - // Iterate time printing off a message and "waiting" - // for all other threads to complete this iteration. - -private: - ACE_Barrier barrier_; - // Reference to the tester barrier. This controls each - // iteration of the tester function running in every thread. - - int n_iterations_; - // Number of iterations to run. - - // = Not needed for this test. - virtual int open (void *) { return 0; } - virtual int close (u_long) { return 0; } - virtual int put (ACE_Message_Block *, ACE_Time_Value *) { return 0; } -}; - -Barrier_Task::Barrier_Task (ACE_Thread_Manager *thr_mgr, - int n_threads, - int n_iterations) - : ACE_Task (thr_mgr), - barrier_ (n_threads), - n_iterations_ (n_iterations) -{ - // Create worker threads. - if (this->activate (THR_NEW_LWP, n_threads) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "activate failed")); -} - -// Iterate time printing off a message and "waiting" -// for all other threads to complete this iteration. - -int -Barrier_Task::svc (void) -{ - // Note that the ACE_Task::svc_run() method automatically adds us to - // the Thread_Manager when the thread begins. - - for (int iterations = 1; - iterations <= this->n_iterations_; - iterations++) - { - ACE_DEBUG ((LM_DEBUG, "(%t) in iteration %d\n", iterations)); - - // Block until all other threads have waited, then continue. - this->barrier_.wait (); - } - - // Note that the ACE_Task::svc_run() method automatically removes us - // from the Thread_Manager when the thread exits. - - return 0; -} - -// Default number of threads to spawn. -static const int DEFAULT_ITERATIONS = 5; - -int -main (int argc, char *argv[]) -{ - int n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_THREADS; - int n_iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS; - - Barrier_Task barrier_task (ACE_Service_Config::thr_mgr (), - n_threads, - n_iterations); - - // Wait for all the threads to reach their exit point. - ACE_Service_Config::thr_mgr ()->wait (); - - ACE_DEBUG ((LM_DEBUG, "(%t) done\n")); - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_task_four.cpp b/examples/Threads/test_task_four.cpp deleted file mode 100644 index 64209cb3430..00000000000 --- a/examples/Threads/test_task_four.cpp +++ /dev/null @@ -1,248 +0,0 @@ -// $Id$ - -// The following test was written by Hamutal Yanay & Ari Erev's -// (Ari_Erev@comverse.com). -// -// This test program test enhancements to the thread_manager and task -// classes. The purpose of these enhancements was to allow the -// thread_manager to recognize the concept of an ACE_Task and to be -// able to group ACE_Tasks in groups. -// -// There are two main ACE_Tasks in this sample: -// -// Invoker_Task - is run from main (). It's purpose is to run a number of -// ACE_Tasks of type Worker_Task. The number can be specified -// on the command line. -// After starting the tasks, the Invoker_Task groups all the tasks -// in one group and then uses the -// num_tasks_in_group () to find out if the real number of tasks -// that are now running (should be the same as the number of tasks -// started). -// It also, suspends and resumes all the threads in the group to -// test the suspend_grp () and resume_grp () methods. -// Then it waits for all the tasks to end. -// Worker_Task - ACE_Tasks that are started by the Invoker_Task. -// Each Worker_Task can start a number of threads. -// The Worker_Task threads perform some work (iteration). The number -// of the iterations can be specified on the command line. -// -// The command line syntax is: -// -// test_task [num_tasks] [num_threads] [num_iterations] - -#include "ace/Task.h" -#include "ace/Service_Config.h" - - -#if defined (ACE_HAS_THREADS) - -#include "ace/Task.h" - -class Invoker_Task : public ACE_Task -{ -public: - Invoker_Task (ACE_Thread_Manager *thr_mgr, - int n_tasks, - int n_threads, - int n_iterations); - virtual int svc (void); - // creats and wait for them to finish - -private: - int n_tasks_; - // Number of tasks to start. - int n_threads_; - // Number of threads per task. - int n_iterations_; - // Number of iterations per thread. - - // = Not needed for this test. - virtual int open (void *) { return 0; } - virtual int close (u_long) { return 0; } - virtual int put (ACE_Message_Block *, ACE_Time_Value *) { return 0; } -}; - -class Worker_Task : public ACE_Task -{ -public: - Worker_Task (ACE_Thread_Manager *thr_mgr, - int n_threads, - int n_iterations); - virtual int svc (void); - // Does a small work... - virtual int open (void * = NULL); -private: - static int workers_count_; - int index_; - int n_threads_; - int n_iterations_; - - // = Not needed for this test. - virtual int close (u_long) { return 0; } - virtual int put (ACE_Message_Block *, ACE_Time_Value *) { return 0; } -}; - -int Worker_Task::workers_count_ = 1; - -Worker_Task::Worker_Task (ACE_Thread_Manager *thr_mgr, - int n_threads, - int n_iterations) - : n_threads_ (n_threads), - n_iterations_ (n_iterations), - ACE_Task (thr_mgr) -{ - index_ = workers_count_++; -} - -int -Worker_Task::open (void *) -{ - // Create worker threads. - int rc = this->activate (THR_NEW_LWP, n_threads_, 0, 0, -1, this); - - if (rc == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "activate failed")); - - return rc; -} - -int -Worker_Task::svc (void) -{ - ACE_DEBUG ((LM_DEBUG, " (%t) in worker %d\n", index_)); - - for (int iterations = 1; - iterations <= this->n_iterations_; - iterations++) - { - ACE_DEBUG ((LM_DEBUG, " (%t) in iteration %d\n", iterations)); - ACE_OS::sleep (0); - } - - ACE_DEBUG ((LM_DEBUG, " (%t) worker %d ends\n", index_)); - - return 0; -} - -Invoker_Task::Invoker_Task (ACE_Thread_Manager *thr_mgr, - int n_tasks, - int n_threads, - int n_iterations) - : n_tasks_ (n_tasks), - n_threads_ (n_threads), - n_iterations_ (n_iterations), - ACE_Task (thr_mgr) -{ - // Create worker threads. - if (this->activate (THR_NEW_LWP, 1, 0, 0, -1, this) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "activate failed")); -} - -// Iterate time printing off a message and "waiting" -// for all other threads to complete this iteration. - -int -Invoker_Task::svc (void) -{ - // Note that the ACE_Task::svc_run () method automatically adds us to - // the Thread_Manager when the thread begins. - - ACE_Thread_Manager *thr_mgr = ACE_Service_Config::thr_mgr (); - Worker_Task **pTask = new Worker_Task* [n_tasks_]; - - for (int task = 0; - task < this->n_tasks_; - task++) - { - ACE_DEBUG ((LM_DEBUG, " (%t) in task %d\n", task+1)); - pTask[task] = new Worker_Task (thr_mgr, n_threads_, n_iterations_); - pTask[task]->open (); - } - - // Set all tasks to be one group - ACE_DEBUG ((LM_DEBUG, " (%t) setting tasks group id\n")); - for (task = 0; - task < this->n_tasks_; - task++) - if (thr_mgr->set_grp (pTask[task], 1) == -1) - ACE_ERROR ((LM_DEBUG, " (%t) %p\n", "set_grp")); - - int nTasks = thr_mgr->num_tasks_in_group (1); - cout << "Number of tasks in group 1: " << nTasks << endl; - - // Wait for 1 second and then suspend every thread in the group. - ACE_OS::sleep (1); - ACE_DEBUG ((LM_DEBUG, " (%t) suspending group\n")); - if (thr_mgr->suspend_grp (1) == -1) - ACE_ERROR ((LM_DEBUG, " (%t) %p\n", "suspend_grp")); - - // Wait for 5 more second and then resume every thread in the - // group. - ACE_OS::sleep (ACE_Time_Value (5)); - - // @QTSK This ACE_DEBUG statement blows us away! can't understand why - ACE_DEBUG ((LM_DEBUG, " (%t) resuming group\n")); - if (thr_mgr->resume_grp (1) == -1) - ACE_ERROR ((LM_DEBUG, " (%t) %p\n", "resume_grp")); - - - // Wait for all the tasks to reach their exit point. - thr_mgr->wait (); - - // Note that the ACE_Task::svc_run () method automatically removes us - // from the Thread_Manager when the thread exits. - - return 0; -} - -// Default number of tasks and iterations. -static const int DEFAULT_TASKS = 4; -static const int DEFAULT_ITERATIONS = 5; - -int -main (int argc, char *argv[]) -{ - int n_tasks = argc > 1 ? ACE_OS::atoi (argv[1]) : DEFAULT_TASKS; - int n_threads = argc > 2 ? ACE_OS::atoi (argv[2]) : ACE_DEFAULT_THREADS; - int n_iterations = argc > 3 ? ACE_OS::atoi (argv[3]) : DEFAULT_ITERATIONS; - - // Since ACE_Thread_Manager can only wait for all threads, we'll have - // special manager for the Invoker_Task. - ACE_Thread_Manager invoker_manager; - - Invoker_Task invoker (&invoker_manager, - n_tasks, - n_threads, - n_iterations); - - // Wait for 1 second and then suspend the invoker task - ACE_OS::sleep (1); - ACE_DEBUG ((LM_DEBUG, " (%t) suspending invoker task\n")); - - if (invoker_manager.suspend_task (&invoker) == -1) - ACE_ERROR ((LM_DEBUG, " (%t) %p\n", "suspend_task")); - - // Wait for 5 more second and then resume the invoker task. - ACE_OS::sleep (ACE_Time_Value (5)); - - // @QTSK This ACE_DEBUG statement blows us away! can't understand why - ACE_DEBUG ((LM_DEBUG, " (%t) resuming invoker task\n")); - if (invoker_manager.resume_task (&invoker) == -1) - ACE_ERROR ((LM_DEBUG, " (%t) %p\n", "resume_task")); - - - // Wait for all the threads to reach their exit point. - invoker_manager.wait (); - - // @QTSK This ACE_DEBUG statement blows us away! can't understand why - ACE_DEBUG ((LM_DEBUG, " (%t) done\n")); - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_task_one.cpp b/examples/Threads/test_task_one.cpp deleted file mode 100644 index d0a8a12e6c4..00000000000 --- a/examples/Threads/test_task_one.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// This test program illustrates how the ACE barrier synchronization -// $Id$ - -// mechanisms work in conjunction with the ACE_Task and the -// ACE_Thread_Manager. It is instructive to compare this with the -// test_barrier.cpp test to see how they differ. - -#include "ace/Task.h" -#include "ace/Service_Config.h" - - -#if defined (ACE_HAS_THREADS) - -#include "ace/Task.h" - -class Barrier_Task : public ACE_Task -{ -public: - Barrier_Task (ACE_Thread_Manager *thr_mgr, - int n_threads, - int n_iterations); - - virtual int svc (void); - // Iterate time printing off a message and "waiting" - // for all other threads to complete this iteration. - -private: - ACE_Barrier barrier_; - // Reference to the tester barrier. This controls each - // iteration of the tester function running in every thread. - - int n_iterations_; - // Number of iterations to run. - - // = Not needed for this test. - virtual int open (void *) { return 0; } - virtual int close (u_long) { return 0; } - virtual int put (ACE_Message_Block *, ACE_Time_Value *) { return 0; } -}; - -Barrier_Task::Barrier_Task (ACE_Thread_Manager *thr_mgr, - int n_threads, - int n_iterations) - : ACE_Task (thr_mgr), - barrier_ (n_threads), - n_iterations_ (n_iterations) -{ - // Create worker threads. - if (this->activate (THR_NEW_LWP, n_threads) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "activate failed")); -} - -// Iterate time printing off a message and "waiting" -// for all other threads to complete this iteration. - -int -Barrier_Task::svc (void) -{ - // Note that the ACE_Task::svc_run() method automatically adds us to - // the Thread_Manager when the thread begins. - - for (int iterations = 1; - iterations <= this->n_iterations_; - iterations++) - { - ACE_DEBUG ((LM_DEBUG, "(%t) in iteration %d\n", iterations)); - - // Block until all other threads have waited, then continue. - this->barrier_.wait (); - } - - // Note that the ACE_Task::svc_run() method automatically removes us - // from the Thread_Manager when the thread exits. - - return 0; -} - -// Default number of threads to spawn. -static const int DEFAULT_ITERATIONS = 5; - -int -main (int argc, char *argv[]) -{ - int n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_THREADS; - int n_iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS; - - Barrier_Task barrier_task (ACE_Service_Config::thr_mgr (), - n_threads, - n_iterations); - - // Wait for all the threads to reach their exit point. - ACE_Service_Config::thr_mgr ()->wait (); - - ACE_DEBUG ((LM_DEBUG, "(%t) done\n")); - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_task_three.cpp b/examples/Threads/test_task_three.cpp deleted file mode 100644 index c6ad69511b5..00000000000 --- a/examples/Threads/test_task_three.cpp +++ /dev/null @@ -1,230 +0,0 @@ -// $Id$ - -// Exercise more tests for the ACE Tasks. This also shows off some -// Interesting uses of the ACE Log_Msg's ability to print to ostreams. -// BTW, make sure that you set the out_stream in *every* thread that -// you want to have write to the output file, i.e.: -// -// -// if (out_stream) -// { -// ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); -// ACE_LOG_MSG->msg_ostream (out_stream); -// } - -#include -#include "ace/Reactor.h" -#include "ace/Service_Config.h" -#include "ace/Task.h" - - -#if defined (ACE_HAS_THREADS) - -static ofstream *out_stream = 0; - -static const int NUM_INVOCATIONS = 100; -static const int TASK_COUNT = 130; - -class Test_Task : public ACE_Task -{ -public: - Test_Task (void); - ~Test_Task (void); - - virtual int open (void *args = 0); - virtual int close (u_long flags = 0); - virtual int put (ACE_Message_Block *, ACE_Time_Value *tv = 0); - virtual int svc (void); - - virtual int handle_input (ACE_HANDLE fd); - - ACE_Reactor *r_; - int handled_; - static int current_count_; - static int done_cnt_; -}; - -int Test_Task::current_count_ = 0; -int Test_Task::done_cnt_ = 0; - -static ACE_Thread_Mutex lock_; - -Test_Task::Test_Task (void) -{ - ACE_GUARD (ACE_Thread_Mutex, ace_mon, lock_); - - this->handled_ = 0; - Test_Task::current_count_++; - ACE_DEBUG ((LM_DEBUG, - "Test_Task constructed, current_count_ = %d\n", - Test_Task::current_count_)); -} - -Test_Task::~Test_Task (void) -{ - ACE_GUARD (ACE_Thread_Mutex, ace_mon, lock_); - - ACE_DEBUG ((LM_DEBUG, "Test_Task destroyed, current_count_ = %d\n", - Test_Task::current_count_)); -} - -int -Test_Task::open (void *args) -{ - r_ = (ACE_Reactor *) args; - return ACE_Task::activate (THR_NEW_LWP); -} - -int -Test_Task::close (u_long) -{ - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, lock_, -1); - - Test_Task::current_count_--; - ACE_DEBUG ((LM_DEBUG, "Test_Task::close () current_count_ = %d.\n", - Test_Task::current_count_)); - return 0; -} - -int -Test_Task::put (ACE_Message_Block *, ACE_Time_Value *) -{ - return 0; -} - -Test_Task::svc (void) -{ - // Every thread must register the same stream to write to file. - if (out_stream) - { - ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); - ACE_LOG_MSG->msg_ostream (out_stream); - } - - for (int index = 0; index < NUM_INVOCATIONS; index++) - { - ACE_OS::thr_yield (); - - if (r_->notify (this, ACE_Event_Handler::READ_MASK)) - { - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, lock_, -1); - - ACE_DEBUG ((LM_DEBUG, "Test_Task: error notifying reactor!\n")); - } - } - - ACE_DEBUG ((LM_DEBUG, " (%t) returning from svc ()\n")); - return 0; -} - -int -Test_Task::handle_input (ACE_HANDLE) -{ - this->handled_++; - - if (this->handled_ == NUM_INVOCATIONS) - { - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, lock_, -1); - Test_Task::done_cnt_++; - ACE_DEBUG ((LM_DEBUG, - " (%t) Test_Task: handle_input! done_cnt_ = %d.\n", - Test_Task::done_cnt_)); - } - - ACE_OS::thr_yield (); - return -1; -} - -static void * -dispatch (void *arg) -{ - // every thread must register the same stream to write to file - if (out_stream) - { - ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); - ACE_LOG_MSG->msg_ostream (out_stream); - } - - ACE_DEBUG ((LM_DEBUG, " (%t) Dispatcher Thread started!\n")); - ACE_Reactor *r = (ACE_Reactor *) arg; - int result; - - r->owner (ACE_OS::thr_self ()); - - while (1) - { - result = r->handle_events (); - if (result <= 0) - ACE_DEBUG ((LM_DEBUG, "Dispatch: handle_events (): %d", result)); - } - - return 0; -} - -extern "C" void -handler (int) -{ - *out_stream << flush; - out_stream->close (); - ACE_OS::exit (42); -} - -int -main (int argc, char **argv) -{ - if (argc > 1) - { - // Send output to file. - out_stream = new ofstream ("test_task_three.out", ios::trunc|ios::out); - ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); - ACE_LOG_MSG->msg_ostream (out_stream); - } - - // Register a signal handler. - ACE_Sig_Action sa (ACE_SignalHandler (handler), SIGINT); - - ACE_Reactor *reactor1 = ACE_Service_Config::reactor (); - ACE_Reactor *reactor2 = new ACE_Reactor (); - - Test_Task t1[TASK_COUNT]; - Test_Task t2[TASK_COUNT]; - - ACE_Thread::spawn (ACE_THR_FUNC (dispatch), reactor2); - - reactor1->owner (ACE_OS::thr_self ()); - - for (int index = 0; index < TASK_COUNT; index++) - { - t1[index].open (reactor1); - t2[index].open (reactor2); - } - - ACE_OS::sleep (3); - - for (;;) - { - ACE_Time_Value timeout (2); - - if (reactor1->handle_events (timeout) <= 0) - { - if (errno == ETIME) - { - ACE_DEBUG ((LM_DEBUG, "no activity within 2 seconds, shutting down\n")); - break; - } - else - ACE_ERROR ((LM_ERROR, "%p error handling events\n", "main")); - } - } - - return 0; -} - -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_task_two.cpp b/examples/Threads/test_task_two.cpp deleted file mode 100644 index 9f25962c795..00000000000 --- a/examples/Threads/test_task_two.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// $Id$ - -// Exercise more tests for the ACE Tasks. This test can spawn off -// zillions of tasks and then wait for them using both polling and the -// ACE Thread Manager. - -#include "ace/Task.h" - -#include "ace/Service_Config.h" -#include "ace/Synch.h" - -#if defined (ACE_HAS_THREADS) - -typedef ACE_Atomic_Op ATOMIC_INT; - -static u_long zero = 0; -static ATOMIC_INT task_count (zero); -static ATOMIC_INT max_count (zero); -static ATOMIC_INT wait_count (zero); - -static u_long n_threads = 0; - -// Default number of tasks. -static const int default_threads = ACE_DEFAULT_THREADS; - -// Default number of times to run the test. -static const int default_iterations = 1000; - -class Task_Test : public ACE_Task -{ -public: - virtual int open (void *args = 0); - virtual int close (u_long flags = 0); - virtual int put (ACE_Message_Block *, ACE_Time_Value *tv = 0); - virtual int svc (void); - -private: - static ACE_Thread_Mutex lock_; -}; - -ACE_Thread_Mutex Task_Test::lock_; - -int -Task_Test::open (void *) -{ - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, Task_Test::lock_, -1); - - task_count++; - ACE_DEBUG ((LM_DEBUG, "(%t) creating Task_Test, task count = %d\n", - (u_long) task_count)); - - return this->activate (THR_BOUND); -} - -int -Task_Test::close (u_long) -{ - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, Task_Test::lock_, -1); - - task_count--; - ACE_DEBUG ((LM_DEBUG, "(%t) destroying Task_Test, task count = %d\n", - (u_long) task_count)); - wait_count--; -// delete this; - return 0; -} - -int -Task_Test::put (ACE_Message_Block *, - ACE_Time_Value *) -{ - return 0; -} - -int -Task_Test::svc (void) -{ - wait_count++; - max_count++; - - ACE_DEBUG ((LM_DEBUG, "(%t) svc: waiting\n")); - - for (;;) - if (max_count >= n_threads) - break; - else - ACE_Thread::yield (); - - ACE_DEBUG ((LM_DEBUG, "(%t) svc: finished waiting\n")); - return 0; -} - -int -main (int argc, char *argv[]) -{ - n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : default_threads; - int n_iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : default_iterations; - - Task_Test **task_array = new Task_Test *[n_threads]; - - for (int i = 1; i <= n_iterations; i++) - { - ACE_DEBUG ((LM_DEBUG, "(%t) iteration = %d, max_count %d\n", - i, (u_long) max_count)); - max_count = 0; - - ACE_DEBUG ((LM_DEBUG, "(%t) starting %d task%s\n", - n_threads, n_threads == 1 ? "" : "s")); - - // Launch the new tasks. - for (int j = 0; j < n_threads; j++) - { - task_array[j] = new Task_Test; - // Activate the task, i.e., make it an active object. - task_array[j]->open (); - } - - // Wait for initialization to kick in. - while (max_count == 0) - ACE_Thread::yield (); - - ACE_DEBUG ((LM_DEBUG, "(%t) waiting for threads to finish\n")); - - // Wait for the threads to finish this iteration. - while (max_count != n_threads && wait_count != 0) - ACE_Thread::yield (); - - ACE_DEBUG ((LM_DEBUG, "(%t) iteration %d finished, max_count %d, wait_count %d, waiting for tasks to exit\n", - i, (u_long) max_count, (u_long) wait_count)); - - // Wait for all the tasks to exit. - ACE_Service_Config::thr_mgr ()->wait (); - - // Delete the existing tasks. - for (int k = 0; k < n_threads; k++) - delete task_array[k]; - } - - delete [] task_array; - - ACE_DEBUG ((LM_DEBUG, "(%t) shutting down the test\n")); - return 0; -} - -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_Atomic_Op; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ - -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_thread_manager.cpp b/examples/Threads/test_thread_manager.cpp deleted file mode 100644 index 73029d70d88..00000000000 --- a/examples/Threads/test_thread_manager.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// $Id$ - -// Test out the group management mechanisms provided by the -// ACE_Thread_Manager, including the group signal handling, group -// suspension and resumption, and cooperative thread cancellation -// mechanisms. - -#include "ace/Service_Config.h" -#include "ace/Thread_Manager.h" - -#if defined (ACE_HAS_THREADS) - -extern "C" void -handler (int signum) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) received signal %d\n", signum)); -} - -static void * -worker (int iterations) -{ - ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); - - for (int i = 0; i < iterations; i++) - { - if ((i % 1000) == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%t) checking cancellation before iteration %d!\n", - i)); - - if (ACE_Service_Config::thr_mgr ()->testcancel (ACE_Thread::self ()) != 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%t) has been cancelled before iteration %d!\n", - i)); - break; - } - } - } - - // Destructor removes thread from Thread_Manager. - return 0; -} - -static const int DEFAULT_THREADS = ACE_DEFAULT_THREADS; -static const int DEFAULT_ITERATIONS = 100000; - -int -main (int argc, char *argv[]) -{ - ACE_Service_Config daemon; - - daemon.open (argv[0]); - - // Register a signal handler. - ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); - - int n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : DEFAULT_THREADS; - int n_iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : DEFAULT_ITERATIONS; - - ACE_Thread_Manager *thr_mgr = ACE_Service_Config::thr_mgr (); - - int grp_id = thr_mgr->spawn_n (n_threads, ACE_THR_FUNC (worker), - (void *) n_iterations, - THR_NEW_LWP | THR_DETACHED); - - // Wait for 1 second and then suspend every thread in the group. - ACE_OS::sleep (1); - ACE_DEBUG ((LM_DEBUG, "(%t) suspending group\n")); - if (thr_mgr->suspend_grp (grp_id) == -1) - ACE_ERROR ((LM_DEBUG, "(%t) %p\n", "suspend_grp")); - - // Wait for 1 more second and then resume every thread in the - // group. - ACE_OS::sleep (ACE_Time_Value (1)); - ACE_DEBUG ((LM_DEBUG, "(%t) resuming group\n")); - if (thr_mgr->resume_grp (grp_id) == -1) - ACE_ERROR ((LM_DEBUG, "(%t) %p\n", "resume_grp")); - - // Wait for 1 more second and then send a SIGINT to every thread in - // the group. - ACE_OS::sleep (ACE_Time_Value (1)); - ACE_DEBUG ((LM_DEBUG, "(%t) signaling group\n")); - if (thr_mgr->kill_grp (grp_id, SIGINT) == -1) - ACE_ERROR ((LM_DEBUG, "(%t) %p\n", "kill_grp")); - - // Wait for 1 more second and then cancel all the threads. - ACE_OS::sleep (ACE_Time_Value (1)); - ACE_DEBUG ((LM_DEBUG, "(%t) cancelling group\n")); - if (thr_mgr->cancel_grp (grp_id) == -1) - ACE_ERROR ((LM_DEBUG, "(%t) %p\n", "cancel_grp")); - - // Perform a barrier wait until all the threads have shut down. - thr_mgr->wait (); - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR_RETURN ((LM_ERROR, "threads not supported on this platform\n"), -1); -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_thread_pool.cpp b/examples/Threads/test_thread_pool.cpp deleted file mode 100644 index 68741156b83..00000000000 --- a/examples/Threads/test_thread_pool.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// This test program illustrates how the ACE task synchronization -// $Id$ - -// mechanisms work in conjunction with the ACE_Task and the -// ACE_Thread_Manager. If the manual flag is not set input comes from -// stdin until the user enters a return only. This stops all workers -// via a message block of length 0. This is an alternative shutdown of -// workers compared to queue deactivate. -// -// This code is original based on a test program written by Karlheinz -// Dorn. It was modified to utilize more "ACE" features by Doug Schmidt. - -#include "ace/Task.h" -#include "ace/Service_Config.h" - -#include "ace/Task.h" - -#if defined (ACE_HAS_THREADS) - -// Number of iterations to run the test. -static size_t n_iterations = 100; - -class Thread_Pool : public ACE_Task -{ -public: - Thread_Pool (ACE_Thread_Manager *thr_mgr, int n_threads); - - virtual int svc (void); - // Iterate time printing off a message and "waiting" - // for all other threads to complete this iteration. - - virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv=0); - // This allows the producer to pass messages to the . - -private: - virtual int close (u_long); - - // = Not needed for this test. - virtual int open (void *) { return 0; } -}; - -int -Thread_Pool::close (u_long) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) close of worker\n")); - return 0; -} - -Thread_Pool::Thread_Pool (ACE_Thread_Manager *thr_mgr, - int n_threads) - : ACE_Task (thr_mgr) -{ - // Create worker threads. - if (this->activate (THR_NEW_LWP, n_threads) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "activate failed")); -} - -// Simply enqueue the Message_Block into the end of the queue. - -int -Thread_Pool::put (ACE_Message_Block *mb, ACE_Time_Value *tv) -{ - return this->putq (mb, tv); -} - -// Iterate time printing off a message and "waiting" -// for all other threads to complete this iteration. - -int -Thread_Pool::svc (void) -{ - // Note that the ACE_Task::svc_run () method automatically adds us to - // the Thread_Manager when the thread begins. - - int result = 0; - int count = 1; - - // Keep looping, reading a message out of the queue, until we get a - // message with a length == 0, which signals us to quit. - - for (;; count++) - { - ACE_Message_Block *mb; - - ACE_DEBUG ((LM_DEBUG, "(%t) in iteration %d before getq ()\n", count)); - - if (this->getq (mb) == -1) - { - ACE_ERROR ((LM_ERROR, - "(%t) in iteration %d, got result -1, exiting\n", count)); - break; - } - - int length = mb->length (); - - if (length > 0) - ACE_DEBUG ((LM_DEBUG, - "(%t) in iteration %d, length = %d, text = \"%*s\"\n", - count, length, length - 1, mb->rd_ptr ())); - - // We're responsible for deallocating this. - delete mb; - - if (length == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%t) in iteration %d, got NULL message, exiting\n", - count)); - break; - } - } - - // Note that the ACE_Task::svc_run () method automatically removes - // us from the Thread_Manager when the thread exits. - return 0; -} - -static void -produce (Thread_Pool &thread_pool) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) producer start, dumping the Thread_Pool\n")); - thread_pool.dump (); - - for (int n;;) - { - // Allocate a new message. - ACE_Message_Block *mb = new ACE_Message_Block (BUFSIZ); - -#if defined (manual) - ACE_DEBUG ((LM_DEBUG, - "(%t) press chars and enter to put a new message into task queue...")); - n = ACE_OS::read (ACE_STDIN, mb->rd_ptr (), mb->size ()); -#else // Automatically generate messages. - static int count = 0; - - ACE_OS::sprintf (mb->rd_ptr (), "%d\n", count); - - n = ACE_OS::strlen (mb->rd_ptr ()); - - if (count == n_iterations) - n = 1; // Indicate that we need to shut down. - else - count++; - - if (count == 0 || (count % 20 == 0)) - ACE_OS::sleep (1); -#endif /* manual */ - if (n > 1) - { - // Send a normal message to the waiting threads and continue - // producing. - mb->wr_ptr (n); - - // Pass the message to the Thread_Pool. - if (thread_pool.put (mb) == -1) - ACE_ERROR ((LM_ERROR, " (%t) %p\n", "put")); - } - else - { - // Send a shutdown message to the waiting threads and exit. - ACE_DEBUG ((LM_DEBUG, "\n(%t) start loop, dump of task:\n")); - thread_pool.dump (); - - for (int i = thread_pool.thr_count (); i > 0; i--) - { - ACE_DEBUG ((LM_DEBUG, - "(%t) EOF, enqueueing NULL block for thread = %d\n", - i)); - - // Enqueue a NULL message to flag each consumer to - // shutdown. - if (thread_pool.put (new ACE_Message_Block) == -1) - ACE_ERROR ((LM_ERROR, " (%t) %p\n", "put")); - } - - ACE_DEBUG ((LM_DEBUG, "\n(%t) end loop, dump of task:\n")); - thread_pool.dump (); - break; - } - } -} - -int -main (int argc, char *argv[]) -{ - int n_threads = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_THREADS; - n_iterations = argc > 2 ? ACE_OS::atoi (argv[2]) : n_iterations; - - ACE_DEBUG ((LM_DEBUG, "(%t) argc = %d, threads = %d\n", - argc, n_threads)); - - // Create the worker tasks. - Thread_Pool thread_pool (ACE_Service_Config::thr_mgr (), - n_threads); - - // Create work for the worker tasks to process in their own threads. - produce (thread_pool); - - // Wait for all the threads to reach their exit point. - - ACE_DEBUG ((LM_DEBUG, "(%t) waiting with thread manager...\n")); - ACE_Service_Config::thr_mgr ()->wait (); - - ACE_DEBUG ((LM_DEBUG, "(%t) destroying worker tasks and exiting...\n")); - return 0; -} -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_thread_specific.cpp b/examples/Threads/test_thread_specific.cpp deleted file mode 100644 index f7a4f6dccf3..00000000000 --- a/examples/Threads/test_thread_specific.cpp +++ /dev/null @@ -1,219 +0,0 @@ -#include "ace/Service_Config.h" -// $Id$ - -#include "ace/Synch.h" - -#if defined (ACE_HAS_THREADS) - -// Define a class that will be stored in thread-specific data. Note -// that as far as this class is concerned it's just a regular C++ -// class. The ACE_TSS wrapper transparently ensures that -// objects of this class will be placed in thread-specific storage. -// All calls on ACE_TSS::operator->() are delegated to the -// appropriate method in the Errno class. - -class Errno -{ -public: - int error (void) { return this->errno_; } - void error (int i) { this->errno_ = i; } - - int line (void) { return this->lineno_; } - void line (int l) { this->lineno_ = l; } - - // Errno::flags_ is a static variable, so we've got to protect it - // with a mutex since it isn't kept in thread-specific storage. - int flags (void) - { - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, Errno::lock_, -1); - - return Errno::flags_; - } - - void flags (int f) - { - ACE_GUARD (ACE_Thread_Mutex, ace_mon, Errno::lock_); - - Errno::flags_ = f; - } - -private: - // = errno_ and lineno_ will be thread-specific data so they don't - // need a lock. - int errno_; - int lineno_; - - static int flags_; -#if defined (ACE_HAS_THREADS) - // flags_ needs a lock. - static ACE_Thread_Mutex lock_; -#endif /* ACE_HAS_THREADS */ -}; - -// Static variables. -ACE_MT (ACE_Thread_Mutex Errno::lock_); -int Errno::flags_; - -// This is our thread-specific error handler... -static ACE_TSS TSS_Error; - -#if defined (ACE_HAS_THREADS) -// Serializes output via cout. -static ACE_Thread_Mutex lock; - -typedef ACE_TSS_Guard GUARD; -#else -// Serializes output via cout. -static ACE_Null_Mutex lock; - -typedef ACE_Guard GUARD; -#endif /* ACE_HAS_THREADS */ - -static void -cleanup (void *ptr) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) in cleanup, ptr = %x\n", ptr)); - - delete ptr; -} - -// This worker function is the entry point for each thread. - -static void * -worker (void *c) -{ - ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); - int count = int (c); - - ACE_thread_key_t key = 0; - int *ip = 0; - - // Make one key that will be available when the thread exits so that - // we'll have something to cleanup! - - if (ACE_OS::thr_keycreate (&key, cleanup) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_keycreate")); - - ip = new int; - - if (ACE_OS::thr_setspecific (key, (void *) ip) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_setspecific")); - - for (int i = 0; i < count; i++) - { - if (ACE_OS::thr_keycreate (&key, cleanup) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_keycreate")); - - ip = new int; - - ACE_DEBUG ((LM_DEBUG, "(%t) in worker 1, key = %d, ip = %x\n", key, ip)); - - if (ACE_OS::thr_setspecific (key, (void *) ip) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_setspecific")); - - if (ACE_OS::thr_getspecific (key, (void **) &ip) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_setspecific")); - - if (ACE_OS::thr_setspecific (key, (void *) 0) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_setspecific")); - - delete ip; - - if (ACE_OS::thr_keyfree (key) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_keyfree")); - - // Cause an error. - ACE_OS::read (ACE_INVALID_HANDLE, 0, 0); - - // The following two lines set the thread-specific state. - TSS_Error->error (errno); - TSS_Error->line (__LINE__); - - // This sets the static state (note how C++ makes it easy to do - // both). - TSS_Error->flags (count); - - { - // Use the guard to serialize access to cout... - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, lock, 0); - - cout << "(" << ACE_Thread::self () - << ") errno = " << TSS_Error->error () - << ", lineno = " << TSS_Error->line () - << ", flags = " << TSS_Error->flags () - << endl; - } - key = 0; - - if (ACE_OS::thr_keycreate (&key, cleanup) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_keycreate")); - - ip = new int; - - ACE_DEBUG ((LM_DEBUG, "(%t) in worker 2, key = %d, ip = %x\n", key, ip)); - - if (ACE_OS::thr_setspecific (key, (void *) ip) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_setspecific")); - - if (ACE_OS::thr_getspecific (key, (void **) &ip) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_setspecific")); - - if (ACE_OS::thr_setspecific (key, (void *) 0) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_setspecific")); - - delete ip; - - if (ACE_OS::thr_keyfree (key) == -1) - ACE_ERROR ((LM_ERROR, "(%t) %p\n", "ACE_OS::thr_keyfree")); - } - - ACE_DEBUG ((LM_DEBUG, "(%t) exiting\n")); - return 0; -} - -extern "C" void -handler (int signum) -{ - ACE_DEBUG ((LM_DEBUG, "signal = %S\n", signum)); - ACE_Service_Config::thr_mgr ()->exit (0); -} - -int -main (int argc, char *argv[]) -{ - // The Service_Config must be the first object defined in main... - ACE_Service_Config daemon (argv[0]); - ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); - int threads = argc > 1 ? ACE_OS::atoi (argv[1]) : 4; - int count = argc > 2 ? ACE_OS::atoi (argv[2]) : 10000; - - // Register a signal handler. - ACE_Sig_Action sa ((ACE_SignalHandler) (handler), SIGINT); - -#if defined (ACE_HAS_THREADS) - if (ACE_Service_Config::thr_mgr ()->spawn_n (threads, - ACE_THR_FUNC (&worker), - (void *) count, - THR_BOUND | THR_DETACHED) == -1) - ACE_OS::perror ("ACE_Thread_Manager::spawn_n"); - - ACE_Service_Config::thr_mgr ()->wait (); -#else - worker ((void *) count); -#endif /* ACE_HAS_THREADS */ - return 0; -} - -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_TSS; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ - -#else -int -main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "ACE doesn't support support threads on this platform (yet)\n"), - -1); -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_token.cpp b/examples/Threads/test_token.cpp deleted file mode 100644 index 5a51496d011..00000000000 --- a/examples/Threads/test_token.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Test out the ACE Token class. -// $Id$ - -#include "ace/Token.h" -#include "ace/Task.h" - -#if defined (ACE_HAS_THREADS) - -class My_Task : public ACE_Task -{ -public: - My_Task (int n); - virtual int open (void *) { return 0; } - virtual int close (u_long) { return 0; } - virtual int put (ACE_Message_Block *, ACE_Time_Value *) { return 0; } - virtual int svc (void); - - static void sleep_hook (void *); - -private: - ACE_Token token_; -}; - -My_Task::My_Task (int n) -{ - // Make this Task into an Active Object. - this->activate (THR_BOUND | THR_DETACHED, n); - - // Wait for all the threads to exit. - this->thr_mgr ()->wait (); -} - -void -My_Task::sleep_hook (void *) -{ - cerr << '(' << ACE_Thread::self () << ')' - << " blocking, My_Task::sleep_hook () called" << endl; -} - -// Test out the behavior of the ACE_Token class. - -int -My_Task::svc (void) -{ - for (int i = 0; i < 10000; i++) - { - // Wait for up to 1 millisecond past the current time to get the token. - ACE_Time_Value timeout (ACE_OS::time (0), 1000); - - if (this->token_.acquire (&My_Task::sleep_hook, 0, &timeout) == 1) - { - this->token_.acquire (); - this->token_.renew (); - this->token_.release (); - this->token_.release (); - } - else - ACE_Thread::yield (); - } - return 0; -} - -int -main (int argc, char *argv[]) -{ - My_Task tasks (argc > 1 ? atoi (argv[1]) : 4); - - return 0; -} -#else -int -main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, "your platform doesn't support threads\n"), -1); -} -#endif /* */ diff --git a/examples/Threads/test_tss.cpp b/examples/Threads/test_tss.cpp deleted file mode 100644 index c81ca41c429..00000000000 --- a/examples/Threads/test_tss.cpp +++ /dev/null @@ -1,235 +0,0 @@ -// Torture test ACE thread-specific storage... -// $Id$ - - -#include "ace/Task.h" -#include "ace/Token.h" - -#if defined (ACE_HAS_THREADS) - -class TSS_Obj -{ -public: - - TSS_Obj (void); - ~TSS_Obj (void); - -private: - static int count_; - static ACE_Thread_Mutex lock_; -}; - -int TSS_Obj::count_ = 0; -ACE_Thread_Mutex TSS_Obj::lock_; - -TSS_Obj::TSS_Obj (void) -{ - ACE_GUARD (ACE_Thread_Mutex, ace_mon, lock_); - - count_++; - cout << "TO+ : " << count_ << endl; -} - -TSS_Obj::~TSS_Obj (void) -{ - ACE_GUARD (ACE_Thread_Mutex, ace_mon, lock_); - - count_--; - cout << "TO- : " << count_ << endl; -} - -class Test_Task -{ -public: - - Test_Task (void); - ~Test_Task (void); - - int open (void *arg); - - static void* svc (void *arg); - - static int wait_count_; - static int max_count_; - -private: - static int count_; -}; - -int Test_Task::count_ = 0; -int Test_Task::wait_count_ = 0; -int Test_Task::max_count_ = 0; -int num_threads_ = 0; - -ACE_Token token; - -Test_Task::Test_Task (void) -{ - ACE_GUARD (ACE_Token, ace_mon, token); - - count_++; - cout << "Test_Task+ : " - << count_ << " (" - << ACE_OS::thr_self () - << ")" << endl; -} - -Test_Task::~Test_Task (void) -{ - ACE_GUARD (ACE_Token, ace_mon, token); - - count_--; - cout << "Test_Task- : " - << count_ << " (" - << ACE_OS::thr_self () - << ")" << endl; - - wait_count_--; -} - -int Test_Task::open (void *arg) -{ - - ACE_Thread::spawn (Test_Task::svc, arg); - - return 0; -} - - -void * -Test_Task::svc (void *arg) -{ - ACE_TSS tss (new TSS_Obj); - - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, 0); - - wait_count_++; - max_count_++; - cout << "svc: waiting (" << ACE_OS::thr_self () << ")" << endl; - } - - while (1) - { - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, 0); - - if (max_count_ >= num_threads_) - break; - else - { - ace_mon.release (); - ACE_Thread::yield (); - ace_mon.acquire (); - } - } - - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, 0); - - cout << "svc: waiting (" << ACE_OS::thr_self () << ") finished" << endl; - } - } - - delete (Test_Task *) arg; - - return 0; -} - -int -main (int argc, char **argv) -{ - if (argc != 2) - { - cout << "Missing parameters!" << endl; - return 1; - } - - int num_Tasks = atoi (argv[1]); - - num_threads_ = num_Tasks; - - Test_Task **task_arr = (Test_Task**) new char[sizeof (Test_Task*) * num_Tasks]; - - while (1) - { - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - - cout << "ReseTest_Tasking Test_Task::max_count_ from: " - << Test_Task::max_count_ << endl; - - Test_Task::max_count_ = 0; - } - - for (int i = 0; i < num_Tasks; i++) - { - task_arr[i] = new Test_Task; - task_arr[i]->open (task_arr[i]); - } - - cout << "Waiting for first thread started..." << endl; - - for (;;) - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - - if (Test_Task::max_count_ != 0 ) - { - ace_mon.release (); - ACE_Thread::yield (); - ace_mon.acquire (); - break; - } - ace_mon.release (); - ACE_Thread::yield (); - ace_mon.acquire (); - } - - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - - cout << "First thread started!" << endl - << "Waiting for all threads finished..." << endl; - } - - for (;;) - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - - if (!(Test_Task::max_count_ == num_threads_ - && Test_Task::wait_count_ == 0)) - { - ace_mon.release (); - ACE_Thread::yield (); - ace_mon.acquire (); - continue; - } - - cout << "Test_Task::max_count_ = " - << Test_Task::max_count_ - << " Test_Task::wait_count_ = " - << Test_Task::wait_count_ - << endl; - break; - } - - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - cout << "All threads finished..." << endl; - } - - ACE_OS::sleep (2); - } - - return 0; -} - -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_tss1.cpp b/examples/Threads/test_tss1.cpp deleted file mode 100644 index 7efdc9dc3ef..00000000000 --- a/examples/Threads/test_tss1.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// tests -// -// = FILENAME -// TSS_Test.cpp -// -// = DESCRIPTION -// This program tests thread specific storage of data. The ACE_TSS -// wrapper transparently ensures that the objects of this class -// will be placed in thread-specific storage. All calls on -// ACE_TSS::operator->() are delegated to the appropriate method -// in the Errno class. -// -// = AUTHOR -// Detlef Becker -// -// ============================================================================ - -#include "ace/Service_Config.h" -#include "ace/Synch.h" -#include "ace/Task.h" - -#if defined (ACE_HAS_THREADS) - -static int iterations = 100; - -class Errno -{ -public: - int error (void) { return this->errno_; } - void error (int i) { this->errno_ = i; } - - int line (void) { return this->lineno_; } - void line (int l) { this->lineno_ = l; } - - // Errno::flags_ is a static variable, so we've got to protect it - // with a mutex since it isn't kept in thread-specific storage. - int flags (void) { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_Mon, Errno::lock_, -1)); - - return Errno::flags_; - } - int flags (int f) - { - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, Errno::lock_, -1)); - - Errno::flags_ = f; - return 0; - } - -private: - // = errno_ and lineno_ will be thread-specific data so they don't - // need a lock. - int errno_; - int lineno_; - - static int flags_; -#if defined (ACE_HAS_THREADS) - // flags_ needs a lock. - static ACE_Thread_Mutex lock_; -#endif /* ACE_HAS_THREADS */ -}; - -// Static variables. -ACE_MT (ACE_Thread_Mutex Errno::lock_); -int Errno::flags_; - -// This is our thread-specific error handler... -static ACE_TSS TSS_Error; - -#if defined (ACE_HAS_THREADS) -// Serializes output via cout. -static ACE_Thread_Mutex lock; - -typedef ACE_TSS_Guard GUARD; -#else -// Serializes output via cout. -static ACE_Null_Mutex lock; - -typedef ACE_Guard GUARD; -#endif /* ACE_HAS_THREADS */ - -// Keeps track of whether Tester::close () has started. -static int close_started = 0; - -template -class Tester: public ACE_Task -{ -public: - Tester (void) {} - ~Tester (void) {} - - virtual int open (void *theArgs = 0); - virtual int close (u_long theArg = 0); - virtual int put (ACE_Message_Block *theMsgBlock, - ACE_Time_Value *theTimeVal = 0); - virtual int svc (void); -}; - -template int -Tester::open (void *) -{ - return this->activate (); -} - -template -int Tester::close (u_long) -{ - ACE_DEBUG ((LM_DEBUG, "close running\n!")); - close_started = 1; - ACE_OS::sleep (2); - ACE_DEBUG ((LM_DEBUG, "close: trying to log error code 7!\n")); - TSS_Error->error (7); - ACE_DEBUG ((LM_DEBUG, "close: logging succeeded!\n")); - return 0; -} - -template int -Tester::put (ACE_Message_Block *, ACE_Time_Value *) -{ - return 0; -} - -template int -Tester::svc (void) -{ - return 0; -} - -int -main (int, char *[]) -{ - Tester tester; - - tester.open (); - - while (!close_started) - continue; - - ACE_DEBUG ((LM_DEBUG, "main: trying to log error code 7!\n")); - - TSS_Error->error (3); - - ACE_DEBUG ((LM_DEBUG, "main: logging succeeded!\n")); - return 0; -} - -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_TSS; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ - -#else -int -main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, - "ACE doesn't support support threads on this platform (yet)\n"), - -1); -} -#endif /* ACE_HAS_THREADS */ diff --git a/examples/Threads/test_tss2.cpp b/examples/Threads/test_tss2.cpp deleted file mode 100644 index 24a8d958e91..00000000000 --- a/examples/Threads/test_tss2.cpp +++ /dev/null @@ -1,252 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// tests -// -// = FILENAME -// TSS_Test.cpp -// -// = DESCRIPTION -// This program tests thread specific storage of data. The ACE_TSS -// wrapper transparently ensures that the objects of this class -// will be placed in thread-specific storage. All calls on -// ACE_TSS::operator->() are delegated to the appropriate method -// in the Errno class. -// -// = AUTHOR -// Prashant Jain and Doug Schmidt -// -// ============================================================================ - -#include "ace/Task.h" -#include "ace/Token.h" - -#if defined (ACE_HAS_THREADS) - -class TSS_Obj -{ -public: - - TSS_Obj (void); - ~TSS_Obj (void); - -private: - static int count_; - static ACE_Thread_Mutex lock_; -}; - -int TSS_Obj::count_ = 0; -ACE_Thread_Mutex TSS_Obj::lock_; - -TSS_Obj::TSS_Obj (void) -{ - ACE_GUARD (ACE_Thread_Mutex, ace_mon, lock_); - - count_++; - cout << "TO+ : " << count_ << endl; -} - -TSS_Obj::~TSS_Obj (void) -{ - ACE_GUARD (ACE_Thread_Mutex, ace_mon, lock_); - - count_--; - cout << "TO- : " << count_ << endl; -} - -class Test_Task -{ -public: - - Test_Task (void); - ~Test_Task (void); - - int open (void *arg); - - static void *svc (void *arg); - static int wait_count_; - static int max_count_; - -private: - static int count_; -}; - -int Test_Task::count_ = 0; -int Test_Task::wait_count_ = 0; -int Test_Task::max_count_ = 0; -int num_threads_ = 0; - -ACE_Token token; - -Test_Task::Test_Task (void) -{ - ACE_GUARD (ACE_Token, ace_mon, token); - - count_++; - cout << "Test_Task+ : " - << count_ << " (" - << ACE_OS::thr_self () - << ")" << endl; -} - -Test_Task::~Test_Task (void) -{ - ACE_GUARD (ACE_Token, ace_mon, token); - - count_--; - cout << "Test_Task- : " - << count_ << " (" - << ACE_OS::thr_self () - << ")" << endl; - - wait_count_--; -} - -void * -Test_Task::svc (void *arg) -{ - ACE_TSS tss (new TSS_Obj); - - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, 0); - - wait_count_++; - max_count_++; - cout << "svc: waiting (" << ACE_OS::thr_self () << ")" << endl; - } - - while (1) - { - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, 0); - - if (max_count_ >= num_threads_) - break; - else - { - ace_mon.release (); - ACE_Thread::yield (); - ace_mon.acquire (); - } - } - - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, 0); - - cout << "svc: waiting (" << ACE_OS::thr_self () << ") finished" << endl; - } - } - - delete (Test_Task *) arg; - - return 0; -} - -int -Test_Task::open (void *arg) -{ - if (ACE_Thread::spawn (Test_Task::svc, arg) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Thread::spawn"), 0); - - return 0; -} - -int -main (int argc, char **argv) -{ - if (argc != 2) - { - cout << "Missing parameters!" << endl; - return 1; - } - - int num_Tasks = atoi (argv[1]); - - num_threads_ = num_Tasks; - - Test_Task **task_arr = (Test_Task**) new char[sizeof (Test_Task*) * num_Tasks]; - - while (1) - { - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - - cout << "ReseTest_Tasking Test_Task::max_count_ from: " - << Test_Task::max_count_ << endl; - - Test_Task::max_count_ = 0; - } - - for (int i = 0; i < num_Tasks; i++) - { - task_arr[i] = new Test_Task; - task_arr[i]->open (task_arr[i]); - } - - cout << "Waiting for first thread started..." << endl; - - for (;;) - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - - if (Test_Task::max_count_ != 0 ) - { - ace_mon.release (); - ACE_Thread::yield (); - ace_mon.acquire (); - break; - } - ace_mon.release (); - ACE_Thread::yield (); - ace_mon.acquire (); - } - - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - - cout << "First thread started!" << endl - << "Waiting for all threads finished..." << endl; - } - - for (;;) - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - - if (!(Test_Task::max_count_ == num_threads_ - && Test_Task::wait_count_ == 0)) - { - ace_mon.release (); - ACE_Thread::yield (); - ace_mon.acquire (); - continue; - } - - cout << "Test_Task::max_count_ = " - << Test_Task::max_count_ - << " Test_Task::wait_count_ = " - << Test_Task::wait_count_ - << endl; - break; - } - - { - ACE_GUARD_RETURN (ACE_Token, ace_mon, token, -1); - cout << "All threads finished..." << endl; - } - - ACE_OS::sleep (2); - } - - return 0; -} - -#else -int -main (int, char *[]) -{ - ACE_ERROR ((LM_ERROR, "threads not supported on this platform\n")); - return 0; -} -#endif /* ACE_HAS_THREADS */ diff --git a/netsvcs/clients/Naming/Dump_Restore/nametest.cpp b/netsvcs/clients/Naming/Dump_Restore/nametest.cpp deleted file mode 100644 index fb9c71a5014..00000000000 --- a/netsvcs/clients/Naming/Dump_Restore/nametest.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "ace/Naming_Context.h" -// $Id$ - -#include "ace/Name_Options.h" -#include "nametest.h" - -void -Nametest::listopt (void) -{ - cout << "serverport is " - << ACE_Name_Options::instance ()->nameserver_port() - << endl; - cout << "serverhost is " - << ACE_Name_Options::instance ()->nameserver_host() - << endl; - cout << "process_name is " - << ACE_Name_Options::instance ()->process_name() - << endl; - cout << "namespace_dir is " - << ACE_Name_Options::instance ()->namespace_dir() - << endl; -} - -int -Nametest::init (int argc, char *argv[]) -{ - ACE_Server_Record *sr; - ACE_Service_Config::svc_rep ()->find ("Name_Server_Proxy", &sr); - ACE_Service_Type *st = sr->type (); - ACE_Server_Object *so = st->object (); -dynamic_cast (so); - - ACE_Name_Server_Proxy *ns_proxy = ACE_Service_Config::name_server_proxy (); - - ns_proxy->bind (...); - - this->listopt (); - - ACE_Naming_Context ns_context; - - if (ns_context.open (ACE_Naming_Context::NET_LOCAL) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ns_context.open"), -1); - - const char *mykey = argv[0]; - char *myvalue = argv[1]; - char *ns_value = 0; - char *ns_type = 0; - - if (ns_context.bind (mykey, myvalue, "ottotype") == -1) - cout << "bind failed" << endl; - else - cout << "bind succeeded" << endl; - - - if (ns_context.resolve (mykey, ns_value, ns_type) == -1) - cout << "resolve of " << mykey << " failed" << endl; - else - cout << "resolve of " << mykey << " succeeded, value = " - << ns_value << ", type = " << ns_type << endl; - - delete [] ns_value; - delete [] ns_type; - ns_value = 0; - ns_type = 0; - - if (ns_context.rebind (mykey, myvalue, "newottotype") == -1) - cout << "rebind failed" << endl; - else - cout << "rebind succeeded" << endl; - - if (ns_context.resolve (mykey, ns_value, ns_type) == -1) - cout << "resolve of " << mykey << " failed" << endl; - else - cout << "resolve of " << mykey << " succeeded, value = " - << ns_value << ", type = " << ns_type << endl; - - delete [] ns_value; - delete [] ns_type; - ns_value = 0; - ns_type = 0; - - if (ns_context.unbind (mykey) == -1) - cout << "unbind failed" << endl; - else - cout << "unbind succeeded" << endl; - - return 0; -} - -int -Nametest::fini (void) -{ - cout << "Nametest::fini called" << endl; - return 0; -} - -int -Nametest::info (char **, unsigned) const -{ - cout << "Nametest::info called" << endl; - return 0; -} - -extern "C" ACE_Service_Object *_alloc(void); - -// Factory function that is called automatically when the ACE -// framework dynamically links this shared object file. - -ACE_Service_Object *_alloc (void) -{ - return new Nametest; -} diff --git a/netsvcs/clients/Naming/Dump_Restore/nametest.h b/netsvcs/clients/Naming/Dump_Restore/nametest.h deleted file mode 100644 index fa0cc5dc05c..00000000000 --- a/netsvcs/clients/Naming/Dump_Restore/nametest.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#include "ace/Service_Object.h" - -class Nametest : public ACE_Service_Object -{ -public: - virtual int init (int argc, char *argv[]); - virtual int fini (void); - virtual int info (char **, size_t) const; - - void listopt (void); -}; - diff --git a/netsvcs/lib/Client_Logging_Handler.i b/netsvcs/lib/Client_Logging_Handler.i deleted file mode 100644 index 57c6d26e751..00000000000 --- a/netsvcs/lib/Client_Logging_Handler.i +++ /dev/null @@ -1,4 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - - diff --git a/netsvcs/lib/Server_Logging_Handler.i b/netsvcs/lib/Server_Logging_Handler.i deleted file mode 100644 index 57c6d26e751..00000000000 --- a/netsvcs/lib/Server_Logging_Handler.i +++ /dev/null @@ -1,4 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - - diff --git a/netsvcs/servers/cli.conf b/netsvcs/servers/cli.conf deleted file mode 100644 index b2d8fbc8194..00000000000 --- a/netsvcs/servers/cli.conf +++ /dev/null @@ -1,11 +0,0 @@ -# UNIX version -# -# These are the services that can be linked into ACE. -# Note that you can replace the hardcoded "../lib/libnet_svcs" with -# a relative path if you set your LD search path correctly -- ACE will -# locate this for you automatically by reading your LD search path! -# In addition, you can replace the hardcoded "-p 20xxx" with "-p -# $PORTxxx" if you set your environment variables correctly. - -# Activate the Client Logging Daemon. -dynamic Client_Logging_Service Service_Object * ../lib/libnet_svcs:_make_ACE_Client_Logging_Connector() active "-p 20009 -h merengue" diff --git a/netsvcs/servers/ntsvc.conf b/netsvcs/servers/ntsvc.conf deleted file mode 100644 index 94ed5d78c2a..00000000000 --- a/netsvcs/servers/ntsvc.conf +++ /dev/null @@ -1,12 +0,0 @@ -# Windows NT version. -# -# These are the services that can be linked into ACE. -# Note that your path needs to include the path for netsvcs.dll -# In addition, you can replace the hardcoded "-p 20xxx" with "-p -# $PORTxxx" if you set your environment variables correctly. - -dynamic Token_Service Service_Object * netsvcs.dll:_make_ACE_Token_Acceptor() "-p 20202" -dynamic Name_Server Service_Object * netsvcs.dll:_make_ACE_Name_Acceptor() "-p 20012" -#dynamic Client_Logging_Service Service_Object * netsvcs.dll:_make_ACE_Client_Logging_Connector() active "-p 20008" -#dynamic Server_Logging_Service Service_Object * netsvcs.dll:_make_ACE_Server_Logging_Acceptor() active "-p 20009" -#dynamic Thr_Server_Logging_Service Service_Object * netsvcs.dll:_make_ACE_Thr_Server_Logging_Acceptor() active "-p 20020" diff --git a/tests/CPP_Test.cpp b/tests/CPP_Test.cpp deleted file mode 100644 index 4c0bd291a50..00000000000 --- a/tests/CPP_Test.cpp +++ /dev/null @@ -1,261 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// tests -// -// = FILENAME -// CPP_Test.cpp -// -// = DESCRIPTION -// This is a simple test of the ACE_SOCK_Acceptor and -// AC_SOCK_Connector classes. The test forks two processes or -// spawns two threads (depending upon the platform) and then executes -// client and server allowing them to connect and exchange -// data. No user input is required as far as command line -// arguments are concerned. -// -// = AUTHOR -// Prashant Jain and Doug Schmidt -// -// ============================================================================ - -#include "ace/OS.h" -#include "ace/Thread.h" -#include "ace/Service_Config.h" -#include "ace/SOCK_Connector.h" -#include "ace/SOCK_Acceptor.h" -#include "ace/SOCK_Stream.h" -#include "ace/INET_Addr.h" -#include "ace/Handle_Set.h" -#include "test_config.h" - -static void * -client (void *arg) -{ -#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) - // Insert thread into thr_mgr - ACE_Thread_Control thread_control (ACE_Service_Config::thr_mgr ()); - ACE_NEW_THREAD; -#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */ - - ACE_INET_Addr *remote_addr = (ACE_INET_Addr *) arg; - ACE_INET_Addr server_addr (remote_addr->get_port_number (), "localhost"); - ACE_SOCK_Stream cli_stream; - ACE_SOCK_Connector con; - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting non-blocking connect\n")); - // Initiate timed, non-blocking connection with server. - - // Attempt a non-blocking connect to the server, reusing the local - // addr if necessary. - if (con.connect (cli_stream, server_addr, - (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) - { - if (errno != EWOULDBLOCK) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "connection failed")); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting timed connect\n")); - - // Check if non-blocking connection is in progress, - // and wait up to ACE_DEFAULT_TIMEOUT seconds for it to complete. - ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); - - if (con.complete (cli_stream, &server_addr, &tv) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "connection failed"), 0); - else - ACE_DEBUG ((LM_DEBUG, "(%P|%t) connected to %s\n", - server_addr.get_host_name ())); - } - - if (cli_stream.disable (ACE_NONBLOCK) == -1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "disable")); - - // Send data to server (correctly handles "incomplete writes"). - - for (char c = 'a'; c <= 'z'; c++) - if (cli_stream.send_n (&c, 1) == -1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "send_n")); - - // Explicitly close the writer-side of the connection. - if (cli_stream.close_writer () == -1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "close_writer")); - - char buf[1]; - - // Wait for handshake with server. - if (cli_stream.recv_n (buf, 1) != 1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "recv_n")); - - // Close the connection completely. - if (cli_stream.close () == -1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "close")); - - return 0; -} - -static void * -server (void *arg) -{ -#if (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) - // Insert thread into thr_mgr - ACE_Thread_Control thread_control (ACE_Service_Config::thr_mgr ()); - ACE_NEW_THREAD; -#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */ - - ACE_SOCK_Acceptor *peer_acceptor = (ACE_SOCK_Acceptor *) arg; - - if (peer_acceptor->enable (ACE_NONBLOCK) == -1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "enable")); - - // Keep these objects out here to prevent excessive constructor - // calls... - ACE_SOCK_Stream new_stream; - ACE_INET_Addr cli_addr; - ACE_Handle_Set handle_set; - ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); - // Performs the iterative server activities. - - for (;;) - { - char buf[BUFSIZ]; - char t = 'a'; - - handle_set.reset (); - handle_set.set_bit (peer_acceptor->get_handle ()); - - int result = ACE_OS::select (int (peer_acceptor->get_handle ()) + 1, - handle_set, - 0, 0, &tv); - if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "select"), 0); - else if (result == 0) - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) select timed out, shutting down\n")); - return 0; - } - - // Create a new ACE_SOCK_Stream endpoint (note automatic restart - // if errno == EINTR). - - while ((result = peer_acceptor->accept (new_stream, &cli_addr)) != -1) - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) client %s connected from %d\n", - cli_addr.get_host_name (), cli_addr.get_port_number ())); - - // Enable non-blocking I/O. - if (new_stream.enable (ACE_NONBLOCK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "enable"), 0); - - handle_set.reset (); - handle_set.set_bit (new_stream.get_handle ()); - - // Read data from client (terminate on error). - - for (ssize_t r_bytes; ;) - { - if (ACE_OS::select (int (new_stream.get_handle ()) + 1, - handle_set, - 0, 0, 0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "select"), 0); - - while ((r_bytes = new_stream.recv_n (buf, 1)) > 0) - { - ACE_ASSERT (t == buf[0]); - t++; - } - - if (r_bytes == 0) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) reached end of input, connection closed by client\n")); - - // Handshake back with client. - if (new_stream.send_n ("", 1) != 1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "send_n")); - - // Close endpoint. - if (new_stream.close () == -1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "close")); - return 0; - } - else if (r_bytes == -1) - { - if (errno == EWOULDBLOCK) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) no input available, going back to reading\n")); - else - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "recv_n"), 0); - } - } - } - - if (result == -1) - { - if (errno == EWOULDBLOCK) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) no connections available, going back to accepting\n")); - else - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "accept")); - } - } - return 0; -} - -static void -spawn (void) -{ - // Acceptor - ACE_SOCK_Acceptor peer_acceptor; - - // Create a server address. - ACE_INET_Addr server_addr; - - // Bind listener to any port and then find out what the port was. - if (peer_acceptor.open (ACE_Addr::sap_any) == -1 - || peer_acceptor.get_local_addr (server_addr) == -1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "open")); - else - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting server at port %d\n", - server_addr.get_port_number ())); - -#if !defined (ACE_WIN32) && !defined (VXWORKS) - switch (ACE_OS::fork ()) - { - case -1: - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n%a", "fork failed")); - exit (-1); - case 0: - ACE_LOG_MSG->sync ("child"); - client (&server_addr); - default: - server ((void *) &peer_acceptor); - ACE_OS::wait (); - } -#elif defined (ACE_HAS_THREADS) - if (ACE_Service_Config::thr_mgr ()->spawn - (ACE_THR_FUNC (server), (void *) &peer_acceptor, THR_NEW_LWP | THR_DETACHED) == -1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n%a", "thread create failed")); - - if (ACE_Service_Config::thr_mgr ()->spawn - (ACE_THR_FUNC (client), (void *) &server_addr, THR_NEW_LWP | THR_DETACHED) == -1) - ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n%a", "thread create failed")); - - // Wait for the threads to exit. - ACE_Service_Config::thr_mgr ()->wait (); -#else - ACE_ERROR ((LM_ERROR, "(%P|%t) only one thread may be run in a process on this platform\n%a", 1)); -#endif /* ACE_HAS_THREADS */ - } -} - -int -main (int, char *[]) -{ - ACE_START_TEST ("CPP_Test"); - - spawn (); - - ACE_END_TEST; - return 0; -} diff --git a/tests/Shared_Memory_SV_Test.cpp b/tests/Shared_Memory_SV_Test.cpp deleted file mode 100644 index a3654a7745b..00000000000 --- a/tests/Shared_Memory_SV_Test.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// tests -// -// = FILENAME -// Shared_Memory_SV_Test.cpp -// -// = DESCRIPTION -// This is a simple test of ACE_Shared_Memory_SV -// -// = AUTHOR -// Prashant Jain and Doug Schmidt -// -// ============================================================================ - - -#include "ace/Shared_Memory_SV.h" -#include "test_config.h" - -const int SHMSZ = 27; -const int SHM_KEY = 5678; - -static void -client (void) -{ - char t = 'a'; - ACE_Shared_Memory_SV shm_client (SHM_KEY, SHMSZ, - ACE_Shared_Memory_SV::ACE_CREATE); - char *shm = (char *) shm_client.malloc (); - - for (char *s = shm; *s != '\0'; s++) - { - ACE_ASSERT (t == s[0]); - t++; - } - *shm = '*'; - ACE_OS::exit (0); -} - -static void -server (void) -{ - ACE_Shared_Memory_SV shm_server (SHM_KEY, SHMSZ, - ACE_Shared_Memory_SV::ACE_CREATE); - char *shm = (char *) shm_server.malloc (); - char *s = shm; - - for (char c = 'a'; c <= 'z'; c++) - *s++ = c; - - *s = '\0'; - - while (*shm != '*') - ACE_OS::sleep (1); - - if (shm_server.remove () < 0) - ACE_ERROR ((LM_ERROR, "%p\n", "remove")); -} - -int -main (int, char *argv []) -{ - ACE_START_TEST ("Shared_Memory_SV_Test.cpp"); - - switch (ACE_OS::fork ()) - { - case -1: - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "fork"), 1); - case 0: - client (); - break; - default: - server (); - break; - } - - ACE_END_TEST; - return 0; -} - diff --git a/tests/run_tests.ksh b/tests/run_tests.ksh deleted file mode 100755 index a4d7f0d8b17..00000000000 --- a/tests/run_tests.ksh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/ksh -f - -. ./run_tests.sh - -# EOF - -- cgit v1.2.1