00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file SPIPE.h 00006 * 00007 * $Id: SPIPE.h 69051 2005-10-28 16:14:56Z ossama $ 00008 * 00009 * @author Doug Schmidt 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef ACE_SPIPE_H 00015 #define ACE_SPIPE_H 00016 #include /**/ "ace/pre.h" 00017 00018 #include "ace/IPC_SAP.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "ace/SPIPE_Addr.h" 00025 00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 /** 00029 * @class ACE_SPIPE 00030 * 00031 * @brief Defines the member functions for the base class of the 00032 * ACE_SPIPE abstraction. 00033 * 00034 * ACE_SPIPE was designed as a wrapper facade for STREAM pipes. On 00035 * Windows, however, ACE_SPIPE is a wrapper for Named Pipes. Therefore, 00036 * on Windows, it is better to use the ACE_Proactor or blocking operations 00037 * in lieu of using the ACE_Reactor. 00038 * 00039 * @sa ACE_SPIPE_Acceptor for additional notes on use with ACE_Reactor 00040 * on Windows. 00041 * 00042 * @warning Windows: Works only on Windows NT 4 and higher. 00043 * @warning Works on non-Windows platforms only when @c ACE_HAS_STREAM_PIPES 00044 * is defined. 00045 */ 00046 class ACE_Export ACE_SPIPE : public ACE_IPC_SAP 00047 { 00048 public: 00049 /// Close down the SPIPE without removing the rendezvous point. 00050 /** 00051 * Closes the underlying pipe handle and sets this object's handle value 00052 * to @c ACE_INVALID_HANDLE. 00053 * @return 0 for success; -1 for failure. If a failure occurs, further 00054 * error information is available from ACE_OS::last_error(). 00055 */ 00056 int close (void); 00057 00058 /// Close down the SPIPE and remove the rendezvous point from 00059 /// the file system. 00060 /** 00061 * @return 0 for success; -1 for failure. If a failure occurs, further 00062 * error information is available from ACE_OS::last_error(). 00063 */ 00064 int remove (void); 00065 00066 /// Return the local address of this endpoint. 00067 /** 00068 * Returns the local address of the SPIPE's endpoint in @arg addr. 00069 * @return 0 for success; -1 for failure. If a failure occurs, further 00070 * error information is available from ACE_OS::last_error(). 00071 */ 00072 int get_local_addr (ACE_SPIPE_Addr &) const; 00073 00074 /** 00075 * Disable signal @arg signum. 00076 * @note This reimplements the inherited method from 00077 * ACE_IPC_SAP. Since the signal actions do not make any sense on 00078 * Windows, this method intercepts the call and NOPs it. On non-Windows, 00079 * it is passed through to ACE_IPC_SAP::disable(). 00080 */ 00081 int disable (int signum) const ; 00082 00083 /// Dump the state of an object. 00084 void dump (void) const; 00085 00086 #if defined (ACE_HAS_STREAM_PIPES) 00087 /// Temporary store of duplex pipe handle. 00088 void set_duplex_handle (ACE_HANDLE handle); 00089 #endif /* ACE_HAS_STREAM_PIPES */ 00090 00091 /// Declare the dynamic allocation hooks. 00092 ACE_ALLOC_HOOK_DECLARE; 00093 00094 private: 00095 #if defined (ACE_HAS_STREAM_PIPES) 00096 /// Duplex to the pipe I/O handle. 00097 /// Stored here for latter cleaning. 00098 ACE_HANDLE duplex_pipe_handle_; 00099 #endif /* ACE_HAS_STREAM_PIPES */ 00100 00101 protected: 00102 /// Ensure that this class is an abstract base class 00103 ACE_SPIPE (void); 00104 00105 /// Our local address. 00106 ACE_SPIPE_Addr local_addr_; 00107 }; 00108 00109 ACE_END_VERSIONED_NAMESPACE_DECL 00110 00111 #if defined (__ACE_INLINE__) 00112 #include "ace/SPIPE.inl" 00113 #endif /* __ACE_INLINE__ */ 00114 00115 #include /**/ "ace/post.h" 00116 #endif /* ACE_SPIPE_H */