TAO_IIOP_Endpoint Class Reference

TAO_IIOP_Endpoint. More...

#include <IIOP_Endpoint.h>

Inheritance diagram for TAO_IIOP_Endpoint:

Inheritance graph
[legend]
Collaboration diagram for TAO_IIOP_Endpoint:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_IIOP_Endpoint (void)
 Default constructor.

 TAO_IIOP_Endpoint (const char *host, CORBA::UShort port, const ACE_INET_Addr &addr, CORBA::Short priority=TAO_INVALID_PRIORITY)
 TAO_IIOP_Endpoint (const ACE_INET_Addr &addr, int use_dotted_decimal_addresses)
 Constructor.

 TAO_IIOP_Endpoint (const char *host, CORBA::UShort port, CORBA::Short priority)
 Constructor. This constructor is used when decoding endpoints.

 ~TAO_IIOP_Endpoint (void)
 Destructor.

virtual TAO_Endpointnext (void)
 Endpoints can be linked in a list.

virtual TAO_Endpointnext_filtered (TAO_ORB_Core *, TAO_Endpoint *root)
virtual int addr_to_string (char *buffer, size_t length)
 Return a string representation for the address.

virtual TAO_Endpointduplicate (void)
 Makes a copy of this.

virtual CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint)
virtual CORBA::ULong hash (void)
 Return a hash value for this object.

const ACE_INET_Addrobject_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.

bool is_preferred_network (void) const
 Do we have a preferred local network for the target?

const char * preferred_network (void) const
 Return the preferred network if any.

bool is_ipv6_decimal (void) const
 Does the host string represent an IPv6 decimal address.

TAO_IIOP_Endpointoperator= (const TAO_IIOP_Endpoint &other)

Private Member Functions

TAO_IIOP_Endpointnext_filtered_i (TAO_IIOP_Endpoint *root, bool ipv6_only, bool prefer_ipv6, bool want_ipv6)
int set (const ACE_INET_Addr &addr, int use_dotted_decimal_addresses)
 Helper method for setting INET_Addr.

void object_addr_i (void) const
 Helper method for object_addr () call.

CORBA::ULong preferred_interfaces (const char *csvPreferred, bool enforce)
TAO_IIOP_Endpointadd_local_endpoint (TAO_IIOP_Endpoint *ep, const char *local)
 TAO_IIOP_Endpoint (const TAO_IIOP_Endpoint &)
 Canonical copy constructor.


Private Attributes

CORBA::String_var host_
 String representing the host name.

CORBA::UShort port_
 TCP port number.

bool is_ipv6_decimal_
 Does the host string represent an IPv6 decimal address.

bool is_encodable_
 Is this endpoint created encodable as part of the IOR?

bool object_addr_set_
 Flag to indicate if the address has been resolved and set.

ACE_INET_Addr object_addr_
TAO::IIOP_Endpoint_Info preferred_path_
 Preferred path for this endpoint.

TAO_IIOP_Endpointnext_

Friends

class TAO_IIOP_Profile
class TAO_SSLIOP_Profile

Detailed Description

TAO_IIOP_Endpoint.

IIOP-specific implementation of PP Framework Endpoint interface.

Definition at line 45 of file IIOP_Endpoint.h.


Constructor & Destructor Documentation

TAO_IIOP_Endpoint::TAO_IIOP_Endpoint void   ) 
 

Default constructor.

Definition at line 77 of file IIOP_Endpoint.cpp.

00078   : TAO_Endpoint (IOP::TAG_INTERNET_IOP)
00079   , host_ ()
00080   , port_ (683)  // default port (IANA assigned)
00081 #if defined (ACE_HAS_IPV6)
00082   , is_ipv6_decimal_ (false)
00083 #endif /* ACE_HAS_IPV6 */
00084   , is_encodable_ (true)
00085   , object_addr_set_ (false)
00086   , object_addr_ ()
00087   , preferred_path_ ()
00088   , next_ (0)
00089 {
00090 }

