Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 Methods

 ACE_UNIX_Addr (void)
 Default constructor. More...

 ACE_UNIX_Addr (const ACE_UNIX_Addr &sa)
 Copy constructor. More...

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

 ACE_UNIX_Addr (const sockaddr_un *, int len)
 Creates an ACE_INET_Addr from a sockaddr_un structure. More...

int set (const ACE_UNIX_Addr &sa)
 Creates an ACE_UNIX_Addr from another ACE_UNIX_Addr. More...

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

int set (const sockaddr_un *, int len)
 Creates an ACE_UNIX_Addr from a sockaddr_un structure. More...

virtual void * get_addr (void) const
 Return a pointer to the underlying network address. More...

virtual void set_addr (void *addr, int len)
 Set a pointer to the underlying network address. More...

virtual int addr_to_string (char addr[], size_t) const
 Transform the current address into string format. More...

virtual int string_to_addr (const char addr[])
 Transform the string into the current addressing format. More...

int operator== (const ACE_UNIX_Addr &SAP) const
 Compare two addresses for equality. More...

int operator!= (const ACE_UNIX_Addr &SAP) const
 Compare two addresses for inequality. More...

const char * get_path_name (void) const
 Return the path name of the underlying rendezvous point. More...

virtual u_long hash (void) const
 Computes and returns hash value. More...

void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Attributes

sockaddr_un unix_addr_
 Underlying socket address. More...


Detailed Description

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

Definition at line 35 of file UNIX_Addr.h.


Constructor & Destructor Documentation

ACE_UNIX_Addr::ACE_UNIX_Addr void   
 

Default constructor.

Definition at line 36 of file UNIX_Addr.cpp.

References ACE_OS_String::memset, and unix_addr_.

00037   : ACE_Addr (AF_UNIX, sizeof this->unix_addr_)
00038 {
00039   (void) ACE_OS::memset ((void *) &this->unix_addr_,
00040                          0,
00041                          sizeof this->unix_addr_);
00042 
00043   this->unix_addr_.sun_family = AF_UNIX;
00044 }

ACE_UNIX_Addr::ACE_UNIX_Addr const ACE_UNIX_Addr &    sa
 

Copy constructor.

Definition at line 65 of file UNIX_Addr.cpp.

References set.

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

ACE_UNIX_Addr::ACE_UNIX_Addr const char    rendezvous_point[]
 

Creates an ACE_UNIX_Addr from a string.

Definition at line 110 of file UNIX_Addr.cpp.

References set.

00111 {
00112   this->set (rendezvous_point);
00113 }

ACE_UNIX_Addr::ACE_UNIX_Addr const sockaddr_un *   ,
int    len
 

Creates an ACE_INET_Addr from a sockaddr_un structure.

Definition at line 82 of file UNIX_Addr.cpp.

References set.

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


Member Function Documentation

ACE_INLINE int ACE_UNIX_Addr::addr_to_string char    addr[],
size_t   
const [virtual]
 

Transform the current address into string format.

Definition at line 29 of file UNIX_Addr.i.

References ACE_OS_String::strsncpy.

00030 {
00031   ACE_OS::strsncpy (s, this->unix_addr_.sun_path, len);
00032   return 0;
00033 }

void ACE_UNIX_Addr::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_Addr.

Definition at line 30 of file UNIX_Addr.cpp.

Referenced by ACE_LSOCK_Acceptor::dump.

00031 {
00032 }

ACE_INLINE void * ACE_UNIX_Addr::get_addr void    const [virtual]
 

Return a pointer to the underlying network address.

Reimplemented from ACE_Addr.

Definition at line 11 of file UNIX_Addr.i.

References unix_addr_.

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

ACE_INLINE const char * ACE_UNIX_Addr::get_path_name void    const
 

Return the path name of the underlying rendezvous point.

Definition at line 56 of file UNIX_Addr.i.

References unix_addr_.

00057 {
00058   return this->unix_addr_.sun_path;
00059 }

ACE_INLINE u_long ACE_UNIX_Addr::hash void    const [virtual]
 

Computes and returns hash value.

Reimplemented from ACE_Addr.

Definition at line 62 of file UNIX_Addr.i.

