SSLIOP_X509.h

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

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