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

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 Methods

 ACE_SPIPE_Addr (void)
 Default constructor. More...

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

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

int set (const ACE_SPIPE_Addr &sa)
 Acts like a copy constructor... More...

int 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. More...

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

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

virtual int addr_to_string (ACE_TCHAR *addr, size_t) const
 Transform the current address into string format. More...

virtual int string_to_addr (const ACE_TCHAR *addr)
 Transform the string into the current addressing format. More...

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

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

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

uid_t user_id (void) const
 Get user id. More...

void user_id (uid_t uid)
 Set user id. More...

void group_id (gid_t gid)
 Set group ids. More...

gid_t group_id (void) const
 Get group ids. 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

ACE_SPIPE_Addr::SPIPE_Addr SPIPE_addr_
 Contains security attributes. More...


Detailed Description

Defines the SVR4 STREAM pipe address family address format.

Definition at line 33 of file SPIPE_Addr.h.


Constructor & Destructor Documentation

ACE_SPIPE_Addr::ACE_SPIPE_Addr void   
 

Default constructor.

Definition at line 34 of file SPIPE_Addr.cpp.

References AF_SPIPE, and ACE_OS_String::memset.

00035   : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_)
00036 {
00037   (void) ACE_OS::memset ((void *) &this->SPIPE_addr_, 
00038                          0, 
00039                          sizeof this->SPIPE_addr_);
00040 }

ACE_SPIPE_Addr::ACE_SPIPE_Addr const ACE_SPIPE_Addr &    sa
 

Copy constructor.

Definition at line 68 of file SPIPE_Addr.cpp.

References AF_SPIPE, and set.

00069   : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_)
00070 {
00071   this->set (sa);
00072 }

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 136 of file SPIPE_Addr.cpp.

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

00139   : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_)
00140 {
00141   this->set (addr, gid, uid);
00142 }


Member Function Documentation

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

Transform the current address into string format.

Definition at line 11 of file SPIPE_Addr.i.

References ACE_TCHAR, and ACE_OS_String::strsncpy.

00012 {
00013   ACE_OS::strsncpy (s,
00014                     this->SPIPE_addr_.rendezvous_,
00015                     len);
00016   return 0;
00017 }

void ACE_SPIPE_Addr::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_Addr.

Definition at line 16 of file SPIPE_Addr.cpp.

00017 {
00018 }

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

Return a pointer to the address.

Reimplemented from ACE_Addr.

Definition at line 22 of file SPIPE_Addr.i.

References SPIPE_addr_.

00023 {
00024   return (void *) &this->SPIPE_addr_;
00025 }

ACE_INLINE const ACE_TCHAR * ACE_SPIPE_Addr::get_path_name void    const
 

Pathname of rendezvous point in file system.

Definition at line 47 of file SPIPE_Addr.i.

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

Referenced by ACE_SPIPE_Connector::ACE_SPIPE_Connector, ACE_UPIPE_Connector::ACE_UPIPE_Connector, ACE_UPIPE_Connector::connect, ACE_SPIPE_Connector::connect, and ACE_SPIPE_Acceptor::create_new_instance.

00048 {
00049   return this->SPIPE_addr_.rendezvous_;
00050 }

ACE_INLINE gid_t ACE_SPIPE_Addr::group_id void    const
 

Get group ids.

Definition at line 65 of file SPIPE_Addr.i.

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

00066 {
00067   return this->SPIPE_addr_.gid_;
00068 }

ACE_INLINE void ACE_SPIPE_Addr::group_id gid_t    gid
 

Set group ids.

Definition at line 71 of file SPIPE_Addr.i.

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

Referenced by ACE_SPIPE_Acceptor::accept.

00072 {
00073   this->SPIPE_addr_.gid_ = gid;
00074 }

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

Check for inequality.

Definition at line 39 of file SPIPE_Addr.i.

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

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

Check for equality.

Definition at line 30 of file SPIPE_Addr.i.

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

00031 {
00032   return ACE_OS::strcmp (this->SPIPE_addr_.rendezvous_,
00033                          sap.SPIPE_addr_.rendezvous_    ) == 0;
00034 }

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 75 of file SPIPE_Addr.cpp.

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