TAO_IIOP_Endpoint::TAO_IIOP_Endpoint const char *  host,
CORBA::UShort  port,
const ACE_INET_Addr addr,
CORBA::Short  priority = TAO_INVALID_PRIORITY
 

Constructor. This is the most efficient constructor since it does not require any address resolution processing.

Definition at line 58 of file IIOP_Endpoint.cpp.

References host().

00062   : TAO_Endpoint (IOP::TAG_INTERNET_IOP, priority)
00063   , host_ ()
00064   , port_ (port)
00065 #if defined (ACE_HAS_IPV6)
00066   , is_ipv6_decimal_ (false)
00067 #endif /* ACE_HAS_IPV6 */
00068   , is_encodable_ (true)
00069   , object_addr_set_ (false)
00070   , object_addr_ (addr)
00071   , preferred_path_ ()
00072   , next_ (0)
00073 {
00074   this->host(host); // With IPv6 performs check for decimal address
00075 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_IIOP_Endpoint::TAO_IIOP_Endpoint const ACE_INET_Addr addr,
int  use_dotted_decimal_addresses
 

Constructor.

Definition at line 41 of file IIOP_Endpoint.cpp.

References set().

00043   : TAO_Endpoint (IOP::TAG_INTERNET_IOP)
00044   , host_ ()
00045   , port_ (683) // default port (IANA assigned)
00046 #if defined (ACE_HAS_IPV6)
00047   , is_ipv6_decimal_ (false)
00048 #endif /* ACE_HAS_IPV6 */
00049   , is_encodable_ (true)
00050   , object_addr_set_ (false)
00051   , object_addr_ (addr)
00052   , preferred_path_ ()
00053   , next_ (0)
00054 {
00055   this->set (addr, use_dotted_decimal_addresses);
00056 }

TAO_IIOP_Endpoint::TAO_IIOP_Endpoint const char *  host,
CORBA::UShort  port,
CORBA::Short  priority
 

Constructor. This constructor is used when decoding endpoints.

Definition at line 92 of file IIOP_Endpoint.cpp.

References host().

00095   : TAO_Endpoint (IOP::TAG_INTERNET_IOP, priority)
00096   , host_ ()
00097   , port_ (port)
00098 #if defined (ACE_HAS_IPV6)
00099   , is_ipv6_decimal_ (false)
00100 #endif /* ACE_HAS_IPV6 */
00101   , is_encodable_ (true)
00102   , object_addr_set_ (false)
00103   , object_addr_ ()
00104   , preferred_path_ ()
00105   , next_ (0)
00106 {
00107   this->host(host); // With IPv6 performs check for decimal address
00108 }

TAO_IIOP_Endpoint::~TAO_IIOP_Endpoint void   ) 
 

Destructor.

Definition at line 128 of file IIOP_Endpoint.cpp.

00129 {
00130 }

TAO_IIOP_Endpoint::TAO_IIOP_Endpoint const TAO_IIOP_Endpoint  )  [private]
 

Canonical copy constructor.

In private section to prevent clients from invoking this accidentally. Clients should only use duplicate () to make a depp copy

Definition at line 134 of file IIOP_Endpoint.cpp.

00135   : TAO_Endpoint (rhs.tag_, rhs.priority_)
00136   , host_ (rhs.host_)
00137   , port_ (rhs.port_)
00138 #if defined (ACE_HAS_IPV6)
00139   , is_ipv6_decimal_ (rhs.is_ipv6_decimal_)
00140 #endif /* ACE_HAS_IPV6 */
00141   , is_encodable_ (rhs.is_encodable_)
00142   , object_addr_set_ (rhs.object_addr_set_)
00143   , object_addr_ (rhs.object_addr_)
00144   , preferred_path_  (rhs.preferred_path_)
00145   , next_ (0)
00146 {
00147 }


Member Function Documentation

TAO_IIOP_Endpoint * TAO_IIOP_Endpoint::add_local_endpoint TAO_IIOP_Endpoint ep,
const char *  local
[private]
 