References ACE::hash_pjw.

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

ACE_INLINE int ACE_UNIX_Addr::operator!= const ACE_UNIX_Addr &    SAP const
 

Compare two addresses for inequality.

Definition at line 48 of file UNIX_Addr.i.

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

ACE_INLINE int ACE_UNIX_Addr::operator== const ACE_UNIX_Addr &    SAP const
 

Compare two addresses for equality.

Definition at line 38 of file UNIX_Addr.i.

References ACE_OS_String::strncmp, and unix_addr_.

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

int ACE_UNIX_Addr::set const sockaddr_un *   ,
int    len
 

Creates an ACE_UNIX_Addr from a sockaddr_un structure.

Definition at line 72 of file UNIX_Addr.cpp.

References ACE_Addr::base_set, ACE_OS_String::memset, ACE_OS_String::strcpy, and unix_addr_.

00073 {
00074   (void) ACE_OS::memset ((void *) &this->unix_addr_, 0, 
00075                    sizeof this->unix_addr_);
00076   this->unix_addr_.sun_family = AF_UNIX;
00077   ACE_OS::strcpy (this->unix_addr_.sun_path, un->sun_path);
00078   this->base_set (AF_UNIX, len);
00079   return 0;
00080 }

int ACE_UNIX_Addr::set const char    rendezvous_point[]
 

Creates an ACE_UNIX_Addr from a string.

Definition at line 88 of file UNIX_Addr.cpp.

References ACE_Addr::base_set, ACE_OS_String::memcpy, ACE_OS_String::memset, ACE_OS_String::strlen, and unix_addr_.

00089 {
00090   (void) ACE_OS::memset ((void *) &this->unix_addr_, 
00091                          0,
00092                          sizeof this->unix_addr_);
00093   this->unix_addr_.sun_family = AF_UNIX;
00094   size_t len = ACE_OS::strlen (rendezvous_point);
00095   size_t maxlen = sizeof this->unix_addr_.sun_path;
00096  
00097   (void) ACE_OS::memcpy (this->unix_addr_.sun_path, 
00098                          rendezvous_point,
00099                          len >= maxlen ? maxlen - 1 : len);
00100  
00101   this->ACE_Addr::base_set (AF_UNIX, 
00102                             sizeof this->unix_addr_ -
00103                             sizeof (this->unix_addr_.sun_path) +
00104                             ACE_OS::strlen (this->unix_addr_.sun_path));
00105   return 0;
00106 }

int ACE_UNIX_Addr::set const ACE_UNIX_Addr &    sa
 

Creates an ACE_UNIX_Addr from another ACE_UNIX_Addr.

Definition at line 47 of file UNIX_Addr.cpp.

References AF_ANY, ACE_Addr::base_set, ACE_Addr::get_size, ACE_Addr::get_type, ACE_OS_String::memset, ACE_OS_String::strcpy, and unix_addr_.

Referenced by ACE_UNIX_Addr.

00048 {
00049   if (sa.get_type () == AF_ANY)
00050     (void) ACE_OS::memset ((void *) &this->unix_addr_,
00051                            0,
00052                            sizeof this->unix_addr_);
00053   else
00054     ACE_OS::strcpy (this->unix_addr_.sun_path,
00055                     sa.unix_addr_.sun_path);
00056 
00057   this->unix_addr_.sun_family = AF_UNIX;
00058   this->base_set (sa.get_type (), sa.get_size ());
00059 
00060   return 0;
00061 }

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_String::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 }

ACE_INLINE int ACE_UNIX_Addr::string_to_addr const char    addr[] [virtual]
 

Transform the string into the current addressing format.

Definition at line 19 of file UNIX_Addr.i.

References ACE_OS_String::strsncpy.

00020 {
00021   ACE_OS::strsncpy (this->unix_addr_.sun_path, addr,
00022                     sizeof this->unix_addr_.sun_path);
00023   return 0;
00024 }


Member Data Documentation

ACE_UNIX_Addr::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Addr.

Definition at line 88 of file UNIX_Addr.h.

sockaddr_un ACE_UNIX_Addr::unix_addr_ [private]
 

Underlying socket address.

Definition at line 92 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 Mon Jun 16 12:58:57 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002