SSLIOP_SSL.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   SSLIOP_SSL.h
00006  *
00007  *  OpenSSL @c SSL data structure specializations and typedefs.
00008  *
00009  *  SSLIOP_SSL.h,v 1.7 2006/03/14 06:14:35 jtc Exp
00010  *
00011  *  @author Ossama Othman <ossama@dre.vanderbilt.edu>
00012  */
00013 //=============================================================================
00014 
00015 #ifndef TAO_SSLIOP_SSL_H
00016 #define TAO_SSLIOP_SSL_H
00017 
00018 #include /**/ "ace/pre.h"
00019 
00020 #include "ace/config-all.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 #pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.h"
00027 
00028 #include <openssl/ssl.h>
00029 #include <openssl/crypto.h>
00030 
00031 
00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00033 
00034 namespace TAO
00035 {
00036   namespace SSLIOP
00037   {
00038     // OpenSSL @c SSL structure traits specialization.
00039     template <>
00040     struct OpenSSL_traits< ::SSL >
00041     {
00042       /// OpenSSL lock ID for use in OpenSSL CRYPTO_add() reference
00043       /// count manipulation function.
00044       enum { LOCK_ID = CRYPTO_LOCK_SSL };
00045 
00046       /// Increase the reference count on the given OpenSSL structure.
00047       /**
00048        * @note This used to be in a function template but MSVC++ 6
00049        *       can't handle function templates correctly so reproduce
00050        *       the code in each specialization.  *sigh*
00051        */
00052       static ::SSL * _duplicate (::SSL * st)
00053       {
00054         if (st != 0)
00055           CRYPTO_add (&(st->references),
00056                       1,
00057                       LOCK_ID);
00058 
00059         return st;
00060       }
00061 
00062       /// Perform deep copy of the given OpenSSL structure.
00063       static ::SSL * copy (::SSL const & st)
00064       {
00065         return ::SSL_dup (const_cast< ::SSL * > (&st));
00066       }
00067 
00068       /// Decrease the reference count on the given OpenSSL
00069       /// structure.
00070       static void release (::SSL * st)
00071       {
00072         ::SSL_free (st);
00073       }
00074     };
00075 
00076     typedef OpenSSL_st_var< ::SSL > SSL_var;
00077 
00078   }  // End SSLIOP namespace.
00079 }  // End TAO namespace.
00080 
00081 TAO_END_VERSIONED_NAMESPACE_DECL
00082 
00083 #include /**/ "ace/post.h"
00084 
00085 #endif  /* TAO_SSLIOP_SSL_H */

Generated on Thu Nov 9 13:54:15 2006 for TAO_SSLIOP by doxygen 1.3.6