diff options
| author | Xanadu <none@none> | 2010-07-20 02:49:28 +0200 |
|---|---|---|
| committer | Xanadu <none@none> | 2010-07-20 02:49:28 +0200 |
| commit | 79622802f397258ee0f34327ba3ae6977ca3e7ff (patch) | |
| tree | 1868946c234ab9ee256a6b7766a15713eae94235 /dep/include/ace/SSL | |
| parent | 7dd2dc91816ab8b3bc3b99a1b1c99c7ea314d5a8 (diff) | |
| parent | f906976837502fa5aa81b982b901d1509f5aa0c4 (diff) | |
Merge. Revision history for source files should be all back now.
--HG--
branch : trunk
rename : sql/CMakeLists.txt => sql/tools/CMakeLists.txt
rename : src/server/game/Pools/PoolHandler.cpp => src/server/game/Pools/PoolMgr.cpp
rename : src/server/game/Pools/PoolHandler.h => src/server/game/Pools/PoolMgr.h
rename : src/server/game/PrecompiledHeaders/NixCorePCH.cpp => src/server/game/PrecompiledHeaders/gamePCH.cpp
rename : src/server/game/PrecompiledHeaders/NixCorePCH.h => src/server/game/PrecompiledHeaders/gamePCH.h
Diffstat (limited to 'dep/include/ace/SSL')
| -rw-r--r-- | dep/include/ace/SSL/SSL_Asynch_BIO.h | 42 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_Asynch_Stream.h | 425 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_Context.h | 384 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_Context.inl | 113 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_Export.h | 45 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_SOCK.h | 103 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_SOCK.inl | 71 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_SOCK_Acceptor.h | 197 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_SOCK_Acceptor.inl | 85 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_SOCK_Connector.h | 318 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_SOCK_Connector.inl | 28 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_SOCK_Stream.h | 321 | ||||
| -rw-r--r-- | dep/include/ace/SSL/SSL_SOCK_Stream.inl | 330 | ||||
| -rw-r--r-- | dep/include/ace/SSL/sslconf.h | 55 |
14 files changed, 0 insertions, 2517 deletions
diff --git a/dep/include/ace/SSL/SSL_Asynch_BIO.h b/dep/include/ace/SSL/SSL_Asynch_BIO.h deleted file mode 100644 index b406321777c..00000000000 --- a/dep/include/ace/SSL/SSL_Asynch_BIO.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_Asynch_BIO.h - * - * $Id: SSL_Asynch_BIO.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Alexander Libman <alibman@baltimore.com> - * @author Ossama Othman <ossama@uci.edu> - * - */ -//============================================================================= - -#ifndef ACE_SSL_ASYNCH_BIO_H -#define ACE_SSL_ASYNCH_BIO_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// This must be included before any <openssl> include on LynxOS -#include "ace/os_include/os_stdio.h" - -#include <openssl/bio.h> - -#if OPENSSL_VERSION_NUMBER > 0x0090581fL && ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -extern BIO * ACE_SSL_make_BIO (void * ssl_asynch_stream); -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL (ACE_WIN32 || - ACE_HAS_AIO_CALLS) */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_ASYNCH_BIO_H */ diff --git a/dep/include/ace/SSL/SSL_Asynch_Stream.h b/dep/include/ace/SSL/SSL_Asynch_Stream.h deleted file mode 100644 index faae6112cdb..00000000000 --- a/dep/include/ace/SSL/SSL_Asynch_Stream.h +++ /dev/null @@ -1,425 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_Asynch_Stream.h - * - * $Id: SSL_Asynch_Stream.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Alexander Libman <alibman@baltimore.com> - */ -//============================================================================= - -#ifndef ACE_SSL_ASYNCH_STREAM_H -#define ACE_SSL_ASYNCH_STREAM_H - -#include /**/ "ace/pre.h" -#include "SSL_Context.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#if OPENSSL_VERSION_NUMBER > 0x0090581fL && ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - -#include "SSL_Asynch_BIO.h" - -#include "ace/Asynch_IO_Impl.h" -#include "ace/Message_Block.h" -#include "ace/Synch_Traits.h" -#include "ace/Thread_Mutex.h" - -/* - * This facility doesn't follow the normal ACE asynch I/O support classes' - * interface/implementation arrangement. It's not needed because rather than - * branching off to platform-specific APIs, all platforms use the OpenSSL - * API. Thus, you can think of this class as the implementation class (for - * OpenSSL) and there's no separate interface class. - * Also, since both read and write operations are defined in one I/O - * factory, there's no single Result class defined as there is for - * ACE_Asynch_Read_Stream, et al. There are separate result classes defined - * for read and write operations. - */ - -#if defined (ACE_WIN32) -# include "ace/WIN32_Asynch_IO.h" -typedef ACE_WIN32_Asynch_Result A_RESULT; -typedef ACE_WIN32_Asynch_Read_Stream_Result ARS_RESULT; -typedef ACE_WIN32_Asynch_Write_Stream_Result AWS_RESULT; - -# define ERR_CANCELED ERROR_OPERATION_ABORTED - -#else -# include "ace/POSIX_Asynch_IO.h" -typedef ACE_POSIX_Asynch_Result A_RESULT; -typedef ACE_POSIX_Asynch_Read_Stream_Result ARS_RESULT; -typedef ACE_POSIX_Asynch_Write_Stream_Result AWS_RESULT; - -# define ERR_CANCELED ECANCELED - -#endif /* ACE_WIN32 */ - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_SSL_Asynch_Stream; // Forward decl for use in result class def. - -/** - * @class ACE_SSL_Asynch_Read_Stream_Result - * - * Result class that communicates result of read operations initiated on - * an ACE_SSL_Asynch_Stream object. - */ -class ACE_SSL_Asynch_Read_Stream_Result : public ARS_RESULT -{ - /// Factory class will have special permissions. - friend class ACE_SSL_Asynch_Stream; - -protected: - ACE_SSL_Asynch_Read_Stream_Result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number); -}; - -/** - * @class ACE_SSL_Asynch_Write_Stream_Result - * - * Result class that communicates result of write operations initiated on - * an ACE_SSL_Asynch_Stream object. - */ -class ACE_SSL_Asynch_Write_Stream_Result : public AWS_RESULT -{ - /// Factory class will have special permissions. - friend class ACE_SSL_Asynch_Stream; - -protected: - ACE_SSL_Asynch_Write_Stream_Result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number); -}; - - -/** - * @class ACE_SSL_Asynch_Result - * - * Result class that is used internally for socket close notifications. - */ -class ACE_SSL_Asynch_Result : public A_RESULT -{ -public: - ACE_SSL_Asynch_Result (ACE_Handler &handler); - - void complete (size_t bytes_transferred, - int success, - const void * completion_key, - u_long error); -}; - - -// Only provide forward declarations to prevent possible abuse of the -// friend declarations in ACE_SSL_Asynch_Stream. -struct ACE_SSL_Asynch_Stream_Accessor; - -/** - * @class ACE_SSL_Asynch_Stream - * - * @brief This class is a factory for initiating asynchronous reads - * and writes on an SSL stream. - * - * Once open() is called, multiple asynchronous read and write operations - * can be started using this class. The handler object (derived from - * ACE_Handler) specified in open() will receive completion events for the - * operations initiated via this class. - */ -class ACE_SSL_Export ACE_SSL_Asynch_Stream - : public ACE_Asynch_Operation, - public ACE_Handler -{ -public: - - // Use a class/struct to work around scoping - // problems for extern "C" free functions with some compilers. For - // example, some can't handle - // - // friend ::some_extern_c_free_function (...) - // - // Note that we could use a straight C++ (i.e. not extern "C") free - // function, but using a class or struct allows us to hide the - // interface from the user, which prevents abuse of this friend - // relationship. - friend struct ACE_SSL_Asynch_Stream_Accessor; - - enum Stream_Type - { - ST_CLIENT = 0x0001, - ST_SERVER = 0x0002 - }; - - /// Constructor. - /** - * @arg context Pointer to an ACE_SSL_Context instance containing - * the OpenSSL information to be associated with this - * ACE_SSL_Asynch_Stream. The needed SSL data will be - * copied before return. Therefore, this object can be - * reused, modified, or deleted upon return. If a 0 pointer - * is passed, the ACE_SSL_Context::instance() method will - * be called to get access to a singleton. - */ - ACE_SSL_Asynch_Stream (Stream_Type s_type = ST_SERVER, - ACE_SSL_Context * context = 0); - - /// Destructor - virtual ~ACE_SSL_Asynch_Stream (void); - - int cancel (void); - - int close (void); - - /** - * Initializes the factory with information which will be used with - * each asynchronous call. - * - * @arg handler The ACE_Handler that will be called to handle completions - * for operations initiated using this factory. - * @arg handle The handle that future read/write operations will use. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int open (ACE_Handler &handler, - ACE_HANDLE handle = ACE_INVALID_HANDLE, - const void *completion_key = 0, - ACE_Proactor *proactor = 0); - - /** - * Initiates an asynchronous read. If the operation is successfully - * initiated, the handle_read_stream() method will be called on the - * ACE_Handler object passed to open() when the operation completes. - * Data is read into the specified ACE_Message_Block beginning at its - * write pointer; the block's write pointer is updated to reflect any - * added data when the operation completes. - * - * @arg message_block The specified ACE_Message_Block will receive any - * data that is read. Data will be read into the - * block beginning at the block's write pointer. - * @arg num_bytes_to_read The maximum number of bytes to read. The actual - * amount read may be less. - * @arg act ACT which is passed to the completion handler in - * the result object. - * @arg priority Specifies the operation priority. This has an - * affect on POSIX only. Works like @i nice in Unix. - * Negative values are not allowed. 0 means priority - * of the operation same as the process priority. - * 1 means priority of the operation is one less than - * process, and so forth. This parameter has no - * affect on Win32. - * @arg signal_number The POSIX4 real-time signal number to be used - * for the operation. signal_number ranges from - * ACE_SIGRTMIN to ACE_SIGRTMAX. This argument is - * unused on non-POSIX4 systems. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int read (ACE_Message_Block &message_block, - size_t num_bytes_to_read, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /** - * Initiates an asynchronous write. If the operation is successfully - * initiated, the handle_write_stream() method will be called on the - * ACE_Handler object passed to open() when the operation completes. - * Data is taken from the specified ACE_Message_Block beginning at its - * read pointer; the block's read pointer is updated to reflect any - * data successfully sent when the operation completes. - * - * @arg message_block The specified ACE_Message_Block is the source of - * data that is written. Data will be taken from the - * block beginning at the block's read pointer. - * @arg bytes_to_write The maximum number of bytes to write. The actual - * amount written may be less. - * @arg act ACT which is passed to the completion handler in - * the result object. - * @arg priority Specifies the operation priority. This has an - * affect on POSIX only. Works like @i nice in Unix. - * Negative values are not allowed. 0 means priority - * of the operation same as the process priority. - * 1 means priority of the operation is one less than - * process, and so forth. This parameter has no - * affect on Win32. - * @arg signal_number The POSIX4 real-time signal number to be used - * for the operation. signal_number ranges from - * ACE_SIGRTMIN to ACE_SIGRTMAX. This argument is - * unused on non-POSIX4 systems. - * - * @retval 0 for success. - * @retval -1 for failure; consult @c errno for further information. - */ - int write (ACE_Message_Block &message_block, - size_t bytes_to_write, - const void *act = 0, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - -protected: - /// Virtual from ACE_Asynch_Operation. Since this class is essentially an - /// implementation class, simply return 0. - virtual ACE_Asynch_Operation_Impl *implementation (void) const { return 0; } - - /// virtual from ACE_Handler - - /// This method is called when BIO write request is completed. It - /// processes the IO completion and calls do_SSL_state_machine(). - virtual void handle_write_stream - (const ACE_Asynch_Write_Stream::Result &result); - - /// This method is called when BIO read request is completed. It - /// processes the IO completion and calls do_SSL_state_machine(). - virtual void handle_read_stream - (const ACE_Asynch_Read_Stream::Result &result); - - /// This method is called when all SSL sessions are closed and no - /// more pending AIOs exist. It also calls users handle_wakeup(). - virtual void handle_wakeup (void); - - /** - * @name SSL State Machine - */ - //@{ - int do_SSL_state_machine (void); - int do_SSL_handshake (void); - int do_SSL_read (void); - int do_SSL_write(void); - int do_SSL_shutdown(void); - //@} - - void print_error (int err_ssl, - const ACE_TCHAR *pText); - - int pending_BIO_count (void); - - /// This method is called to notify user handler when user's read in - /// done. - int notify_read (int bytes_transferred, int error); - - /// This method is called to notify user handler when user's write - /// in done. - int notify_write (int bytes_transferred, int error); - - /// This method is called to notify ourself that SSL session is - /// shutdown and that there is no more I/O activity now and in the - /// future. - int notify_close(void); - - /** - * @name BIO Helpers - */ - //@{ - int ssl_bio_read (char * buf, size_t len, int & errval); - int ssl_bio_write (const char * buf, size_t len, int & errval); - //@} - -private: - - // Preventing copying through construction or assignment. - ACE_SSL_Asynch_Stream (ACE_SSL_Asynch_Stream const &); - ACE_SSL_Asynch_Stream & operator= (ACE_SSL_Asynch_Stream const &); - -protected: - - /// Stream Type ST_CLIENT/ST_SERVER - Stream_Type type_; - - /// The real file/socket handle - ACE_HANDLE handle_; - - /// The proactor - ACE_Proactor * proactor_; - - /// External,i.e user handler - ACE_Handler * ext_handler_; - - /// External, i.e. read result faked for user - ACE_SSL_Asynch_Read_Stream_Result * ext_read_result_ ; - - /// External, i.e. write result faked for user - ACE_SSL_Asynch_Write_Stream_Result * ext_write_result_ ; - - /// Stream state/flags - enum Stream_Flag - { - /// istream_ open OK - SF_STREAM_OPEN = 0x0001, - /// request to SSL shutdown - SF_REQ_SHUTDOWN = 0x0002, - /// SSL shutdown finished - SF_SHUTDOWN_DONE = 0x0004, - /// Close notification sent - SF_CLOSE_NTF_SENT = 0x0008, - /// Stream can be safely destroyed - SF_DELETE_ENABLE = 0x0010 - }; - - int flags_; - - /// The SSL session. - SSL * ssl_; - - /// The BIO implementation - BIO * bio_; - - /// The real streams which work under the ssl connection. - /// BIO performs I/O via this streams - enum BIO_Flag // internal IO flags - { - /// End of stream - BF_EOS = 0x01, - /// Real AIO in progress - BF_AIO = 0x02 - }; - - /** - * @name Internal stream, buffer and info for BIO read - */ - //@{ - ACE_Asynch_Read_Stream bio_istream_; - ACE_Message_Block bio_inp_msg_; - int bio_inp_errno_; - int bio_inp_flag_; - //@} - - /** - * @name Internal stream, buffer and info for BIO write - */ - //@{ - ACE_Asynch_Write_Stream bio_ostream_; - ACE_Message_Block bio_out_msg_; - int bio_out_errno_; - int bio_out_flag_; - //@} - - /// Mutex to protect work - ACE_SYNCH_MUTEX mutex_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL && (ACE_WIN32 || - ACE_HAS_AIO_CALLS) */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_ASYNCH_STREAM_H */ diff --git a/dep/include/ace/SSL/SSL_Context.h b/dep/include/ace/SSL/SSL_Context.h deleted file mode 100644 index bc3cb329042..00000000000 --- a/dep/include/ace/SSL/SSL_Context.h +++ /dev/null @@ -1,384 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_Context.h - * - * $Id: SSL_Context.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Carlos O'Ryan <coryan@ece.uci.edu> - * @author Ossama Othman <ossama@dre.vanderbilt.edu> - */ -//============================================================================= - - -#ifndef ACE_SSL_CONTEXT_H -#define ACE_SSL_CONTEXT_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SString.h" - -#ifdef ACE_HAS_THREADS -# include "ace/Synch_Traits.h" -#endif /* ACE_HAS_THREADS */ - -#include <openssl/ssl.h> - - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -class ACE_SSL_Export ACE_SSL_Data_File -{ -public: - - /// Default constructor - ACE_SSL_Data_File (void); - - /// Contructor from a file name and the file type. - ACE_SSL_Data_File (const char *file_name, - int type = SSL_FILETYPE_PEM); - - /// The file name - const char *file_name (void) const; - - /// The type - int type (void) const; - -private: - - /// The file name - ACE_CString file_name_; - - /// The type, used by the SSL library to parse the file contents. - int type_; -}; - -// **************************************************************** - - -/** - * @class ACE_SSL_Context - * - * @brief A wrapper for the OpenSSL SSL_CTX related functions. - * - * 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. - */ -class ACE_SSL_Export ACE_SSL_Context -{ -public: - -#ifdef ACE_HAS_THREADS - typedef ACE_SYNCH_MUTEX lock_type; -#endif /* ACE_HAS_THREADS */ - - 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 - }; - - /// Constructor - ACE_SSL_Context (void); - - /// Destructor - ~ACE_SSL_Context (void); - - /// The Singleton context, the SSL components use the singleton if - /// nothing else is available. - static ACE_SSL_Context *instance (void); - - /** - * 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, then the class automatically initializes - * itself to the default mode. - */ - int set_mode (int mode = ACE_SSL_Context::SSLv23); - - int get_mode (void) const; - - /// Get the SSL context - SSL_CTX *context (void); - - /// Get the file name and file format used for the private key - int private_key_type (void) const; - const char *private_key_file_name (void) const; - - /// Set the private key file. - /** - * @note This method should only be called after a certificate has - * been set since key verification is performed against the - * certificate, among other things. - */ - int private_key (const char *file_name, int type = SSL_FILETYPE_PEM); - - /// Verify that the private key is valid. - /** - * @note This method should only be called after a certificate has - * been set since key verification is performed against the - * certificate, among other things. - */ - int verify_private_key (void); - - /// Get the file name and file format used for the certificate file - int certificate_type (void) const; - const char *certificate_file_name (void) const; - - /// Set the certificate file. - int certificate (const char *file_name, - int type = SSL_FILETYPE_PEM); - - /// Load certificate from memory rather than a file. - int certificate (X509* cert); - - /** - * Load the location of the trusted certification authority - * certificates. Note that CA certificates are stored in PEM format - * as a sequence of certificates in @a ca_file or as a set of - * individual certificates in @a ca_dir (or both). - * - * Note this method is called by set_mode() to load the default - * environment settings for @a ca_file and @a ca_dir, if any. This - * allows for automatic service configuration (and backward - * compatibility with previous versions). - * - * Note that the underlying SSL function will add valid file and - * directory names to the load location lists maintained as part of - * the SSL_CTX table. It therefore doesn't make sense to keep a - * copy of the file and path name of the most recently added - * @a ca_file or @a ca_path. - * - * @param[in] ca_file CA file pathname. Passed to - * @c SSL_CTX_load_verify_locations() if not - * 0. If 0, behavior depends on the value of - * @a use_env_defaults. - * @param[in] ca_dir CA directory pathname. Passed to - * @c SSL_CTX_load_verify_locations() if not - * 0. If 0, behavior depends on the value of - * @a use_env_defaults. - * @param[in] use_env_defaults If false, the specified @a ca_file argument - * is passed to - * @c SSL_CTX_load_verify_locations(), - * regardless of its value. - * If true (the default), additional defaults - * can be applied to either @a ca_file, - * @a ca_dir, or both. The following - * additional defaults are applied when the - * @a ca_file argument is 0: - * - The @c SSL_CERT_FILE environment variable - * will be queried for a file name to use as - * the @a ca_file argument. The environment - * variable name to query can be changed by - * supplying a @c ACE_SSL_CERT_FILE_ENV - * configuration item when building ACE. - * - If there is no @c SSL_CERT_FILE in the - * current environment, the file specified - * by the @c ACE_DEFAULT_SSL_CERT_FILE ACE - * configuration item will be used. The - * default value is "cert.pem" on Windows - * and "/etc/ssl/cert.pem" on all other - * platforms. - * The following additional defaults are - * applied when the @a ca_dir argument is 0: - * - The @c SSL_CERT_DIR environment variable - * will be queried for a file name to use as - * the @a ca_dir argument. The environment - * variable name to query can be changed by - * supplying a @c ACE_SSL_CERT_DIR_ENV - * configuration item when building ACE. - * - If there is no @c SSL_CERT_DIR in the - * current environment, the directory - * specified by the @c - * ACE_DEFAULT_SSL_CERT_DIR ACE - * configuration item will be used. The - * default value is "certs" on Windows - * and "/etc/ssl/certs" on all other - * platforms. - * - * @return 0 for success or -1 on error. - * - * @see OpenSSL manual SSL_CTX_load_verify_locations(3) for a - * detailed description of the CA file and directory requirements - * and processing. - */ - int load_trusted_ca (const char* ca_file = 0, - const char* ca_dir = 0, - bool use_env_defaults = true); - - /** - * Test whether any CA locations have been successfully loaded and - * return the number of successful attempts. - * - * @retval >0 The number of successful CA load attempts. - * @retval 0 If all CA load attempts have failed. - */ - int have_trusted_ca (void) const; - - - /** - * @todo Complete this documentation where elipses(...) are used - * - * @doc Use this method when certificate chain verification is - * required. The default server behaviour is SSL_VERIFY_NONE - * i.e. client certicates are requested for verified. This method - * can be used to configure server to request client certificates - * and perform the certificate verification. If <strict> is set - * true the client connection is rejected when certificate - * verification fails. Otherwise the session is accepted with a - * warning, which is the default behaviour. If <once> is set true - * (default), certificates are requested only once per session. - * The last parameter <depth> can be used to set the verification - * depth. - * - * Note for verification to work correctly there should be a valid - * CA name list set using load_trusted_ca(). - * - * @see OpenSSL documentation of SSL_CTX_set_verify(3) for details of - * the verification process. - * - * @see OpenSSL documentation ... set_verify_depth(3) ... - * - * Note that this method overrides the use of the - * default_verify_mode() method. - */ - void set_verify_peer (int strict = 0, int once = 1, int depth = 0); - - - /// TODO: a implementation that will lookup the CTX table for the list - /// of files and paths etc. - /// Query the location of trusted certification authority - /// certificates. - // const char* ca_file_name(void) const; - // const char* ca_dir_name(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. - */ - void default_verify_mode (int mode); - int default_verify_mode (void) const; - - /** - * @name OpenSSL Random Number Generator Seed Related Methods - * - * These are methods that can be used to seed OpenSSL's - * pseudo-random number generator. These methods can be called more - * than once. - */ - //@{ - /// Seed the underlying random number generator. This value should - /// have at least 128 bits of entropy. - static int random_seed (const char * seed); - - /// Set the Entropy Gathering Daemon (EGD) UNIX domain socket file to - /// read random seed values from. - static int egd_file (const char * socket_file); - - /** - * Set the file that contains the random seed value state, and the - * amount of bytes to read. "-1" bytes causes the entire file to be - * read. - */ - static int seed_file (const char * seed_file, long bytes = -1); - //@} - - /// Print SSL error corresponding to the given error code. - static void report_error (unsigned long error_code); - - /// Print the last SSL error for the current thread. - static void report_error (void); - - /** - * @name Diffie-Hellman (DH) Parameters - * - * When using DSS-based certificates, Diffie-Hellman keys need to be - * exchanged. These must be provided in the form of DH key - * generation parameters loaded in, or as fixed keys hardcoded into - * the code itself. ACE_SSL supports loaded parameters. - * - */ - //@{ - /** - * Load Diffie-Hellman parameters from file_name. The specified file can be - * a standalone file containing only DH parameters (e.g., as created - * by <code>openssl dhparam</code>), or it can be a certificate which has - * a PEM-encoded set of DH params concatenated on to i. - */ - int dh_params (const char *file_name, int type = SSL_FILETYPE_PEM); - const char *dh_params_file_name () const; - int dh_params_file_type () const; - //@} - -private: - - /// Verify if the context has been initialized or not. - void check_context (void); - - /// @@ More to document - void ssl_library_init (); - void ssl_library_fini (); - - // = Prevent assignment and copy initialization. - //@{ - ACE_SSL_Context (const ACE_SSL_Context &); - ACE_SSL_Context & operator= (const ACE_SSL_Context &); - //@} - -private: - - /// The SSL_CTX structure - SSL_CTX *context_; - - /// Cache the mode so we can answer fast - int mode_; - - /// The private key, certificate, and Diffie-Hellman paramters files - ACE_SSL_Data_File private_key_; - ACE_SSL_Data_File certificate_; - ACE_SSL_Data_File dh_params_; - - /// The default verify mode. - int default_verify_mode_; - - /// count of successful CA load attempts - int have_ca_; - -#ifdef ACE_HAS_THREADS - /// Array of mutexes used internally by OpenSSL when the SSL - /// application is multithreaded. - static lock_type * locks_; -#endif /* ACE_HAS_THREADS */ - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined(__ACE_INLINE__) -#include "SSL_Context.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_CONTEXT_H */ diff --git a/dep/include/ace/SSL/SSL_Context.inl b/dep/include/ace/SSL/SSL_Context.inl deleted file mode 100644 index 990eab38293..00000000000 --- a/dep/include/ace/SSL/SSL_Context.inl +++ /dev/null @@ -1,113 +0,0 @@ -// -*- C++ -*- -// -// $Id: SSL_Context.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -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 void -ACE_SSL_Context::check_context (void) -{ - if (this->context_ == 0) - { - this->set_mode (); - } - - ::SSL_CTX_set_verify (this->context_, this->default_verify_mode (), 0); -} - -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 int -ACE_SSL_Context::dh_params_file_type (void) const -{ - return this->dh_params_.type (); -} - -ACE_INLINE const char* -ACE_SSL_Context::dh_params_file_name (void) const -{ - return this->dh_params_.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_; -} - -ACE_INLINE int -ACE_SSL_Context::get_mode (void) const -{ - return this->mode_; -} - -ACE_INLINE int -ACE_SSL_Context::have_trusted_ca (void) const -{ - return this->have_ca_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/include/ace/SSL/SSL_Export.h b/dep/include/ace/SSL/SSL_Export.h deleted file mode 100644 index 59bd892e7fd..00000000000 --- a/dep/include/ace/SSL/SSL_Export.h +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- -// $Id: SSL_Export.h 80826 2008-03-04 14:51:23Z wotte $ -// Definition for Win32 Export directives. -// This file is generated automatically by -// generate_export_file.pl -// ------------------------------ -#if !defined (ACE_SSL_EXPORT_H) -#define ACE_SSL_EXPORT_H -#define ACE_SSL_BUILD_DLL - -#include /**/ "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_SSL_HAS_DLL) -# define ACE_SSL_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_SSL_HAS_DLL */ - -#if !defined (ACE_SSL_HAS_DLL) -#define ACE_SSL_HAS_DLL 1 -#endif /* ! ACE_SSL_HAS_DLL */ - -#if defined (ACE_SSL_HAS_DLL) -# if (ACE_SSL_HAS_DLL == 1) -# if defined (ACE_SSL_BUILD_DLL) -# define ACE_SSL_Export ACE_Proper_Export_Flag -# define ACE_SSL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_SSL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else -# define ACE_SSL_Export ACE_Proper_Import_Flag -# define ACE_SSL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_SSL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_SSL_BUILD_DLL */ -# else -# define ACE_SSL_Export -# define ACE_SSL_SINGLETON_DECLARATION(T) -# define ACE_SSL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ! ACE_SSL_HAS_DLL == 1 */ -#else -# define ACE_SSL_Export -# define ACE_SSL_SINGLETON_DECLARATION(T) -# define ACE_SSL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_SSL_HAS_DLL */ - -#endif /* ACE_SSL_EXPORT_H */ - -// End of auto generated file. diff --git a/dep/include/ace/SSL/SSL_SOCK.h b/dep/include/ace/SSL/SSL_SOCK.h deleted file mode 100644 index c07a4ecfda3..00000000000 --- a/dep/include/ace/SSL/SSL_SOCK.h +++ /dev/null @@ -1,103 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_SOCK.h - * - * $Id: SSL_SOCK.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Ossama Othman <ossama@ece.uci.edu> - */ -//============================================================================= - - -#ifndef ACE_SSL_SOCK_H -#define ACE_SSL_SOCK_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/SOCK.h" - -#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) -# define ACE_SSL_SOCK_ACCEPTOR ACE_SSL_SOCK_Acceptor -# define ACE_SSL_SOCK_CONNECTOR ACE_SSL_SOCK_Connector -# define ACE_SSL_SOCK_STREAM ACE_SSL_SOCK_Stream -#else -# define ACE_SSL_SOCK_ACCEPTOR ACE_SSL_SOCK_Acceptor, ACE_INET_Addr -# define ACE_SSL_SOCK_CONNECTOR ACE_SSL_SOCK_Connector, ACE_INET_Addr -# define ACE_SSL_SOCK_STREAM ACE_SSL_SOCK_Stream, ACE_INET_Addr -#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SSL_SOCK - * - * @brief An abstract class that forms the basis for more specific - * classes, such as "ACE_SSL_SOCK_Acceptor" and - * "ACE_SSL_SOCK_Stream". Do not instantiate this class. - * - * This class provides functions that are common to all of the - * ACE_SSL_SOCK_* classes. ACE_SSL_SOCK provides the ability - * to get and set socket options, get the local and remote - * addresses, and close the socket. - */ -class ACE_SSL_Export ACE_SSL_SOCK : public ACE_SOCK -{ -public: - - /** - * Override ACE_SOCK base class implementations with these SSL - * specific ones. - */ - //@{ - int set_option (int level, - int option, - void *optval, - int optlen) const; - int get_option (int level, - int option, - void *optval, - int *optlen) const; - int enable (int value) const; - int disable (int value) const; - void set_handle (ACE_HANDLE); - ACE_HANDLE get_handle (void) const; - int control (int cmd, void *arg) const; - //@} - -protected: - - /// Default constructor is private to prevent instances of this class - /// from being defined. - ACE_SSL_SOCK (void); - - /// Destructor - /** - * Not a virtual destructor. Protected destructor to prevent - * operator delete() from being called through a base class - * ACE_SSL_SOCK pointer/reference. - */ - ~ACE_SSL_SOCK (void); - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "SSL_SOCK.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_SOCK_H */ - - - - diff --git a/dep/include/ace/SSL/SSL_SOCK.inl b/dep/include/ace/SSL/SSL_SOCK.inl deleted file mode 100644 index e24e12b9258..00000000000 --- a/dep/include/ace/SSL/SSL_SOCK.inl +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- -// -// $Id: SSL_SOCK.inl 80826 2008-03-04 14:51:23Z wotte $ - -#include "ace/OS_NS_sys_socket.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_SSL_SOCK::set_handle (ACE_HANDLE fd) -{ - this->ACE_SOCK::set_handle (fd); -} - -ACE_INLINE ACE_HANDLE -ACE_SSL_SOCK::get_handle (void) const -{ - // return this->ssl_ ? (ACE_HANDLE) ::SSL_get_fd (this->ssl_) : ACE_INVALID_HANDLE; - return this->ACE_SOCK::get_handle (); -} - - -ACE_INLINE int -ACE_SSL_SOCK::control (int cmd, void *arg) const -{ - return ACE_OS::ioctl (this->get_handle (), cmd, arg); -} - -ACE_INLINE int -ACE_SSL_SOCK::set_option (int level, - int option, - void *optval, - int optlen) const -{ -// switch (option) -// { -// case SO_SNDBUF: -// return ::BIO_set_write_buffer_size (this->io_bio_, *((int *) optval)); -// case SO_RCVCBUF: -// return ::BIO_set_read_buffer_size (this->io_bio_, *((int *) optval)); -// default: - return ACE_OS::setsockopt (this->get_handle (), - level, - option, (char *) optval, - optlen); -// } -} - -// Provides access to the ACE_OS::getsockopt system call. - -ACE_INLINE int -ACE_SSL_SOCK::get_option (int level, - int option, - void *optval, - int *optlen) const -{ -// switch (option) -// { -// case SO_SNDBUF: -// return ::BIO_get_write_buffer_size (this->io_bio_, *((int *) optval)); -// case SO_RCVCBUF: -// return ::BIO_get_read_buffer_size (this->io_bio_, *((int *) optval)); -// default: - return ACE_OS::getsockopt (this->get_handle (), - level, - option, (char *) optval, - optlen); -// } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/include/ace/SSL/SSL_SOCK_Acceptor.h b/dep/include/ace/SSL/SSL_SOCK_Acceptor.h deleted file mode 100644 index 997378bf329..00000000000 --- a/dep/include/ace/SSL/SSL_SOCK_Acceptor.h +++ /dev/null @@ -1,197 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_SOCK_Acceptor.h - * - * $Id: SSL_SOCK_Acceptor.h 81826 2008-06-02 15:29:53Z schmidt $ - * - * @author John Heitmann - * @author Chris Zimman - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef ACE_SSL_SOCK_ACCEPTOR_H -#define ACE_SSL_SOCK_ACCEPTOR_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "SSL_SOCK_Stream.h" - -#include "ace/SOCK_Acceptor.h" -#include "ace/OS_QoS.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SSL_SOCK_Acceptor - * - * @brief Defines a factory that creates new @c ACE_SSL_SOCK_Stream - * objects passively. - * - * The ACE_SSL_SOCK_Acceptor has its own @c ACE_SOCK_Acceptor - * which handles the basic socket acceptance. This class is a - * wrapper which adds the SSL acceptance handshake handling. - * Since SSL is record oriented, some additional steps must be taken - * after the basic socket acceptance to complete the SSL handshake that - * takes place at session establishment. - * - * @note The user must currently ensure that only one thread services - * a given SSL session at any given time since some underlying - * SSL implementations, such as OpenSSL, are not entirely - * thread-safe or reentrant. - */ -class ACE_SSL_Export ACE_SSL_SOCK_Acceptor : public ACE_SSL_SOCK -{ -public: - - /// Default constructor. - ACE_SSL_SOCK_Acceptor (void); - - /// Default destructor. - ~ACE_SSL_SOCK_Acceptor (void); - - /** - * Initiate a passive mode SSL/BSD-style acceptor socket. - * @param local_sap The address that we're going to listen for - * connections on. If this is @c ACE_Addr::sap_any, - * this socket listens on an the "any" IP address - * and selects an unused port. To find out what port - * was selected, call this object's - * @c ACE_SOCK::get_local_addr(ACE_Addr&) method - * upon return. - */ - ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /** - * Initiate a passive-mode QoS-enabled acceptor socket. - * @param local_sap The address that we're going to listen for - * connections on. If this is @c ACE_Addr::sap_any, - * this socket listens on an the "any" IP address - * and selects an unused port. To find out what port - * was selected, call this object's - * @c ACE_SOCK::get_local_addr(ACE_Addr&) method - * upon return. - */ - 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 = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /** - * Initiate a passive mode SSL/BSD-style acceptor socket. - * @param local_sap The address that we're going to listen for - * connections on. If this is @c ACE_Addr::sap_any, - * this socket listens on an the "any" IP address - * and selects an unused port. To find out what port - * was selected, call this object's - * @c ACE_SOCK::get_local_addr(ACE_Addr&) method - * upon return. - * - * @return 0 if success; -1 for failure (errno contains error code). - */ - int open (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); - - /// Close the listening socket. - int close (void); - - /** - * @name Passive Connection "accept" Methods - * - * These are the canonical methods exposed by the Acceptor pattern. - */ - //@{ - /** - * Accept a new ACE_SSL_SOCK_Stream connection. On successful return, - * the socket has been accepted and the SSL handshake has been completed. - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will receive - * the new SSL socket. - * @param remote_addr Pointer to an @c ACE_INET_Addr object that will - * receive the address of the peer that connected. - * @param timeout The maximum time to wait for the combined socket - * acceptance and handshake completion. 0 means - * block forever, a timeout of {0, 0} means poll. - * @param restart 1 means "restart if interrupted," that is, - * if errno == EINTR. - * - * @return 0 if success; -1 for failure (errno contains error code). - */ - 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 using the RVSP QoS - * information in qos_params. - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will receive - * the new SSL socket. - * @param remote_addr Pointer to an @c ACE_INET_Addr object that will - * receive the address of the peer that connected. - * @param timeout The maximum time to wait for the combined socket - * acceptance and handshake completion. 0 means - * block forever, a timeout of {0, 0} means poll. - * @param restart 1 means "restart if interrupted," that is, - * if errno == EINTR. - * - * @return 0 if success; -1 for failure (errno contains error code). - */ - 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; - //@} - - /// Meta-type info - //@{ - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_SSL_SOCK_Stream PEER_STREAM; - //@} - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - /// Complete SSL passive connection establishment. - int ssl_accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Time_Value *timeout) const; - -private: - - /// The BSD-socket workhorse - ACE_SOCK_Acceptor acceptor_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "SSL_SOCK_Acceptor.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_SOCK_ACCEPTOR_H */ diff --git a/dep/include/ace/SSL/SSL_SOCK_Acceptor.inl b/dep/include/ace/SSL/SSL_SOCK_Acceptor.inl deleted file mode 100644 index 318d66d5c25..00000000000 --- a/dep/include/ace/SSL/SSL_SOCK_Acceptor.inl +++ /dev/null @@ -1,85 +0,0 @@ -// -*- C++ -*- -// -// $Id: SSL_SOCK_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor (void) - : acceptor_ () -{ - 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"); - - this->set_handle (this->acceptor_.get_handle ()); -} - -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, - int protocol) - : acceptor_ (local_sap, - protocolinfo, - g, - flags, - reuse_addr, - protocol_family, - backlog, - protocol) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor"); - - this->set_handle (this->acceptor_.get_handle ()); -} - -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"); - if (this->acceptor_.open (local_sap, - reuse_addr, - protocol_family, - backlog, - protocol) != 0) - return -1; - else - this->set_handle (this->acceptor_.get_handle ()); - - return 0; -} - -ACE_INLINE int -ACE_SSL_SOCK_Acceptor::close (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Acceptor::close ()"); - - int result = this->acceptor_.close (); - this->set_handle (ACE_INVALID_HANDLE); - - return result; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/include/ace/SSL/SSL_SOCK_Connector.h b/dep/include/ace/SSL/SSL_SOCK_Connector.h deleted file mode 100644 index f1708bf127d..00000000000 --- a/dep/include/ace/SSL/SSL_SOCK_Connector.h +++ /dev/null @@ -1,318 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_SOCK_Connector.h - * - * $Id: SSL_SOCK_Connector.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Ossama Othman <ossama@uci.edu> - * @author Carlos O'Ryan <coryan@uci.edu> - * @author John Heitmann - * @author Chris Zimman - */ -//============================================================================= - - -#ifndef ACE_SSL_SOCK_CONNECTOR_H -#define ACE_SSL_SOCK_CONNECTOR_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "SSL_SOCK_Stream.h" - -#include "ace/SOCK_Connector.h" -#include "ace/OS_QoS.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SSL_SOCK_Connector - * - * @brief Defines a factory that creates new <ACE_SSL_SOCK_Stream>s - * actively. - * - * The ACE_SSL_SOCK_Connector doesn't have a socket of its own, - * i.e., it simply "borrows" the one from the ACE_SSL_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_SSL_SOCK_Connector from ACE_SSL_SOCK. - * - * Since SSL is record-oriented, some additional work is done after - * the plain socket is connected. - * - * @note The user must currently ensure that only one thread services - * a given SSL session at any given time since some underlying - * SSL implementations, such as OpenSSL, are not entirely - * thread-safe or reentrant. - */ -class ACE_SSL_Export ACE_SSL_SOCK_Connector -{ - -public: - - /// Default constructor. - ACE_SSL_SOCK_Connector (void); - - /** - * Actively connect to a peer, producing a connected @c ACE_SSL_SOCK_Stream - * object if the connection succeeds. This method performs both the - * initial socket connect and the SSL handshake. - * - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will be - * connected to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - ACE_SSL_SOCK_Connector (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0); - - /** - * Actively connect to a peer, producing a connected @c ACE_SSL_SOCK_Stream - * object if the connection succeeds. This method performs both the - * initial socket connect and the SSL handshake. - * - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will be - * connected to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param qos_params Contains QoS parameters that are passed to the - * IntServ (RSVP) and DiffServ protocols. - * @see ACE_QoS_Params. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - ACE_SSL_SOCK_Connector (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const 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); - - /// Default dtor. - ~ACE_SSL_SOCK_Connector (void); - - /** - * Actively connect to a peer, producing a connected @c ACE_SSL_SOCK_Stream - * object if the connection succeeds. This method performs both the - * initial socket connect and the SSL handshake. - * - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will be - * connected to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - int connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, - int reuse_addr = 0, - int flags = 0, - int perms = 0); - - /** - * Actively connect to a peer, producing a connected @c ACE_SSL_SOCK_Stream - * object if the connection succeeds. This method performs both the - * initial socket connect and the SSL handshake. - * - * @param new_stream The @c ACE_SSL_SOCK_Stream object that will be - * connected to the peer. - * @param remote_sap The address that we are trying to connect to. - * The protocol family of @c remote_sap is used for - * the connected socket. That is, if @c remote_sap - * contains an IPv6 address, a socket with family - * PF_INET6 will be used, else it will be PF_INET. - * @param qos_params Contains QoS parameters that are passed to the - * IntServ (RSVP) and DiffServ protocols. - * @see ACE_QoS_Params. - * @param timeout Pointer to an @c ACE_Time_Value object with amount - * of time to wait to connect. If the pointer is 0 - * then the call blocks until the connection attempt - * is complete, whether it succeeds or fails. If - * *timeout == {0, 0} then the connection is done - * using nonblocking mode. In this case, if the - * connection can't be made immediately, this method - * returns -1 and errno == EWOULDBLOCK. - * If *timeout > {0, 0} then this is the maximum amount - * of time to wait before timing out; if the specified - * amount of time passes before the connection is made, - * this method returns -1 and errno == ETIME. Note - * the difference between this case and when a blocking - * connect is attmpted that TCP times out - in the latter - * case, errno will be ETIMEDOUT. - * @param local_sap (optional) The local address to bind to. If it's - * the default value of @c ACE_Addr::sap_any then the - * OS will choose an unused port. - * @param reuse_addr (optional) If the value is 1, the local address - * (@c local_sap) is reused, even if it hasn't been - * cleaned up yet. - * @param flags Ignored. - * @param perms Ignored. - * - * @return Returns 0 if the connection succeeds. If it fails, - * -1 is returned and errno contains a specific error - * code. - */ - int connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Addr &remote_sap, - ACE_QoS_Params qos_params, - const 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); - - /** - * Try to complete a non-blocking connection. - * If connection completion is successful then <new_stream> contains - * the connected ACE_SSL_SOCK_Stream. If <remote_sap> is non-NULL - * then it will contain the address of the connected peer. - */ - int complete (ACE_SSL_SOCK_Stream &new_stream, - ACE_Addr *remote_sap = 0, - const ACE_Time_Value *timeout = 0); - - /// Resets any event associations on this handle - int reset_new_handle (ACE_HANDLE handle); - - /// Meta-type info - //@{ - typedef ACE_INET_Addr PEER_ADDR; - typedef ACE_SSL_SOCK_Stream PEER_STREAM; - //@} - - /// Dump the state of an object. - void dump (void) const; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - -protected: - - /// Complete non-blocking SSL active connection. - int ssl_connect (ACE_SSL_SOCK_Stream &new_stream, - const ACE_Time_Value *timeout); - -private: - - /// The class that does all of the non-secure socket connection. - /// It is default contructed, and subsequently used by connect(). - ACE_SOCK_Connector connector_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "SSL_SOCK_Connector.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_SOCK_CONNECTOR_H */ diff --git a/dep/include/ace/SSL/SSL_SOCK_Connector.inl b/dep/include/ace/SSL/SSL_SOCK_Connector.inl deleted file mode 100644 index 58978966dcf..00000000000 --- a/dep/include/ace/SSL/SSL_SOCK_Connector.inl +++ /dev/null @@ -1,28 +0,0 @@ -// -*- C++ -*- -// -// $Id: SSL_SOCK_Connector.inl 80826 2008-03-04 14:51:23Z wotte $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector (void) - : connector_ () -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector"); -} - -ACE_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); -} - -ACE_INLINE void -ACE_SSL_SOCK_Connector::dump (void) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Connector::dump"); - this->connector_.dump (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/include/ace/SSL/SSL_SOCK_Stream.h b/dep/include/ace/SSL/SSL_SOCK_Stream.h deleted file mode 100644 index be78b924299..00000000000 --- a/dep/include/ace/SSL/SSL_SOCK_Stream.h +++ /dev/null @@ -1,321 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file SSL_SOCK_Stream.h - * - * $Id: SSL_SOCK_Stream.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Ossama Othman <ossama@uci.edu> - * @author Carlos O'Ryan <coryan@uci.edu> - * @author John Heitmann - */ -//============================================================================= - - -#ifndef ACE_SSL_SOCK_STREAM_H -#define ACE_SSL_SOCK_STREAM_H - -#include /**/ "ace/pre.h" - -#include "SSL_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -// This must be included before any <openssl> include on LynxOS -#include "ace/os_include/os_stdio.h" - -#include <openssl/err.h> - -#include "SSL_SOCK.h" -#include "SSL_Context.h" - -#include "ace/SOCK_Stream.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_SSL_SOCK_Stream - * - * @brief Defines methods in the ACE_SSL_SOCK_Stream abstraction. - * - * This class encapsulates the methods and functionality necessary to - * send and receive data over TLS/SSL. - * @par - * Since SSL is record-oriented, some additional steps must be taken - * to make the ACE_SSL_SOCK_Stream interact properly with the - * Reactor (if one is used) when performing non-blocking IO. In - * particular, if ::SSL_pending (ssl), where "ssl" is a pointer to the - * SSL data structure returned from ACE_SSL_SOCK_Stream::ssl(), - * returns a non-zero value then the event handler that calls the IO - * methods in this class should return a value greater than zero to - * force the Reactor to invoke the event handler before polling for - * additional events (e.g. blocking on select()). - * - * @note The user must currently ensure that only one thread services - * a given SSL session at any given time since underlying SSL - * implementations, such as OpenSSL, are not entirely - * thread-safe or reentrant. - */ -class ACE_SSL_Export ACE_SSL_SOCK_Stream : public ACE_SSL_SOCK -{ -public: - - /// Constructor - /** - * @param context Pointer to @c ACE_SSL_Context instance containing - * the OpenSSL @c SSL data structure to be associated - * with this @c ACE_SSL_SOCK_Stream. The @c SSL data - * structure will be copied to make it at least - * logically independent of the supplied @a context. - */ - ACE_SSL_SOCK_Stream (ACE_SSL_Context *context = - ACE_SSL_Context::instance ()); - - /// Destructor - ~ACE_SSL_SOCK_Stream (void); - - /// 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 send (const 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 recv (void *buf, - size_t n, - int flags) const; - - /// Send an n byte buffer to the ssl socket using the semantics of - /// write(2). - ssize_t send (const void *buf, - size_t n) const; - - /// Recv an n byte buffer from the ssl socket using the semantics of - /// read(2). - ssize_t recv (void *buf, - size_t n) const; - - /// Send an iovec of size n to the ssl socket. - /** - * Note that it is not possible to perform a "scattered" write with - * the underlying OpenSSL implementation. As such, the expected - * semantics are not fully reproduced with this implementation. - */ - ssize_t sendv (const iovec iov[], - size_t n, - 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 recvv (iovec *io_vec, - const ACE_Time_Value *timeout = 0) const; - - /** - * Wait to timeout amount of time to send up to n bytes into buf - * (uses the send() call). If send() times out -1 is returned with - * errno == ETIME. If it succeeds the number of bytes sent is - * returned. No flags are supported. - */ - ssize_t send (const 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 -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 recv (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. - */ - ssize_t send (const 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 @c errno == ETIME. If it succeeds the - * number of bytes received is returned. - */ - ssize_t recv (void *buf, - size_t n, - const ACE_Time_Value *timeout) const; - - /// Send n varargs messages to the connected ssl socket. - ssize_t send (size_t n, - ...) const; - - /// Recv n varargs messages to the connected ssl socket. - ssize_t recv (size_t n, - ...) const; - - /// Send n bytes, keep trying until n are sent. - ssize_t send_n (const void *buf, int n) const; - - /// Recv n bytes, keep trying until n are received. - ssize_t recv_n (void *buf, int n) const; - - /** - * @note In the following four methods, only MSG_PEEK is supported - * for recv_n(), and no flags are supported for send_n(). - */ - //@{ - /// Send n bytes, keep trying until n are sent. - ssize_t send_n (const void *buf, int n, int flags) const; - - /// Recv n bytes, keep trying until n are sent. - ssize_t recv_n (void *buf, int n, int flags) 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 send_n (const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred = 0) const; - - /** - * Try to receive 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 recv_n (void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred = 0) const; - //@} - - /** - * Send an iovec of size n to the connected socket. Will block - * until all bytes are sent or an error occurs. - */ - ssize_t sendv_n (const iovec iov[], - size_t n) const; - - /// Receive an iovec of size n to the connected socket. - ssize_t recvv_n (iovec iov[], - size_t n) const; - - - /** - * Selectively close endpoints. - */ - //@{ - /// Close down the reader. - int close_reader (void); - - /// Close down the writer. - int close_writer (void); - //@} - - ///Close down the socket. - int close (void); - - /// Meta-type info - typedef ACE_INET_Addr PEER_ADDR; - - /// Declare the dynamic allocation hooks. - ACE_ALLOC_HOOK_DECLARE; - - /// Overridden set_handle() method. - /** - * Only an ACE_SSL_SOCK_Acceptor or ACE_SSL_SOCK_Connector should - * access this method since some state in the underlying "ssl_" data - * structure is set during SSL connection establishment. - */ - void set_handle (ACE_HANDLE fd); - - /// Return a pointer to the underlying SSL structure. - SSL *ssl (void) const; - - /** - * Return the address of the remotely connected peer (if there is - * one), in the referenced <ACE_Addr>. Returns 0 if successful, else - * -1. - * - * @note If the TCP connection has been completed but the SSL - * connection has not been completed yet, -1 will be - * returned. - */ - int get_remote_addr (ACE_Addr &) const; - - /// Return the underlying ACE_SOCK_Stream which ACE_SSL runs atop of. - ACE_SOCK_Stream & peer (void); - -protected: - - /// Underlying send() helper method common to all public send() - /// methods. - ssize_t send_i (const void *buf, - size_t n, - int flags) const; - - /// Underlying send() helper method common to all public send() - /// methods. - ssize_t recv_i (void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const; - -private: - - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_SSL_SOCK_Stream &)) - ACE_UNIMPLEMENTED_FUNC (ACE_SSL_SOCK_Stream (const ACE_SSL_SOCK_Stream &)) - -protected: - - /// The SSL session. - SSL *ssl_; - - /// The stream which works under the ssl connection. - ACE_SOCK_Stream stream_; - -}; - -ACE_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "SSL_SOCK_Stream.inl" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSL_SOCK_STREAM_H */ diff --git a/dep/include/ace/SSL/SSL_SOCK_Stream.inl b/dep/include/ace/SSL/SSL_SOCK_Stream.inl deleted file mode 100644 index 71661308f61..00000000000 --- a/dep/include/ace/SSL/SSL_SOCK_Stream.inl +++ /dev/null @@ -1,330 +0,0 @@ -// -*- C++ -*- -// -// $Id: SSL_SOCK_Stream.inl 82579 2008-08-10 23:03:06Z mitza $ - -#include "ace/OS_NS_errno.h" -#include "ace/Truncate.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE void -ACE_SSL_SOCK_Stream::set_handle (ACE_HANDLE fd) -{ - if (this->ssl_ == 0 || fd == ACE_INVALID_HANDLE) - { - this->ACE_SSL_SOCK::set_handle (ACE_INVALID_HANDLE); - return; - } - else - { - (void) ::SSL_set_fd (this->ssl_, (int) fd); - this->ACE_SSL_SOCK::set_handle (fd); - this->stream_.set_handle (fd); - } -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::send_i (const void *buf, - size_t n, - int flags) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send_i"); - - // NOTE: Caller must provide thread-synchronization. - - // No send flags are supported in SSL. - if (flags != 0) - { - ACE_NOTSUP_RETURN (-1); - } - - int const bytes_sent = ::SSL_write (this->ssl_, - static_cast<const char *> (buf), - ACE_Utils::truncate_cast<int> (n)); - - switch (::SSL_get_error (this->ssl_, bytes_sent)) - { - case SSL_ERROR_NONE: - return bytes_sent; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - errno = EWOULDBLOCK; - - return -1; - - case SSL_ERROR_ZERO_RETURN: - // The peer has notified us that it is shutting down via the SSL - // "close_notify" message so we need to shutdown, too. - (void) ::SSL_shutdown (this->ssl_); - - return bytes_sent; - - case SSL_ERROR_SYSCALL: - if (bytes_sent == 0) - // An EOF occured but the SSL "close_notify" message was not - // sent. This is a protocol error, but we ignore it. - return 0; - - // If not an EOF, then fall through to "default" case. - - // On some platforms (e.g. MS Windows) OpenSSL does not store - // the last error in errno so explicitly do so. - ACE_OS::set_errno_to_last_error (); - - break; - - default: - // Reset errno to prevent previous values (e.g. EWOULDBLOCK) - // from being associated with fatal SSL errors. - errno = 0; - - ACE_SSL_Context::report_error (); - - break; - } - - return -1; -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t n, - int flags) const -{ - return this->send_i (buf, n, flags); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv_i (void *buf, - size_t n, - int flags, - const ACE_Time_Value *timeout) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv_i"); - - // NOTE: Caller must provide thread-synchronization. - - int bytes_read = 0; - ACE_HANDLE const handle = this->get_handle (); - - // Value for current I/O mode (blocking/non-blocking) - int val = 0; - - if (timeout != 0) - ACE::record_and_set_non_blocking_mode (handle, - val); - - // Only block on select() with a timeout if no data in the - // internal OpenSSL buffer is pending read completion for - // the same reasons stated above, i.e. all data must be read - // before blocking on select(). - if (timeout != 0 - && !::SSL_pending (this->ssl_)) - { - if (ACE::enter_recv_timedwait (handle, - timeout, - val) == -1) - return -1; - } - - if (flags) - { - if (ACE_BIT_ENABLED (flags, MSG_PEEK)) - { - bytes_read = ::SSL_peek (this->ssl_, - static_cast<char *> (buf), - ACE_Utils::truncate_cast<int> (n)); - } - else - { - ACE_NOTSUP_RETURN (-1); - } - } - else - { - bytes_read = ::SSL_read (this->ssl_, - static_cast<char *> (buf), - ACE_Utils::truncate_cast<int> (n)); - } - - int const status = ::SSL_get_error (this->ssl_, bytes_read); - switch (status) - { - case SSL_ERROR_NONE: - if (timeout != 0) - ACE::restore_non_blocking_mode (handle, val); - - return bytes_read; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - errno = EWOULDBLOCK; - - return -1; - - case SSL_ERROR_ZERO_RETURN: - if (timeout != 0) - ACE::restore_non_blocking_mode (handle, val); - - // The peer has notified us that it is shutting down via the SSL - // "close_notify" message so we need to shutdown, too. - (void) ::SSL_shutdown (this->ssl_); - - return bytes_read; - - case SSL_ERROR_SYSCALL: - if (bytes_read == 0) - // An EOF occured but the SSL "close_notify" message was not - // sent. This is a protocol error, but we ignore it. - return 0; - - // If not an EOF, then fall through to "default" case. - - // On some platforms (e.g. MS Windows) OpenSSL does not store - // the last error in errno so explicitly do so. - ACE_OS::set_errno_to_last_error (); - - break; - - default: - // Reset errno to prevent previous values (e.g. EWOULDBLOCK) - // from being associated with a fatal SSL error. - errno = 0; - - ACE_SSL_Context::report_error (); - - break; - } - - return -1; -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n, - int flags) const -{ - return this->recv_i (buf, n, flags, 0); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::send (const void *buf, - size_t n) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::send"); - - return this->send_i (buf, n, 0); -} - -ACE_INLINE ssize_t -ACE_SSL_SOCK_Stream::recv (void *buf, - size_t n) const -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::recv"); - - return this->recv_i (buf, n, 0, 0); -} - -ACE_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); -} - -ACE_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); -} - -ACE_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); -} - -ACE_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); -} - -ACE_INLINE int -ACE_SSL_SOCK_Stream::close_reader (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::close_reader"); - return this->stream_.close_reader (); -} - -ACE_INLINE int -ACE_SSL_SOCK_Stream::close_writer (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::close_writer"); - return this->stream_.close_writer (); -} - -ACE_INLINE int -ACE_SSL_SOCK_Stream::close (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::close"); - - if (this->ssl_ == 0 || this->get_handle () == ACE_INVALID_HANDLE) - return 0; // SSL_SOCK_Stream was never opened. - - // SSL_shutdown() returns 1 on successful shutdown of the SSL - // connection, not 0. - int const status = ::SSL_shutdown (this->ssl_); - - switch (::SSL_get_error (this->ssl_, status)) - { - case SSL_ERROR_NONE: - case SSL_ERROR_SYSCALL: // Ignore this error condition. - - // Reset the SSL object to allow another connection to be made - // using this ACE_SSL_SOCK_Stream instance. This prevents the - // previous SSL session state from being associated with the new - // SSL session/connection. - (void) ::SSL_clear (this->ssl_); - this->set_handle (ACE_INVALID_HANDLE); - return this->stream_.close (); - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - errno = EWOULDBLOCK; - break; - - default: - ACE_SSL_Context::report_error (); - - ACE_Errno_Guard error (errno); // Save/restore errno - (void) this->stream_.close (); - - return -1; - } - - return -1; -} - -ACE_INLINE ACE_SOCK_Stream & -ACE_SSL_SOCK_Stream::peer (void) -{ - ACE_TRACE ("ACE_SSL_SOCK_Stream::peer"); - return this->stream_; -} - -ACE_INLINE SSL * -ACE_SSL_SOCK_Stream::ssl (void) const -{ - return this->ssl_; -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/include/ace/SSL/sslconf.h b/dep/include/ace/SSL/sslconf.h deleted file mode 100644 index c4ba34797c4..00000000000 --- a/dep/include/ace/SSL/sslconf.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file sslconf.h - * - * $Id: sslconf.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Carlos O'Ryan <coryan@ece.uci.edu> - */ -//============================================================================= - - -#ifndef ACE_SSLCONF_H -#define ACE_SSLCONF_H - -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_DEFAULT_SSL_CERT_FILE) -# ifdef WIN32 -# define ACE_DEFAULT_SSL_CERT_FILE "cert.pem" -# else -# define ACE_DEFAULT_SSL_CERT_FILE "/etc/ssl/cert.pem" -# endif /* WIN32 */ -#endif /* ACE_DEFAULT_SSL_CERT_FILE */ - -#if !defined (ACE_DEFAULT_SSL_CERT_DIR) -# ifdef WIN32 -# define ACE_DEFAULT_SSL_CERT_DIR "certs" -# else -# define ACE_DEFAULT_SSL_CERT_DIR "/etc/ssl/certs" -# endif /* WIN32 */ -#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 */ - -#if !defined (ACE_SSL_EGD_FILE_ENV) -#define ACE_SSL_EGD_FILE_ENV "SSL_EGD_FILE" -#endif /* ACE_SSL_EGD_FILE_ENV */ - -#if !defined (ACE_SSL_RAND_FILE_ENV) -#define ACE_SSL_RAND_FILE_ENV "SSL_RAND_FILE" -#endif /* ACE_SSL_RAND_FILE_ENV */ - -#include /**/ "ace/post.h" - -#endif /* ACE_SSLCONF_H */ |
