ACE_SPIPE_Addr Class Reference

Defines the SVR4 STREAM pipe address family address format. More...

#include <SPIPE_Addr.h>

Inheritance diagram for ACE_SPIPE_Addr:

Inheritance graph
[legend]
Collaboration diagram for ACE_SPIPE_Addr:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_SPIPE_Addr (void)
 Default constructor.

 ACE_SPIPE_Addr (const ACE_SPIPE_Addr &sa)
 Copy constructor.

 ACE_SPIPE_Addr (const ACE_TCHAR *rendezvous_point, gid_t=0, uid_t=0)
int set (const ACE_SPIPE_Addr &sa)
 Acts like a copy constructor...

int set (const ACE_TCHAR *rendezvous_point, gid_t=0, uid_t=0)
virtual void * get_addr (void) const
 Return a pointer to the 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 ACE_TCHAR *addr)
 Transform the string into the current addressing format.

bool operator== (const ACE_SPIPE_Addr &SAP) const
 Check for equality.

bool operator!= (const ACE_SPIPE_Addr &SAP) const
 Check for inequality.

const ACE_TCHARget_path_name (void) const
 Pathname of rendezvous point in file system.

uid_t user_id (void) const
 Get user id.

void user_id (uid_t uid)
 Set user id.

void group_id (gid_t gid)
 Set group ids.

gid_t group_id (void) const
 Get group ids.

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Attributes

ACE_SPIPE_Addr::SPIPE_Addr SPIPE_addr_
 Contains security attributes.


Detailed Description

Defines the SVR4 STREAM pipe address family address format.

Definition at line 35 of file SPIPE_Addr.h.


Constructor & Destructor Documentation

ACE_SPIPE_Addr::ACE_SPIPE_Addr void   ) 
 

Default constructor.

Definition at line 48 of file SPIPE_Addr.cpp.

References AF_SPIPE, and ACE_OS::memset().

00049   : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_)
00050 {
00051   (void) ACE_OS::memset ((void *) &this->SPIPE_addr_,
00052                          0,
00053                          sizeof this->SPIPE_addr_);
00054 }

ACE_SPIPE_Addr::ACE_SPIPE_Addr const ACE_SPIPE_Addr sa  ) 
 

Copy constructor.

Definition at line 91 of file SPIPE_Addr.cpp.

References AF_SPIPE, and set().

00092   : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_)
00093 {
00094   this->set (sa);
00095 }

ACE_SPIPE_Addr::ACE_SPIPE_Addr const ACE_TCHAR rendezvous_point,
gid_t  = 0,
uid_t  = 0
 

Create a ACE_SPIPE_Addr from a rendezvous point in the file system.

Definition at line 159 of file SPIPE_Addr.cpp.

References ACE_TCHAR, AF_SPIPE, gid_t, set(), and uid_t.

00162   : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_)
00163 {
00164   this->set (addr, gid, uid);
00165 }


Member Function Documentation

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

Transform the current address into string format.

Definition at line 57 of file SPIPE_Addr.cpp.

References ACE_TCHAR, and ACE_OS::strsncpy().

00058 {
00059   ACE_OS::strsncpy (s,
00060                     this->SPIPE_addr_.rendezvous_,
00061                     len);
00062   return 0;
00063 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_SPIPE_Addr::dump void   )  const
 

Dump the state of an object.

Reimplemented from ACE_Addr.

Definition at line 19 of file SPIPE_Addr.cpp.

00020 {
00021 #if defined (ACE_HAS_DUMP)
00022 #endif /* ACE_HAS_DUMP */
00023 }

void * ACE_SPIPE_Addr::get_addr void   )  const [virtual]
 

Return a pointer to the address.

Reimplemented from ACE_Addr.

Definition at line 40 of file SPIPE_Addr.cpp.

References SPIPE_addr_.

00041 {
00042   return (void *) &this->SPIPE_addr_;
00043 }

ACE_INLINE const ACE_TCHAR * ACE_SPIPE_Addr::get_path_name void   )  const
 

Pathname of rendezvous point in file system.

Definition at line 30 of file SPIPE_Addr.inl.

References ACE_SPIPE_Addr::SPIPE_Addr::rendezvous_, and SPIPE_addr_.