00078 {
00079   int len = sizeof (this->SPIPE_addr_.uid_);
00080   len += sizeof (this->SPIPE_addr_.gid_);
00081 
00082 #if defined (ACE_WIN32)
00083   const ACE_TCHAR *colonp = ACE_OS::strchr (addr, ':');
00084   ACE_TCHAR temp[BUFSIZ];
00085 
00086   if (colonp == 0) // Assume it's a local name.
00087     {
00088       ACE_OS::strcpy (temp, ACE_LIB_TEXT ( "\\\\.\\pipe\\"));
00089       ACE_OS::strcat (temp, addr);
00090     }
00091   else
00092     {
00093       
00094       if (ACE_OS::strncmp (addr,
00095                            ACE_LIB_TEXT ("localhost"),
00096                            ACE_OS::strlen ("localhost")) == 0)
00097         // change "localhost" to "."
00098         ACE_OS::strcpy (temp, ACE_LIB_TEXT ("\\\\."));
00099       else
00100         {
00101           ACE_OS::strcpy (temp, ACE_LIB_TEXT ("\\\\"));
00102 
00103           ACE_TCHAR *t;
00104           
00105           // We need to allocate a duplicate so that we can write a
00106           // NUL character into it.
00107           ACE_ALLOCATOR_RETURN (t, ACE_OS::strdup (addr), -1);
00108 
00109           t[colonp - addr] = ACE_LIB_TEXT ('\0');
00110           ACE_OS::strcat (temp, t);
00111 
00112           ACE_OS::free (t);
00113         }
00114 
00115       ACE_OS::strcat (temp, ACE_LIB_TEXT ("\\pipe\\"));
00116       ACE_OS::strcat (temp, colonp + 1);
00117     }
00118   len += ACE_static_cast (int, ACE_OS_String::strlen (temp));
00119   this->ACE_Addr::base_set (AF_SPIPE, len);
00120 
00121   ACE_OS_String::strcpy (this->SPIPE_addr_.rendezvous_, temp);
00122 #else
00123   this->ACE_Addr::base_set (AF_SPIPE,
00124                             ACE_OS::strlen (addr) + 1 + len);
00125   ACE_OS::strsncpy (this->SPIPE_addr_.rendezvous_,
00126                     addr,
00127                     sizeof this->SPIPE_addr_.rendezvous_);
00128 #endif /* ACE_WIN32 */
00129   this->SPIPE_addr_.gid_ = gid == 0 ? ACE_OS::getgid () : gid;
00130   this->SPIPE_addr_.uid_ = uid == 0 ? ACE_OS::getuid () : uid;
00131   return 0;
00132 }

int ACE_SPIPE_Addr::set const ACE_SPIPE_Addr &    sa
 

Acts like a copy constructor...

Definition at line 51 of file SPIPE_Addr.cpp.

References AF_ANY, ACE_Addr::base_set, ACE_Addr::get_size, ACE_Addr::get_type, ACE_OS_String::memcpy, ACE_OS_String::memset, and SPIPE_addr_.

Referenced by ACE_SPIPE_Addr, and string_to_addr.

00052 {
00053   this->base_set (sa.get_type (), sa.get_size ());
00054 
00055   if (sa.get_type () == AF_ANY)
00056     (void) ACE_OS::memset ((void *) &this->SPIPE_addr_,
00057                            0,
00058                            sizeof this->SPIPE_addr_);
00059   else
00060     (void) ACE_OS::memcpy ((void *) &this->SPIPE_addr_, (void *)
00061                            &sa.SPIPE_addr_,
00062                            sa.get_size ()); 
00063   return 0;
00064 }

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 22 of file SPIPE_Addr.cpp.

References ACE_TRACE, AF_SPIPE, ACE_Addr::base_set, and ACE_OS_String::memcpy.

00023 {
00024   ACE_TRACE ("ACE_SPIPE_Addr::set_addr");
00025 
00026   this->ACE_Addr::base_set (AF_SPIPE, len);
00027   ACE_OS::memcpy ((void *) &this->SPIPE_addr_,
00028                   (void *) addr, 
00029                   len);
00030 }

int ACE_SPIPE_Addr::string_to_addr const ACE_TCHAR   addr [virtual]
 

Transform the string into the current addressing format.

Definition at line 45 of file SPIPE_Addr.cpp.

References ACE_TCHAR, and set.

00046 {
00047   return this->set (addr);
00048 }

ACE_INLINE void ACE_SPIPE_Addr::user_id uid_t    uid
 

Set user id.

Definition at line 59 of file SPIPE_Addr.i.

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

00060 {
00061   this->SPIPE_addr_.uid_ = uid;
00062 }

ACE_INLINE uid_t ACE_SPIPE_Addr::user_id void    const
 

Get user id.

Definition at line 53 of file SPIPE_Addr.i.

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

Referenced by ACE_SPIPE_Acceptor::accept.

00054 {
00055   return this->SPIPE_addr_.uid_;
00056 }


Member Data Documentation

ACE_SPIPE_Addr::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Addr.

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