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.

 ACE_UNIX_Addr (const wchar_t rendezvous_point[])
 Creates an ACE_UNIX_Addr from a string.

int set (const wchar_t rendezvous_point[])
 Creates an ACE_UNIX_Addr from a string.

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.

References ACE_OS::memset(), and unix_addr_.

00074   : ACE_Addr (AF_UNIX, sizeof this->unix_addr_)
00075 {
00076   (void) ACE_OS::memset ((void *) &this->unix_addr_,
00077                          0,
00078                          sizeof this->unix_addr_);
00079 
00080   this->unix_addr_.sun_family = AF_UNIX;
00081 }

ACE_UNIX_Addr::ACE_UNIX_Addr const ACE_UNIX_Addr sa  ) 
 

Copy constructor.

Definition at line 102 of file UNIX_Addr.cpp.

References set().

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

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.

References set().

00145 {
00146   this->set (rendezvous_point);
00147 }

ACE_UNIX_Addr::ACE_UNIX_Addr const sockaddr_un *  ,
int  len
 

Creates an ACE_INET_Addr from a sockaddr_un structure.

Definition at line 119 of file UNIX_Addr.cpp.

References set().

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

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_UNIX_Addr::ACE_UNIX_Addr const wchar_t  rendezvous_point[]  ) 
 

Creates an ACE_UNIX_Addr from a string.

Definition at line 16 of file UNIX_Addr.inl.

References ACE_TEXT_ALWAYS_CHAR, and set().

00017 {
00018   this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point));
00019 }


Member Function Documentation

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

Transform the current address into string format.

Definition at line 50 of file UNIX_Addr.cpp.

References ACE_TCHAR, ACE_TEXT_CHAR_TO_TCHAR, and ACE_OS::strsncpy().

00051 {
00052   ACE_OS::strsncpy (s,
00053                     ACE_TEXT_CHAR_TO_TCHAR (this->unix_addr_.sun_path),
00054                     len);
00055   return 0;
00056 }

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.

Referenced by ACE_LSOCK_Acceptor::dump().

00066 {
00067 #if defined (ACE_HAS_DUMP)
00068 #endif /* ACE_HAS_DUMP */
00069 }

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.

References unix_addr_.

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

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

References unix_addr_.

00051 {
00052   return this->unix_addr_.sun_path;
00053 }

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.

References ACE::hash_pjw().

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

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

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

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

References ACE_OS::strncmp(), and unix_addr_.

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

ACE_INLINE int ACE_UNIX_Addr::set const wchar_t  rendezvous_point[]  ) 
 

Creates an ACE_UNIX_Addr from a string.

Definition at line 23 of file UNIX_Addr.inl.

References ACE_TEXT_ALWAYS_CHAR, and set().

00024 {
00025   return this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point));
00026 }

int ACE_UNIX_Addr::set const sockaddr_un *  ,
int  len
 

Creates an ACE_UNIX_Addr from a sockaddr_un structure.

Definition at line 109 of file UNIX_Addr.cpp.

References ACE_Addr::base_set(), ACE_OS::memset(), ACE_OS::strcpy(), and unix_addr_.

00110 {
00111   (void) ACE_OS::memset ((void *) &this->unix_addr_, 0,
00112                    sizeof this->unix_addr_);
00113   this->unix_addr_.sun_family = AF_UNIX;
00114   ACE_OS::strcpy (this->unix_addr_.sun_path, un->sun_path);
00115   this->base_set (AF_UNIX, len);
00116   return 0;
00117 }

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.

References ACE_Addr::base_set(), ACE_OS::memset(), ACE_OS::strsncpy(), and unix_addr_.

00126 {
00127   (void) ACE_OS::memset ((void *) &this->unix_addr_,
00128                          0,
00129                          sizeof this->unix_addr_);
00130   this->unix_addr_.sun_family = AF_UNIX;
00131   (void) ACE_OS::strsncpy (this->unix_addr_.sun_path,
00132                            rendezvous_point,
00133                            sizeof this->unix_addr_.sun_path);
00134 
00135   this->ACE_Addr::base_set (AF_UNIX,
00136                             sizeof this->unix_addr_ -
00137                             sizeof (this->unix_addr_.sun_path) +
00138                             ACE_OS::strlen (this->unix_addr_.sun_path));
00139   return 0;
00140 }

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.

References AF_ANY, ACE_Addr::base_set(), ACE_Addr::get_size(), ACE_Addr::get_type(), ACE_OS::memset(), ACE_OS::strcpy(), and unix_addr_.

Referenced by ACE_UNIX_Addr(), and set().

00085 {
00086   if (sa.get_type () == AF_ANY)
00087     (void) ACE_OS::memset ((void *) &this->unix_addr_,
00088                            0,
00089                            sizeof this->unix_addr_);
00090   else
00091     ACE_OS::strcpy (this->unix_addr_.sun_path,
00092                     sa.unix_addr_.sun_path);
00093 
00094   this->unix_addr_.sun_family = AF_UNIX;
00095   this->base_set (sa.get_type (), sa.get_size ());
00096 
00097   return 0;
00098 }

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

References ACE_TRACE, ACE_Addr::base_set(), and ACE_OS::memcpy().

00020 {
00021   ACE_TRACE ("ACE_UNIX_Addr::set_addr");
00022 
00023   this->ACE_Addr::base_set (AF_UNIX, len);
00024   ACE_OS::memcpy ((void *) &this->unix_addr_,
00025                   (void *) addr,
00026                   len);
00027 }

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.

References ACE_OS::strsncpy().

00041 {
00042   ACE_OS::strsncpy (this->unix_addr_.sun_path, addr,
00043                     sizeof this->unix_addr_.sun_path);
00044   return 0;
00045 }


Member Data Documentation

ACE_UNIX_Addr::ACE_ALLOC_HOOK_DECLARE
 

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.

Referenced by ACE_UNIX_Addr(), get_addr(), get_path_name(), operator==(), and set().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:32:15 2006 for ACE by doxygen 1.3.6