00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file DIOP_Endpoint.h 00006 * 00007 * $Id: DIOP_Endpoint.h 78851 2007-07-12 12:06:21Z vridosh $ 00008 * 00009 * DIOP implementation of PP Framework Endpoint interface. 00010 * 00011 * @author Michael Kircher 00012 */ 00013 //============================================================================= 00014 00015 00016 #ifndef TAO_DIOP_ENDPOINT_H 00017 #define TAO_DIOP_ENDPOINT_H 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 defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0) 00027 00028 #include "tao/Strategies/strategies_export.h" 00029 #include "tao/Endpoint.h" 00030 #include "tao/CORBA_String.h" 00031 #include "ace/INET_Addr.h" 00032 00033 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00034 00035 class TAO_DIOP_Connection_Handler; 00036 00037 /** 00038 * @class TAO_DIOP_Endpoint 00039 * 00040 * @brief TAO_DIOP_Endpoint 00041 * 00042 * DIOP-specific implementation of PP Framework Endpoint interface. 00043 */ 00044 class TAO_Strategies_Export TAO_DIOP_Endpoint : public TAO_Endpoint 00045 { 00046 public: 00047 00048 friend class TAO_DIOP_Profile; 00049 friend class TAO_SSLIOP_Profile; 00050 00051 // = Initialization and termination methods. 00052 00053 /// Default constructor. 00054 TAO_DIOP_Endpoint (void); 00055 00056 /// Constructor. This is the most efficient constructor since it 00057 /// does not require any address resolution processing. 00058 TAO_DIOP_Endpoint (const char *host, 00059 CORBA::UShort port, 00060 const ACE_INET_Addr &addr, 00061 CORBA::Short priority = TAO_INVALID_PRIORITY); 00062 00063 /// Constructor. 00064 TAO_DIOP_Endpoint (const ACE_INET_Addr &addr, 00065 int use_dotted_decimal_addresses); 00066 00067 /// Constructor. This constructor is used when decoding endpoints. 00068 TAO_DIOP_Endpoint (const char *host, 00069 CORBA::UShort port, 00070 CORBA::Short priority); 00071 00072 /// Destructor. 00073 ~TAO_DIOP_Endpoint (void); 00074 00075 /** 00076 * @name TAO_Endpoint Methods 00077 * 00078 * Please check the documentation in Endpoint.h for details. 00079 */ 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 CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint); 00088 00089 /// Return a hash value for this object. 00090 CORBA::ULong hash (void); 00091 //@} 00092 00093 // Allocates memory and returns a copy of <this> 00094 00095 // = DIOP_Endpoint-specific methods. 00096 00097 /// Return a reference to the <object_addr>. 00098 const ACE_INET_Addr &object_addr (void) const; 00099 00100 /// Return a pointer to the host string. This object maintains 00101 /// ownership of this string. 00102 const char *host (void) const; 00103 00104 /// Copy the string <h> into <host_> and return the resulting pointer. 00105 /// This object maintains ownership of this string. 00106 const char *host (const char *h); 00107 00108 /// Return the port number. 00109 CORBA::UShort port (void) const; 00110 00111 /// Set the port number. 00112 CORBA::UShort port (CORBA::UShort p); 00113 00114 private: 00115 00116 /// Helper method for setting INET_Addr. 00117 int set (const ACE_INET_Addr &addr, 00118 int use_dotted_decimal_addresses); 00119 00120 /// Helper method for object_addr () call. 00121 void object_addr_i (void) const; 00122 00123 /// String representing the host name. 00124 CORBA::String_var host_; 00125 00126 /// TCP port number. 00127 CORBA::UShort port_; 00128 00129 #if defined (ACE_HAS_IPV6) 00130 /// Does the host string represent an IPv6 decimal address. 00131 bool is_ipv6_decimal_; 00132 #endif /* ACE_HAS_IPV6 */ 00133 00134 /// Cached instance of <ACE_INET_Addr> for use in making 00135 /// invocations, etc. 00136 mutable ACE_INET_Addr object_addr_; 00137 00138 /// Flag to indicate if the address has been resolved and set. 00139 mutable bool object_addr_set_; 00140 00141 /// DIOP Endpoints can be stringed into a list. Return the next 00142 /// endpoint in the list, if any. 00143 TAO_DIOP_Endpoint *next_; 00144 }; 00145 00146 TAO_END_VERSIONED_NAMESPACE_DECL 00147 00148 #if defined (__ACE_INLINE__) 00149 # include "tao/Strategies/DIOP_Endpoint.inl" 00150 #endif /* __ACE_INLINE__ */ 00151 00152 #endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */ 00153 00154 #include /**/ "ace/post.h" 00155 #endif /* TAO_DIOP_PROFILE_H */