00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file SSLIOP_Current.h 00006 * 00007 * SSLIOP_Current.h,v 1.22 2006/06/21 13:53:07 parsons Exp 00008 * 00009 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00010 */ 00011 // =================================================================== 00012 00013 #ifndef TAO_SSLIOP_CURRENT_H 00014 #define TAO_SSLIOP_CURRENT_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "orbsvcs/SSLIOP/SSLIOP_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "orbsvcs/SSLIOP/SSLIOP_Current_Impl.h" 00025 00026 #include "orbsvcs/SSLIOPC.h" 00027 #include "tao/ORB_Core.h" 00028 #include "tao/LocalObject.h" 00029 00030 // This is to remove "inherits via dominance" warnings from MSVC. 00031 // MSVC is being a little too paranoid. 00032 #if defined(_MSC_VER) 00033 #pragma warning(push) 00034 #pragma warning(disable:4250) 00035 #endif /* _MSC_VER */ 00036 00037 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00038 00039 namespace TAO 00040 { 00041 namespace SSLIOP 00042 { 00043 class Current; 00044 typedef Current * Current_ptr; 00045 typedef TAO_Pseudo_Var_T<Current> Current_var; 00046 typedef TAO_Pseudo_Out_T<Current> Current_out; 00047 00048 /** 00049 * @class Current 00050 * 00051 * @brief Implementation of the TAO SSLIOP::Current extension. 00052 * 00053 * This object can be used to obtain SSL session related 00054 * information about the current execution context. For example, 00055 * SSL peer certificate chains for the current request can be 00056 * obtained from this object. 00057 */ 00058 class Current 00059 : public ::SSLIOP::Current, 00060 public TAO_Local_RefCounted_Object 00061 { 00062 public: 00063 typedef Current_ptr _ptr_type; 00064 typedef Current_var _var_type; 00065 typedef Current_out _out_type; 00066 00067 /// Constructor. 00068 Current (TAO_ORB_Core *orb_core); 00069 00070 /// Return the peer certificate associated with the current 00071 /// request. 00072 virtual ::SSLIOP::ASN_1_Cert * get_peer_certificate ( 00073 ACE_ENV_SINGLE_ARG_DECL) 00074 ACE_THROW_SPEC ((CORBA::SystemException, 00075 ::SSLIOP::Current::NoContext)); 00076 00077 /** 00078 * Return the certificate chain associated with the current 00079 * execution context. If no SSL session is being used for the 00080 * request or upcall, then the NoContext exception is raised. 00081 * On the client side, the chain does include the peer (server) 00082 * certficate. However, the certificate chain on the server 00083 * side does NOT contain the peer (client) certificate. 00084 */ 00085 virtual ::SSLIOP::SSL_Cert * get_peer_certificate_chain ( 00086 ACE_ENV_SINGLE_ARG_DECL) 00087 ACE_THROW_SPEC ((CORBA::SystemException, 00088 ::SSLIOP::Current::NoContext)); 00089 00090 /** 00091 * This method is mostly useful as an inexpensive means of 00092 * determining whether or not SSL session state is available. 00093 * 00094 * @return @c true if the current execution context is not 00095 * within a SSL session. 00096 */ 00097 virtual CORBA::Boolean no_context (ACE_ENV_SINGLE_ARG_DECL) 00098 ACE_THROW_SPEC ((CORBA::SystemException)); 00099 00100 /// Set the TSS slot ID assigned to this object. 00101 void tss_slot (size_t slot); 00102 00103 /// Setup the Current. 00104 void setup (Current_Impl *& prev_impl, 00105 Current_Impl * new_impl, 00106 bool &setup_done); 00107 00108 /// Teardown the Current for this request. 00109 void teardown (Current_Impl *prev_impl, 00110 bool &setup_done); 00111 00112 /** 00113 * @name Downcast and Reference Counting Methods 00114 * 00115 * These are basically the same methods generated by the IDL 00116 * compiler for all IDL interfaces. 00117 */ 00118 //@{ 00119 // The static operations. 00120 static Current_ptr _duplicate (Current_ptr obj); 00121 00122 static Current_ptr _narrow (CORBA::Object_ptr obj 00123 ACE_ENV_ARG_DECL); 00124 00125 static Current_ptr _nil (void) 00126 { 00127 return (Current_ptr)0; 00128 } 00129 00130 virtual const char* _interface_repository_id (void) const; 00131 //@} 00132 00133 protected: 00134 00135 /// Destructor 00136 ~Current (void); 00137 00138 /// Set the TSS SSLIOP::Current implementation. 00139 int implementation (Current_Impl *impl); 00140 00141 /// Return the TSS SSLIOP::Current implementation. 00142 Current_Impl *implementation (void); 00143 00144 private: 00145 00146 /// Prevent copying through the copy constructor and the assignment 00147 /// operator. 00148 //@{ 00149 Current (const Current &); 00150 void operator= (const Current &); 00151 //@} 00152 00153 private: 00154 00155 /// TSS slot assigned to this object. 00156 size_t tss_slot_; 00157 00158 /// Pointer to the ORB Core corresponding to the ORB with which this 00159 /// object is registered. 00160 TAO_ORB_Core * const orb_core_; 00161 }; 00162 } // End SSLIOP namespace. 00163 } // End TAO namespace. 00164 00165 TAO_END_VERSIONED_NAMESPACE_DECL 00166 00167 #if defined (__ACE_INLINE__) 00168 # include "orbsvcs/SSLIOP/SSLIOP_Current.inl" 00169 #endif /* __ACE_INLINE__ */ 00170 00171 #if defined(_MSC_VER) 00172 #pragma warning(pop) 00173 #endif /* _MSC_VER */ 00174 00175 #include /**/ "ace/post.h" 00176 00177 #endif /* TAO_SSLIOP_CURRENT_H */