IIOP_Profile.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file     IIOP_Profile.h
00006  *
00007  *  IIOP_Profile.h,v 1.77 2006/04/26 17:12:47 mesnier_p Exp
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 (ACE_ENV_SINGLE_ARG_DECL);
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   virtual CORBA::ULong endpoint_count (void) const;
00109   virtual CORBA::ULong hash (CORBA::ULong max
00110                              ACE_ENV_ARG_DECL);
00111 
00112 protected:
00113   /// Destructor is to be called only through <_decr_refcnt>.
00114   ~TAO_IIOP_Profile (void);
00115 
00116   /**
00117    * Helper method for encode_endpoints to deal with RT requests.
00118    *
00119    * Encodes this profile's endpoints into a tagged component.
00120    * This is done only if RTCORBA is enabled, since currently this is
00121    * the only case when we have more than one endpoint per profile.
00122    * Returns 0 on success and -1 on failure.
00123    *
00124    * Endpoints are transmitted using TAO-proprietory tagged component.
00125    * Component tag is TAO_TAG_ENDPOINTS and component data is an
00126    * encapsulation of a sequence of structs, each representing a
00127    * single endpoint.  Data format is specified in iiop_endpoins.pidl.
00128    */
00129 
00130   //@@ TAO_PROFILE_SPL_PROTECTED_METHODS_COPY_HOOK_START
00131 
00132   int encode_endpoints_for_rt (void);
00133 
00134   //@@ TAO_PROFILE_SPL_PROTECTED_METHODS_COPY_HOOK_END
00135 
00136   /// Template methods. Please see Profile.h for the documentation.
00137   virtual int decode_profile (TAO_InputCDR &cdr);
00138   virtual int decode_endpoints (void);
00139   virtual void parse_string_i (const char *string
00140                                ACE_ENV_ARG_DECL);
00141   virtual void create_profile_body (TAO_OutputCDR &cdr) const;
00142   virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile);
00143 
00144 protected:
00145 
00146   /**
00147    * Head of this profile's list of endpoints.  This endpoint is not
00148    * dynamically allocated because a profile always contains at least
00149    * one endpoint.
00150    *
00151    * Currently, a profile contains more than one endpoint, i.e.,
00152    * list contains more than just the head, only for two cases
00153    * (1) when RTCORBA is enabled and
00154    * (2) the ORB is initialized with -ORBPreferredInterfaces option.
00155    * However, in the near future, this will be used in for mode as
00156    * well, e.g., to support TAG_ALTERNATE_IIOP_ADDRESS  feature.
00157    *
00158    * This is probably as good a place to discuss how the list of
00159    * endpoints is used for #2. If the ORB is configured to use
00160    * preferred interfaces for invocation, TAO creates an endpoint per
00161    * preferred interface. To be clear, every tuple
00162    * <destination:target> will have an endpoint. What TAO essentially
00163    * does is that creates it multiple endpoints so that the invocation
00164    * code path can use existing iterating techniques to try one
00165    * preferred interface after another (if the first did not work). If
00166    * the ORB is configured with -ORBEnforcePreferredInterface set to
00167    * false in addition to the ORBPreferredInterfaces option , TAO
00168    * creates another endpoint with the preferred bit set to null, so
00169    * that the invocation code can fall back to a TCP stack returned
00170    * local address.
00171    * Addressing info of the default endpoint, i.e., head of the list,
00172    * is transmitted using standard IIOP ProfileBody components.  See
00173    * <encode_endpoints> method documentation above for how the rest of
00174    * the endpoint list is transmitted.
00175    */
00176 
00177   //@@ TAO_PROFILE_SPL_PRIVATE_DATA_COPY_HOOK_START
00178 
00179   TAO_IIOP_Endpoint endpoint_;
00180 
00181   /// Number of endpoints in the list headed by <endpoint_>.
00182   CORBA::ULong count_;
00183 
00184   //@@ TAO_PROFILE_SPL_PRIVATE_DATA_COPY_HOOK_END
00185 };
00186 
00187 TAO_END_VERSIONED_NAMESPACE_DECL
00188 
00189 #endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
00190 
00191 #include /**/ "ace/post.h"
00192 
00193 #endif  /* TAO_IIOP_PROFILE_H */

Generated on Thu Nov 9 11:54:13 2006 for TAO by doxygen 1.3.6