Referenced by ACE_SPIPE_Connector::ACE_SPIPE_Connector(), ACE_SPIPE_Connector::connect(), and ACE_SPIPE_Acceptor::create_new_instance().

00031 {
00032   return this->SPIPE_addr_.rendezvous_;
00033 }

ACE_INLINE gid_t ACE_SPIPE_Addr::group_id void   )  const
 

Get group ids.

Definition at line 48 of file SPIPE_Addr.inl.

References ACE_SPIPE_Addr::SPIPE_Addr::gid_, and SPIPE_addr_.

00049 {
00050   return this->SPIPE_addr_.gid_;
00051 }

ACE_INLINE void ACE_SPIPE_Addr::group_id gid_t  gid  ) 
 

Set group ids.

Definition at line 54 of file SPIPE_Addr.inl.

References ACE_SPIPE_Addr::SPIPE_Addr::gid_, gid_t, and SPIPE_addr_.

Referenced by ACE_SPIPE_Acceptor::accept().

00055 {
00056   this->SPIPE_addr_.gid_ = gid;
00057 }

ACE_INLINE bool ACE_SPIPE_Addr::operator!= const ACE_SPIPE_Addr SAP  )  const
 

Check for inequality.

Definition at line 22 of file SPIPE_Addr.inl.

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

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE bool ACE_SPIPE_Addr::operator== const ACE_SPIPE_Addr SAP  )  const
 

Check for equality.

Definition at line 13 of file SPIPE_Addr.inl.

References ACE_SPIPE_Addr::SPIPE_Addr::rendezvous_, SPIPE_addr_, and ACE_OS::strcmp().

00014 {
00015   return ACE_OS::strcmp (this->SPIPE_addr_.rendezvous_,
00016                          sap.SPIPE_addr_.rendezvous_    ) == 0;
00017 }

int ACE_SPIPE_Addr::set const ACE_TCHAR rendezvous_point,
gid_t  = 0,
uid_t  = 0
 

Create a ACE_SPIPE_Addr from a rendezvous point in the file system.

Definition at line 98 of file SPIPE_Addr.cpp.

References ACE_ALLOCATOR_RETURN, ACE_LIB_TEXT, ACE_TCHAR, AF_SPIPE, ACE_Addr::base_set(), ACE_OS::free(), ACE_OS::getgid(), ACE_OS::getuid(), ACE_SPIPE_Addr::SPIPE_Addr::gid_, gid_t, SPIPE_addr_, ACE_OS::strcat(), ACE_OS::strchr(), ACE_OS::strcpy(), ACE_OS::strlen(), ACE_OS::strncmp(), ACE_OS::strsncpy(), ACE_SPIPE_Addr::SPIPE_Addr::uid_, and uid_t.

00101 {
00102   int len = sizeof (this->SPIPE_addr_.uid_);
00103   len += sizeof (this->SPIPE_addr_.gid_);
00104 
00105 #if defined (ACE_WIN32)
00106   const ACE_TCHAR *colonp = ACE_OS::strchr (addr, ':');
00107   ACE_TCHAR temp[BUFSIZ];
00108 
00109   if (colonp == 0) // Assume it's a local name.
00110     {
00111       ACE_OS::strcpy (temp, ACE_LIB_TEXT ( "\\\\.\\pipe\\"));
00112       ACE_OS::strcat (temp, addr);
00113     }
00114   else
00115     {
00116 
00117       if (ACE_OS::strncmp (addr,
00118                            ACE_LIB_TEXT ("localhost"),
00119                            ACE_OS::strlen ("localhost")) == 0)
00120         // change "localhost" to "."
00121         ACE_OS::strcpy (temp, ACE_LIB_TEXT ("\\\\."));
00122       else
00123         {
00124           ACE_OS::strcpy (temp, ACE_LIB_TEXT ("\\\\"));
00125 
00126           ACE_TCHAR *t;
00127 
00128           // We need to allocate a duplicate so that we can write a
00129           // NUL character into it.
00130           ACE_ALLOCATOR_RETURN (t, ACE_OS::strdup (addr), -1);
00131 
00132           t[colonp - addr] = ACE_LIB_TEXT ('\0');
00133           ACE_OS::strcat (temp, t);
00134 
00135           ACE_OS::free (t);
00136         }
00137 
00138       ACE_OS::strcat (temp, ACE_LIB_TEXT ("\\pipe\\"));
00139       ACE_OS::strcat (temp, colonp + 1);
00140     }
00141   len += static_cast<int> (ACE_OS::strlen (temp));
00142   this->ACE_Addr::base_set (AF_SPIPE, len);
00143 
00144   ACE_OS::strcpy (this->SPIPE_addr_.rendezvous_, temp);
00145 #else
00146   this->ACE_Addr::base_set (AF_SPIPE,
00147                             ACE_OS::strlen (addr) + 1 + len);
00148   ACE_OS::strsncpy (this->SPIPE_addr_.rendezvous_,
00149                     addr,
00150                     sizeof this->SPIPE_addr_.rendezvous_);
00151 #endif /* ACE_WIN32 */
00152   this->SPIPE_addr_.gid_ = gid == 0 ? ACE_OS::getgid () : gid;
00153   this->SPIPE_addr_.uid_ = uid == 0 ? ACE_OS::getuid () : uid;
00154   return 0;
00155 }

