Public Member Functions | Private Member Functions | Private Attributes

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 <this>
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 <object_addr>.
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_UIPMC_Endpoint::TAO_UIPMC_Endpoint ( void   ) 

Default constructor.

Definition at line 24 of file UIPMC_Endpoint.cpp.

  : TAO_Endpoint (IOP::TAG_UIPMC),
    host_ (),
    port_ (0),
    object_addr_ (),
    next_ (0)
{
}

TAO_UIPMC_Endpoint::TAO_UIPMC_Endpoint ( const ACE_INET_Addr addr  ) 

Constructor.

Definition at line 33 of file UIPMC_Endpoint.cpp.

  : TAO_Endpoint (IOP::TAG_UIPMC),
    host_ (),
    port_ (0),
    object_addr_ (addr),
    next_ (0)
{
  this->object_addr (addr);
}

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.

  : TAO_Endpoint (IOP::TAG_UIPMC),
    port_ (port),
    next_ (0)
{
  for (int i = 0; i<4; i++)
    this->class_d_address_[i] = class_d_address[i];

  this->update_object_addr ();
}

TAO_UIPMC_Endpoint::~TAO_UIPMC_Endpoint ( void   ) 

Destructor.

Definition at line 56 of file UIPMC_Endpoint.cpp.

{
}


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.

{
  size_t actual_len =
    ACE_OS::strlen (this->object_addr_.get_host_addr ()) // chars in host name
    + sizeof (':')               // delimiter
    + 5                          // max port
    + sizeof ('\0');

#if defined (ACE_HAS_IPV6)
  if (this->object_addr_.get_type () == AF_INET6)
    actual_len += 2; // '[' + ']'
#endif /* ACE_HAS_IPV6 */

  if (length < actual_len)
    return -1;

#if defined (ACE_HAS_IPV6)
  if (this->object_addr_.get_type () == AF_INET6)
    ACE_OS::sprintf (buffer, "[%s]:%d",
                     this->object_addr_.get_host_addr (),
                     this->port_);
  else
#endif /* ACE_HAS_IPV6 */
  ACE_OS::sprintf (buffer, "%s:%d",
                   this->object_addr_.get_host_addr (),
                   this->port_);

  return 0;
}

TAO_Endpoint * TAO_UIPMC_Endpoint::duplicate ( void   )  [virtual]

Makes a copy of <this>

Implements TAO_Endpoint.

Definition at line 113 of file UIPMC_Endpoint.cpp.

{
  TAO_UIPMC_Endpoint *endpoint = 0;

  ACE_NEW_RETURN (endpoint,
                  TAO_UIPMC_Endpoint (this->object_addr_),
                  0);

  return endpoint;
}

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.

{
  if (this->hash_val_ != 0)
    return this->hash_val_;

  {
    ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
                      guard,
                      this->addr_lookup_lock_,
                      this->hash_val_);
    // .. DCL
    if (this->hash_val_ != 0)
      return this->hash_val_;

    this->hash_val_ = this->object_addr_.hash ();
  }

  return this->hash_val_;
}

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.

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

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

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

Implements TAO_Endpoint.

Definition at line 125 of file UIPMC_Endpoint.cpp.

{
  const TAO_UIPMC_Endpoint *endpoint =
    dynamic_cast<const TAO_UIPMC_Endpoint *> (other_endpoint);

  if (endpoint == 0)
    return 0;

  return
    (this->port_ == endpoint->port_
     && ACE_OS::strcmp (this->host (), endpoint->host ()) == 0);
}

TAO_Endpoint * TAO_UIPMC_Endpoint::next ( void   )  [virtual]

Implements TAO_Endpoint.

Definition at line 107 of file UIPMC_Endpoint.cpp.

{
  return this->next_;
}

const ACE_INET_Addr & TAO_UIPMC_Endpoint::object_addr ( void   )  const

Return a reference to the <object_addr>.

Definition at line 8 of file UIPMC_Endpoint.inl.

{
  return this->object_addr_;
}

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.

{
  this->port_ = addr.get_port_number();
  this->host_ = CORBA::string_dup (addr.get_host_addr ());

  this->object_addr_.set (addr);
}

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

Return the port number.

Definition at line 15 of file UIPMC_Endpoint.inl.

{
  return this->port_;
}

CORBA::UShort TAO_UIPMC_Endpoint::port ( CORBA::UShort  p  ) 

Set the port number.

Definition at line 21 of file UIPMC_Endpoint.inl.

{
  return this->port_ = p;
}

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.

{
  return (((ACE_UINT32)this->class_d_address_[0] << 24) |
          ((ACE_UINT32)this->class_d_address_[1] << 16) |
          ((ACE_UINT32)this->class_d_address_[2] << 8)  |
          ((ACE_UINT32)this->class_d_address_[3]));
}

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

Definition at line 37 of file UIPMC_Endpoint.inl.

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

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.

{
  this->object_addr_.set (this->port_,
                          this->uint_ip_addr ());
}


Member Data Documentation

IP Multicast address. @ Frank - deprecate this.

Definition at line 107 of file UIPMC_Endpoint.h.

String representing the host address.

Definition at line 110 of file UIPMC_Endpoint.h.

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.

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

Definition at line 117 of file UIPMC_Endpoint.h.

UDP port number.

Definition at line 113 of file UIPMC_Endpoint.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines