00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file SSLIOP_Current.h 00006 * 00007 * $Id: SSLIOP_Current.h 81490 2008-04-28 14:32:24Z johnnyw $ 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 ::CORBA::LocalObject 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 00074 /** 00075 * Return the certificate chain associated with the current 00076 * execution context. If no SSL session is being used for the 00077 * request or upcall, then the NoContext exception is raised. 00078 * On the client side, the chain does include the peer (server) 00079 * certficate. However, the certificate chain on the server 00080 * side does NOT contain the peer (client) certificate. 00081 */ 00082 virtual ::SSLIOP::SSL_Cert * get_peer_certificate_chain (); 00083 00084 /** 00085 * This method is mostly useful as an inexpensive means of 00086 * determining whether or not SSL session state is available. 00087 * 00088 * @return @c true if the current execution context is not 00089 * within a SSL session. 00090 */ 00091 virtual CORBA::Boolean no_context (void); 00092 00093 /// Set the TSS slot ID assigned to this object. 00094 void tss_slot (size_t slot); 00095 00096 /// Setup the Current. 00097 void setup (Current_Impl *& prev_impl, 00098 Current_Impl * new_impl, 00099 bool &setup_done); 00100 00101 /// Teardown the Current for this request. 00102 void teardown (Current_Impl *prev_impl, bool &setup_done); 00103 00104 /** 00105 * @name Downcast and Reference Counting Methods 00106 * 00107 * These are basically the same methods generated by the IDL 00108 * compiler for all IDL interfaces. 00109 */ 00110 //@{ 00111 // The static operations. 00112 static Current_ptr _duplicate (Current_ptr obj); 00113 00114 static Current_ptr _narrow (CORBA::Object_ptr obj); 00115 00116 static Current_ptr _nil (void) 00117 { 00118 return (Current_ptr)0; 00119 } 00120 00121 virtual const char* _interface_repository_id (void) const; 00122 //@} 00123 00124 protected: 00125 00126 /// Destructor 00127 ~Current (void); 00128 00129 /// Set the TSS SSLIOP::Current implementation. 00130 int implementation (Current_Impl *impl); 00131 00132 /// Return the TSS SSLIOP::Current implementation. 00133 Current_Impl *implementation (void); 00134 00135 private: 00136 00137 /// Prevent copying through the copy constructor and the assignment 00138 /// operator. 00139 //@{ 00140 Current (const Current &); 00141 void operator= (const Current &); 00142 //@} 00143 00144 private: 00145 00146 /// TSS slot assigned to this object. 00147 size_t tss_slot_; 00148 00149 /// Pointer to the ORB Core corresponding to the ORB with which this 00150 /// object is registered. 00151 TAO_ORB_Core * const orb_core_; 00152 }; 00153 } // End SSLIOP namespace. 00154 } // End TAO namespace. 00155 00156 TAO_END_VERSIONED_NAMESPACE_DECL 00157 00158 #if defined (__ACE_INLINE__) 00159 # include "orbsvcs/SSLIOP/SSLIOP_Current.inl" 00160 #endif /* __ACE_INLINE__ */ 00161 00162 #if defined(_MSC_VER) 00163 #pragma warning(pop) 00164 #endif /* _MSC_VER */ 00165 00166 #include /**/ "ace/post.h" 00167 00168 #endif /* TAO_SSLIOP_CURRENT_H */