int ACE_SPIPE_Addr::set const ACE_SPIPE_Addr sa  ) 
 

Acts like a copy constructor...

Definition at line 74 of file SPIPE_Addr.cpp.

References AF_ANY, ACE_Addr::base_set(), ACE_Addr::get_size(), ACE_Addr::get_type(), ACE_OS::memcpy(), ACE_OS::memset(), and SPIPE_addr_.

Referenced by ACE_SPIPE_Addr(), and string_to_addr().

00075 {
00076   this->base_set (sa.get_type (), sa.get_size ());
00077 
00078   if (sa.get_type () == AF_ANY)
00079     (void) ACE_OS::memset ((void *) &this->SPIPE_addr_,
00080                            0,
00081                            sizeof this->SPIPE_addr_);
00082   else
00083     (void) ACE_OS::memcpy ((void *) &this->SPIPE_addr_, (void *)
00084                            &sa.SPIPE_addr_,
00085                            sa.get_size ());
00086   return 0;
00087 }

void ACE_SPIPE_Addr::set_addr void *  addr,
int  len
[virtual]
 

Set a pointer to the underlying network address.

Reimplemented from ACE_Addr.

Definition at line 27 of file SPIPE_Addr.cpp.

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

00028 {
00029   ACE_TRACE ("ACE_SPIPE_Addr::set_addr");
00030 
00031   this->ACE_Addr::base_set (AF_SPIPE, len);
00032   ACE_OS::memcpy ((void *) &this->SPIPE_addr_,
00033                   (void *) addr,
00034                   len);
00035 }

int ACE_SPIPE_Addr::string_to_addr const ACE_TCHAR addr  )  [virtual]
 

Transform the string into the current addressing format.

Definition at line 68 of file SPIPE_Addr.cpp.

References ACE_TCHAR, and set().

00069 {
00070   return this->set (addr);
00071 }

ACE_INLINE void ACE_SPIPE_Addr::user_id uid_t  uid  ) 
 

Set user id.

Definition at line 42 of file SPIPE_Addr.inl.

References SPIPE_addr_, ACE_SPIPE_Addr::SPIPE_Addr::uid_, and uid_t.

00043 {
00044   this->SPIPE_addr_.uid_ = uid;
00045 }

ACE_INLINE uid_t ACE_SPIPE_Addr::user_id void   )  const
 

Get user id.

Definition at line 36 of file SPIPE_Addr.inl.

References SPIPE_addr_, and ACE_SPIPE_Addr::SPIPE_Addr::uid_.

Referenced by ACE_SPIPE_Acceptor::accept().

00037 {
00038   return this->SPIPE_addr_.uid_;
00039 }


Member Data Documentation

ACE_SPIPE_Addr::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Addr.

Definition at line 95 of file SPIPE_Addr.h.

struct ACE_SPIPE_Addr::SPIPE_Addr ACE_SPIPE_Addr::SPIPE_addr_ [private]
 

Contains security attributes.

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


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