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 * get_host_addr (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.

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


Private Attributes

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

CORBA::UShort port_
 UDP port number. Frank - deprecate this.

ACE_INET_Addr object_addr_
TAO_UIPMC_Endpointnext_

Detailed Description

TAO_UIPMC_Endpoint.

UIPMC-specific implementation of PP Framework Endpoint interface.

Definition at line 39 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     object_addr_ (),
00027     next_ (0)
00028 {
00029 }

TAO_UIPMC_Endpoint::TAO_UIPMC_Endpoint const ACE_INET_Addr addr  ) 
 

Constructor.

Definition at line 32 of file UIPMC_Endpoint.cpp.

References object_addr().

00033   : TAO_Endpoint (IOP::TAG_UIPMC),
00034     object_addr_ (addr),
00035     next_ (0)
00036 {
00037   this->object_addr (addr);
00038 }

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

Constructor. Frank - deprecate this.

@

Definition at line 40 of file UIPMC_Endpoint.cpp.

References class_d_address_, and update_object_addr().

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

TAO_UIPMC_Endpoint::~TAO_UIPMC_Endpoint void   ) 
 

Destructor.

Definition at line 53 of file UIPMC_Endpoint.cpp.

00054 {
00055 
00056 }


Member Function Documentation

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

Implements TAO_Endpoint.

Definition at line 75 of file UIPMC_Endpoint.cpp.

References ACE_OS::sprintf().

00076 {
00077   size_t actual_len =
00078     15                           // chars in dotted decimal addr
00079     + sizeof (':')               // delimiter
00080     + 5                          // max port
00081     + sizeof ('\0');
00082 
00083   if (length < actual_len)
00084     return -1;
00085 
00086   ACE_OS::sprintf (buffer, "%d.%d.%d.%d:%d",
00087                    this->class_d_address_[0],
00088                    this->class_d_address_[1],
00089                    this->class_d_address_[2],
00090                    this->class_d_address_[3],
00091                    this->port_);
00092 
00093   return 0;
00094 }

TAO_Endpoint * TAO_UIPMC_Endpoint::duplicate void   )  [virtual]
 

Makes a copy of .

Implements TAO_Endpoint.

Definition at line 103 of file UIPMC_Endpoint.cpp.

References ACE_NEW_RETURN.

00104 {
00105   TAO_UIPMC_Endpoint *endpoint = 0;
00106 
00107   ACE_NEW_RETURN (endpoint,
00108                   TAO_UIPMC_Endpoint (this->object_addr_),
00109                   0);
00110 
00111   return endpoint;
00112 }

const char * TAO_UIPMC_Endpoint::get_host_addr 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 68 of file UIPMC_Endpoint.cpp.

References ACE_INET_Addr::get_host_addr().

00069 {
00070   return this->object_addr_.get_host_addr ();
00071 }

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

Return a hash value for this object.

Implements TAO_Endpoint.

Definition at line 129 of file UIPMC_Endpoint.cpp.

References ACE_GUARD_RETURN, TAO_SYNCH_MUTEX, and uint_ip_addr().

Referenced by TAO_UIPMC_Profile::hash().

00130 {
00131   if (this->hash_val_ != 0)
00132     return this->hash_val_;
00133 
00134   {
00135     ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00136                       guard,
00137                       this->addr_lookup_lock_,
00138                       this->hash_val_);
00139     // .. DCL
00140     if (this->hash_val_ != 0)
00141       return this->hash_val_;
00142 
00143     this->hash_val_ =
00144       this->uint_ip_addr () + this->port_;
00145   }
00146 
00147   return this->hash_val_;
00148 }

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

References class_d_address_, ACE_OS::memcmp(), and port_.

Referenced by TAO_UIPMC_Profile::do_is_equivalent().

00116 {
00117   TAO_Endpoint *endpt = const_cast<TAO_Endpoint *> (other_endpoint);
00118 
00119   TAO_UIPMC_Endpoint *endpoint = dynamic_cast<TAO_UIPMC_Endpoint *> (endpt);
00120   if (endpoint == 0)
00121     return 0;
00122 
00123   return
00124     this->port_ == endpoint->port_
00125     && ACE_OS::memcmp (this->class_d_address_, endpoint->class_d_address_, 4) == 0;
00126 }

TAO_Endpoint * TAO_UIPMC_Endpoint::next void   )  [virtual]
 

Implements TAO_Endpoint.

Definition at line 97 of file UIPMC_Endpoint.cpp.

00098 {
00099   return this->next_;
00100 }

void TAO_UIPMC_Endpoint::object_addr const ACE_INET_Addr addr  ) 
 

Set the IP multicast address and port.

Definition at line 59 of file UIPMC_Endpoint.cpp.

References ACE_INET_Addr::get_ip_address(), ACE_INET_Addr::get_port_number(), ACE_INET_Addr::set(), and uint_ip_addr().

00060 {
00061   this->port_ = addr.get_port_number();
00062   this->uint_ip_addr (addr.get_ip_address ());
00063 
00064   this->object_addr_.set (addr);
00065 }

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.i.

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

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.i.

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.i.

Referenced by 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.i.

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.

Definition at line 28 of file UIPMC_Endpoint.i.

References class_d_address_.

Referenced by hash(), and object_addr().

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.

Definition at line 46 of file UIPMC_Endpoint.i.

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 is_equivalent(), TAO_UIPMC_Endpoint(), and uint_ip_addr().

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 118 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 114 of file UIPMC_Endpoint.h.

CORBA::UShort TAO_UIPMC_Endpoint::port_ [private]
 

UDP port number. Frank - deprecate this.

@

Definition at line 110 of file UIPMC_Endpoint.h.

Referenced by is_equivalent().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:05:15 2006 for TAO_PortableGroup by doxygen 1.3.6