00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file UPIPE_Acceptor.h 00006 * 00007 * $Id: UPIPE_Acceptor.h 69062 2005-10-28 23:55:10Z ossama $ 00008 * 00009 * @author Gerhard Lenzer 00010 * @author Douglas C. Schmidt 00011 */ 00012 //============================================================================= 00013 00014 00015 #ifndef ACE_UPIPE_ACCEPTOR_H 00016 #define ACE_UPIPE_ACCEPTOR_H 00017 #include /**/ "ace/pre.h" 00018 00019 #include "ace/UPIPE_Stream.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #if defined (ACE_HAS_THREADS) 00026 00027 #include "ace/SPIPE_Acceptor.h" 00028 #include "ace/Thread_Manager.h" 00029 00030 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00031 00032 /** 00033 * @class ACE_UPIPE_Acceptor 00034 * 00035 * @brief Defines the format and interface for the listener side of the 00036 * ACE_UPIPE_Stream. 00037 */ 00038 class ACE_Export ACE_UPIPE_Acceptor : public ACE_SPIPE_Acceptor 00039 { 00040 public: 00041 // = Initialization and termination. 00042 /// Default constructor. 00043 ACE_UPIPE_Acceptor (void); 00044 00045 /// Initialize passive endpoint. 00046 ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_sap, 00047 int reuse_addr = 0); 00048 00049 /// Initialize passive endpoint. 00050 int open (const ACE_UPIPE_Addr &local_sap, 00051 int reuse_addr = 0); 00052 00053 /// Close down and release resources. 00054 ~ACE_UPIPE_Acceptor (void); 00055 00056 /// Close down and release resources. 00057 int close (void); 00058 00059 /// Close down and release resources and remove the underlying SPIPE 00060 /// rendezvous point. 00061 int remove (void); 00062 00063 // = Passive connection acceptance method. 00064 /** 00065 * Accept a new data transfer connection. A @a timeout of 0 means 00066 * block forever, a @a timeout of {0, 0} means poll. @a restart == 1 00067 * means "restart if interrupted." 00068 */ 00069 int accept (ACE_UPIPE_Stream &server_stream, 00070 ACE_UPIPE_Addr *remote_addr = 0, 00071 ACE_Time_Value *timeout = 0, 00072 int restart = 1, 00073 int reset_new_handle = 0); 00074 00075 /// Dump the state of an object. 00076 void dump (void) const; 00077 00078 /// Declare the dynamic allocation hooks. 00079 ACE_ALLOC_HOOK_DECLARE; 00080 00081 private: 00082 /// Manage threads. 00083 ACE_Thread_Manager tm; 00084 00085 /// To confirm connection establishment. 00086 ACE_Message_Block mb_; 00087 }; 00088 00089 ACE_END_VERSIONED_NAMESPACE_DECL 00090 00091 #if defined (__ACE_INLINE__) 00092 #include "ace/UPIPE_Acceptor.inl" 00093 #endif /* __ACE_INLINE__ */ 00094 00095 #endif /* ACE_HAS_THREADS */ 00096 00097 #include /**/ "ace/post.h" 00098 00099 #endif /* ACE_UPIPE_ACCEPTOR_H */