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 .

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

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.

00041   : handle_ (ACE_INVALID_HANDLE)
00042 {
00043   // ACE_TRACE ("ACE_IPC_SAP::ACE_IPC_SAP");
00044 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_IPC_SAP::~ACE_IPC_SAP void   )  [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.

00011 {
00012   // ACE_TRACE ("ACE_IPC_SAP::~ACE_IPC_SAP");
00013 }


Member Function Documentation

ACE_INLINE int ACE_IPC_SAP::control int  cmd,
void * 
const
 

Interface for .

Reimplemented in ACE_UPIPE_Stream.

Definition at line 34 of file IPC_SAP.inl.

References ACE_TRACE, and ACE_OS::ioctl().

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

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 .

Reimplemented in ACE_SPIPE.

Definition at line 123 of file IPC_SAP.cpp.

References ACE_CLOEXEC, ACE_NONBLOCK, ACE_NOTSUP_RETURN, ACE_SIGIO, ACE_SIGURG, ACE_TRACE, ACE::clr_flags(), ACE_OS::fcntl(), ACE_OS::ioctl(), and SIGIO.

Referenced by ACE_MEM_Acceptor::accept(), ACE_TLI_Connector::complete(), ACE_SOCK_SEQPACK_Connector::complete(), ACE_SOCK_Connector::complete(), ACE_MEM_Connector::connect(), ACE_SPIPE::disable(), ACE_FIFO_Recv::open(), ACE_SOCK_SEQPACK_Connector::shared_connect_finish(), and ACE_SOCK_Connector::shared_connect_finish().

00124 {
00125   ACE_TRACE ("ACE_IPC_SAP::disable");
00126 
00127 #if defined (ACE_WIN32) || defined (ACE_VXWORKS)
00128   switch (value)
00129     {
00130     case ACE_NONBLOCK:
00131       // nonblocking argument (1)
00132       // blocking:            (0)
00133       {
00134         int nonblock = 0;
00135         return ACE_OS::ioctl (this->handle_,
00136                               FIONBIO,
00137                               &nonblock);
00138       }
00139     default:
00140       ACE_NOTSUP_RETURN (-1);
00141     }
00142 #else  /* ! ACE_WIN32 && ! VXWORKS */
00143   switch (value)
00144     {
00145 #if defined (SIGURG)
00146     case SIGURG:
00147     case ACE_SIGURG:
00148 #if defined (F_SETOWN)
00149       return ACE_OS::fcntl (this->handle_,
00150                             F_SETOWN,
00151                             0);
00152 #else
00153       ACE_NOTSUP_RETURN (-1);
00154 #endif /* F_SETOWN */
00155 #endif /* SIGURG */
00156 #if defined (SIGIO)
00157     case SIGIO:
00158     case ACE_SIGIO:
00159 #if defined (F_SETOWN) && defined (FASYNC)
00160       if (ACE_OS::fcntl (this->handle_,
00161                          F_SETOWN,
00162                          0) == -1
00163           || ACE::clr_flags (this->handle_,
00164                                         FASYNC) == -1)
00165         return -1;
00166       break;
00167 #else
00168       ACE_NOTSUP_RETURN (-1);
00169 #endif /* F_SETOWN && FASYNC */
00170 #endif /* SIGIO <== */
00171 #if defined (F_SETFD)
00172     case ACE_CLOEXEC:
00173       // Disables the close-on-exec flag.
00174       if (ACE_OS::fcntl (this->handle_,
00175                          F_SETFD,
00176                          0) == -1)
00177         return -1;
00178       break;
00179 #endif /* F_SETFD */
00180     case ACE_NONBLOCK:
00181       if (ACE::clr_flags (this->handle_,
00182                                      ACE_NONBLOCK) == -1)
00183         return -1;
00184       break;
00185     default:
00186       return -1;
00187     }
00188   return 0;
00189 #endif /* ! ACE_WIN32 && ! VXWORKS */
00190   /* NOTREACHED */
00191 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_IPC_SAP::dump void   )  const
 

Dump the state of an object.

Reimplemented in ACE_FIFO, ACE_FIFO_Recv, ACE_FIFO_Recv_Msg, ACE_FIFO_Send, ACE_FIFO_Send_Msg, ACE_ICMP_Socket, ACE_LSOCK_Acceptor, ACE_LSOCK_CODgram, ACE_LSOCK_Dgram, ACE_LSOCK_Stream, ACE_MEM_Acceptor, ACE_MEM_IO, ACE_MEM_Stream, ACE_Ping_Socket, ACE_SOCK, ACE_SOCK_Acceptor, ACE_SOCK_CODgram, ACE_SOCK_Dgram, ACE_SOCK_Dgram_Bcast, ACE_SOCK_Dgram_Mcast, ACE_SOCK_IO, ACE_SOCK_SEQPACK_Acceptor, ACE_SOCK_SEQPACK_Association, ACE_SOCK_Stream, ACE_SPIPE, ACE_SPIPE_Acceptor, ACE_SPIPE_Stream, ACE_TLI, ACE_TLI_Acceptor, ACE_TLI_Stream, ACE_UPIPE_Acceptor, and ACE_UPIPE_Stream.

Definition at line 22 of file IPC_SAP.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, and LM_DEBUG.

00023 {
00024 #if defined (ACE_HAS_DUMP)
00025   ACE_TRACE ("ACE_IPC_SAP::dump");
00026 
00027   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00028   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("handle_ = %d"), this->handle_));
00029   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\npid_ = %d"), this->pid_));
00030   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00031 #endif /* ACE_HAS_DUMP */
00032 }

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 .

