TAO_UIPMC_Endpoint Class Reference

TAO_UIPMC_Endpoint. More...

#include <UIPMC_Endpoint.h>

Inheritance diagram for TAO_UIPMC_Endpoint:

Inheritance graph
[legend]
Collaboration diagram for TAO_UIPMC_Endpoint:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_UIPMC_Endpoint (void)
 Default constructor.

 TAO_UIPMC_Endpoint (const ACE_INET_Addr &addr)
 Constructor.

 TAO_UIPMC_Endpoint (const CORBA::Octet class_d_address[4], CORBA::UShort port)
 Constructor. Frank - deprecate this.

 ~TAO_UIPMC_Endpoint (void)
 Destructor.

virtual TAO_Endpointnext (void)
virtual int addr_to_string (char *buffer, size_t length)
virtual TAO_Endpointduplicate (void)
 Makes a copy of .

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

const ACE_INET_Addrobject_addr (void) const
 Return a reference to the .

void object_addr (const ACE_INET_Addr &addr)
 Set the IP multicast address and port.

const char * host (void) const
CORBA::UShort port (void) const
 Return the port number.

CORBA::UShort port (CORBA::UShort p)
 Set the port number.


Private Member Functions

ACE_UINT32 uint_ip_addr (void) const
 Helper methods for getting and setting the IP address. Vadym - deprecate these.

void uint_ip_addr (ACE_UINT32 ip_addr)
void update_object_addr (void)
 Helper method to update the cached object address. Vadym - deprecate this.


Private Attributes

CORBA::Octet class_d_address_ [4]
 IP Multicast address. Frank - deprecate this.

CORBA::String_var host_
 String representing the host address.

CORBA::UShort port_
 UDP port number.

ACE_INET_Addr object_addr_
TAO_UIPMC_Endpointnext_

Detailed Description

TAO_UIPMC_Endpoint.

UIPMC-specific implementation of PP Framework Endpoint interface.

Definition at line 40 of file UIPMC_Endpoint.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_UIPMC_Endpoint::TAO_UIPMC_Endpoint void   ) 
 

Default constructor.

Definition at line 24 of file UIPMC_Endpoint.cpp.

00025   : TAO_Endpoint (IOP::TAG_UIPMC),
00026     host_ (),
00027     port_ (0),
00028     object_addr_ (),
00029     next_ (0)
00030 {
00031 }

TAO_UIPMC_Endpoint::TAO_UIPMC_Endpoint const ACE_INET_Addr addr  ) 
 

Constructor.

Definition at line 33 of file UIPMC_Endpoint.cpp.

References object_addr().

00034   : TAO_Endpoint (IOP::TAG_UIPMC),
00035     host_ (),
00036     port_ (0),
00037     object_addr_ (addr),
00038     next_ (0)
00039 {
00040   this->object_addr (addr);
00041 }

TAO_UIPMC_Endpoint::TAO_UIPMC_Endpoint const CORBA::Octet  class_d_address[4],
CORBA::UShort  port
 

Constructor. Frank - deprecate this.

@

Definition at line 44 of file UIPMC_Endpoint.cpp.

References class_d_address_, and update_object_addr().

00046   : TAO_Endpoint (IOP::TAG_UIPMC),
00047     port_ (port),
00048     next_ (0)
00049 {
00050   for (int i = 0; i<4; i++)
00051     this->class_d_address_[i] = class_d_address[i];
00052 
00053   this->update_object_addr ();
00054 }

TAO_UIPMC_Endpoint::~TAO_UIPMC_Endpoint void   ) 
 

Destructor.

Definition at line 56 of file UIPMC_Endpoint.cpp.

00057 {
00058 }


Member Function Documentation

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

Implements TAO_Endpoint.

Definition at line 76 of file UIPMC_Endpoint.cpp.

References ACE_Addr::get_type(), ACE_OS::sprintf(), and ACE_OS::strlen().

