00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SSLIOP_Profile.h 00006 * 00007 * SSLIOP_Profile.h,v 1.28 2006/03/14 06:14:35 jtc Exp 00008 * 00009 * SSLIOP profile specific processing 00010 * 00011 * @author Carlos O'Ryan <coryan@uci.edu> 00012 * @author Ossama Othman <ossama@uci.edu> 00013 */ 00014 //============================================================================= 00015 00016 00017 #ifndef TAO_SSLIOP_PROFILE_H 00018 #define TAO_SSLIOP_PROFILE_H 00019 00020 #include /**/ "ace/pre.h" 00021 00022 #include "ace/config-all.h" 00023 00024 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00025 # pragma once 00026 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00027 00028 #include "orbsvcs/SSLIOP/SSLIOP_Endpoint.h" 00029 #include "tao/IIOP_Profile.h" 00030 00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 // namespace TAO 00034 // { 00035 // namespace SSLIOP 00036 // { 00037 00038 /** 00039 * @class Profile 00040 * 00041 * @brief This class defines the protocol specific attributes 00042 * required for locating ORBs over a TCP/IP network, using 00043 * either IIOP or IIOP/SSL for communication. 00044 * 00045 * This class extends TAO_IIOP_Profile to support secure 00046 * communication using SSL. 00047 */ 00048 class TAO_SSLIOP_Profile : public TAO_IIOP_Profile 00049 { 00050 public: 00051 /// Profile constructor, same as above except the object_key has 00052 /// already been marshaled. 00053 TAO_SSLIOP_Profile (const ACE_INET_Addr & addr, 00054 const TAO::ObjectKey & object_key, 00055 const TAO_GIOP_Message_Version & version, 00056 TAO_ORB_Core * orb_core, 00057 const ::SSLIOP::SSL * ssl_component); 00058 00059 /// Profile constructor, this is the most efficient since it 00060 /// doesn't require any address resolution processing. 00061 TAO_SSLIOP_Profile (const char *host, 00062 CORBA::UShort port, 00063 const TAO::ObjectKey & object_key, 00064 const ACE_INET_Addr & addr, 00065 const TAO_GIOP_Message_Version & version, 00066 TAO_ORB_Core * orb_core, 00067 const ::SSLIOP::SSL * ssl_component); 00068 00069 /// Create profile with the given SSLIOP tagged component. 00070 TAO_SSLIOP_Profile (TAO_ORB_Core * orb_core, 00071 const ::SSLIOP::SSL * ssl_component); 00072 00073 /// Profile constructor. ssl_only != 0 will force secure 00074 /// connections, pnly. 00075 TAO_SSLIOP_Profile (TAO_ORB_Core * orb_core, int ssl_only = 0); 00076 00077 00078 // = Please see Profile.h for the documentation of these methods. 00079 virtual int decode (TAO_InputCDR& cdr); 00080 virtual int encode_endpoints (void); 00081 virtual TAO_Endpoint *endpoint (void); 00082 00083 /** 00084 * Override parse_string() from the base class to update the SSL 00085 * endpoint's iiop endpoint once the base class has completed 00086 * parsing the string. 00087 *@par 00088 * Initialize this object using the given input string. 00089 * URL-style string contain only one endpoint. 00090 */ 00091 virtual void parse_string (const char * string 00092 ACE_ENV_ARG_DECL); 00093 00094 /** 00095 * Add @a endp to this profile's list of endpoints (it is 00096 * inserted next to the head of the list). This profiles takes 00097 * ownership of @a endp. If @a endp's @c iiop_endpoint_ member 00098 * is not 0, it is added to our parent's class endpoint list. 00099 */ 00100 void add_endpoint (TAO_SSLIOP_Endpoint * endp); 00101 00102 protected: 00103 00104 /// Destructor. 00105 /** 00106 * Protected destructor to enforce proper memory management 00107 * through the reference counting mechanism. 00108 */ 00109 ~TAO_SSLIOP_Profile (void); 00110 00111 /// Profile equivalence template method. 00112 /** 00113 * @see TAO_Profile::do_is_equivalent() 00114 */ 00115 virtual CORBA::Boolean do_is_equivalent ( 00116 const TAO_Profile * other_profile); 00117 00118 private: 00119 00120 /** 00121 * Helper for @c decode. Decodes TAO_TAG_SSL_ENDPOINTS from a 00122 * tagged component. Decode only if RTCORBA is enabled. 00123 * 00124 * @return 0 on success and -1 on failure. 00125 * 00126 * @note This should be enabled only when RTCORBA is enabled, 00127 * but sadly others pay the price (of footprint) under 00128 * normal operations. 00129 */ 00130 int decode_tagged_endpoints (void); 00131 00132 /** 00133 * Head of this profile's list of endpoints. This endpoint is 00134 * not dynamically allocated because a profile always contains 00135 * at least one endpoint. 00136 * @par 00137 * Currently, a profile contains more than one endpoint, i.e., 00138 * list contains more than just the head, only when RTCORBA is 00139 * enabled. However, in the near future, this will be used in 00140 * non-RT mode as well, e.g., to support @c 00141 * TAG_ALTERNATE_IIOP_ADDRESS feature. 00142 * @par 00143 * Since SSLIOP profile is an extension of IIOP profile, its 00144 * addressing info is contained in two places: IIOP parent 00145 * class contains all iiop addressing while this class contains 00146 * SSL-specific addressing additions to iiop. This means that 00147 * there are two lists of endpoints: one maintained in the 00148 * parent class and one maintained here. Each ssl endpoint 00149 * maintains a pointer to its counterpart in the parent class 00150 * endpoint list. 00151 * @par 00152 * For transmission of IIOP addressing information, see 00153 * @c TAO_IIOP_Profile. Addressing info of the default SSL 00154 * endpoint, i.e., head of the list, is transmitted using 00155 * standard SSLIOP::TAG_SSL_SEC_TRANS tagged component. See 00156 * @c encode_endpoints method documentation above for how the 00157 * rest of the SSL endpoint list is transmitted. 00158 */ 00159 TAO_SSLIOP_Endpoint ssl_endpoint_; 00160 00161 /** 00162 * Allways treat this endpoint as secure, even if the constructor 00163 * did not explicitely specify a tagged component for SSL. 00164 * @par 00165 * Most likely the parse_string() will supply a subset of the 00166 * attributes - port number, for instance. 00167 */ 00168 int ssl_only_; 00169 00170 }; 00171 00172 // } // End SSLIOP namespace. 00173 // } // End TAO namespace. 00174 00175 TAO_END_VERSIONED_NAMESPACE_DECL 00176 00177 #include /**/ "ace/post.h" 00178 00179 #endif /* TAO_SSLIOP_PROFILE_H */