Chain a new duplicate of ourself with the specified local preferred interface.

Definition at line 412 of file IIOP_Endpoint.cpp.

References duplicate(), TAO::IIOP_Endpoint_Info::host, is_encodable_, next_, preferred_path_, and CORBA::string_dup().

Referenced by preferred_interfaces().

00413 {
00414   TAO_Endpoint* tmp = ep->duplicate();
00415   ep->next_ = static_cast<TAO_IIOP_Endpoint*>(tmp);
00416   ep->next_->is_encodable_ = true;
00417   ep->next_->preferred_path_.host = CORBA::string_dup(local);
00418   return ep->next_;
00419 }

int TAO_IIOP_Endpoint::addr_to_string char *  buffer,
size_t  length
[virtual]
 

Return a string representation for the address.

The purpose of this method is to provide a general interface to the underlying address object's addr_to_string method. This allows the protocol implementor to select the appropriate string format.

Returns:
-1 if buffer is too small.

Implements TAO_Endpoint.

Definition at line 200 of file IIOP_Endpoint.cpp.

References is_ipv6_decimal_, port_, ACE_OS::sprintf(), and ACE_OS::strlen().

00201 {
00202   size_t actual_len =
00203     ACE_OS::strlen (this->host_.in ()) // chars in host name
00204     + sizeof (':')                     // delimiter
00205     + ACE_OS::strlen ("65536")         // max port
00206     + sizeof ('\0');
00207 
00208 #if defined (ACE_HAS_IPV6)
00209   if (this->is_ipv6_decimal_)
00210     actual_len += 2; // '[' + ']'
00211 #endif /* ACE_HAS_IPV6 */
00212 
00213   if (length < actual_len)
00214     return -1;
00215 
00216 #if defined (ACE_HAS_IPV6)
00217   if (this->is_ipv6_decimal_)
00218     ACE_OS::sprintf (buffer, "[%s]:%d",
00219                      this->host_.in (), this->port_);
00220   else
00221 #endif /* ACE_HAS_IPV6 */
00222   ACE_OS::sprintf (buffer, "%s:%d",
00223                    this->host_.in (), this->port_);
00224 
00225   return 0;
00226 }

TAO_Endpoint * TAO_IIOP_Endpoint::duplicate void   )  [virtual]
 

Makes a copy of this.

Implements TAO_Endpoint.

Definition at line 316 of file IIOP_Endpoint.cpp.

References ACE_NEW_RETURN.

Referenced by add_local_endpoint().

00317 {
00318   TAO_IIOP_Endpoint *endpoint = 0;
00319 
00320   // @@ NOTE: Not exception safe..
00321   ACE_NEW_RETURN (endpoint, TAO_IIOP_Endpoint (*this), 0);
00322 
00323   return endpoint;
00324 }

CORBA::ULong TAO_IIOP_Endpoint::hash void   )  [virtual]
 

Return a hash value for this object.

Implements TAO_Endpoint.

Definition at line 562 of file IIOP_Endpoint.cpp.

References ACE_GUARD_RETURN, ACE_INET_Addr::hash(), object_addr_, object_addr_i(), object_addr_set_, and TAO_SYNCH_MUTEX.

Referenced by TAO_IIOP_Profile::hash().

00563 {
00564   if (this->hash_val_ != 0)
00565     return this->hash_val_;
00566 
00567   {
00568     ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00569                       guard,
00570                       this->addr_lookup_lock_,
00571                       this->hash_val_);
00572     // .. DCL
00573     if (this->hash_val_ != 0)
00574       return this->hash_val_;
00575 
00576     // A few comments about this optimization. The call below will
00577     // deadlock if the object_addr_set is false. If you don't belive
00578 
00579     if (!this->object_addr_set_)
00580       {
00581         // Set the object_addr first
00582         (void) this->object_addr_i ();
00583       }
00584 
00585     this->hash_val_ = this->object_addr_.hash ();
00586   }
00587 
00588   return this->hash_val_;
00589 }

