Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | Static Private Attributes

ACE_IPC_SAP Class Reference

Defines the member functions for the base class of the ACE_IPC_SAP abstraction. More...

#include <IPC_SAP.h>

Inheritance diagram for ACE_IPC_SAP:
Inheritance graph
[legend]

List of all members.

Public Member Functions

int control (int cmd, void *) const
 Interface for <ioctl>.
int enable (int value) const
int disable (int value) const
ACE_HANDLE get_handle (void) const
 Get the underlying handle.
void set_handle (ACE_HANDLE handle)
 Set the underlying handle.
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Protected Member Functions

 ACE_IPC_SAP (void)
 Default constructor.
 ~ACE_IPC_SAP (void)
 Protected destructor.

Private Attributes

ACE_HANDLE handle_
 Underlying I/O handle.

Static Private Attributes

static pid_t pid_ = 0
 Cache the process ID.

Detailed Description

Defines the member functions for the base class of the ACE_IPC_SAP abstraction.

Definition at line 32 of file IPC_SAP.h.


Constructor & Destructor Documentation

ACE_IPC_SAP::ACE_IPC_SAP ( void   )  [protected]

Default constructor.

Definition at line 40 of file IPC_SAP.cpp.

  : handle_ (ACE_INVALID_HANDLE)
{
  // ACE_TRACE ("ACE_IPC_SAP::ACE_IPC_SAP");
}

ACE_IPC_SAP::~ACE_IPC_SAP ( void   )  [inline, protected]

Protected destructor.

Not a virtual destructor. Protected destructor to prevent operator delete() from being called through a base class ACE_IPC_SAP pointer/reference.

Definition at line 10 of file IPC_SAP.inl.

{
  // ACE_TRACE ("ACE_IPC_SAP::~ACE_IPC_SAP");
}


Member Function Documentation

int ACE_IPC_SAP::control ( int  cmd,
void *  arg 
) const [inline]

Interface for <ioctl>.

Reimplemented in ACE_SSL_SOCK.

Definition at line 34 of file IPC_SAP.inl.

{
  ACE_TRACE ("ACE_IPC_SAP::control");
  return ACE_OS::ioctl (this->handle_, cmd, arg);
}

int ACE_IPC_SAP::disable ( int  value  )  const

Disable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), which is passed as the value.

Reimplemented in ACE_SPIPE, and ACE_SSL_SOCK.

Definition at line 123 of file IPC_SAP.cpp.

{
  ACE_TRACE ("ACE_IPC_SAP::disable");

#if defined (ACE_WIN32) || defined (ACE_VXWORKS)
  switch (value)
    {
    case ACE_NONBLOCK:
      // nonblocking argument (1)
      // blocking:            (0)
      {
        int nonblock = 0;
        return ACE_OS::ioctl (this->handle_,
                              FIONBIO,
                              &nonblock);
      }
    default:
      ACE_NOTSUP_RETURN (-1);
    }
#else  /* ! ACE_WIN32 && ! ACE_VXWORKS */
  switch (value)
    {
#if defined (SIGURG)
    case SIGURG:
    case ACE_SIGURG:
#if defined (F_SETOWN)
      return ACE_OS::fcntl (this->handle_,
                            F_SETOWN,
                            0);
#else
      ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN */
#endif /* SIGURG */
#if defined (SIGIO)
    case SIGIO:
    case ACE_SIGIO:
#if defined (F_SETOWN) && defined (FASYNC)
      if (ACE_OS::fcntl (this->handle_,
                         F_SETOWN,
                         0) == -1
          || ACE::clr_flags (this->handle_,
                                        FASYNC) == -1)
        return -1;
      break;
#else
      ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN && FASYNC */
#endif /* SIGIO <== */
#if defined (F_SETFD)
    case ACE_CLOEXEC:
      // Disables the close-on-exec flag.
      if (ACE_OS::fcntl (this->handle_,
                         F_SETFD,
                         0) == -1)
        return -1;
      break;
#endif /* F_SETFD */
    case ACE_NONBLOCK:
      if (ACE::clr_flags (this->handle_,
                                     ACE_NONBLOCK) == -1)
        return -1;
      break;
    default:
      return -1;
    }
  return 0;
#endif /* ! ACE_WIN32 && ! ACE_VXWORKS */
  /* NOTREACHED */
}

