Public Member Functions | Public Attributes | Private Attributes

ACE_UNIX_Addr Class Reference

Defines the ``UNIX domain address family'' address format. More...

#include <UNIX_Addr.h>

Inheritance diagram for ACE_UNIX_Addr:
Inheritance graph
[legend]
Collaboration diagram for ACE_UNIX_Addr:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ACE_UNIX_Addr (void)
 Default constructor.
 ACE_UNIX_Addr (const ACE_UNIX_Addr &sa)
 Copy constructor.
 ACE_UNIX_Addr (const char rendezvous_point[])
 Creates an ACE_UNIX_Addr from a string.
 ACE_UNIX_Addr (const sockaddr_un *, int len)
 Creates an ACE_INET_Addr from a sockaddr_un structure.
int set (const ACE_UNIX_Addr &sa)
 Creates an ACE_UNIX_Addr from another ACE_UNIX_Addr.
int set (const char rendezvous_point[])
 Creates an ACE_UNIX_Addr from a string.
int set (const sockaddr_un *, int len)
 Creates an ACE_UNIX_Addr from a sockaddr_un structure.
virtual void * get_addr (void) const
 Return a pointer to the underlying network address.
virtual void set_addr (void *addr, int len)
 Set a pointer to the underlying network address.
virtual int addr_to_string (ACE_TCHAR addr[], size_t) const
 Transform the current address into string format.
virtual int string_to_addr (const char addr[])
 Transform the string into the current addressing format.
bool operator== (const ACE_UNIX_Addr &SAP) const
 Compare two addresses for equality.
bool operator!= (const ACE_UNIX_Addr &SAP) const
 Compare two addresses for inequality.
const char * get_path_name (void) const
 Return the path name of the underlying rendezvous point.
virtual u_long hash (void) const
 Computes and returns hash value.
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Private Attributes

sockaddr_un unix_addr_
 Underlying socket address.

Detailed Description

Defines the ``UNIX domain address family'' address format.

Definition at line 39 of file UNIX_Addr.h.


Constructor & Destructor Documentation

ACE_UNIX_Addr::ACE_UNIX_Addr ( void   ) 

Default constructor.

Definition at line 73 of file UNIX_Addr.cpp.

  : ACE_Addr (AF_UNIX, sizeof this->unix_addr_)
{
  (void) ACE_OS::memset ((void *) &this->unix_addr_,
                         0,
                         sizeof this->unix_addr_);

  this->unix_addr_.sun_family = AF_UNIX;
}

ACE_UNIX_Addr::ACE_UNIX_Addr ( const ACE_UNIX_Addr sa  ) 

Copy constructor.

Definition at line 102 of file UNIX_Addr.cpp.

  : ACE_Addr (AF_UNIX, sa.get_size ())
{
  this->set (sa);
}

ACE_UNIX_Addr::ACE_UNIX_Addr ( const char  rendezvous_point[]  ) 

Creates an ACE_UNIX_Addr from a string.

Definition at line 144 of file UNIX_Addr.cpp.

{
  this->set (rendezvous_point);
}

ACE_UNIX_Addr::ACE_UNIX_Addr ( const sockaddr_un *  un,
int  len 
)

Creates an ACE_INET_Addr from a sockaddr_un structure.

Definition at line 119 of file UNIX_Addr.cpp.

{
  this->set (un, len);
}


Member Function Documentation

int ACE_UNIX_Addr::addr_to_string ( ACE_TCHAR  addr[],
size_t  len 
) const [virtual]

Transform the current address into string format.

Definition at line 50 of file UNIX_Addr.cpp.

{
  ACE_OS::strsncpy (s,
                    ACE_TEXT_CHAR_TO_TCHAR (this->unix_addr_.sun_path),
                    len);
  return 0;
}

void ACE_UNIX_Addr::dump ( void   )  const

Dump the state of an object.

Reimplemented from ACE_Addr.

Definition at line 65 of file UNIX_Addr.cpp.

{
#if defined (ACE_HAS_DUMP)
#endif /* ACE_HAS_DUMP */
}

void * ACE_UNIX_Addr::get_addr ( void   )  const [virtual]

Return a pointer to the underlying network address.

Reimplemented from ACE_Addr.

Definition at line 32 of file UNIX_Addr.cpp.

{
  return (void *) &this->unix_addr_;
}