const char * TAO_IIOP_Endpoint::host const char *  h  ) 
 

Copy the string into and return the resulting pointer. This object maintains ownership of this string.

Definition at line 229 of file IIOP_Endpoint.cpp.

References TAO::String_var< charT >::in(), is_ipv6_decimal_, and ACE_OS::strchr().

00230 {
00231   this->host_ = h;
00232 #if defined (ACE_HAS_IPV6)
00233   if (ACE_OS::strchr (h, ':') != 0)
00234     this->is_ipv6_decimal_ = true;
00235 #endif /* ACE_HAS_IPV6 */
00236 
00237   return this->host_.in ();
00238 }

const char* TAO_IIOP_Endpoint::host void   )  const
 

Return a pointer to the host string. This object maintains ownership of this string.

Referenced by TAO_IIOP_Connector::begin_connection(), TAO_IIOP_Connector::complete_connection(), TAO_IIOP_Profile::encode_alternate_endpoints(), TAO_IIOP_Profile::encode_endpoints(), TAO_IIOP_Acceptor::is_collocated(), is_equivalent(), TAO_IIOP_Connector::make_connection(), TAO_IIOP_Endpoint(), and TAO_IIOP_Profile::to_string().

CORBA::Boolean TAO_IIOP_Endpoint::is_equivalent const TAO_Endpoint other_endpoint  )  [virtual]
 

Return true if this endpoint is equivalent to other_endpoint. Two endpoints are equivalent if their port and host are the same.

Implements TAO_Endpoint.

Definition at line 549 of file IIOP_Endpoint.cpp.

References host(), port_, and ACE_OS::strcmp().

Referenced by TAO_IIOP_Profile::do_is_equivalent().

00550 {
00551   const TAO_IIOP_Endpoint *endpoint =
00552     dynamic_cast<const TAO_IIOP_Endpoint *> (other_endpoint);
00553 
00554   if (endpoint == 0)
00555     return 0;
00556 
00557   return (this->port_ == endpoint->port_
00558           && (ACE_OS::strcmp (this->host (), endpoint->host ()) == 0));
00559 }

bool TAO_IIOP_Endpoint::is_ipv6_decimal void   )  const
 

Does the host string represent an IPv6 decimal address.

Referenced by next_filtered_i().

bool TAO_IIOP_Endpoint::is_preferred_network void   )  const
 

Do we have a preferred local network for the target?

Definition at line 592 of file IIOP_Endpoint.cpp.

References TAO::IIOP_Endpoint_Info::host, and preferred_path_.

Referenced by TAO_IIOP_Connector::begin_connection().

00593 {
00594   return (this->preferred_path_.host.in () != 0 &&
00595           this->preferred_path_.host.in ()[0] != 0);
00596 }

TAO_Endpoint * TAO_IIOP_Endpoint::next void   )  [virtual]
 

Endpoints can be linked in a list.

Returns:
The next endpoint in the list, if any.

Implements TAO_Endpoint.

Definition at line 241 of file IIOP_Endpoint.cpp.

00242 {
00243   return this->next_;
00244 }

TAO_Endpoint * TAO_IIOP_Endpoint::next_filtered TAO_ORB_Core ,
TAO_Endpoint root
[virtual]
 

Return the next endpoint in the list, but use protocol-specific filtering to constrain the value. The orb core is needed to supply any sort of filter arguments, and the root endpoint is needed in case the algorithm needs to rewind. If the supplied root is 0, then this is assumed to be the candidate next endpoint.

To use this, the caller starts off the change with root == 0. This is a bit of a violation in logic, a more correct implementation would accept this == 0 and a non-null root. To do iteration using next_filtered, do: for (TAO_Endpoint *ep = root_endpoint->next_filtered (orb_core, 0); ep != 0; ep = ep->next_filtered(orb_core, root_endpoint)) { }

Reimplemented from TAO_Endpoint.

Definition at line 247 of file IIOP_Endpoint.cpp.

