IIOP_Profile.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file     IIOP_Profile.h
00006  *
00007  *  $Id: IIOP_Profile.h 78994 2007-07-23 11:45:55Z johnnyw $
00008  *
00009  *  IIOP profile specific processing.
00010  *
00011  *  @author  Fred Kuhns <fredk@cs.wustl.edu>
00012  */
00013 //=============================================================================
00014 
00015 
00016 #ifndef TAO_IIOP_PROFILE_H
00017 #define TAO_IIOP_PROFILE_H
00018 
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "tao/orbconf.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
00028 
00029 #include "tao/Profile.h"
00030 #include "tao/IIOP_Endpoint.h"
00031 
00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00033 
00034 // TAO IIOP_Profile concrete Profile definitions
00035 /**
00036  * @class TAO_IIOP_Profile
00037  *
00038  * @brief This class defines the protocol specific attributes required
00039  * for locating ORBs over a TCP/IP network.
00040  *
00041  * This class defines the IIOP profile as specified in the CORBA
00042  * specification.
00043  */
00044 class TAO_Export TAO_IIOP_Profile : public TAO_Profile
00045 {
00046 public:
00047 
00048   //@@ TAO_PROFILE_SPL_PUBLIC_METHODS_COPY_HOOK_START
00049   static const char object_key_delimiter_;
00050 
00051   /// Return the char string prefix.
00052   static const char *prefix (void);
00053 
00054   /// Profile constructor, same as above except the object_key has
00055   /// already been marshaled.
00056   TAO_IIOP_Profile (const ACE_INET_Addr &addr,
00057                     const TAO::ObjectKey &object_key,
00058                     const TAO_GIOP_Message_Version &version,
00059                     TAO_ORB_Core *orb_core);
00060 
00061   /// Profile constructor, this is the most efficient since it
00062   /// doesn't require any address resolution processing.
00063   TAO_IIOP_Profile (const char *host,
00064                     CORBA::UShort port,
00065                     const TAO::ObjectKey &object_key,
00066                     const ACE_INET_Addr &addr,
00067                     const TAO_GIOP_Message_Version &version,
00068                     TAO_ORB_Core *orb_core);
00069 
00070   /// Profile constructor, default.
00071   TAO_IIOP_Profile (TAO_ORB_Core *orb_core);
00072 
00073   /**
00074    * Add @a endp to this profile's list of endpoints (it is inserted
00075    * next to the head of the list).  This profiles takes ownership of
00076    * @a endp.
00077    */
00078   void add_endpoint (TAO_IIOP_Endpoint *endp);
00079 
00080   /**
00081    * Remove @a endp from this profile's list of endpoints and free the
00082    * @a endp memory.
00083    * This method assumes @a endp is in this profile's endpoint list.
00084    */
00085   void remove_endpoint (TAO_IIOP_Endpoint *endp);
00086 
00087   virtual void remove_generic_endpoint (TAO_Endpoint *ep);
00088 
00089   /// Add an endpoint when the specific endpoint type is unknown
00090   virtual void add_generic_endpoint (TAO_Endpoint *ep);
00091 
00092   //@@ TAO_PROFILE_SPL_PUBLIC_METHODS_COPY_HOOK_END
00093 
00094   /// The object key delimiter that IIOP uses or expects.
00095   virtual char object_key_delimiter (void) const;
00096 
00097   /// Template methods. Please see Profile.h for documentation.
00098   virtual char * to_string (void);
00099 
00100   /// Encode endpoints for RT profiles, using a single TAO_TAG_ENDPOINT
00101   /// component.
00102   virtual int encode_endpoints (void);
00103 
00104   /// Encode alternate endpoints for non-RT profiles, using multiple
00105   /// TAG_ALTERNATE_IIOP_ADDRESS components, one endpoint per component
00106   virtual int encode_alternate_endpoints (void);
00107   virtual TAO_Endpoint *endpoint (void);
00108 
00109   /// Since SSLIOP_Profile derives from IIOP_Profile, but SSLIOP_Endpoint
00110   /// does not derive from IIOP_Endpoint, it is necessary to have a way
00111   /// of always getting the IIOP_Endpoint using a generic interface
00112   /// regardless of the final type of the profile.
00113   virtual TAO_Endpoint *base_endpoint (void);
00114 
00115   virtual CORBA::ULong endpoint_count (void) const;
00116   virtual CORBA::ULong hash (CORBA::ULong max);
00117 
00118 protected:
00119   /// Destructor is to be called only through <_decr_refcnt>.
00120   ~TAO_IIOP_Profile (void);
00121 
00122   /**
00123    * Helper method for encode_endpoints to deal with RT requests.
00124    *
00125    * Encodes this profile's endpoints into a tagged component.
00126    * This is done only if RTCORBA is enabled, since currently this is
00127    * the only case when we have more than one endpoint per profile.
00128    * Returns 0 on success and -1 on failure.
00129    *
00130    * Endpoints are transmitted using TAO-proprietory tagged component.
00131    * Component tag is TAO_TAG_ENDPOINTS and component data is an
00132    * encapsulation of a sequence of structs, each representing a
00133    * single endpoint.  Data format is specified in iiop_endpoins.pidl.
00134    */
00135 
00136   //@@ TAO_PROFILE_SPL_PROTECTED_METHODS_COPY_HOOK_START
00137 
00138   int encode_endpoints_for_rt (void);
00139 
00140   //@@ TAO_PROFILE_SPL_PROTECTED_METHODS_COPY_HOOK_END
00141 
00142   /// Template methods. Please see Profile.h for the documentation.
00143   virtual int decode_profile (TAO_InputCDR &cdr);
00144   virtual int decode_endpoints (void);
00145   virtual void parse_string_i (const char *string
00146                               );
00147   virtual void create_profile_body (TAO_OutputCDR &cdr) const;
00148   virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile);
00149 
00150 protected:
00151 
00152   /**
00153    * Head of this profile's list of endpoints.  This endpoint is not
00154    * dynamically allocated because a profile always contains at least
00155    * one endpoint.
00156    *
00157    * Currently, a profile contains more than one endpoint, i.e.,
00158    * list contains more than just the head, only for two cases
00159    * (1) when RTCORBA is enabled and
00160    * (2) the ORB is initialized with -ORBPreferredInterfaces option.
00161    * However, in the near future, this will be used in for mode as
00162    * well, e.g., to support TAG_ALTERNATE_IIOP_ADDRESS  feature.
00163    *
00164    * This is probably as good a place to discuss how the list of
00165    * endpoints is used for #2. If the ORB is configured to use
00166    * preferred interfaces for invocation, TAO creates an endpoint per
00167    * preferred interface. To be clear, every tuple
00168    * <destination:target> will have an endpoint. What TAO essentially
00169    * does is that creates it multiple endpoints so that the invocation
00170    * code path can use existing iterating techniques to try one
00171    * preferred interface after another (if the first did not work). If
00172    * the ORB is configured with -ORBEnforcePreferredInterface set to
00173    * false in addition to the ORBPreferredInterfaces option , TAO
00174    * creates another endpoint with the preferred bit set to null, so
00175    * that the invocation code can fall back to a TCP stack returned
00176    * local address.
00177    * Addressing info of the default endpoint, i.e., head of the list,
00178    * is transmitted using standard IIOP ProfileBody components.  See
00179    * <encode_endpoints> method documentation above for how the rest of
00180    * the endpoint list is transmitted.
00181    */
00182 
00183   //@@ TAO_PROFILE_SPL_PRIVATE_DATA_COPY_HOOK_START
00184 
00185   TAO_IIOP_Endpoint endpoint_;
00186 
00187   /// Number of endpoints in the list headed by <endpoint_>.
00188   CORBA::ULong count_;
00189 
00190   //@@ TAO_PROFILE_SPL_PRIVATE_DATA_COPY_HOOK_END
00191 };
00192 
00193 TAO_END_VERSIONED_NAMESPACE_DECL
00194 
00195 #endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
00196 
00197 #include /**/ "ace/post.h"
00198 
00199 #endif  /* TAO_IIOP_PROFILE_H */

Generated on Sun Jan 27 13:07:33 2008 for TAO by doxygen 1.3.6