void ACE_IPC_SAP::dump ( void   )  const
int ACE_IPC_SAP::enable ( int  value  )  const

Enable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), which is passed as the value.

Reimplemented in ACE_SSL_SOCK.

Definition at line 47 of file IPC_SAP.cpp.

{
  ACE_TRACE ("ACE_IPC_SAP::enable");

  // First-time in initialization.
  if (ACE_IPC_SAP::pid_ == 0)
    ACE_IPC_SAP::pid_ = ACE_OS::getpid ();

#if defined (ACE_WIN32) || defined (ACE_VXWORKS)
  switch (value)
    {
    case ACE_NONBLOCK:
      {
        // nonblocking argument (1)
        // blocking:            (0)
        int nonblock = 1;
        return ACE_OS::ioctl (this->handle_,
                              FIONBIO,
                              &nonblock);
      }
    default:
      ACE_NOTSUP_RETURN (-1);
    }
#else  /* ! ACE_WIN32 && ! ACE_VXWORKS */
  switch (value)
    {
#if defined (SIGURG)
    case SIGURG:
    case ACE_SIGURG:
#if defined (F_SETOWN)
      return ACE_OS::fcntl (this->handle_,
                            F_SETOWN,
                            ACE_IPC_SAP::pid_);
#else
      ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN */
#endif /* SIGURG */
#if defined (SIGIO)
    case SIGIO:
    case ACE_SIGIO:
#if defined (F_SETOWN) && defined (FASYNC)
      if (ACE_OS::fcntl (this->handle_,
                         F_SETOWN,
                         ACE_IPC_SAP::pid_) == -1
          || ACE::set_flags (this->handle_,
                                        FASYNC) == -1)
        return -1;
      break;
#else
      ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN && FASYNC */
#endif /* SIGIO <== */
#if defined (F_SETFD)
    case ACE_CLOEXEC:
      // Enables the close-on-exec flag.
      if (ACE_OS::fcntl (this->handle_,
                         F_SETFD,
                         1) == -1)
        return -1;
      break;
#endif /* F_SETFD */
    case ACE_NONBLOCK:
      if (ACE::set_flags (this->handle_,
                                     ACE_NONBLOCK) == ACE_INVALID_HANDLE)
        return -1;
      break;
    default:
      return -1;
    }
  return 0;
#endif /* ! ACE_WIN32 && ! ACE_VXWORKS */

  /* NOTREACHED */
}

ACE_HANDLE ACE_IPC_SAP::get_handle ( void   )  const [inline]

Get the underlying handle.

Reimplemented in ACE_SSL_SOCK.

Definition at line 16 of file IPC_SAP.inl.

{
  ACE_TRACE ("ACE_IPC_SAP::get_handle");
  return this->handle_;
}

void ACE_IPC_SAP::set_handle ( ACE_HANDLE  handle  )  [inline]

Set the underlying handle.

Reimplemented in ACE_SSL_SOCK, and ACE_SSL_SOCK_Stream.

Definition at line 25 of file IPC_SAP.inl.

{
  ACE_TRACE ("ACE_IPC_SAP::set_handle");
  this->handle_ = handle;
}


Member Data Documentation

ACE_HANDLE ACE_IPC_SAP::handle_ [private]

Underlying I/O handle.

Definition at line 83 of file IPC_SAP.h.

pid_t ACE_IPC_SAP::pid_ = 0 [static, private]

Cache the process ID.

Definition at line 86 of file IPC_SAP.h.


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