References TAO_ORB_Parameters::connect_ipv6_only(), next_filtered_i(), TAO_ORB_Core::orb_params(), and TAO_ORB_Parameters::prefer_ipv6_interfaces().

00248 {
00249   bool want_ipv6 = false;
00250   bool ipv6_only = false;
00251   bool prefer_ipv6 = false;
00252 #if defined (ACE_HAS_IPV6)
00253   want_ipv6 = true;
00254   ipv6_only = orb_core->orb_params()->connect_ipv6_only();
00255   prefer_ipv6 = orb_core->orb_params()->prefer_ipv6_interfaces();
00256 #else
00257   ACE_UNUSED_ARG (orb_core);
00258 #endif /* ACE_HAS_IPV6 */
00259   return
00260     this->next_filtered_i (static_cast<TAO_IIOP_Endpoint *>(root),
00261                            ipv6_only,
00262                            prefer_ipv6,
00263                            want_ipv6);
00264 }

TAO_IIOP_Endpoint * TAO_IIOP_Endpoint::next_filtered_i TAO_IIOP_Endpoint root,
bool  ipv6_only,
bool  prefer_ipv6,
bool  want_ipv6
[private]
 

Definition at line 267 of file IIOP_Endpoint.cpp.

References ACE_Addr::get_type(), ACE_INET_Addr::is_ipv4_mapped_ipv6(), is_ipv6_decimal(), and object_addr().

Referenced by next_filtered().

00271 {
00272   // the candidate is nominally the next entry in the list, but since
00273   // the list may loop back on itself, the root of the list needs to be
00274   // initialized.
00275   TAO_IIOP_Endpoint *candidate = (root == 0) ? this : next_;
00276   if (root == 0)
00277     root = this;
00278 
00279 #if defined (ACE_HAS_IPV6)
00280   if (ipv6_only)
00281     {
00282       if (candidate == 0 || candidate->is_ipv6_decimal())
00283         return candidate;
00284       const ACE_INET_Addr &addr = candidate->object_addr ();
00285       bool allowed = addr.get_type () == AF_INET6 &&
00286         !addr.is_ipv4_mapped_ipv6();
00287 
00288       return allowed ? candidate :
00289         candidate->next_filtered_i(root, ipv6_only, prefer_ipv6, true);
00290     }
00291   if (prefer_ipv6)
00292     {
00293       if (candidate == 0)
00294         return !want_ipv6 ? candidate :
00295           root->next_filtered_i(root, ipv6_only, prefer_ipv6, false);
00296 
00297       if (want_ipv6 == candidate->is_ipv6_decimal())
00298         return candidate;
00299 
00300       const ACE_INET_Addr &addr = candidate->object_addr ();
00301       bool really_ipv6 = addr.get_type () == AF_INET6 &&
00302                          !addr.is_ipv4_mapped_ipv6();
00303       return (want_ipv6 == really_ipv6) ? candidate :
00304         candidate->next_filtered_i(root, ipv6_only, prefer_ipv6, want_ipv6);
00305     }
00306 #else
00307   ACE_UNUSED_ARG (want_ipv6);
00308   ACE_UNUSED_ARG (ipv6_only);
00309   ACE_UNUSED_ARG (prefer_ipv6);
00310 #endif
00311 
00312   return candidate;
00313 }

const ACE_INET_Addr & TAO_IIOP_Endpoint::object_addr void   )  const
 

Return a reference to the .

Definition at line 327 of file IIOP_Endpoint.cpp.

References ACE_GUARD_RETURN, object_addr_, object_addr_i(), object_addr_set_, and TAO_SYNCH_MUTEX.

Referenced by TAO_IIOP_Connector::begin_connection(), next_filtered_i(), and TAO_IIOP_Connector::set_validate_endpoint().

