diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-12-16 02:23:17 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-12-16 02:23:17 +0000 |
commit | bf5eac59f3803f9de1c848d78bd11974072fb9be (patch) | |
tree | bf31518c620d23c7142aeabc1413e86678f7293a | |
parent | 0aa34ec98e744a4e3602c05211c47a0eb772065f (diff) | |
download | ATCD-bf5eac59f3803f9de1c848d78bd11974072fb9be.tar.gz |
This commit was manufactured by cvs2svn to create tag 'pre-SHM'.pre-SHM
44 files changed, 0 insertions, 9039 deletions
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<TAO_SSLIOP_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR>; -template class ACE_Strategy_Acceptor<TAO_SSLIOP_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR>; -template class ACE_Accept_Strategy<TAO_SSLIOP_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR>; -template class ACE_Creation_Strategy<TAO_SSLIOP_Server_Connection_Handler>; -template class ACE_Concurrency_Strategy<TAO_SSLIOP_Server_Connection_Handler>; -template class ACE_Scheduling_Strategy<TAO_SSLIOP_Server_Connection_Handler>; -template class TAO_Creation_Strategy<TAO_SSLIOP_Server_Connection_Handler>; -template class TAO_Concurrency_Strategy<TAO_SSLIOP_Server_Connection_Handler>; -template class TAO_Accept_Strategy<TAO_SSLIOP_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Acceptor<TAO_SSLIOP_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR> -#pragma instantiate ACE_Strategy_Acceptor<TAO_SSLIOP_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR> -#pragma instantiate ACE_Accept_Strategy<TAO_SSLIOP_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR> -#pragma instantiate ACE_Creation_Strategy<TAO_SSLIOP_Server_Connection_Handler> -#pragma instantiate ACE_Concurrency_Strategy<TAO_SSLIOP_Server_Connection_Handler> -#pragma instantiate ACE_Scheduling_Strategy<TAO_SSLIOP_Server_Connection_Handler> -#pragma instantiate TAO_Creation_Strategy<TAO_SSLIOP_Server_Connection_Handler> -#pragma instantiate TAO_Concurrency_Strategy<TAO_SSLIOP_Server_Connection_Handler> -#pragma instantiate TAO_Accept_Strategy<TAO_SSLIOP_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR> - -#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_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR> TAO_SSLIOP_BASE_ACCEPTOR; - typedef TAO_Creation_Strategy<TAO_SSLIOP_Server_Connection_Handler> TAO_SSLIOP_CREATION_STRATEGY; - typedef TAO_Concurrency_Strategy<TAO_SSLIOP_Server_Connection_Handler> TAO_SSLIOP_CONCURRENCY_STRATEGY; - typedef TAO_Accept_Strategy<TAO_SSLIOP_Server_Connection_Handler, ACE_SSL_SOCK_ACCEPTOR> 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 <Strategy_Acceptor> 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 <message_state> 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 <Strategy_Acceptor> 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<ACE_SSL_SOCK_STREAM, ACE_NULL_SYNCH>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Svc_Handler<ACE_SSL_SOCK_STREAM, ACE_NULL_SYNCH> - -#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<ACE_SSL_SOCK_STREAM, ACE_NULL_SYNCH> - 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 - // <Svc_Handler> used on the client side and returned by the - // <TAO_CONNECTOR>. -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); - - // = <Connector> 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 <Strategy_Acceptor> 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 <activate>. This serves as the event loop in such cases. - - // = Template Methods Called by <handle_input> - - 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 <peer()>, dispatching and servicing it - // appropriately. - // handle_input() just delegates on handle_input_i() which timeouts - // after <max_wait_time>, 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<TAO_HANDLER> -#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_ATTRIBUTES, TAO_CACHING_UTILITY> - 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_ATTRIBUTES, TAO_CACHING_UTILITY> - TAO_SSLIOP_CACHING_STRATEGY; -typedef ACE_LFU_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY> - TAO_SSLIOP_LFU_CACHING_STRATEGY; -typedef ACE_FIFO_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY> - TAO_SSLIOP_FIFO_CACHING_STRATEGY; -typedef ACE_Null_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY> - TAO_SSLIOP_NULL_CACHING_STRATEGY; -typedef ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_LRU_CACHING_STRATEGY> - TAO_SSLIOP_LRU_CACHING_STRATEGY_ADAPTER; -typedef ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_LFU_CACHING_STRATEGY> - TAO_SSLIOP_LFU_CACHING_STRATEGY_ADAPTER; -typedef ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_FIFO_CACHING_STRATEGY> - TAO_SSLIOP_FIFO_CACHING_STRATEGY_ADAPTER; -typedef ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_NULL_CACHING_STRATEGY> - 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<TAO_SSLIOP_Client_Connection_Handler> -#define CACHED_CONNECT_STRATEGY ACE_Cached_Connect_Strategy<TAO_SSLIOP_Client_Connection_Handler, ACE_SSL_SOCK_CONNECTOR, TAO_Cached_Connector_Lock> -#define TAO_ADDR ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> -#define TAO_HANDLER TAO_SSLIOP_Client_Connection_Handler -#define TAO_HASH_KEY ACE_Hash<TAO_ADDR> -#define TAO_COMPARE_KEYS ACE_Equal_To<TAO_ADDR> -#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<ACE_INET_Addr>; -template class ACE_Auto_Basic_Array_Ptr<TAO_SSLIOP_Client_Connection_Handler*>; -template class auto_ptr<TAO_SSLIOP_Connect_Creation_Strategy>; -template class ACE_Auto_Basic_Ptr<TAO_SSLIOP_Connect_Creation_Strategy>; - -template class ACE_Node<ACE_INET_Addr>; -template class ACE_Unbounded_Stack<ACE_INET_Addr>; -template class ACE_Unbounded_Stack_Iterator<ACE_INET_Addr>; - -#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<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; -template class ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr>; -template class ACE_NOOP_Creation_Strategy<TAO_HANDLER>; -template class ACE_Concurrency_Strategy<TAO_HANDLER>; -template class ACE_Connect_Strategy<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR>; -template class ACE_Connector<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR>; -template class ACE_Creation_Strategy<TAO_HANDLER>; -template class ACE_Hash_Map_Entry<TAO_ADDR, TAO_HANDLER *>; -template class ACE_Hash<ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> >; -template class ACE_Equal_To<ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> >; -template class ACE_Map_Entry<ACE_HANDLE, TAO_SVC_TUPLE *>; -template class ACE_Map_Manager<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX>; -template class ACE_NOOP_Concurrency_Strategy<TAO_HANDLER>; -template class ACE_Recycling_Strategy<TAO_HANDLER>; -template class ACE_Strategy_Connector<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR>; -template class TAO_SVC_TUPLE; - -template class ACE_Hash_Map_Manager<TAO_ADDR, TAO_HANDLER *, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator<TAO_ADDR, TAO_HANDLER *, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator<TAO_ADDR, TAO_HANDLER *, ACE_Null_Mutex>; -template class ACE_Hash_Map_Manager_Ex<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; -template class ACE_Hash_Map_Bucket_Iterator<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) -template class ACE_Pair<TAO_HANDLER *, TAO_ATTRIBUTES>; -template class ACE_Reference_Pair<TAO_ADDR, TAO_HANDLER *>; -template class ACE_Hash_Map_Entry<TAO_ADDR, TAO_CACHED_HANDLER>; - -template class ACE_Hash_Map_Manager<TAO_ADDR, TAO_CACHED_HANDLER, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator<TAO_ADDR, TAO_CACHED_HANDLER, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator<TAO_ADDR, TAO_CACHED_HANDLER, ACE_Null_Mutex>; -template class ACE_Hash_Map_Manager_Ex<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; -template class ACE_Hash_Map_Bucket_Iterator<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex>; - -// = Caching_Strategy -template class ACE_Hash_Cache_Map_Manager<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES>; - -template class ACE_LRU_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY>; - -#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES) - -template class ACE_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY>; -template class ACE_LFU_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY>; -template class ACE_FIFO_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY>; -template class ACE_Null_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY>; - -template class ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_LRU_CACHING_STRATEGY>; -template class ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_LFU_CACHING_STRATEGY>; -template class ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_FIFO_CACHING_STRATEGY>; -template class ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_NULL_CACHING_STRATEGY>; - -template class ACE_Cache_Map_Manager<TAO_ADDR, TAO_HANDLER *, TAO_HASH_MAP, TAO_HASH_MAP_ITERATOR, TAO_HASH_MAP_REVERSE_ITERATOR, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES>; -template class ACE_Cache_Map_Iterator<TAO_ADDR, TAO_HANDLER *, TAO_HASH_MAP_ITERATOR, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES>; -template class ACE_Cache_Map_Reverse_Iterator<TAO_ADDR, TAO_HANDLER *, TAO_HASH_MAP_REVERSE_ITERATOR, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES>; - -#else - -template class ACE_Cache_Map_Manager<TAO_ADDR, TAO_HANDLER *, TAO_HASH_MAP, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES>; - -#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */ - -template class ACE_Cached_Connect_Strategy_Ex<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES, TAO_Cached_Connector_Lock>; -template class ACE_Cached_Connect_Strategy<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR, TAO_Cached_Connector_Lock>; - -template class ACE_Cleanup_Strategy<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_MAP>; -template class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_MAP>; -template class ACE_Refcounted_Recyclable_Handler_Caching_Utility<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_MAP, TAO_HASH_MAP_ITERATOR, TAO_ATTRIBUTES>; -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Auto_Basic_Array_Ptr<ACE_INET_Addr> -#pragma instantiate ACE_Auto_Basic_Array_Ptr<TAO_SSLIOP_Client_Connection_Handler*> -#pragma instantiate auto_ptr<TAO_SSLIOP_Connect_Creation_Strategy> -#pragma instantiate ACE_Auto_Basic_Ptr<TAO_SSLIOP_Connect_Creation_Strategy> - -#pragma instantiate ACE_Node<ACE_INET_Addr> -#pragma instantiate ACE_Unbounded_Stack<ACE_INET_Addr> -#pragma instantiate ACE_Unbounded_Stack_Iterator<ACE_INET_Addr> - -#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<ACE_SOCK_STREAM, ACE_NULL_SYNCH> -#pragma instantiate ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> -#pragma instantiate ACE_NOOP_Creation_Strategy<TAO_HANDLER> -#pragma instantiate ACE_Concurrency_Strategy<TAO_HANDLER> -#pragma instantiate ACE_Connect_Strategy<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR> -#pragma instantiate ACE_Connector<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR> -#pragma instantiate ACE_Creation_Strategy<TAO_HANDLER> -#pragma instantiate ACE_Hash_Map_Entry<TAO_ADDR, TAO_HANDLER *> -#pragma instantiate ACE_Hash<ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> > -#pragma instantiate ACE_Equal_To<ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> > -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, TAO_SVC_TUPLE *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_NOOP_Concurrency_Strategy<TAO_HANDLER> -#pragma instantiate ACE_Recycling_Strategy<TAO_HANDLER> -#pragma instantiate ACE_Strategy_Connector<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR> -#pragma instantiate TAO_SVC_TUPLE - -#pragma instantiate ACE_Hash_Map_Manager<TAO_ADDR, TAO_HANDLER *, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator<TAO_ADDR, TAO_HANDLER *, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator<TAO_ADDR, TAO_HANDLER *, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Manager_Ex<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Bucket_Iterator<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) -#pragma instantiate ACE_Pair<TAO_HANDLER *, TAO_ATTRIBUTES> -#pragma instantiate ACE_Reference_Pair<TAO_ADDR, TAO_HANDLER *> -#pragma instantiate ACE_Hash_Map_Entry<TAO_ADDR, TAO_CACHED_HANDLER> - -#pragma instantiate ACE_Hash_Map_Manager<TAO_ADDR, TAO_CACHED_HANDLER, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator<TAO_ADDR, TAO_CACHED_HANDLER, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator<TAO_ADDR, TAO_CACHED_HANDLER, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Manager_Ex<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Bucket_Iterator<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_KEY, TAO_COMPARE_KEYS, ACE_Null_Mutex> - -// = Caching_Strategy -#pragma instantiate ACE_Hash_Cache_Map_Manager<TAO_ADDR, TAO_HANDLER *, TAO_HASH_KEY, TAO_COMPARE_KEYS, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES> - -#pragma instantiate ACE_LRU_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY> - -#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES) - -#pragma instantiate ACE_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY> -#pragma instantiate ACE_LFU_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY> -#pragma instantiate ACE_FIFO_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY> -#pragma instantiate ACE_Null_Caching_Strategy<TAO_ATTRIBUTES, TAO_CACHING_UTILITY> - -#pragma instantiate ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_LRU_CACHING_STRATEGY> -#pragma instantiate ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_LFU_CACHING_STRATEGY> -#pragma instantiate ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_FIFO_CACHING_STRATEGY> -#pragma instantiate ACE_Caching_Strategy_Adapter<TAO_ATTRIBUTES, TAO_CACHING_UTILITY, TAO_SSLIOP_NULL_CACHING_STRATEGY> - -#pragma instantiate ACE_Cache_Map_Manager<TAO_ADDR, TAO_HANDLER *, TAO_HASH_MAP, TAO_HASH_MAP_ITERATOR, TAO_HASH_MAP_REVERSE_ITERATOR, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES> -#pragma instantiate ACE_Cache_Map_Iterator<TAO_ADDR, TAO_HANDLER *, TAO_HASH_MAP_ITERATOR, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES> -#pragma instantiate ACE_Cache_Map_Reverse_Iterator<TAO_ADDR, TAO_HANDLER *, TAO_HASH_MAP_REVERSE_ITERATOR, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES> - -#else - -#pragma instantiate ACE_Cache_Map_Manager<TAO_ADDR, TAO_HANDLER *, TAO_HASH_MAP, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES> - -#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */ - -#pragma instantiate ACE_Cached_Connect_Strategy_Ex<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR, TAO_CACHING_STRATEGY, TAO_ATTRIBUTES, TAO_Cached_Connector_Lock> -#pragma instantiate ACE_Cached_Connect_Strategy<TAO_HANDLER, ACE_SSL_SOCK_CONNECTOR, TAO_Cached_Connector_Lock> - -#pragma instantiate ACE_Cleanup_Strategy<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_MAP> -#pragma instantiate ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_MAP> -#pragma instantiate ACE_Refcounted_Recyclable_Handler_Caching_Utility<TAO_ADDR, TAO_CACHED_HANDLER, TAO_HASH_MAP, TAO_HASH_MAP_ITERATOR, TAO_ATTRIBUTES> -#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<TAO_SSLIOP_Client_Connection_Handler> (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_SSLIOP_Client_Connection_Handler, - ACE_SSL_SOCK_CONNECTOR, - TAO_Cached_Connector_Lock> - 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<TAO_SSLIOP_Connect_Creation_Strategy> - 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<TAO_Cached_Connector_Lock> 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 <result> - // 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 <coryan@cs.wustl.edu> & -// Ossama Othman <othman@cs.wustl.edu> -// -// ============================================================================ - -#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_Client_Connection_Handler, - ACE_SSL_SOCK_CONNECTOR> - TAO_SSLIOP_BASE_CONNECTOR; - -// **************************************************************** - -class TAO_Export TAO_SSLIOP_Connect_Creation_Strategy : public ACE_Creation_Strategy<TAO_SSLIOP_Client_Connection_Handler> -{ - // = TITLE - // Helper creation strategy - // - // = DESCRIPTION - // Creates UIOP_Client_Connection_Handler objects but satisfies - // the interface required by the - // ACE_Creation_Strategy<TAO_SSLIOP_Client_Connection_Handler> - // -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_SSLIOP_Client_Connection_Handler *, - TAO_ATTRIBUTES> - TAO_CACHED_HANDLER; - typedef ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> - TAO_IADDR; - typedef ACE_Hash<TAO_IADDR> TAO_HASH_KEY; - typedef ACE_Equal_To<TAO_IADDR> TAO_COMPARE_KEYS; - - typedef ACE_Hash_Map_Manager_Ex<TAO_IADDR, - TAO_CACHED_HANDLER, - TAO_HASH_KEY, - TAO_COMPARE_KEYS, - ACE_Null_Mutex> - TAO_HASH_MAP; - typedef ACE_Hash_Map_Iterator_Ex<TAO_IADDR, - TAO_CACHED_HANDLER, - TAO_HASH_KEY, - TAO_COMPARE_KEYS, - ACE_Null_Mutex> - TAO_HASH_MAP_ITERATOR; - typedef ACE_Hash_Map_Reverse_Iterator_Ex<TAO_IADDR, - TAO_CACHED_HANDLER, - TAO_HASH_KEY, - TAO_COMPARE_KEYS, - ACE_Null_Mutex> - TAO_HASH_MAP_REVERSE_ITERATOR; - - typedef ACE_Refcounted_Recyclable_Handler_Caching_Utility<TAO_IADDR, - TAO_CACHED_HANDLER, - TAO_HASH_MAP, - TAO_HASH_MAP_ITERATOR, - TAO_ATTRIBUTES> - TAO_CACHING_UTILITY; - -#if defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES) - typedef ACE_LRU_Caching_Strategy<TAO_ATTRIBUTES, - TAO_CACHING_UTILITY> - TAO_CACHING_STRATEGY; -#else - typedef ACE_Caching_Strategy<TAO_ATTRIBUTES, - TAO_CACHING_UTILITY> - TAO_CACHING_STRATEGY; -#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */ - - typedef ACE_Cached_Connect_Strategy_Ex<TAO_SSLIOP_Client_Connection_Handler, - ACE_SSL_SOCK_CONNECTOR, - TAO_CACHING_STRATEGY, - TAO_ATTRIBUTES, - TAO_Cached_Connector_Lock> - TAO_CACHED_CONNECT_STRATEGY; -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - - typedef ACE_NOOP_Concurrency_Strategy<TAO_SSLIOP_Client_Connection_Handler> - TAO_NULL_ACTIVATION_STRATEGY; - - typedef ACE_NOOP_Creation_Strategy<TAO_SSLIOP_Client_Connection_Handler> - 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 <fredk@cs.wustl.edu> -// -// ============================================================================ - -#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 <fredk@cs.wustl.edu> -// -// ============================================================================ - -#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 713e1e758e4..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp +++ /dev/null @@ -1,427 +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, - const ACE_Message_Block *message_block, - const ACE_Time_Value *max_wait_time) -{ - if (stub == 0) - { - 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 78437f713d1..00000000000 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h +++ /dev/null @@ -1,166 +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 <fredk@cs.wustl.edu> -// -// ============================================================================ - -#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, - 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 <coryan@cs.wustl.edu> -// Ossama Othman <othman@cs.wustl.edu> -// -// ============================================================================ - -#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 <openssl/x509.h> -#include <openssl/err.h> - -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<ACE_SSL_Context,ACE_SYNCH_MUTEX>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Singleton<ACE_SSL_Context,ACE_SYNCH_MUTEX> - -#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 <coryan@cs.wustl.edu> -// -// ============================================================================ - -#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 <openssl/ssl.h> - -// @@ 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<ACE_SSL_Context,ACE_SYNCH_MUTEX>::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<ACE_SSL_Context,ACE_SYNCH_MUTEX>::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 <accept>. - 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 <new_stream>'s handle and <this> 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 <accept> 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 <accept> 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 <ACE_SSL_SOCK_Stream>s passively. - // - // = DESCRIPTION - // The <ACE_SSL_SOCK_Acceptor> has its own <ACE_SOCK_Acceptor> 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. - // <local_sap> 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. - // <local_sap> is the address that we-re going to listen for - // connections on. - - int close (void); - - ~ACE_SSL_SOCK_Acceptor (void); - // Default dtor. - - // = Passive connection <accept> 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 <ACE_SSL_SOCK_Stream> connection. A <timeout> of 0 - // means block forever, a <timeout> of {0, 0} means poll. <restart> - // == 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 <ACE_SSL_SOCK_Stream> connection using the RVSP QoS - // information in <qos_params>. A <timeout> of 0 means block - // forever, a <timeout> of {0, 0} means poll. <restart> == 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 <value>. - - 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 <value>. - - 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 <ACE_OS::accept> 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 <ACE_OS::accept> 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 <openssl/err.h> - -#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>. - 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 <coryan@cs.wustl.edu> -// Ossama Othman <othman@cs.wustl.edu> -// -// ============================================================================ - -#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 <ACE_Stream>s actively. - // - // = DESCRIPTION - // The <ACE_SOCK_Connector> 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 - // <ACE_SOCK_Connector> from <ACE_SOCK>. A nice side-effect of - // this is that <ACE_SOCK_Connector>'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 <new_stream> if things go well. - // The <remote_sap> is the address that we are trying to connect - // with. The <timeout> 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 <errno == EWOULDBLOCK>. 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 <errno == ETIME>. The - // <local_sap> is the value of local address to bind to. If it's - // the default value of <ACE_Addr::sap_any> then the user is letting - // the OS do the binding. If <reuse_addr> == 1 then the - // <local_addr> 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 <new_stream> if things go well. - // The <remote_sap> is the address that we are trying to connect - // with. The <qos_params> contains QoS parameters that are passed - // to RSVP. The <timeout> 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 <errno == EWOULDBLOCK>. 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 <errno == ETIME>. The - // <local_sap> is the value of local address to bind to. If it's - // the default value of <ACE_Addr::sap_any> then the user is letting - // the OS do the binding. If <reuse_addr> == 1 then the - // <local_addr> 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 <new_stream> if things go well. - // The <remote_sap> is the address that we are trying to connect - // with. The <timeout> 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 <errno == EWOULDBLOCK>. 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 <errno == ETIME>. The - // <local_sap> is the value of local address to bind to. If it's - // the default value of <ACE_Addr::sap_any> then the user is letting - // the OS do the binding. If <reuse_addr> == 1 then the - // <local_addr> 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 <new_stream> if things go well. - // The <remote_sap> is the address that we are trying to connect - // with. The <qos_params> contains QoS parameters that are passed - // to RSVP. The <timeout> 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 <errno == EWOULDBLOCK>. 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 <errno == ETIME>. The - // <local_sap> is the value of local address to bind to. If it's - // the default value of <ACE_Addr::sap_any> then the user is letting - // the OS do the binding. If <reuse_addr> == 1 then the - // <local_addr> 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 <new_stream> contains - // the connected ACE_SOCK_Stream. If <remote_sap> 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 <ACE_SOCK_IO::recvv>. -#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 <ACE::send>. - 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 <ACE::recv>. - 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 <ACE_SOCK_IO::send (...)>. - 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 <send> 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 <ACE::send_n> */ - 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 <iov>. - 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 <coryan@cs.wustl.edu> -// Ossama Othman <othman@cs.wustl.edu> -// -// ============================================================================ - -#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 <ACE_SSL_SOCK_Stream> abstraction. - // - // = DESCRIPTION - // This adds ssl functionality to an <ACE_SOCK_IO> interface by - // wrapping around an <ACE_SSL_SOCK_Stream> implementation. - // -public: - // = Initializtion and termination functions. - - ACE_SSL_SOCK_Stream (void); - // Constructor (sets the underlying <ACE_HANDLE> with <h>, and - // <SSL*> with <session>). If the handle in <session> does not - // match <h>, it will set <session's> handle to <h>. - - ACE_SSL_SOCK_Stream (ACE_HANDLE h); - // Constructor (sets <ACE_HANDLE> with the handle in <session> - // and the underlying <SSL*> with session. - - ~ACE_SSL_SOCK_Stream (void); - //Destructor - - ssize_t send (const void *buf, - size_t n, - int flags) const; - // Send an <n> byte buffer to the ssl socket using - // the semantics of <send(3n)>. ACE+SSL supports no - // flags for sending at this time. - - ssize_t recv (void *buf, - size_t n, - int flags) const; - // Recv an <n> byte buffer from the ssl socket using - // the semantics of <recv(3n)>. ACE+SSL supports MSG_PEEK, - // but no other flags at this time. - - - ssize_t send (const void *buf, - size_t n) const; - // Send an <n> byte buffer to the ssl socket using - // the semantics of <write(2)>. - - ssize_t recv (void *buf, - size_t n) const; - // Recv an <n> byte buffer from the ssl socket using - // the semantics of <read(2)>. - - ssize_t sendv (const iovec iov[], - size_t n) const; - // Send an <iovec> of size <n> 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 <iov_base> field of <io_vec> 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 <timeout> amount of time to send up to <n> bytes into - // <buf> (uses the <send> call). If <send> times out - // a -1 is returned with <errno == ETIME>. 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 <timeout> amount of time to receive up to <n> bytes - // into <buf> (uses the <recv> call). If <recv> times - // out a -1 is returned with <errno == ETIME>. 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 <timeout> amount of time to send up to <n> bytes into - // <buf> (uses the <send> call). If <send> times out - // a -1 is returned with <errno == ETIME>. 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 <timeout> amount of time to receive up to <n> bytes - // into <buf> (uses the <recv> call). If <recv> times - // out a -1 is returned with <errno == ETIME>. If it succeeds the - // number of bytes received is returned. - - ssize_t send (size_t n, - ...) const; - // Send <n> varargs messages to the connected ssl socket. - - ssize_t recv (size_t n, - ...) const; - // Recv <n> varargs messages to the connected ssl socket. - - ssize_t send_n (const void *buf, int n) const; - // Send <n> bytes, keep trying until <n> are sent. - - ssize_t recv_n (void *buf, int n) const; - // Recv <n> bytes, keep trying until <n> 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 <n> bytes, keep trying until <n> are sent. - - ssize_t recv_n (void *buf, int n, int flags) const; - // Recv <n> bytes, keep trying until <n> are sent. - - ssize_t send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) const; - // Try to send exactly <len> bytes into <buf> (uses - // the <send> call). If <send> blocks for longer than <timeout> the - // number of bytes actually sent is returned with <errno == ETIME>. - // If a timeout does not occur, <send_n> return <len> (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 <len> bytes into <buf> (uses - // the <recv> call). The <ACE_Time_Value> indicates how long - // to blocking trying to receive. If <timeout> == 0, the caller - // will block until action is possible, else will wait until the - // relative time specified in *<timeout> elapses). If <recv> blocks - // for longer than <timeout> the number of bytes actually read is - // returned with <errno == ETIME>. If a timeout does not occur, - // <recv_n> return <len> (i.e., the number of bytes requested to be - // read). - - ssize_t sendv_n (const iovec iov[], - size_t n) const; - // Send an <iovec> of size <n> 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 <iovec> of size <n> 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 <value>. - - 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 <value>. - - int get_local_addr (ACE_Addr &) const; - // Return the local endpoint address in the referenced <ACE_Addr>. - - 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 <ACE_SOCK_Stream> 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/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 <ACE_SSL_SOCK_Connector> and -// <ACE_SSL_SOCK_Stream> 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, ACE_Null_Mutex> 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 <host>] " - "[-i iterations] [-m message-size] " - "[-p <port>] [-q <quit string>] " - "[-s] [-T <sleep_time>]\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 <request> to the server. - else - { - // Note that we use the incremental feature of the - // <ACE_High_Res_Timer> so that we don't get "charged" for the - // <ACE_OS::sleep> 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<Options, ACE_Null_Mutex>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<Options, ACE_Null_Mutex> -#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 <ACE_SSL_SOCK_Connector> and -// <ACE_SSL_SOCK_Stream> 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, ACE_SYNCH_RECURSIVE_MUTEX> 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 <host>] " - "[-i iterations] [-m message-size] " - "[-p <port>] [-q <quit string>] " - "[-s] [-t <threads>] [-T <sleep_time>]\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 <request> to the server. - else - { - // Note that we use the incremental feature of the - // <ACE_High_Res_Timer> so that we don't get "charged" for the - // <ACE_OS::sleep> 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<Options, ACE_SYNCH_RECURSIVE_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<Options, ACE_SYNCH_RECURSIVE_MUTEX> -#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 <ACE_SSL_SOCK_Acceptor>, -// <ACE_SSL_SOCK_Stream>, and <ACE_Svc_Handler> 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 <Handler>. - - // = 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<ACE_SSL_SOCK_STREAM, ACE_NULL_SYNCH> -{ - // = 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 - // <run> 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 <svc> 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 <svc>. -}; - -class Oneway_Handler : public Handler -{ - // = TITLE -public: - Oneway_Handler (ACE_HANDLE handle); - // Constructor. - -private: - virtual int run (void); - // Template Method hook called by <svc>. - - 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 <port>] [-v]"), - -1); - } - - return 0; -} - -// Options Singleton. -typedef ACE_Singleton<Options, ACE_SYNCH_RECURSIVE_MUTEX> 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 <server> 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<Options, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Svc_Handler<ACE_SSL_SOCK_STREAM, ACE_NULL_SYNCH>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<Options, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Svc_Handler<ACE_SSL_SOCK_STREAM, ACE_NULL_SYNCH> -#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 <poll> 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 <pollfd>'s. -static struct pollfd poll_array[MAX_HANDLES]; - -// Array of <Buffer_Info>. -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_); - // <recv> 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 <stdio.h> -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 <ACE_SSL_SOCK_Acceptor>, -// <ACE_SSL_SOCK_Stream>, and <ACE_Svc_Handler> 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 <ACE_SSL_SOCK_Acceptor>, -// <ACE_SSL_SOCK_Stream>, and <ACE_Svc_Handler> 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 <server> 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 = <FILE>) { - if ($line =~ /.*usec-per-message = ([\d\.]+)/) - { - $high_latency += $1 ; - $number++; - } - } - close FILE; - - printf "%3d\t\t\t%8f\n", - $total_threads, $high_latency/$number; -} |