diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
commit | c44379cc7d9c7aa113989237ab0f56db12aa5219 (patch) | |
tree | 66a84b20d47f2269d8bdc6e0323f338763424d3a /ACE/examples/Connection/blocking/SPIPE-acceptor.h | |
parent | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (diff) | |
download | ATCD-c44379cc7d9c7aa113989237ab0f56db12aa5219.tar.gz |
Repo restructuring
Diffstat (limited to 'ACE/examples/Connection/blocking/SPIPE-acceptor.h')
-rw-r--r-- | ACE/examples/Connection/blocking/SPIPE-acceptor.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/ACE/examples/Connection/blocking/SPIPE-acceptor.h b/ACE/examples/Connection/blocking/SPIPE-acceptor.h new file mode 100644 index 00000000000..546941c48fb --- /dev/null +++ b/ACE/examples/Connection/blocking/SPIPE-acceptor.h @@ -0,0 +1,79 @@ +/* -*- C++ -*- */ +// $Id$ + +#ifndef SP_ACCEPTOR_H +#define SP_ACCEPTOR_H + +#include "ace/Svc_Handler.h" +#include "ace/Service_Config.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Acceptor.h" +#include "ace/SPIPE_Stream.h" +#include "ace/SPIPE_Acceptor.h" +#include "ace/Asynch_IO.h" + +// This only works on Win32 platforms and on Unix platforms +// supporting POSIX aio calls. +#if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) + +// This is the class that does the work once the ACE_Oneshot_Acceptor +// has accepted a connection. + +class Svc_Handler : public ACE_Svc_Handler <ACE_SPIPE_STREAM, ACE_NULL_SYNCH>, public ACE_Handler +{ +public: + Svc_Handler (void); + ~Svc_Handler (void); + + virtual int open (void *); + + virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); + // This is called when asynchronous read from the socket complete + // Handle data from the client. + +private: + ACE_Asynch_Read_Stream ar_; + ACE_Message_Block mb_; +}; + +class IPC_Server : public ACE_Oneshot_Acceptor<Svc_Handler, ACE_SPIPE_ACCEPTOR> +{ +public: + IPC_Server (void); + ~IPC_Server (void); + + // = Dynamic linking hooks. + virtual int init (int argc, ACE_TCHAR *argv[]); + // Initialize the network server. + + virtual int fini (void); + // Close down the server. + + virtual int svc (void); + // Run the interative service. + +private: + int parse_args (int argc, ACE_TCHAR *argv[]); + // Parse command-line arguments. + + int n_threads_; + // Size of thread pool to use. + + ACE_TCHAR rendezvous_[MAXPATHLEN + 1]; + // Meeting place for pipe. + + int shutdown_; + // Keeps track of when we shut down due to receipt of the SIGINT + // signal. + + int handle_signal (int signum, siginfo_t *, ucontext_t *); + // Signal handler method. +}; + +#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS*/ +#endif /* SP_ACCEPTOR_H */ + |