00328 {
00329   // The object_addr_ is initialized here, rather than at IOR decode
00330   // time for several reasons:
00331   //   1. A request on the object may never be invoked.
00332   //   2. The DNS setup may have changed dynamically.
00333   //   ...etc..
00334 
00335   // Double checked locking optimization.
00336   if (!this->object_addr_set_)
00337     {
00338       ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00339                         guard,
00340                         this->addr_lookup_lock_,
00341                         this->object_addr_);
00342 
00343       if (!this->object_addr_set_)
00344         {
00345           (void) this->object_addr_i ();
00346         }
00347     }
00348 
00349   return this->object_addr_;
00350 }

void TAO_IIOP_Endpoint::object_addr_i void   )  const [private]
 

Helper method for object_addr () call.

Definition at line 353 of file IIOP_Endpoint.cpp.

References is_ipv6_decimal_, object_addr_, object_addr_set_, ACE_INET_Addr::set(), ACE_Addr::set_type(), ACE_OS::strlen(), and ACE_OS::strspn().

Referenced by hash(), and object_addr().

00354 {
00355   // We should have already held the lock
00356 
00357 #if defined (ACE_HAS_IPV6)
00358   bool is_ipv4_decimal_ = false;
00359   if (!this->is_ipv6_decimal_)
00360     is_ipv4_decimal_ =
00361       ACE_OS::strspn (this->host_.in (), ".0123456789") ==
00362                               ACE_OS::strlen (this->host_.in ());
00363 
00364   // If this is *not* an IPv4 decimal address at first try to
00365   // resolve the address as an IPv6 address; if that fails
00366   // (or it's an IPv4 address) and the address is *not* an IPv6
00367   // decimal address try to resolve it as an IPv4 address.
00368   if ((is_ipv4_decimal_ ||
00369         this->object_addr_.set (this->port_,
00370                                 this->host_.in (),
00371                                 1,
00372                                 AF_INET6) == -1) &&
00373       (this->is_ipv6_decimal_ ||
00374         this->object_addr_.set (this->port_,
00375                               this->host_.in (),
00376                               1,
00377                               AF_INET) == -1))
00378 #else
00379   if (this->object_addr_.set (this->port_,
00380                               this->host_.in ()) == -1)
00381 #endif
00382     {
00383       // If this call fails, it most likely due a hostname
00384       // lookup failure caused by a DNS misconfiguration.  If
00385       // a request is made to the object at the given host and
00386       // port, then a CORBA::TRANSIENT() exception should be
00387       // thrown.
00388 
00389       // Invalidate the ACE_INET_Addr.  This is used as a flag
00390       // to denote that ACE_INET_Addr initialization failed.
00391       this->object_addr_.set_type (-1);
00392     }
00393   else
00394     {
00395       this->object_addr_set_ = true;
00396     }
00397 }

TAO_IIOP_Endpoint & TAO_IIOP_Endpoint::operator= const TAO_IIOP_Endpoint other  ) 
 

Need to have an assignment operator since the IIOP_Profile class may have to reorder its list of endpoints based on filtering by the EndpointPolicy.

Definition at line 113 of file IIOP_Endpoint.cpp.

References host_, is_encodable_, is_ipv6_decimal_, object_addr_, object_addr_set_, port_, and preferred_path_.

00114 {
00115   this->host_ = other.host_;
00116   this->port_ = other.port_;
00117 #if defined (ACE_HAS_IPV6)
00118   this->is_ipv6_decimal_ = other.is_ipv6_decimal_;
00119 #endif /* ACE_HAS_IPV6 */
00120   this->is_encodable_  = other.is_encodable_;
00121   this->object_addr_set_ = other.object_addr_set_;
00122   this->object_addr_ = other.object_addr_;
00123   this->preferred_path_ = other.preferred_path_;
00124   this->next_ = 0; // do not copy list membership, since we are only cloning the values
00125   return *this;
00126 }

CORBA::UShort TAO_IIOP_Endpoint::port CORBA::UShort  p  ) 
 

Set the port number.

CORBA::UShort TAO_IIOP_Endpoint::port void   )  const
 

Return the port number.