Definition at line 47 of file IPC_SAP.cpp.

References ACE_CLOEXEC, ACE_NONBLOCK, ACE_NOTSUP_RETURN, ACE_SIGIO, ACE_SIGURG, ACE_TRACE, ACE_OS::fcntl(), ACE_OS::getpid(), ACE_OS::ioctl(), pid_, ACE::set_flags(), and SIGIO.

Referenced by ACE_TLI_Connector::connect(), ACE_SOCK_SEQPACK_Connector::shared_connect_start(), and ACE_SOCK_Connector::shared_connect_start().

00048 {
00049   ACE_TRACE ("ACE_IPC_SAP::enable");
00050 
00051   // First-time in initialization.
00052   if (ACE_IPC_SAP::pid_ == 0)
00053     ACE_IPC_SAP::pid_ = ACE_OS::getpid ();
00054 
00055 #if defined (ACE_WIN32) || defined (ACE_VXWORKS)
00056   switch (value)
00057     {
00058     case ACE_NONBLOCK:
00059       {
00060         // nonblocking argument (1)
00061         // blocking:            (0)
00062         int nonblock = 1;
00063         return ACE_OS::ioctl (this->handle_,
00064                               FIONBIO,
00065                               &nonblock);
00066       }
00067     default:
00068       ACE_NOTSUP_RETURN (-1);
00069     }
00070 #else  /* ! ACE_WIN32 && ! VXWORKS */
00071   switch (value)
00072     {
00073 #if defined (SIGURG)
00074     case SIGURG:
00075     case ACE_SIGURG:
00076 #if defined (F_SETOWN)
00077       return ACE_OS::fcntl (this->handle_,
00078                             F_SETOWN,
00079                             ACE_IPC_SAP::pid_);
00080 #else
00081       ACE_NOTSUP_RETURN (-1);
00082 #endif /* F_SETOWN */
00083 #endif /* SIGURG */
00084 #if defined (SIGIO)
00085     case SIGIO:
00086     case ACE_SIGIO:
00087 #if defined (F_SETOWN) && defined (FASYNC)
00088       if (ACE_OS::fcntl (this->handle_,
00089                          F_SETOWN,
00090                          ACE_IPC_SAP::pid_) == -1
00091           || ACE::set_flags (this->handle_,
00092                                         FASYNC) == -1)
00093         return -1;
00094       break;
00095 #else
00096       ACE_NOTSUP_RETURN (-1);
00097 #endif /* F_SETOWN && FASYNC */
00098 #endif /* SIGIO <== */
00099 #if defined (F_SETFD)
00100     case ACE_CLOEXEC:
00101       // Enables the close-on-exec flag.
00102       if (ACE_OS::fcntl (this->handle_,
00103                          F_SETFD,
00104                          1) == -1)
00105         return -1;
00106       break;
00107 #endif /* F_SETFD */
00108     case ACE_NONBLOCK:
00109       if (ACE::set_flags (this->handle_,
00110                                      ACE_NONBLOCK) == ACE_INVALID_HANDLE)
00111         return -1;
00112       break;
00113     default:
00114       return -1;
00115     }
00116   return 0;
00117 #endif /* ! ACE_WIN32 && ! VXWORKS */
00118 
00119   /* NOTREACHED */
00120 }

ACE_INLINE ACE_HANDLE ACE_IPC_SAP::get_handle void   )  const
 

Get the underlying handle.

Reimplemented in ACE_LSOCK_CODgram, ACE_LSOCK_Dgram, ACE_LSOCK_Stream, and ACE_UPIPE_Stream.

Definition at line 16 of file IPC_SAP.inl.

References ACE_TRACE.

