00001 // -*- C++ -*- 00002 00003 //========================================================================== 00004 /** 00005 * @file SHMIOP_Endpoint.h 00006 * 00007 * $Id: SHMIOP_Endpoint.h 73791 2006-07-27 20:54:56Z wotte $ 00008 * 00009 * SHMIOP implementation of PP Framework Endpoint interface. 00010 * 00011 * @author Marina Spivak <marina@cs.wustl.edu> 00012 */ 00013 //========================================================================== 00014 00015 #ifndef TAO_SHMIOP_ENDPOINT_H 00016 #define TAO_SHMIOP_ENDPOINT_H 00017 #include /**/ "ace/pre.h" 00018 00019 #include "tao/orbconf.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0) 00026 00027 #include "tao/CORBA_String.h" 00028 #include "tao/Endpoint.h" 00029 #include "tao/Strategies/strategies_export.h" 00030 00031 #include "ace/INET_Addr.h" 00032 #include "ace/MEM_Addr.h" 00033 00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00035 00036 /** 00037 * @class TAO_SHMIOP_Endpoint 00038 * 00039 * @brief TAO_SHMIOP_Endpoint 00040 * 00041 * SHMIOP-specific implementation of PP Framework Endpoint interface. 00042 */ 00043 class TAO_Strategies_Export TAO_SHMIOP_Endpoint : public TAO_Endpoint 00044 { 00045 public: 00046 00047 friend class TAO_SHMIOP_Profile; 00048 00049 // = Initialization and termination methods. 00050 00051 /// Default constructor. 00052 TAO_SHMIOP_Endpoint (void); 00053 00054 /// Constructor. This is the most efficient constructor since it 00055 /// does not require any address resolution processing. 00056 TAO_SHMIOP_Endpoint (const char *host, 00057 CORBA::UShort port, 00058 const ACE_INET_Addr &addr, 00059 CORBA::Short priority = TAO_INVALID_PRIORITY); 00060 00061 /// Constructor. 00062 TAO_SHMIOP_Endpoint (const ACE_MEM_Addr &addr, 00063 int use_dotted_decimal_addresses); 00064 00065 /// Constructor. -- More of a extension of the previous one. One of 00066 /// them need to go. We will decide about that as time goes by. 00067 TAO_SHMIOP_Endpoint (const ACE_INET_Addr &addr, 00068 int use_dotted_decimal_addresses); 00069 00070 /// Constructor. This constructor is used when decoding endpoints. 00071 TAO_SHMIOP_Endpoint (const char *host, 00072 CORBA::UShort port, 00073 CORBA::Short priority); 00074 00075 /// Destructor. 00076 ~TAO_SHMIOP_Endpoint (void); 00077 00078 /** 00079 * @name TAO_Endpoint Methods 00080 * 00081 * Please check the documentation in Endpoint.h for details. 00082 */ 00083 //@{ 00084 /// Return a copy of @c this 00085 virtual TAO_Endpoint *next (void); 00086 virtual int addr_to_string (char *buffer, size_t length); 00087 virtual TAO_Endpoint *duplicate (void); 00088 00089 /// Return true if this endpoint is equivalent to @a other_endpoint. Two 00090 /// endpoints are equivalent iff their port and host are the same. 00091 CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint); 00092 00093 /// Return a hash value for this object. 00094 CORBA::ULong hash (void); 00095 //@} 00096 00097 // = SHMIOP_Endpoint-specific methods. 00098 00099 /// Return a reference to the <object_addr>. 00100 const ACE_INET_Addr &object_addr (void) const; 00101 00102 /// Return a pointer to the host string. This object maintains 00103 /// ownership of this string. 00104 const char *host (void) const; 00105 00106 /// Copy the string <h> into <host_> and return the resulting pointer. 00107 /// This object maintains ownership of this string. 00108 const char *host (const char *h); 00109 00110 /// Return the port number. 00111 CORBA::UShort port (void) const; 00112 00113 /// Set the port number. 00114 CORBA::UShort port (CORBA::UShort p); 00115 00116 private: 00117 /// Helper method for setting INET_Addr. 00118 int set (const ACE_INET_Addr &addr, 00119 int use_dotted_decimal_addresses); 00120 00121 /// String representing the host name. 00122 CORBA::String_var host_; 00123 00124 /// TCP port number. 00125 CORBA::UShort port_; 00126 00127 /// Cached instance of <ACE_INET_Addr> for use in making 00128 /// invocations, etc. 00129 ACE_INET_Addr object_addr_; 00130 00131 /// Flag to indicate if the address has been resolved and set. 00132 int object_addr_set_; 00133 00134 /// SHMIOP Endpoints can be stringed into a list. Return the next 00135 /// endpoint in the list, if any. 00136 TAO_SHMIOP_Endpoint *next_; 00137 }; 00138 00139 TAO_END_VERSIONED_NAMESPACE_DECL 00140 00141 #if defined (__ACE_INLINE__) 00142 # include "tao/Strategies/SHMIOP_Endpoint.inl" 00143 #endif /* __ACE_INLINE__ */ 00144 00145 #endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */ 00146 00147 #include /**/ "ace/post.h" 00148 #endif /* TAO_IIOP_PROFILE_H */