Referenced by TAO_IIOP_Connector::begin_connection(), TAO_IIOP_Connector::complete_connection(), TAO_IIOP_Profile::encode_alternate_endpoints(), TAO_IIOP_Profile::encode_endpoints(), TAO_IIOP_Acceptor::is_collocated(), TAO_IIOP_Connector::make_connection(), and TAO_IIOP_Profile::to_string().

CORBA::ULong TAO_IIOP_Endpoint::preferred_interfaces const char *  csvPreferred,
bool  enforce
[private]
 

Generate preferred interfaces from the options passed in by the user.

Definition at line 519 of file IIOP_Endpoint.cpp.

References add_local_endpoint(), find_preferred_interfaces(), TAO::IIOP_Endpoint_Info::host, is_encodable_, preferred_path_, ACE_Vector< T, DEFAULT_SIZE >::size(), and CORBA::string_dup().

Referenced by TAO_IIOP_Profile::decode_profile().

00520 {
00521   ACE_Vector<ACE_CString> preferred;
00522   find_preferred_interfaces(this->host_.in(), csv, preferred);
00523   CORBA::ULong count = preferred.size();
00524   if (count > 0)
00525   {
00526     this->is_encodable_ = true;
00527     this->preferred_path_.host = CORBA::string_dup(preferred[0].c_str());
00528     TAO_IIOP_Endpoint* ep = this;
00529     for (size_t i = 1; i < count; ++i)
00530     {
00531       ep = add_local_endpoint(ep, preferred[i].c_str());
00532     }
00533 
00534     // If we're not enforcing the preferred interfaces, then we can just add
00535     // a new non-preferred endpoint to the end with a default local addr.
00536     if (! enforce)
00537     {
00538       ep = add_local_endpoint(ep, "");
00539     }
00540     else
00541     {
00542       --count;
00543     }
00544   }
00545   return count;
00546 }

const char * TAO_IIOP_Endpoint::preferred_network void   )  const
 

Return the preferred network if any.

Definition at line 599 of file IIOP_Endpoint.cpp.

References TAO::IIOP_Endpoint_Info::host, and preferred_path_.

Referenced by TAO_IIOP_Connector::begin_connection().

00600 {
00601   return this->preferred_path_.host.in ();
00602 }

int TAO_IIOP_Endpoint::set const ACE_INET_Addr addr,
int  use_dotted_decimal_addresses
[private]
 

Helper method for setting INET_Addr.

Definition at line 150 of file IIOP_Endpoint.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT, ACE_INET_Addr::get_host_addr(), ACE_INET_Addr::get_host_name(), ACE_INET_Addr::get_port_number(), ACE_Addr::get_type(), is_ipv6_decimal_, LM_DEBUG, LM_ERROR, MAXHOSTNAMELEN, port_, CORBA::string_dup(), and TAO_debug_level.

Referenced by TAO_IIOP_Endpoint().

00152 {
00153   char tmp_host[MAXHOSTNAMELEN + 1];
00154 
00155 #if defined (ACE_HAS_IPV6)
00156   this->is_ipv6_decimal_ = false; // Reset
00157 #endif /* ACE_HAS_IPV6 */
00158 
00159   if (use_dotted_decimal_addresses
00160       || addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0)
00161     {
00162       if (use_dotted_decimal_addresses == 0 && TAO_debug_level > 5)
00163         {
00164           ACE_DEBUG ((LM_DEBUG,
00165                       ACE_TEXT ("TAO (%P|%t) - IIOP_Endpoint::set, ")
00166                       ACE_TEXT ("%p\n"),
00167                       ACE_TEXT ("cannot determine hostname")));
00168         }
00169 
00170       const char *tmp = addr.get_host_addr ();
00171       if (tmp == 0)
00172         {
00173           if (TAO_debug_level > 0)
00174             {
00175               ACE_ERROR ((LM_ERROR,
00176                           ACE_TEXT ("TAO (%P|%t) - IIOP_Endpoint::set, ")
00177                           ACE_TEXT ("%p\n"),
00178                           ACE_TEXT ("cannot determine hostname and hostaddr")));
00179             }
00180           return -1;
00181         }
00182       else
00183         {
00184           this->host_ = tmp;
00185 #if defined (ACE_HAS_IPV6)
00186           if (addr.get_type () == PF_INET6)
00187             this->is_ipv6_decimal_ = true;
00188 #endif /* ACE_HAS_IPV6 */
00189         }
00190     }
00191   else
00192     this->host_ = CORBA::string_dup (tmp_host);
00193 
00194   this->port_ = addr.get_port_number();
00195 
00196   return 0;
00197 }


