Classes | Public Member Functions | Public Attributes | Private Attributes

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.

Classes

struct  SPIPE_Addr
 Contains security attributes. More...

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

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

  : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_)
{
  (void) ACE_OS::memset ((void *) &this->SPIPE_addr_,
                         0,
                         sizeof this->SPIPE_addr_);
}

ACE_SPIPE_Addr::ACE_SPIPE_Addr ( const ACE_SPIPE_Addr sa  ) 

Copy constructor.

Definition at line 91 of file SPIPE_Addr.cpp.

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

ACE_SPIPE_Addr::ACE_SPIPE_Addr ( const ACE_TCHAR rendezvous_point,
gid_t  gid = 0,
uid_t  uid = 0 
)

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

Definition at line 159 of file SPIPE_Addr.cpp.

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


Member Function Documentation

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

Transform the current address into string format.

Definition at line 57 of file SPIPE_Addr.cpp.

{
  ACE_OS::strsncpy (s,
                    this->SPIPE_addr_.rendezvous_,
                    len);
  return 0;
}

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.

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

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.

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

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.

{
  return this->SPIPE_addr_.rendezvous_;
}

gid_t ACE_SPIPE_Addr::group_id ( void   )  const

Get group ids.

Definition at line 48 of file SPIPE_Addr.inl.

{
  return this->SPIPE_addr_.gid_;
}

void ACE_SPIPE_Addr::group_id ( gid_t  gid  ) 

Set group ids.

Definition at line 54 of file SPIPE_Addr.inl.

{
  this->SPIPE_addr_.gid_ = gid;
}

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

Check for inequality.

Definition at line 22 of file SPIPE_Addr.inl.

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

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

Check for equality.

Definition at line 13 of file SPIPE_Addr.inl.

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

int ACE_SPIPE_Addr::set ( const ACE_SPIPE_Addr sa  ) 

Acts like a copy constructor...

Definition at line 74 of file SPIPE_Addr.cpp.

{
  this->base_set (sa.get_type (), sa.get_size ());

  if (sa.get_type () == AF_ANY)
    (void) ACE_OS::memset ((void *) &this->SPIPE_addr_,
                           0,
                           sizeof this->SPIPE_addr_);
  else
    (void) ACE_OS::memcpy ((void *) &this->SPIPE_addr_, (void *)
                           &sa.SPIPE_addr_,
                           sa.get_size ());
  return 0;
}

int ACE_SPIPE_Addr::set ( const ACE_TCHAR rendezvous_point,
gid_t  gid = 0,
uid_t  uid = 0 
)

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

Definition at line 98 of file SPIPE_Addr.cpp.

{
  int len = sizeof (this->SPIPE_addr_.uid_);
  len += sizeof (this->SPIPE_addr_.gid_);

#if defined (ACE_WIN32)
  const ACE_TCHAR *colonp = ACE_OS::strchr (addr, ':');
  ACE_TCHAR temp[BUFSIZ];

  if (colonp == 0) // Assume it's a local name.
    {
      ACE_OS::strcpy (temp, ACE_TEXT ( "\\\\.\\pipe\\"));
      ACE_OS::strcat (temp, addr);
    }
  else
    {

      if (ACE_OS::strncmp (addr,
                           ACE_TEXT ("localhost"),
                           ACE_OS::strlen ("localhost")) == 0)
        // change "localhost" to "."
        ACE_OS::strcpy (temp, ACE_TEXT ("\\\\."));
      else
        {
          ACE_OS::strcpy (temp, ACE_TEXT ("\\\\"));

          ACE_TCHAR *t;

          // We need to allocate a duplicate so that we can write a
          // NUL character into it.
          ACE_ALLOCATOR_RETURN (t, ACE_OS::strdup (addr), -1);

          t[colonp - addr] = ACE_TEXT ('\0');
          ACE_OS::strcat (temp, t);

          ACE_OS::free (t);
        }

      ACE_OS::strcat (temp, ACE_TEXT ("\\pipe\\"));
      ACE_OS::strcat (temp, colonp + 1);
    }
  len += static_cast<int> (ACE_OS::strlen (temp));
  this->ACE_Addr::base_set (AF_SPIPE, len);

  ACE_OS::strcpy (this->SPIPE_addr_.rendezvous_, temp);
#else
  this->ACE_Addr::base_set (AF_SPIPE,
                            ACE_OS::strlen (addr) + 1 + len);
  ACE_OS::strsncpy (this->SPIPE_addr_.rendezvous_,
                    addr,
                    sizeof this->SPIPE_addr_.rendezvous_);
#endif /* ACE_WIN32 */
  this->SPIPE_addr_.gid_ = gid == 0 ? ACE_OS::getgid () : gid;
  this->SPIPE_addr_.uid_ = uid == 0 ? ACE_OS::getuid () : uid;
  return 0;
}

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.

{
  ACE_TRACE ("ACE_SPIPE_Addr::set_addr");

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

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.

{
  return this->set (addr);
}

uid_t ACE_SPIPE_Addr::user_id ( void   )  const

Get user id.

Definition at line 36 of file SPIPE_Addr.inl.

{
  return this->SPIPE_addr_.uid_;
}

void ACE_SPIPE_Addr::user_id ( uid_t  uid  ) 

Set user id.

Definition at line 42 of file SPIPE_Addr.inl.

{
  this->SPIPE_addr_.uid_ = uid;
}


Member Data Documentation

Declare the dynamic allocation hooks.

Reimplemented from ACE_Addr.

Definition at line 95 of file SPIPE_Addr.h.

Contains security attributes.


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