00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SCIOP_Profile.h 00006 * 00007 * $Id: SCIOP_Profile.h 76551 2007-01-24 13:42:44Z johnnyw $ 00008 * 00009 * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com> 00010 * @author Keith O'Hara, Lockheed Martin ATL 00011 */ 00012 //============================================================================= 00013 00014 00015 #ifndef TAO_SCIOP_PROFILE_H 00016 #define TAO_SCIOP_PROFILE_H 00017 00018 #include /**/ "ace/pre.h" 00019 00020 #include "tao/orbconf.h" 00021 00022 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00023 # pragma once 00024 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00025 00026 #if TAO_HAS_SCIOP == 1 00027 00028 #include "tao/Strategies/SCIOP_Endpoint.h" 00029 #include "tao/Profile.h" 00030 00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 // TAO SCIOP_Profile concrete Profile definitions 00034 /** 00035 * @class TAO_SCIOP_Profile 00036 * 00037 * @brief This class defines the protocol specific attributes required 00038 * for locating ORBs over a TCP/IP network. 00039 * 00040 * This class defines the SCIOP profile as specified in the CORBA 00041 * specification. 00042 */ 00043 class TAO_Strategies_Export TAO_SCIOP_Profile : public TAO_Profile 00044 { 00045 public: 00046 /// The object key delimiter that SCIOP uses or expects. 00047 static const char object_key_delimiter_; 00048 virtual char object_key_delimiter (void) const; 00049 00050 /// Return the char string prefix. 00051 static const char *prefix (void); 00052 00053 /// Profile constructor, same as above except the object_key has 00054 /// already been marshaled. 00055 TAO_SCIOP_Profile (const ACE_INET_Addr &addr, 00056 const TAO::ObjectKey &object_key, 00057 const TAO_GIOP_Message_Version &version, 00058 TAO_ORB_Core *orb_core); 00059 00060 /// Profile constructor, this is the most efficient since it 00061 /// doesn't require any address resolution processing. 00062 TAO_SCIOP_Profile (const char *host, 00063 CORBA::UShort port, 00064 const TAO::ObjectKey &object_key, 00065 const ACE_INET_Addr &addr, 00066 const TAO_GIOP_Message_Version &version, 00067 TAO_ORB_Core *orb_core); 00068 00069 /// Profile constructor, default. 00070 TAO_SCIOP_Profile (TAO_ORB_Core *orb_core); 00071 00072 /// Destructor is to be called only through <_decr_refcnt>. 00073 ~TAO_SCIOP_Profile (void); 00074 00075 /// Template methods. Please see Profile.h for documentation. 00076 virtual char * to_string (void); 00077 virtual int encode_endpoints (void); 00078 virtual TAO_Endpoint *endpoint (void); 00079 virtual CORBA::ULong endpoint_count (void) const; 00080 virtual CORBA::ULong hash (CORBA::ULong max 00081 ); 00082 /** 00083 * Add <endp> to this profile's list of endpoints (it is inserted 00084 * next to the head of the list). This profiles takes ownership of 00085 * <endp>. 00086 */ 00087 void add_endpoint (TAO_SCIOP_Endpoint *endp); 00088 00089 protected: 00090 00091 /// Template methods. Please see Profile.h for the documentation. 00092 virtual int decode_profile (TAO_InputCDR &cdr); 00093 virtual int decode_endpoints (void); 00094 virtual void parse_string_i (const char *string 00095 ); 00096 virtual void create_profile_body (TAO_OutputCDR &cdr) const; 00097 virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile); 00098 00099 protected: 00100 00101 /** 00102 * Head of this profile's list of endpoints. This endpoint is not 00103 * dynamically allocated because a profile always contains at least 00104 * one endpoint. 00105 * 00106 * Currently, a profile contains more than one endpoint, i.e., 00107 * list contains more than just the head, only for two cases 00108 * (1) when RTCORBA is enabled and 00109 * (2) the ORB is initialized with -ORBPreferredInterfaces option. 00110 * However, in the near future, this will be used in for mode as 00111 * well, e.g., to support TAG_ALTERNATE_IIOP_ADDRESS feature. 00112 * 00113 * This is probably as good a place to discuss how the list of 00114 * endpoints is used for #2. If the ORB is configured to use 00115 * preferred interfaces for invocation, TAO creates an endpoint per 00116 * preferred interface. To be clear, every tuple 00117 * <destination:target> will have an endpoint. What TAO essentially 00118 * does is that creates it multiple endpoints so that the invocation 00119 * code path can use existing iterating techniques to try one 00120 * preferred interface after another (if the first did not work). If 00121 * the ORB is configured with -ORBEnforcePreferredInterface set to 00122 * false in addition to the ORBPreferredInterfaces option , TAO 00123 * creates another endpoint with the preferred bit set to null, so 00124 * that the invocation code can fall back to a SCTP stack returned 00125 * local address. 00126 * Addressing info of the default endpoint, i.e., head of the list, 00127 * is transmitted using standard SCIOP ProfileBody components. See 00128 * <encode_endpoints> method documentation above for how the rest of 00129 * the endpoint list is transmitted. 00130 */ 00131 TAO_SCIOP_Endpoint endpoint_; 00132 00133 /// Number of endpoints in the list headed by <endpoint_>. 00134 CORBA::ULong count_; 00135 }; 00136 00137 TAO_END_VERSIONED_NAMESPACE_DECL 00138 00139 #endif /* TAO_HAS_SCIOP == 1 */ 00140 00141 #include /**/ "ace/post.h" 00142 00143 #endif /* TAO_SCIOP_PROFILE_H */