const char * ACE_UNIX_Addr::get_path_name ( void   )  const

Return the path name of the underlying rendezvous point.

Definition at line 50 of file UNIX_Addr.inl.

{
  return this->unix_addr_.sun_path;
}

u_long ACE_UNIX_Addr::hash ( void   )  const [virtual]

Computes and returns hash value.

Reimplemented from ACE_Addr.

Definition at line 59 of file UNIX_Addr.cpp.

{
  return ACE::hash_pjw (this->unix_addr_.sun_path);
}

bool ACE_UNIX_Addr::operator!= ( const ACE_UNIX_Addr SAP  )  const

Compare two addresses for inequality.

Definition at line 42 of file UNIX_Addr.inl.

{
  return !((*this) == sap);     // This is lazy, of course... ;-)
}

bool ACE_UNIX_Addr::operator== ( const ACE_UNIX_Addr SAP  )  const

Compare two addresses for equality.

Definition at line 32 of file UNIX_Addr.inl.

{
  return ACE_OS::strncmp (this->unix_addr_.sun_path,
                          sap.unix_addr_.sun_path,
                          sizeof this->unix_addr_.sun_path) == 0;
}

int ACE_UNIX_Addr::set ( const sockaddr_un *  un,
int  len 
)

Creates an ACE_UNIX_Addr from a sockaddr_un structure.

Definition at line 109 of file UNIX_Addr.cpp.

{
  (void) ACE_OS::memset ((void *) &this->unix_addr_, 0,
                   sizeof this->unix_addr_);
  this->unix_addr_.sun_family = AF_UNIX;
  ACE_OS::strcpy (this->unix_addr_.sun_path, un->sun_path);
  this->base_set (AF_UNIX, len);
  return 0;
}

int ACE_UNIX_Addr::set ( const ACE_UNIX_Addr sa  ) 

Creates an ACE_UNIX_Addr from another ACE_UNIX_Addr.

Definition at line 84 of file UNIX_Addr.cpp.

{
  if (sa.get_type () == AF_ANY)
    (void) ACE_OS::memset ((void *) &this->unix_addr_,
                           0,
                           sizeof this->unix_addr_);
  else
    ACE_OS::strcpy (this->unix_addr_.sun_path,
                    sa.unix_addr_.sun_path);

  this->unix_addr_.sun_family = AF_UNIX;
  this->base_set (sa.get_type (), sa.get_size ());

  return 0;
}

int ACE_UNIX_Addr::set ( const char  rendezvous_point[]  ) 

Creates an ACE_UNIX_Addr from a string.

Definition at line 125 of file UNIX_Addr.cpp.

{
  (void) ACE_OS::memset ((void *) &this->unix_addr_,
                         0,
                         sizeof this->unix_addr_);
  this->unix_addr_.sun_family = AF_UNIX;
  (void) ACE_OS::strsncpy (this->unix_addr_.sun_path,
                           rendezvous_point,
                           sizeof this->unix_addr_.sun_path);

  this->ACE_Addr::base_set (AF_UNIX,
                            sizeof this->unix_addr_ -
                            sizeof (this->unix_addr_.sun_path) +
                            ACE_OS::strlen (this->unix_addr_.sun_path));
  return 0;
}

void ACE_UNIX_Addr::set_addr ( void *  addr,
int  len 
) [virtual]

Set a pointer to the underlying network address.

Reimplemented from ACE_Addr.

Definition at line 19 of file UNIX_Addr.cpp.

{
  ACE_TRACE ("ACE_UNIX_Addr::set_addr");

  this->ACE_Addr::base_set (AF_UNIX, len);
  ACE_OS::memcpy ((void *) &this->unix_addr_,
                  (void *) addr,
                  len);
}

int ACE_UNIX_Addr::string_to_addr ( const char  addr[]  )  [virtual]

Transform the string into the current addressing format.

Definition at line 40 of file UNIX_Addr.cpp.

{
  ACE_OS::strsncpy (this->unix_addr_.sun_path, addr,
                    sizeof this->unix_addr_.sun_path);
  return 0;
}


Member Data Documentation

Declare the dynamic allocation hooks.

Reimplemented from ACE_Addr.

Definition at line 100 of file UNIX_Addr.h.

sockaddr_un ACE_UNIX_Addr::unix_addr_ [private]

Underlying socket address.

Definition at line 104 of file UNIX_Addr.h.


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