Friends And Related Function Documentation

friend class TAO_IIOP_Profile [friend]
 

Definition at line 52 of file IIOP_Endpoint.h.

friend class TAO_SSLIOP_Profile [friend]
 

Definition at line 53 of file IIOP_Endpoint.h.


Member Data Documentation

CORBA::String_var TAO_IIOP_Endpoint::host_ [private]
 

String representing the host name.

Definition at line 195 of file IIOP_Endpoint.h.

Referenced by operator=(), and TAO_IIOP_Profile::parse_string_i().

bool TAO_IIOP_Endpoint::is_encodable_ [private]
 

Is this endpoint created encodable as part of the IOR?

Definition at line 206 of file IIOP_Endpoint.h.

Referenced by add_local_endpoint(), TAO_IIOP_Profile::encode_alternate_endpoints(), TAO_IIOP_Profile::encode_endpoints(), operator=(), and preferred_interfaces().

bool TAO_IIOP_Endpoint::is_ipv6_decimal_ [private]
 

Does the host string represent an IPv6 decimal address.

Definition at line 202 of file IIOP_Endpoint.h.

Referenced by addr_to_string(), TAO_IIOP_Profile::create_profile_body(), TAO_IIOP_Profile::encode_alternate_endpoints(), TAO_IIOP_Profile::encode_endpoints(), host(), object_addr_i(), operator=(), TAO_IIOP_Profile::parse_string_i(), set(), and TAO_IIOP_Profile::to_string().

TAO_IIOP_Endpoint* TAO_IIOP_Endpoint::next_ [private]
 

IIOP Endpoints can be stringed into a list. Return the next endpoint in the list, if any.

Definition at line 220 of file IIOP_Endpoint.h.

Referenced by TAO_IIOP_Profile::add_endpoint(), add_local_endpoint(), TAO_IIOP_Profile::do_is_equivalent(), TAO_IIOP_Profile::encode_alternate_endpoints(), TAO_IIOP_Profile::encode_endpoints(), TAO_IIOP_Profile::hash(), TAO_IIOP_Profile::remove_endpoint(), and TAO_IIOP_Profile::to_string().

ACE_INET_Addr TAO_IIOP_Endpoint::object_addr_ [mutable, private]
 

Cached instance of ACE_INET_Addr for use in making invocations, etc.

Definition at line 213 of file IIOP_Endpoint.h.

Referenced by TAO_IIOP_Profile::decode_profile(), hash(), object_addr(), object_addr_i(), and operator=().

bool TAO_IIOP_Endpoint::object_addr_set_ [mutable, private]
 

Flag to indicate if the address has been resolved and set.

Definition at line 209 of file IIOP_Endpoint.h.

Referenced by hash(), object_addr(), object_addr_i(), and operator=().

CORBA::UShort TAO_IIOP_Endpoint::port_ [private]
 

TCP port number.

Definition at line 198 of file IIOP_Endpoint.h.

Referenced by addr_to_string(), is_equivalent(), operator=(), TAO_IIOP_Profile::parse_string_i(), and set().

TAO::IIOP_Endpoint_Info TAO_IIOP_Endpoint::preferred_path_ [private]
 

Preferred path for this endpoint.

Definition at line 216 of file IIOP_Endpoint.h.

Referenced by add_local_endpoint(), is_preferred_network(), operator=(), preferred_interfaces(), and preferred_network().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:14:38 2006 for TAO by doxygen 1.3.6