Referenced by ACE_UPIPE_Acceptor::accept(), ACE_TLI_Acceptor::accept(), ACE_SOCK_SEQPACK_Acceptor::accept(), ACE_SOCK_Acceptor::accept(), ACE_MEM_Acceptor::accept(), ACE_XTI_ATM_Mcast::add_leaf(), ACE_UPIPE_Stream::close(), ACE_TLI_Stream::close(), ACE_TLI::close(), ACE_SPIPE::close(), ACE_SOCK::close(), ACE_FIFO::close(), ACE_SOCK_Stream::close_reader(), ACE_SOCK_SEQPACK_Association::close_reader(), ACE_MEM_Stream::close_reader(), ACE_SOCK_Stream::close_writer(), ACE_SOCK_SEQPACK_Association::close_writer(), ACE_MEM_Stream::close_writer(), ACE_TLI_Connector::complete(), ACE_SOCK_SEQPACK_Connector::complete(), ACE_SOCK_Connector::complete(), ACE_TLI_Connector::connect(), ACE_SOCK_SEQPACK_Connector::connect(), ACE_SOCK_Connector::connect(), ACE_MEM_Connector::connect(), ACE_SPIPE_Acceptor::create_new_instance(), ACE_UPIPE_Stream::get_handle(), ACE_Service_Manager::get_handle(), ACE_Name_Proxy::get_handle(), ACE_LSOCK_Stream::get_handle(), ACE_LSOCK_Dgram::get_handle(), ACE_LSOCK_CODgram::get_handle(), ACE_SOCK_Dgram_Bcast::mk_broadcast(), ACE_TLI_Acceptor::open(), ACE_TLI::open(), ACE_SOCK_Dgram_Mcast::open(), ACE_SOCK::open(), ACE_Pipe::open(), ACE_FIFO_Recv::open(), ACE_FIFO::open(), ACE_Ping_Socket::send_echo_check(), ACE_SOCK_Dgram_Mcast::set_option(), ACE_SOCK_SEQPACK_Acceptor::shared_accept_finish(), ACE_SOCK_Acceptor::shared_accept_finish(), ACE_MEM_Acceptor::shared_accept_finish(), ACE_SOCK_SEQPACK_Acceptor::shared_accept_start(), ACE_SOCK_Acceptor::shared_accept_start(), ACE_SOCK_SEQPACK_Connector::shared_connect_start(), ACE_SOCK_Connector::shared_connect_start(), ACE_SOCK_SEQPACK_Connector::shared_open(), and ACE_SOCK_Connector::shared_open().

00017 {
00018   ACE_TRACE ("ACE_IPC_SAP::get_handle");
00019   return this->handle_;
00020 }

ACE_INLINE void ACE_IPC_SAP::set_handle ACE_HANDLE  handle  ) 
 

Set the underlying handle.

Reimplemented in ACE_LSOCK_CODgram, ACE_LSOCK_Dgram, and ACE_LSOCK_Stream.

Definition at line 25 of file IPC_SAP.inl.

References ACE_TRACE.

Referenced by ACE_UPIPE_Acceptor::accept(), ACE_TLI_Acceptor::accept(), ACE_SPIPE_Acceptor::accept(), ACE_SOCK_SEQPACK_Acceptor::accept(), ACE_SOCK_Acceptor::accept(), ACE_MEM_Acceptor::accept(), ACE_MEM_Stream::ACE_MEM_Stream(), ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association(), ACE_SOCK_Stream::ACE_SOCK_Stream(), ACE_TLI_Stream::close(), ACE_TLI::close(), ACE_SPIPE_Acceptor::close(), ACE_SPIPE::close(), ACE_SOCK::close(), ACE_FIFO::close(), ACE_UPIPE_Connector::connect(), ACE_TLI_Connector::connect(), ACE_SPIPE_Connector::connect(), ACE_MEM_Connector::connect(), ACE_SPIPE_Acceptor::create_new_instance(), ACE_TLI::open(), ACE_SPIPE_Acceptor::open(), ACE_SOCK_CODgram::open(), ACE_SOCK::open(), ACE_FIFO::open(), ACE_LSOCK_Stream::set_handle(), ACE_LSOCK_Dgram::set_handle(), and ACE_LSOCK_CODgram::set_handle().

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


Member Data Documentation

ACE_IPC_SAP::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented in ACE_FIFO, ACE_FIFO_Recv, ACE_FIFO_Recv_Msg, ACE_FIFO_Send, ACE_FIFO_Send_Msg, ACE_ICMP_Socket, ACE_LSOCK_Acceptor, ACE_LSOCK_CODgram, ACE_LSOCK_Dgram, ACE_LSOCK_Stream, ACE_MEM_Acceptor, ACE_MEM_IO, ACE_MEM_Stream, ACE_Ping_Socket, ACE_SOCK, ACE_SOCK_Acceptor, ACE_SOCK_CODgram, ACE_SOCK_Dgram, ACE_SOCK_Dgram_Bcast, ACE_SOCK_Dgram_Mcast, ACE_SOCK_IO, ACE_SOCK_Netlink, ACE_SOCK_SEQPACK_Acceptor, ACE_SOCK_SEQPACK_Association, ACE_SOCK_Stream, ACE_SPIPE, ACE_SPIPE_Acceptor, ACE_SPIPE_Stream, ACE_TLI, ACE_TLI_Acceptor, ACE_TLI_Stream, ACE_UPIPE_Acceptor, and ACE_UPIPE_Stream.

Definition at line 65 of file IPC_SAP.h.

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 35 of file IPC_SAP.cpp.

Referenced by enable().


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