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

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 Methods

 ~ACE_IPC_SAP (void)
 Default dtor. More...

int control (int cmd, void *) const
 Interface for <ioctl>. More...

int enable (int value) const
int disable (int value) const
ACE_HANDLE get_handle (void) const
 Get the underlying handle. More...

void set_handle (ACE_HANDLE handle)
 Set the underlying handle. More...

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Methods

 ACE_IPC_SAP (void)
 Default constructor. More...


Private Attributes

ACE_HANDLE handle_
 Underlying I/O handle. More...


Static Private Attributes

pid_t pid_ = 0
 Cache the process ID. More...


Detailed Description

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

Definition at line 29 of file IPC_SAP.h.


Constructor & Destructor Documentation

ASYS_INLINE ACE_IPC_SAP::~ACE_IPC_SAP void   
 

Default dtor.

Definition at line 9 of file IPC_SAP.i.

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

ACE_IPC_SAP::ACE_IPC_SAP void    [protected]
 

Default constructor.

Definition at line 32 of file IPC_SAP.cpp.

00033   : handle_ (ACE_INVALID_HANDLE)
00034 {
00035   // ACE_TRACE ("ACE_IPC_SAP::ACE_IPC_SAP");
00036 }


Member Function Documentation

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

Interface for <ioctl>.

Reimplemented in ACE_UPIPE_Stream.

Definition at line 33 of file IPC_SAP.i.

References ACE_TRACE, and ACE_OS::ioctl.

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

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.

Definition at line 115 of file IPC_SAP.cpp.

References ACE_CLOEXEC, ACE_NONBLOCK, ACE_SIGIO, ACE_SIGURG, ACE_TRACE, ACE_Flag_Manip::clr_flags, ACE_OS::fcntl, ACE_OS::ioctl, and SIGIO.

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

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

void ACE_IPC_SAP::dump void    const
 

Dump the state of an object.

Reimplemented in ACE_FIFO.

Definition at line 16 of file IPC_SAP.cpp.

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

00017 {
00018   ACE_TRACE ("ACE_IPC_SAP::dump");
00019 
00020   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00021   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("handle_ = %d"), this->handle_));
00022   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\npid_ = %d"), this->pid_));
00023   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00024 }

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

Definition at line 39 of file IPC_SAP.cpp.

References ACE_CLOEXEC, ACE_NONBLOCK, ACE_SIGIO, ACE_SIGURG, ACE_TRACE, ACE_OS::fcntl, ACE_OS::getpid, ACE_OS::ioctl, pid_, ACE_Flag_Manip::set_flags, and SIGIO.

Referenced by ACE_TLI_Connector::connect, and ACE_SOCK_Connector::shared_connect_start.

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

ASYS_INLINE ACE_HANDLE ACE_IPC_SAP::get_handle void    const
 

Get the underlying handle.

Reimplemented in ACE_LSOCK_CODgram.

Definition at line 15 of file IPC_SAP.i.

References ACE_TRACE, and handle_.

Referenced by ACE_UPIPE_Acceptor::accept, ACE_TLI_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_MEM_Stream::close_reader, ACE_SOCK_Stream::close_writer, ACE_MEM_Stream::close_writer, ACE_TLI_Connector::complete, ACE_SOCK_Connector::complete, ACE_TLI_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_ATM_Stream::get_handle, ACE_ATM_Stream::get_vpi_vci, 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_Log_Msg_IPC::reset, ACE_SOCK_Dgram_Mcast::set_option, ACE_SOCK_Acceptor::shared_accept_finish, ACE_MEM_Acceptor::shared_accept_finish, ACE_SOCK_Acceptor::shared_accept_start, ACE_SOCK_Connector::shared_connect_start, and ACE_SOCK_Connector::shared_open.

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

ASYS_INLINE void ACE_IPC_SAP::set_handle ACE_HANDLE    handle
 

Set the underlying handle.

Reimplemented in ACE_LSOCK_CODgram.

Definition at line 24 of file IPC_SAP.i.

References ACE_TRACE, and handle_.

Referenced by ACE_UPIPE_Acceptor::accept, ACE_TLI_Acceptor::accept, ACE_SPIPE_Acceptor::accept, ACE_SOCK_Acceptor::accept, ACE_MEM_Acceptor::accept, ACE_MEM_Stream::ACE_MEM_Stream, 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.

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


Member Data Documentation

ACE_IPC_SAP::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented in ACE_FIFO.

Definition at line 64 of file IPC_SAP.h.

ACE_HANDLE ACE_IPC_SAP::handle_ [private]
 

Underlying I/O handle.

Definition at line 73 of file IPC_SAP.h.

Referenced by get_handle, and set_handle.

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

Cache the process ID.

Definition at line 27 of file IPC_SAP.cpp.

Referenced by enable.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:49:09 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002