00077 {
00078   size_t actual_len =
00079     ACE_OS::strlen (this->object_addr_.get_host_addr ()) // chars in host name
00080     + sizeof (':')               // delimiter
00081     + 5                          // max port
00082     + sizeof ('\0');
00083 
00084 #if defined (ACE_HAS_IPV6)
00085   if (this->object_addr_.get_type () == AF_INET6)
00086     actual_len += 2; // '[' + ']'
00087 #endif /* ACE_HAS_IPV6 */
00088 
00089   if (length < actual_len)
00090     return -1;
00091 
00092 #if defined (ACE_HAS_IPV6)
00093   if (this->object_addr_.get_type () == AF_INET6)
00094     ACE_OS::sprintf (buffer, "[%s]:%d",
00095                      this->object_addr_.get_host_addr (),
00096                      this->port_);
00097   else
00098 #endif /* ACE_HAS_IPV6 */
00099   ACE_OS::sprintf (buffer, "%s:%d",
00100                    this->object_addr_.get_host_addr (),
00101                    this->port_);
00102 
00103   return 0;
00104 }

TAO_Endpoint * TAO_UIPMC_Endpoint::duplicate void   )  [virtual]
 

Makes a copy of .

Implements TAO_Endpoint.

Definition at line 113 of file UIPMC_Endpoint.cpp.

References ACE_NEW_RETURN.

00114 {
00115   TAO_UIPMC_Endpoint *endpoint = 0;
00116 
00117   ACE_NEW_RETURN (endpoint,
00118                   TAO_UIPMC_Endpoint (this->object_addr_),
00119                   0);
00120 
00121   return endpoint;
00122 }

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

Return a hash value for this object.

Implements TAO_Endpoint.

Definition at line 139 of file UIPMC_Endpoint.cpp.

References ACE_GUARD_RETURN, ACE_INET_Addr::hash(), and TAO_SYNCH_MUTEX.

Referenced by TAO_UIPMC_Profile::hash().

00140 {
00141   if (this->hash_val_ != 0)
00142     return this->hash_val_;
00143 
00144   {
00145     ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00146                       guard,
00147                       this->addr_lookup_lock_,
00148                       this->hash_val_);
00149     // .. DCL
00150     if (this->hash_val_ != 0)
00151       return this->hash_val_;
00152 
00153     this->hash_val_ = this->object_addr_.hash ();
00154   }
00155 
00156   return this->hash_val_;
00157 }

const char * TAO_UIPMC_Endpoint::host void   )  const
 

Return a pointer to the stringified host address (not including the port). This class retains ownership of the address memory.

Definition at line 70 of file UIPMC_Endpoint.cpp.

Referenced by is_equivalent(), and TAO_UIPMC_Connector::make_connection().

00071 {
00072   return this->host_.in ();
00073 }

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

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 125 of file UIPMC_Endpoint.cpp.

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

Referenced by TAO_UIPMC_Profile::do_is_equivalent().

00126 {
00127   const TAO_UIPMC_Endpoint *endpoint =
00128     dynamic_cast<const TAO_UIPMC_Endpoint *> (other_endpoint);
00129 
00130   if (endpoint == 0)
00131     return 0;
00132 
00133   return
00134     (this->port_ == endpoint->port_
00135      && ACE_OS::strcmp (this->host (), endpoint->host ()) == 0);
00136 }

TAO_Endpoint * TAO_UIPMC_Endpoint::next void   )  [virtual]
 

Implements TAO_Endpoint.

Definition at line 107 of file UIPMC_Endpoint.cpp.

00108 {
00109   return this->next_;
00110 }

void TAO_UIPMC_Endpoint::object_addr const ACE_INET_Addr addr  ) 
 

Set the IP multicast address and port.

Definition at line 61 of file UIPMC_Endpoint.cpp.

References ACE_INET_Addr::get_host_addr(), ACE_INET_Addr::get_port_number(), ACE_INET_Addr::set(), and CORBA::string_dup().

00062 {
00063   this->port_ = addr.get_port_number();
00064   this->host_ = CORBA::string_dup (addr.get_host_addr ());
00065 
00066   this->object_addr_.set (addr);
00067 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE const ACE_INET_Addr & TAO_UIPMC_Endpoint::object_addr void   )  const
 

