#include <DIOP_Endpoint.h>
Inheritance diagram for TAO_DIOP_Endpoint:
Public Member Functions | |
TAO_DIOP_Endpoint (void) | |
Default constructor. | |
TAO_DIOP_Endpoint (const char *host, CORBA::UShort port, const ACE_INET_Addr &addr, CORBA::Short priority=TAO_INVALID_PRIORITY) | |
TAO_DIOP_Endpoint (const ACE_INET_Addr &addr, int use_dotted_decimal_addresses) | |
Constructor. | |
TAO_DIOP_Endpoint (const char *host, CORBA::UShort port, CORBA::Short priority) | |
Constructor. This constructor is used when decoding endpoints. | |
~TAO_DIOP_Endpoint (void) | |
Destructor. | |
const ACE_INET_Addr & | object_addr (void) const |
Return a reference to the . | |
const char * | host (void) const |
const char * | host (const char *h) |
CORBA::UShort | port (void) const |
Return the port number. | |
CORBA::UShort | port (CORBA::UShort p) |
Set the port number. | |
TAO_Endpoint Methods | |
virtual TAO_Endpoint * | next (void) |
virtual int | addr_to_string (char *buffer, size_t length) |
virtual TAO_Endpoint * | duplicate (void) |
CORBA::Boolean | is_equivalent (const TAO_Endpoint *other_endpoint) |
CORBA::ULong | hash (void) |
Return a hash value for this object. | |
Private Member Functions | |
int | set (const ACE_INET_Addr &addr, int use_dotted_decimal_addresses) |
Helper method for setting INET_Addr. | |
Private Attributes | |
CORBA::String_var | host_ |
String representing the host name. | |
CORBA::UShort | port_ |
TCP port number. | |
ACE_INET_Addr | object_addr_ |
int | object_addr_set_ |
Flag to indicate if the address has been resolved and set. | |
TAO_DIOP_Endpoint * | next_ |
Friends | |
class | TAO_DIOP_Profile |
class | TAO_SSLIOP_Profile |
DIOP-specific implementation of PP Framework Endpoint interface.
Definition at line 44 of file DIOP_Endpoint.h.
|
Default constructor.
Definition at line 59 of file DIOP_Endpoint.cpp. References TAO_TAG_DIOP_PROFILE.
00060 : TAO_Endpoint (TAO_TAG_DIOP_PROFILE), 00061 host_ (), 00062 port_ (0), 00063 object_addr_ (), 00064 object_addr_set_ (0), 00065 next_ (0) 00066 { 00067 } |
|
Constructor. This is the most efficient constructor since it does not require any address resolution processing. Definition at line 43 of file DIOP_Endpoint.cpp. References TAO_TAG_DIOP_PROFILE.
00047 : TAO_Endpoint (TAO_TAG_DIOP_PROFILE, 00048 priority) 00049 , host_ () 00050 , port_ (port) 00051 , object_addr_ (addr) 00052 , object_addr_set_ (0) 00053 , next_ (0) 00054 { 00055 if (host != 0) 00056 this->host_ = host; 00057 } |
|
Constructor.
Definition at line 30 of file DIOP_Endpoint.cpp. References set(), and TAO_TAG_DIOP_PROFILE.
00033 : TAO_Endpoint (TAO_TAG_DIOP_PROFILE) 00034 , host_ () 00035 , port_ (0) 00036 , object_addr_ (addr) 00037 , object_addr_set_ (0) 00038 , next_ (0) 00039 { 00040 this->set (addr, use_dotted_decimal_addresses); 00041 } |
|
Constructor. This constructor is used when decoding endpoints.
Definition at line 69 of file DIOP_Endpoint.cpp. References TAO_Endpoint::priority(), and TAO_TAG_DIOP_PROFILE.
00072 : TAO_Endpoint (TAO_TAG_DIOP_PROFILE), 00073 host_ (), 00074 port_ (port), 00075 object_addr_ (), 00076 object_addr_set_ (0), 00077 next_ (0) 00078 { 00079 if (host != 0) 00080 this->host_ = host; 00081 00082 this->priority (priority); 00083 } |
|
Destructor.
Definition at line 85 of file DIOP_Endpoint.cpp.
00086 { 00087 00088 } |
|
Implements TAO_Endpoint. Definition at line 122 of file DIOP_Endpoint.cpp. References ACE_OS::sprintf(), and ACE_OS::strlen().
00123 { 00124 size_t const actual_len = 00125 ACE_OS::strlen (this->host_.in ()) // chars in host name 00126 + sizeof (':') // delimiter 00127 + ACE_OS::strlen ("65536") // max port 00128 + sizeof ('\0'); 00129 00130 if (length < actual_len) 00131 return -1; 00132 00133 ACE_OS::sprintf (buffer, "%s:%d", 00134 this->host_.in (), this->port_); 00135 00136 return 0; 00137 } |
|
Implements TAO_Endpoint. Definition at line 154 of file DIOP_Endpoint.cpp. References ACE_NEW_RETURN, and TAO_Endpoint::priority().
00155 { 00156 TAO_DIOP_Endpoint *endpoint = 0; 00157 00158 ACE_NEW_RETURN (endpoint, 00159 TAO_DIOP_Endpoint (this->host_.in (), 00160 this->port_, 00161 this->object_addr_, 00162 this->priority ()), 00163 0); 00164 00165 return endpoint; 00166 } |
|
Return a hash value for this object.
Implements TAO_Endpoint. Definition at line 182 of file DIOP_Endpoint.cpp. References ACE_GUARD_RETURN, ACE::hash_pjw(), port(), and TAO_SYNCH_MUTEX. Referenced by TAO_DIOP_Profile::hash().
00183 { 00184 if (this->hash_val_ != 0) 00185 return this->hash_val_; 00186 00187 { 00188 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00189 guard, 00190 this->addr_lookup_lock_, 00191 this->hash_val_); 00192 // .. DCL 00193 if (this->hash_val_ != 0) 00194 return this->hash_val_; 00195 00196 this->hash_val_ = 00197 ACE::hash_pjw (this->host ()) + this->port (); 00198 } 00199 00200 return this->hash_val_; 00201 } |
|
Copy the string into and return the resulting pointer. This object maintains ownership of this string. Definition at line 140 of file DIOP_Endpoint.cpp.
|
|
Return a pointer to the host string. This object maintains ownership of this string. Definition at line 8 of file DIOP_Endpoint.i. Referenced by TAO_DIOP_Profile::encode_endpoints(), TAO_DIOP_Acceptor::is_collocated(), and is_equivalent().
00009 { 00010 return this->host_.in (); 00011 } |
|
Return true if this endpoint is equivalent to . Two endpoints are equivalent iff their port and host are the same. Implements TAO_Endpoint. Definition at line 169 of file DIOP_Endpoint.cpp. References host(), port(), and ACE_OS::strcmp(). Referenced by TAO_DIOP_Profile::do_is_equivalent().
00170 { 00171 TAO_Endpoint *endpt = const_cast<TAO_Endpoint *> (other_endpoint); 00172 00173 TAO_DIOP_Endpoint *endpoint = dynamic_cast<TAO_DIOP_Endpoint *> (endpt); 00174 if (endpoint == 0) 00175 return 0; 00176 00177 return (this->port () == endpoint->port () 00178 && ACE_OS::strcmp(this->host (), endpoint->host()) == 0); 00179 } |
|
Implements TAO_Endpoint. Definition at line 148 of file DIOP_Endpoint.cpp.
00149 { 00150 return this->next_; 00151 } |
|
Return a reference to the .
Definition at line 204 of file DIOP_Endpoint.cpp. References ACE_GUARD_RETURN, TAO_Endpoint::addr_lookup_lock_, object_addr_, object_addr_set_, ACE_INET_Addr::set(), ACE_Addr::set_type(), and TAO_SYNCH_MUTEX. Referenced by TAO_DIOP_Connector::make_connection(), and TAO_DIOP_Connector::set_validate_endpoint().
00205 { 00206 // The object_addr_ is initialized here, rather than at IOR decode 00207 // time for several reasons: 00208 // 1. A request on the object may never be invoked. 00209 // 2. The DNS setup may have changed dynamically. 00210 // ...etc.. 00211 00212 // Double checked locking optimization. 00213 if (!this->object_addr_set_) 00214 { 00215 // We need to modify the object_addr_ in this method. Do so 00216 // using a non-const copy of the <this> pointer. 00217 TAO_DIOP_Endpoint *endpoint = 00218 const_cast<TAO_DIOP_Endpoint *> (this); 00219 00220 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00221 guard, 00222 endpoint->addr_lookup_lock_, 00223 this->object_addr_ ); 00224 00225 if (!this->object_addr_set_) 00226 { 00227 if (endpoint->object_addr_.set (this->port_, 00228 this->host_.in ()) == -1) 00229 { 00230 // If this call fails, it most likely due a hostname 00231 // lookup failure caused by a DNS misconfiguration. If 00232 // a request is made to the object at the given host and 00233 // port, then a CORBA::TRANSIENT() exception should be 00234 // thrown. 00235 00236 // Invalidate the ACE_INET_Addr. This is used as a flag 00237 // to denote that ACE_INET_Addr initialization failed. 00238 endpoint->object_addr_.set_type (-1); 00239 } 00240 else 00241 { 00242 endpoint->object_addr_set_ = 1; 00243 } 00244 } 00245 } 00246 return this->object_addr_; 00247 } |
|
Set the port number.
Definition at line 20 of file DIOP_Endpoint.i.
00021 { 00022 return this->port_ = p; 00023 } |
|
Return the port number.
Definition at line 14 of file DIOP_Endpoint.i. Referenced by TAO_DIOP_Profile::encode_endpoints(), hash(), TAO_DIOP_Acceptor::is_collocated(), is_equivalent(), and TAO_DIOP_Profile::to_string().
00015 { 00016 return this->port_; 00017 } |
|
Helper method for setting INET_Addr.
Definition at line 91 of file DIOP_Endpoint.cpp. References ACE_DEBUG, ACE_TEXT, ACE_INET_Addr::get_host_addr(), ACE_INET_Addr::get_host_name(), ACE_INET_Addr::get_port_number(), LM_DEBUG, MAXHOSTNAMELEN, CORBA::string_dup(), and TAO_debug_level. Referenced by TAO_DIOP_Endpoint().
00093 { 00094 char tmp_host[MAXHOSTNAMELEN + 1]; 00095 00096 if (use_dotted_decimal_addresses 00097 || addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0) 00098 { 00099 const char *tmp = addr.get_host_addr (); 00100 if (tmp == 0) 00101 { 00102 if (TAO_debug_level > 0) 00103 ACE_DEBUG ((LM_DEBUG, 00104 ACE_TEXT ("\n\nTAO (%P|%t) ") 00105 ACE_TEXT ("DIOP_Endpoint::set ") 00106 ACE_TEXT ("- %p\n\n"), 00107 ACE_TEXT ("cannot determine hostname"))); 00108 return -1; 00109 } 00110 else 00111 this->host_ = tmp; 00112 } 00113 else 00114 this->host_ = CORBA::string_dup (tmp_host); 00115 00116 this->port_ = addr.get_port_number(); 00117 00118 return 0; 00119 } |
|
Definition at line 48 of file DIOP_Endpoint.h. |
|
Definition at line 49 of file DIOP_Endpoint.h. |
|
String representing the host name.
Definition at line 124 of file DIOP_Endpoint.h. Referenced by TAO_DIOP_Profile::parse_string_i(). |
|
DIOP Endpoints can be stringed into a list. Return the next endpoint in the list, if any. Definition at line 138 of file DIOP_Endpoint.h. Referenced by TAO_DIOP_Profile::add_endpoint(), TAO_DIOP_Profile::do_is_equivalent(), TAO_DIOP_Profile::encode_endpoints(), and TAO_DIOP_Profile::hash(). |
|
Cached instance of for use in making invocations, etc. Definition at line 131 of file DIOP_Endpoint.h. Referenced by TAO_DIOP_Profile::decode_profile(), and object_addr(). |
|
Flag to indicate if the address has been resolved and set.
Definition at line 134 of file DIOP_Endpoint.h. Referenced by object_addr(). |
|
TCP port number.
Definition at line 127 of file DIOP_Endpoint.h. Referenced by TAO_DIOP_Profile::parse_string_i(). |