00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SSLIOP_Profile.h 00006 * 00007 * $Id: SSLIOP_Profile.h 77784 2007-03-23 13:08:15Z mesnier_p $ 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 00093 /** 00094 * Add @a endp to this profile's list of endpoints (it is 00095 * inserted next to the head of the list). This profiles takes 00096 * ownership of @a endp. If @a endp's @c iiop_endpoint_ member 00097 * is not 0, it is added to our parent's class endpoint list. 00098 */ 00099 void add_endpoint (TAO_SSLIOP_Endpoint * endp); 00100 00101 00102 /** 00103 * Remove @a endp from this profile's list of endpoints. 00104 */ 00105 void remove_endpoint (TAO_SSLIOP_Endpoint * endp); 00106 00107 void remove_generic_endpoint (TAO_Endpoint *ep); 00108 00109 protected: 00110 00111 /// Destructor. 00112 /** 00113 * Protected destructor to enforce proper memory management 00114 * through the reference counting mechanism. 00115 */ 00116 ~TAO_SSLIOP_Profile (void); 00117 00118 /// Profile equivalence template method. 00119 /** 00120 * @see TAO_Profile::do_is_equivalent() 00121 */ 00122 virtual CORBA::Boolean do_is_equivalent ( 00123 const TAO_Profile * other_profile); 00124 00125 private: 00126 00127 /** 00128 * Helper for @c decode. Decodes TAO_TAG_SSL_ENDPOINTS from a 00129 * tagged component. Decode only if RTCORBA is enabled. 00130 * 00131 * @return 0 on success and -1 on failure. 00132 * 00133 * @note This should be enabled only when RTCORBA is enabled, 00134 * but sadly others pay the price (of footprint) under 00135 * normal operations. 00136 */ 00137 int decode_tagged_endpoints (void); 00138 00139 /** 00140 * Head of this profile's list of endpoints. This endpoint is 00141 * not dynamically allocated because a profile always contains 00142 * at least one endpoint. 00143 * @par 00144 * Currently, a profile contains more than one endpoint, i.e., 00145 * list contains more than just the head, only when RTCORBA is 00146 * enabled. However, in the near future, this will be used in 00147 * non-RT mode as well, e.g., to support @c 00148 * TAG_ALTERNATE_IIOP_ADDRESS feature. 00149 * @par 00150 * Since SSLIOP profile is an extension of IIOP profile, its 00151 * addressing info is contained in two places: IIOP parent 00152 * class contains all iiop addressing while this class contains 00153 * SSL-specific addressing additions to iiop. This means that 00154 * there are two lists of endpoints: one maintained in the 00155 * parent class and one maintained here. Each ssl endpoint 00156 * maintains a pointer to its counterpart in the parent class 00157 * endpoint list. 00158 * @par 00159 * For transmission of IIOP addressing information, see 00160 * @c TAO_IIOP_Profile. Addressing info of the default SSL 00161 * endpoint, i.e., head of the list, is transmitted using 00162 * standard SSLIOP::TAG_SSL_SEC_TRANS tagged component. See 00163 * @c encode_endpoints method documentation above for how the 00164 * rest of the SSL endpoint list is transmitted. 00165 */ 00166 TAO_SSLIOP_Endpoint ssl_endpoint_; 00167 00168 /** 00169 * Allways treat this endpoint as secure, even if the constructor 00170 * did not explicitely specify a tagged component for SSL. 00171 * @par 00172 * Most likely the parse_string() will supply a subset of the 00173 * attributes - port number, for instance. 00174 */ 00175 int ssl_only_; 00176 00177 }; 00178 00179 // } // End SSLIOP namespace. 00180 // } // End TAO namespace. 00181 00182 TAO_END_VERSIONED_NAMESPACE_DECL 00183 00184 #include /**/ "ace/post.h" 00185 00186 #endif /* TAO_SSLIOP_PROFILE_H */