Return a reference to the .

Definition at line 8 of file UIPMC_Endpoint.inl.

Referenced by TAO_UIPMC_Profile::decode_profile(), TAO_UIPMC_Connector::make_connection(), TAO_UIPMC_Profile::parse_string_i(), TAO_UIPMC_Connector::set_validate_endpoint(), TAO_UIPMC_Endpoint(), and TAO_UIPMC_Profile::to_string().

00009 {
00010   return this->object_addr_;
00011 }

ACE_INLINE CORBA::UShort TAO_UIPMC_Endpoint::port CORBA::UShort  p  ) 
 

Set the port number.

Definition at line 21 of file UIPMC_Endpoint.inl.

00022 {
00023   return this->port_ = p;
00024 }

ACE_INLINE CORBA::UShort TAO_UIPMC_Endpoint::port void   )  const
 

Return the port number.

Definition at line 15 of file UIPMC_Endpoint.inl.

Referenced by TAO_UIPMC_Connector::make_connection(), and TAO_UIPMC_Profile::to_string().

00016 {
00017   return this->port_;
00018 }

ACE_INLINE void TAO_UIPMC_Endpoint::uint_ip_addr ACE_UINT32  ip_addr  )  [private]
 

Definition at line 37 of file UIPMC_Endpoint.inl.

References class_d_address_.

00038 {
00039   this->class_d_address_[0] = (CORBA::Char)(ip_addr >> 24);
00040   this->class_d_address_[1] = (CORBA::Char)((ip_addr >> 16) & 0xff);
00041   this->class_d_address_[2] = (CORBA::Char)((ip_addr >> 8) & 0xff);
00042   this->class_d_address_[3] = (CORBA::Char)(ip_addr & 0xff);
00043 }

ACE_INLINE ACE_UINT32 TAO_UIPMC_Endpoint::uint_ip_addr void   )  const [private]
 

Helper methods for getting and setting the IP address. Vadym - deprecate these.

@

Definition at line 28 of file UIPMC_Endpoint.inl.

References class_d_address_.

00029 {
00030   return (((ACE_UINT32)this->class_d_address_[0] << 24) |
00031           ((ACE_UINT32)this->class_d_address_[1] << 16) |
00032           ((ACE_UINT32)this->class_d_address_[2] << 8)  |
00033           ((ACE_UINT32)this->class_d_address_[3]));
00034 }

ACE_INLINE void TAO_UIPMC_Endpoint::update_object_addr void   )  [private]
 

Helper method to update the cached object address. Vadym - deprecate this.

@

Definition at line 46 of file UIPMC_Endpoint.inl.

References ACE_INET_Addr::set().

Referenced by TAO_UIPMC_Endpoint().

00047 {
00048   this->object_addr_.set (this->port_,
00049                           this->uint_ip_addr ());
00050 }


Member Data Documentation

CORBA::Octet TAO_UIPMC_Endpoint::class_d_address_[4] [private]
 

IP Multicast address. Frank - deprecate this.

@

Definition at line 107 of file UIPMC_Endpoint.h.

Referenced by TAO_UIPMC_Endpoint(), and uint_ip_addr().

CORBA::String_var TAO_UIPMC_Endpoint::host_ [private]
 

String representing the host address.

Definition at line 110 of file UIPMC_Endpoint.h.

TAO_UIPMC_Endpoint* TAO_UIPMC_Endpoint::next_ [private]
 

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

Definition at line 121 of file UIPMC_Endpoint.h.

ACE_INET_Addr TAO_UIPMC_Endpoint::object_addr_ [private]
 

Cached instance of for use in making invocations, etc.

Definition at line 117 of file UIPMC_Endpoint.h.

CORBA::UShort TAO_UIPMC_Endpoint::port_ [private]
 

UDP port number.

Definition at line 113 of file UIPMC_Endpoint.h.

Referenced by is_equivalent().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 16:24:30 2008 for TAO_PortableGroup by doxygen 1.3.6