SCIOP_Endpoint.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //===========================================================================
00004 /**
00005  *  @file     SCIOP_Endpoint.h
00006  *
00007  *  SCIOP implementation of PP Framework Endpoint interface.
00008  *
00009  *  SCIOP_Endpoint.h,v 1.15 2006/04/19 11:38:50 jwillemsen Exp
00010  *
00011  *  @author  Jason Cohen, Lockheed Martin ATL  <jcohen@atl.lmco.com>
00012  *  @author  Keith O'Hara, Lockheed Martin ATL
00013  */
00014 //==========================================================================
00015 
00016 
00017 #ifndef TAO_SCIOP_ENDPOINT_H
00018 #define TAO_SCIOP_ENDPOINT_H
00019 
00020 #include /**/ "ace/pre.h"
00021 
00022 #include "tao/orbconf.h"
00023 
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 #if TAO_HAS_SCIOP == 1
00029 #include "tao/Endpoint.h"
00030 #include "tao/Strategies/strategies_export.h"
00031 #include "tao/CORBA_String.h"
00032 #include "ace/INET_Addr.h"
00033 #include "tao/IIOP_EndpointsC.h"
00034 
00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00036 
00037 class TAO_SCIOP_Connection_Handler;
00038 
00039 /**
00040  * @class TAO_SCIOP_Endpoint
00041  *
00042  * @brief TAO_SCIOP_Endpoint
00043  *
00044  * SCIOP-specific implementation of PP Framework Endpoint interface.
00045  */
00046 class TAO_Strategies_Export TAO_SCIOP_Endpoint : public TAO_Endpoint
00047 {
00048 public:
00049 
00050   // @todo Lose these friends!
00051   friend class TAO_SCIOP_Profile;
00052   friend class TAO_SSLIOP_Profile;
00053 
00054   // = Initialization and termination methods.
00055 
00056   /// Default constructor.
00057   TAO_SCIOP_Endpoint (void);
00058 
00059   /// Constructor.  This is the most efficient constructor since it
00060   /// does not require any address resolution processing.
00061   TAO_SCIOP_Endpoint (const char *host,
00062                       CORBA::UShort port,
00063                       const ACE_INET_Addr &addr,
00064                       CORBA::Short priority = TAO_INVALID_PRIORITY);
00065 
00066   /// Constructor.
00067   TAO_SCIOP_Endpoint (const ACE_INET_Addr &addr,
00068                      int use_dotted_decimal_addresses);
00069 
00070   /// Constructor.  This constructor is used when decoding endpoints.
00071   TAO_SCIOP_Endpoint (const char *host,
00072                      CORBA::UShort port,
00073                      CORBA::Short priority);
00074 
00075   /// Destructor.
00076   ~TAO_SCIOP_Endpoint (void);
00077 
00078   // = Implementation of abstract TAO_Endpoint methods.  See
00079   // Endpoint.h for their documentation.
00080 
00081   virtual TAO_Endpoint *next (void);
00082   virtual int addr_to_string (char *buffer, size_t length);
00083   virtual TAO_Endpoint *duplicate (void);
00084 
00085   /// Return true if this endpoint is equivalent to <other_endpoint>.  Two
00086   /// endpoints are equivalent iff their port and host are the same.
00087   virtual CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);
00088 
00089   /// Return a hash value for this object.
00090   virtual CORBA::ULong hash (void);
00091 
00092   // = SCIOP_Endpoint-specific methods.
00093 
00094   /// Return a reference to the <object_addr>.
00095   const ACE_INET_Addr &object_addr (void) const;
00096 
00097   /// Return a pointer to the host string.  This object maintains
00098   /// ownership of this string.
00099   const char *host (void) const;
00100 
00101   /// Copy the string <h> into <host_> and return the resulting pointer.
00102   /// This object maintains ownership of this string.
00103   const char *host (const char *h);
00104 
00105   /// Return the port number.
00106   CORBA::UShort port (void) const;
00107 
00108   /// Set the port number.
00109   CORBA::UShort port (CORBA::UShort p);
00110 
00111   /// Do we have a preferred local network for the target?
00112   bool is_preferred_network (void) const;
00113 
00114   /// Return the preferred network if any.
00115   const char *preferred_network (void) const;
00116 
00117 private:
00118 
00119   /// Helper method for setting INET_Addr.
00120   int set (const ACE_INET_Addr &addr,
00121            int use_dotted_decimal_addresses);
00122 
00123   /// Helper method for object_addr ().
00124   void object_addr_i (void) const;
00125 
00126   /// Generate preferred interfaces from the options passed in by the
00127   /// user.
00128   CORBA::ULong preferred_interfaces (TAO_ORB_Core *oc);
00129 
00130   /// Canonical copy constructor
00131   /**
00132    * In private section to prevent clients from invoking this
00133    * accidentally. Clients should only use duplicate () to make a depp
00134    * copy
00135    */
00136   TAO_SCIOP_Endpoint (const TAO_SCIOP_Endpoint &);
00137 
00138 
00139   /// String representing the host name.
00140   CORBA::String_var host_;
00141 
00142   /// TCP port number.
00143   CORBA::UShort port_;
00144 
00145   /// Cached instance of <ACE_INET_Addr> for use in making
00146   /// invocations, etc.
00147   mutable ACE_INET_Addr object_addr_;
00148 
00149   /// Flag to indicate if the address has been resolved and set.
00150   mutable int object_addr_set_;
00151 
00152   /// Preferred path for this endpoint.
00153   TAO::IIOP_Endpoint_Info preferred_path_;
00154 
00155   /// Is this endpoint created encodable as part of the IOR?
00156   bool is_encodable_;
00157 
00158   /// SCIOP Endpoints can be stringed into a list.  Return the next
00159   /// endpoint in the list, if any.
00160   TAO_SCIOP_Endpoint *next_;
00161 };
00162 
00163 TAO_END_VERSIONED_NAMESPACE_DECL
00164 
00165 #if defined (__ACE_INLINE__)
00166 # include "tao/Strategies/SCIOP_Endpoint.i"
00167 #endif /* __ACE_INLINE__ */
00168 
00169 #endif /* TAO_HAS_SCIOP == 1 */
00170 
00171 #include /**/ "ace/post.h"
00172 #endif  /* TAO_SCIOP_PROFILE_H */

Generated on Thu Nov 9 13:39:29 2006 for TAO_Strategies by doxygen 1.3.6