diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
commit | a5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch) | |
tree | bcf0a25c3d45a209a6e3ac37b233a4812f29c732 /examples/Connection/blocking | |
download | ATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz |
Initial revision
Diffstat (limited to 'examples/Connection/blocking')
-rw-r--r-- | examples/Connection/blocking/Makefile | 414 | ||||
-rw-r--r-- | examples/Connection/blocking/README | 36 | ||||
-rw-r--r-- | examples/Connection/blocking/SPIPE-acceptor.cpp | 179 | ||||
-rw-r--r-- | examples/Connection/blocking/SPIPE-acceptor.h | 63 | ||||
-rw-r--r-- | examples/Connection/blocking/SPIPE-connector.cpp | 182 | ||||
-rw-r--r-- | examples/Connection/blocking/SPIPE-connector.h | 75 | ||||
-rw-r--r-- | examples/Connection/blocking/test_spipe_acceptor.cpp | 22 | ||||
-rw-r--r-- | examples/Connection/blocking/test_spipe_connector.cpp | 22 |
8 files changed, 993 insertions, 0 deletions
diff --git a/examples/Connection/blocking/Makefile b/examples/Connection/blocking/Makefile new file mode 100644 index 00000000000..4240e569478 --- /dev/null +++ b/examples/Connection/blocking/Makefile @@ -0,0 +1,414 @@ +#---------------------------------------------------------------------------- +# @(#)Makefile 1.1 10/18/96 +# +# Makefile for the Connection pattern tests +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +LIB = libSPIPE.a +SHLIB = libSPIPE.so + +BIN = test_spipe_connector \ + test_spipe_acceptor + +SRC = $(addsuffix .cpp,$(BIN)) +OBJ = $(SRC:%.cpp=$(VDIR)%.o) + +LSRC = SPIPE-connector.cpp \ + SPIPE-acceptor.cpp + +LDLIBS = -lSPIPE +LIBS = -lACE + +VLDLIBS = $(LDLIBS:%=%$(VAR)) + +BUILD = $(VLIB) $(VSHLIB) $(SHLIBA) $(VBIN) + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU +include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU +include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU +include $(WRAPPER_ROOT)/include/makeinclude/rules.lib.GNU +include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU +include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +LDFLAGS += -L./ + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +.obj/SPIPE-connector.o .shobj/SPIPE-connector.so: SPIPE-connector.cpp \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/Time_Value.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Addr.h \ + $(WRAPPER_ROOT)/ace/Addr.h \ + $(WRAPPER_ROOT)/ace/SPIPE_Connector.h \ + $(WRAPPER_ROOT)/ace/SPIPE_Stream.h \ + $(WRAPPER_ROOT)/ace/SPIPE.h \ + $(WRAPPER_ROOT)/ace/IPC_SAP.h \ + $(WRAPPER_ROOT)/ace/IPC_SAP.i \ + $(WRAPPER_ROOT)/ace/SPIPE.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Stream.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Connector.i \ + $(WRAPPER_ROOT)/ace/Get_Opt.h \ + SPIPE-connector.h \ + $(WRAPPER_ROOT)/ace/Svc_Handler.h \ + $(WRAPPER_ROOT)/ace/Synch_Options.h \ + $(WRAPPER_ROOT)/ace/Task.h \ + $(WRAPPER_ROOT)/ace/Service_Object.h \ + $(WRAPPER_ROOT)/ace/Shared_Object.h \ + $(WRAPPER_ROOT)/ace/Event_Handler.h \ + $(WRAPPER_ROOT)/ace/Message_Queue.h \ + $(WRAPPER_ROOT)/ace/Message_Block.h \ + $(WRAPPER_ROOT)/ace/Malloc.h \ + $(WRAPPER_ROOT)/ace/Malloc_T.h \ + $(WRAPPER_ROOT)/ace/Synch.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ + $(WRAPPER_ROOT)/ace/Synch_T.h \ + $(WRAPPER_ROOT)/ace/Synch_T.cpp \ + $(WRAPPER_ROOT)/ace/Thread.h \ + $(WRAPPER_ROOT)/ace/Synch_T.i \ + $(WRAPPER_ROOT)/ace/Malloc_T.cpp \ + $(WRAPPER_ROOT)/ace/Malloc_T.i \ + $(WRAPPER_ROOT)/ace/Memory_Pool.h \ + $(WRAPPER_ROOT)/ace/Signal.h \ + $(WRAPPER_ROOT)/ace/Set.h \ + $(WRAPPER_ROOT)/ace/Set.cpp \ + $(WRAPPER_ROOT)/ace/Set.i \ + $(WRAPPER_ROOT)/ace/Mem_Map.h \ + $(WRAPPER_ROOT)/ace/IO_Cntl_Msg.h \ + $(WRAPPER_ROOT)/ace/Message_Queue.cpp \ + $(WRAPPER_ROOT)/ace/Message_Queue.i \ + $(WRAPPER_ROOT)/ace/Thread_Manager.h \ + $(WRAPPER_ROOT)/ace/Task.cpp \ + $(WRAPPER_ROOT)/ace/Module.h \ + $(WRAPPER_ROOT)/ace/Module.cpp \ + $(WRAPPER_ROOT)/ace/Stream_Modules.h \ + $(WRAPPER_ROOT)/ace/Stream_Modules.cpp \ + $(WRAPPER_ROOT)/ace/Stream_Modules.i \ + $(WRAPPER_ROOT)/ace/Module.i \ + $(WRAPPER_ROOT)/ace/Service_Config.h \ + $(WRAPPER_ROOT)/ace/Proactor.h \ + $(WRAPPER_ROOT)/ace/Timer_Queue.h \ + $(WRAPPER_ROOT)/ace/Timer_Queue.i \ + $(WRAPPER_ROOT)/ace/ReactorEx.h \ + $(WRAPPER_ROOT)/ace/Token.h \ + $(WRAPPER_ROOT)/ace/Reactor.h \ + $(WRAPPER_ROOT)/ace/Handle_Set.h \ + $(WRAPPER_ROOT)/ace/Pipe.h \ + $(WRAPPER_ROOT)/ace/Pipe.i \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ + $(WRAPPER_ROOT)/ace/SOCK_IO.h \ + $(WRAPPER_ROOT)/ace/SOCK.h \ + $(WRAPPER_ROOT)/ace/SOCK.i \ + $(WRAPPER_ROOT)/ace/SOCK_IO.i \ + $(WRAPPER_ROOT)/ace/INET_Addr.h \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ + $(WRAPPER_ROOT)/ace/Reactor.i \ + $(WRAPPER_ROOT)/ace/Svc_Conf_Tokens.h \ + $(WRAPPER_ROOT)/ace/Task.i \ + $(WRAPPER_ROOT)/ace/Svc_Handler.cpp \ + $(WRAPPER_ROOT)/ace/Dynamic.h \ + $(WRAPPER_ROOT)/ace/Svc_Handler.i \ + $(WRAPPER_ROOT)/ace/Connector.h \ + $(WRAPPER_ROOT)/ace/Map_Manager.h \ + $(WRAPPER_ROOT)/ace/Map_Manager.cpp \ + $(WRAPPER_ROOT)/ace/Map_Manager.i \ + $(WRAPPER_ROOT)/ace/Strategies.h \ + $(WRAPPER_ROOT)/ace/Strategies.cpp \ + $(WRAPPER_ROOT)/ace/Connector.i \ + $(WRAPPER_ROOT)/ace/Connector.cpp +.obj/SPIPE-acceptor.o .shobj/SPIPE-acceptor.so: SPIPE-acceptor.cpp \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/Time_Value.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Addr.h \ + $(WRAPPER_ROOT)/ace/Addr.h \ + $(WRAPPER_ROOT)/ace/SPIPE_Acceptor.h \ + $(WRAPPER_ROOT)/ace/SPIPE_Stream.h \ + $(WRAPPER_ROOT)/ace/SPIPE.h \ + $(WRAPPER_ROOT)/ace/IPC_SAP.h \ + $(WRAPPER_ROOT)/ace/IPC_SAP.i \ + $(WRAPPER_ROOT)/ace/SPIPE.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Stream.i \ + $(WRAPPER_ROOT)/ace/Get_Opt.h \ + SPIPE-acceptor.h \ + $(WRAPPER_ROOT)/ace/Svc_Handler.h \ + $(WRAPPER_ROOT)/ace/Synch_Options.h \ + $(WRAPPER_ROOT)/ace/Task.h \ + $(WRAPPER_ROOT)/ace/Service_Object.h \ + $(WRAPPER_ROOT)/ace/Shared_Object.h \ + $(WRAPPER_ROOT)/ace/Event_Handler.h \ + $(WRAPPER_ROOT)/ace/Message_Queue.h \ + $(WRAPPER_ROOT)/ace/Message_Block.h \ + $(WRAPPER_ROOT)/ace/Malloc.h \ + $(WRAPPER_ROOT)/ace/Malloc_T.h \ + $(WRAPPER_ROOT)/ace/Synch.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ + $(WRAPPER_ROOT)/ace/Synch_T.h \ + $(WRAPPER_ROOT)/ace/Synch_T.cpp \ + $(WRAPPER_ROOT)/ace/Thread.h \ + $(WRAPPER_ROOT)/ace/Synch_T.i \ + $(WRAPPER_ROOT)/ace/Malloc_T.cpp \ + $(WRAPPER_ROOT)/ace/Malloc_T.i \ + $(WRAPPER_ROOT)/ace/Memory_Pool.h \ + $(WRAPPER_ROOT)/ace/Signal.h \ + $(WRAPPER_ROOT)/ace/Set.h \ + $(WRAPPER_ROOT)/ace/Set.cpp \ + $(WRAPPER_ROOT)/ace/Set.i \ + $(WRAPPER_ROOT)/ace/Mem_Map.h \ + $(WRAPPER_ROOT)/ace/IO_Cntl_Msg.h \ + $(WRAPPER_ROOT)/ace/Message_Queue.cpp \ + $(WRAPPER_ROOT)/ace/Message_Queue.i \ + $(WRAPPER_ROOT)/ace/Thread_Manager.h \ + $(WRAPPER_ROOT)/ace/Task.cpp \ + $(WRAPPER_ROOT)/ace/Module.h \ + $(WRAPPER_ROOT)/ace/Module.cpp \ + $(WRAPPER_ROOT)/ace/Stream_Modules.h \ + $(WRAPPER_ROOT)/ace/Stream_Modules.cpp \ + $(WRAPPER_ROOT)/ace/Stream_Modules.i \ + $(WRAPPER_ROOT)/ace/Module.i \ + $(WRAPPER_ROOT)/ace/Service_Config.h \ + $(WRAPPER_ROOT)/ace/Proactor.h \ + $(WRAPPER_ROOT)/ace/Timer_Queue.h \ + $(WRAPPER_ROOT)/ace/Timer_Queue.i \ + $(WRAPPER_ROOT)/ace/ReactorEx.h \ + $(WRAPPER_ROOT)/ace/Token.h \ + $(WRAPPER_ROOT)/ace/Reactor.h \ + $(WRAPPER_ROOT)/ace/Handle_Set.h \ + $(WRAPPER_ROOT)/ace/Pipe.h \ + $(WRAPPER_ROOT)/ace/Pipe.i \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ + $(WRAPPER_ROOT)/ace/SOCK_IO.h \ + $(WRAPPER_ROOT)/ace/SOCK.h \ + $(WRAPPER_ROOT)/ace/SOCK.i \ + $(WRAPPER_ROOT)/ace/SOCK_IO.i \ + $(WRAPPER_ROOT)/ace/INET_Addr.h \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ + $(WRAPPER_ROOT)/ace/Reactor.i \ + $(WRAPPER_ROOT)/ace/Svc_Conf_Tokens.h \ + $(WRAPPER_ROOT)/ace/Task.i \ + $(WRAPPER_ROOT)/ace/Svc_Handler.cpp \ + $(WRAPPER_ROOT)/ace/Dynamic.h \ + $(WRAPPER_ROOT)/ace/Svc_Handler.i \ + $(WRAPPER_ROOT)/ace/Acceptor.h \ + $(WRAPPER_ROOT)/ace/Strategies.h \ + $(WRAPPER_ROOT)/ace/Strategies.cpp \ + $(WRAPPER_ROOT)/ace/Acceptor.i \ + $(WRAPPER_ROOT)/ace/Acceptor.cpp +.obj/test_spipe_connector.o .shobj/test_spipe_connector.so: test_spipe_connector.cpp \ + $(WRAPPER_ROOT)/ace/SPIPE_Connector.h \ + $(WRAPPER_ROOT)/ace/SPIPE_Stream.h \ + $(WRAPPER_ROOT)/ace/SPIPE.h \ + $(WRAPPER_ROOT)/ace/IPC_SAP.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/Time_Value.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i \ + $(WRAPPER_ROOT)/ace/IPC_SAP.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Addr.h \ + $(WRAPPER_ROOT)/ace/Addr.h \ + $(WRAPPER_ROOT)/ace/SPIPE.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Stream.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Connector.i \ + SPIPE-connector.h \ + $(WRAPPER_ROOT)/ace/Svc_Handler.h \ + $(WRAPPER_ROOT)/ace/Synch_Options.h \ + $(WRAPPER_ROOT)/ace/Task.h \ + $(WRAPPER_ROOT)/ace/Service_Object.h \ + $(WRAPPER_ROOT)/ace/Shared_Object.h \ + $(WRAPPER_ROOT)/ace/Event_Handler.h \ + $(WRAPPER_ROOT)/ace/Message_Queue.h \ + $(WRAPPER_ROOT)/ace/Message_Block.h \ + $(WRAPPER_ROOT)/ace/Malloc.h \ + $(WRAPPER_ROOT)/ace/Malloc_T.h \ + $(WRAPPER_ROOT)/ace/Synch.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ + $(WRAPPER_ROOT)/ace/Synch_T.h \ + $(WRAPPER_ROOT)/ace/Synch_T.cpp \ + $(WRAPPER_ROOT)/ace/Thread.h \ + $(WRAPPER_ROOT)/ace/Synch_T.i \ + $(WRAPPER_ROOT)/ace/Malloc_T.cpp \ + $(WRAPPER_ROOT)/ace/Malloc_T.i \ + $(WRAPPER_ROOT)/ace/Memory_Pool.h \ + $(WRAPPER_ROOT)/ace/Signal.h \ + $(WRAPPER_ROOT)/ace/Set.h \ + $(WRAPPER_ROOT)/ace/Set.cpp \ + $(WRAPPER_ROOT)/ace/Set.i \ + $(WRAPPER_ROOT)/ace/Mem_Map.h \ + $(WRAPPER_ROOT)/ace/IO_Cntl_Msg.h \ + $(WRAPPER_ROOT)/ace/Message_Queue.cpp \ + $(WRAPPER_ROOT)/ace/Message_Queue.i \ + $(WRAPPER_ROOT)/ace/Thread_Manager.h \ + $(WRAPPER_ROOT)/ace/Task.cpp \ + $(WRAPPER_ROOT)/ace/Module.h \ + $(WRAPPER_ROOT)/ace/Module.cpp \ + $(WRAPPER_ROOT)/ace/Stream_Modules.h \ + $(WRAPPER_ROOT)/ace/Stream_Modules.cpp \ + $(WRAPPER_ROOT)/ace/Stream_Modules.i \ + $(WRAPPER_ROOT)/ace/Module.i \ + $(WRAPPER_ROOT)/ace/Service_Config.h \ + $(WRAPPER_ROOT)/ace/Proactor.h \ + $(WRAPPER_ROOT)/ace/Timer_Queue.h \ + $(WRAPPER_ROOT)/ace/Timer_Queue.i \ + $(WRAPPER_ROOT)/ace/ReactorEx.h \ + $(WRAPPER_ROOT)/ace/Token.h \ + $(WRAPPER_ROOT)/ace/Reactor.h \ + $(WRAPPER_ROOT)/ace/Handle_Set.h \ + $(WRAPPER_ROOT)/ace/Pipe.h \ + $(WRAPPER_ROOT)/ace/Pipe.i \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ + $(WRAPPER_ROOT)/ace/SOCK_IO.h \ + $(WRAPPER_ROOT)/ace/SOCK.h \ + $(WRAPPER_ROOT)/ace/SOCK.i \ + $(WRAPPER_ROOT)/ace/SOCK_IO.i \ + $(WRAPPER_ROOT)/ace/INET_Addr.h \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ + $(WRAPPER_ROOT)/ace/Reactor.i \ + $(WRAPPER_ROOT)/ace/Svc_Conf_Tokens.h \ + $(WRAPPER_ROOT)/ace/Task.i \ + $(WRAPPER_ROOT)/ace/Svc_Handler.cpp \ + $(WRAPPER_ROOT)/ace/Dynamic.h \ + $(WRAPPER_ROOT)/ace/Svc_Handler.i \ + $(WRAPPER_ROOT)/ace/Connector.h \ + $(WRAPPER_ROOT)/ace/Map_Manager.h \ + $(WRAPPER_ROOT)/ace/Map_Manager.cpp \ + $(WRAPPER_ROOT)/ace/Map_Manager.i \ + $(WRAPPER_ROOT)/ace/Strategies.h \ + $(WRAPPER_ROOT)/ace/Strategies.cpp \ + $(WRAPPER_ROOT)/ace/Connector.i \ + $(WRAPPER_ROOT)/ace/Connector.cpp +.obj/test_spipe_acceptor.o .shobj/test_spipe_acceptor.so: test_spipe_acceptor.cpp \ + $(WRAPPER_ROOT)/ace/SPIPE_Acceptor.h \ + $(WRAPPER_ROOT)/ace/SPIPE_Stream.h \ + $(WRAPPER_ROOT)/ace/SPIPE.h \ + $(WRAPPER_ROOT)/ace/IPC_SAP.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/Time_Value.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i \ + $(WRAPPER_ROOT)/ace/IPC_SAP.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Addr.h \ + $(WRAPPER_ROOT)/ace/Addr.h \ + $(WRAPPER_ROOT)/ace/SPIPE.i \ + $(WRAPPER_ROOT)/ace/SPIPE_Stream.i \ + SPIPE-acceptor.h \ + $(WRAPPER_ROOT)/ace/Svc_Handler.h \ + $(WRAPPER_ROOT)/ace/Synch_Options.h \ + $(WRAPPER_ROOT)/ace/Task.h \ + $(WRAPPER_ROOT)/ace/Service_Object.h \ + $(WRAPPER_ROOT)/ace/Shared_Object.h \ + $(WRAPPER_ROOT)/ace/Event_Handler.h \ + $(WRAPPER_ROOT)/ace/Message_Queue.h \ + $(WRAPPER_ROOT)/ace/Message_Block.h \ + $(WRAPPER_ROOT)/ace/Malloc.h \ + $(WRAPPER_ROOT)/ace/Malloc_T.h \ + $(WRAPPER_ROOT)/ace/Synch.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ + $(WRAPPER_ROOT)/ace/Synch_T.h \ + $(WRAPPER_ROOT)/ace/Synch_T.cpp \ + $(WRAPPER_ROOT)/ace/Thread.h \ + $(WRAPPER_ROOT)/ace/Synch_T.i \ + $(WRAPPER_ROOT)/ace/Malloc_T.cpp \ + $(WRAPPER_ROOT)/ace/Malloc_T.i \ + $(WRAPPER_ROOT)/ace/Memory_Pool.h \ + $(WRAPPER_ROOT)/ace/Signal.h \ + $(WRAPPER_ROOT)/ace/Set.h \ + $(WRAPPER_ROOT)/ace/Set.cpp \ + $(WRAPPER_ROOT)/ace/Set.i \ + $(WRAPPER_ROOT)/ace/Mem_Map.h \ + $(WRAPPER_ROOT)/ace/IO_Cntl_Msg.h \ + $(WRAPPER_ROOT)/ace/Message_Queue.cpp \ + $(WRAPPER_ROOT)/ace/Message_Queue.i \ + $(WRAPPER_ROOT)/ace/Thread_Manager.h \ + $(WRAPPER_ROOT)/ace/Task.cpp \ + $(WRAPPER_ROOT)/ace/Module.h \ + $(WRAPPER_ROOT)/ace/Module.cpp \ + $(WRAPPER_ROOT)/ace/Stream_Modules.h \ + $(WRAPPER_ROOT)/ace/Stream_Modules.cpp \ + $(WRAPPER_ROOT)/ace/Stream_Modules.i \ + $(WRAPPER_ROOT)/ace/Module.i \ + $(WRAPPER_ROOT)/ace/Service_Config.h \ + $(WRAPPER_ROOT)/ace/Proactor.h \ + $(WRAPPER_ROOT)/ace/Timer_Queue.h \ + $(WRAPPER_ROOT)/ace/Timer_Queue.i \ + $(WRAPPER_ROOT)/ace/ReactorEx.h \ + $(WRAPPER_ROOT)/ace/Token.h \ + $(WRAPPER_ROOT)/ace/Reactor.h \ + $(WRAPPER_ROOT)/ace/Handle_Set.h \ + $(WRAPPER_ROOT)/ace/Pipe.h \ + $(WRAPPER_ROOT)/ace/Pipe.i \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ + $(WRAPPER_ROOT)/ace/SOCK_IO.h \ + $(WRAPPER_ROOT)/ace/SOCK.h \ + $(WRAPPER_ROOT)/ace/SOCK.i \ + $(WRAPPER_ROOT)/ace/SOCK_IO.i \ + $(WRAPPER_ROOT)/ace/INET_Addr.h \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ + $(WRAPPER_ROOT)/ace/Reactor.i \ + $(WRAPPER_ROOT)/ace/Svc_Conf_Tokens.h \ + $(WRAPPER_ROOT)/ace/Task.i \ + $(WRAPPER_ROOT)/ace/Svc_Handler.cpp \ + $(WRAPPER_ROOT)/ace/Dynamic.h \ + $(WRAPPER_ROOT)/ace/Svc_Handler.i \ + $(WRAPPER_ROOT)/ace/Acceptor.h \ + $(WRAPPER_ROOT)/ace/Strategies.h \ + $(WRAPPER_ROOT)/ace/Strategies.cpp \ + $(WRAPPER_ROOT)/ace/Acceptor.i \ + $(WRAPPER_ROOT)/ace/Acceptor.cpp + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Connection/blocking/README b/examples/Connection/blocking/README new file mode 100644 index 00000000000..c7763e3ed04 --- /dev/null +++ b/examples/Connection/blocking/README @@ -0,0 +1,36 @@ +Presently, this directory contains only one example application for +SPIPEs. The test source code is contained in SPIPE-acceptor.h and +SPIPE-connector.h. + +The SPIPE-acceptor example illustrates how named pipes are used on NT. +Once the server establishes a connection to a single client, it spawns +a thread pool to handle incoming requests via the proactor event loop. +That is, a separate thread from the pool is used to process each +message sent by a client. The size of the thread pool can be +specified by command-line arguments. This example leverages the +queueing performed by the NT kernel to trivially implement a thread +pool architecture. + +test_spipe_acceptor has the following command-line arguments: + +test_spipe_acceptor -t <threads> + +<threads> specifies the size of the thread-pool running in the +proactor event loop. + +Here's how to run the tests: + +% test_spipe_acceptor -t 1000000 +starting up daemon test_sock_acceptor +Opening acepipe +hello + +% test_spipe_connector +starting up daemon test_sock_connector +Opening acepipe +activating 5 + +please enter input..: hello + +There are a number of other options that you can provide. Please see +the source code for details. diff --git a/examples/Connection/blocking/SPIPE-acceptor.cpp b/examples/Connection/blocking/SPIPE-acceptor.cpp new file mode 100644 index 00000000000..471ae4db8f4 --- /dev/null +++ b/examples/Connection/blocking/SPIPE-acceptor.cpp @@ -0,0 +1,179 @@ +#if !defined (SPIPE_ACCEPTOR_C) +// @(#)SPIPE-acceptor.cpp 1.1 10/18/96 + +#define SPIPE_ACCEPTOR_C + +#include "ace/Log_Msg.h" +#include "ace/SPIPE_Addr.h" +#include "ace/Time_Value.h" +#include "ace/SPIPE_Acceptor.h" +#include "ace/Get_Opt.h" +#include "SPIPE-acceptor.h" + +Svc_Handler::Svc_Handler (void) +{ +} + +Svc_Handler::~Svc_Handler (void) +{ +} + +int +Svc_Handler::open (void *) +{ + ACE_DEBUG ((LM_DEBUG, "client connected on handle %d\n", + this->peer ().get_handle ())); + return ACE_Service_Config::proactor ()->initiate + (this, ACE_Event_Handler::READ_MASK); +} + +ACE_Message_Block * +Svc_Handler::get_message (void) +{ + // An extra byte for null termination. + ACE_Message_Block *message = + new ACE_Message_Block (BUFSIZ + 1); + message->size (BUFSIZ); + return message; +} + +int +Svc_Handler::handle_input_complete (ACE_Message_Block *msg, + long bytes_transfered) +{ + if (bytes_transfered > 0) + { + msg->base ()[msg->length ()] = '\0'; + // Print out the message received from the server. + ACE_DEBUG ((LM_DEBUG, "(%t) message size %d.\n", msg->length ())); + ACE_DEBUG ((LM_DEBUG, "%s", msg->rd_ptr ())); + + return 1; // Reinvoke a recv() operation. + } + else + return -1; // Close down. +} + +IPC_Server::IPC_Server (void) + : n_threads_ (1), + rendezvous_ ("acepipe"), + done_handler_ (ACE_Sig_Handler_Ex (ACE_Service_Config::end_proactor_event_loop)) +{ +} + +IPC_Server::~IPC_Server (void) +{ +} + +int +IPC_Server::init (int argc, char *argv[]) +{ + if (this->parse_args (argc, argv) == -1) + return -1; + + ACE_DEBUG ((LM_DEBUG, "Opening %s\n", rendezvous_)); + + // Initialize named pipe listener. + if (this->open (ACE_SPIPE_Addr (rendezvous_)) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), 1); + + // Register to receive shutdowns. + else if (ACE_Service_Config::reactor ()->register_handler + (SIGINT, &this->done_handler_) == -1) + return -1; + else + return 0; +} + +int +IPC_Server::fini (void) +{ + return 0; +} + +int +IPC_Server::parse_args (int argc, char *argv[]) +{ + ACE_LOG_MSG->open (argv[0]); + + ACE_Get_Opt get_opt (argc, argv, "ut:r:"); + + for (int c; (c = get_opt ()) != -1; ) + { + switch (c) + { + case 'r': + rendezvous_ = get_opt.optarg; + break; + case 't': + n_threads_ = ACE_OS::atoi (get_opt.optarg); + ACE_DEBUG ((LM_DEBUG, "%s == %d.\n", + get_opt.optarg, + n_threads_)); + ACE_Service_Config::proactor (2*n_threads_); + // This is a lame way to tell the proactor how many threads + // we'll be using. + break; + case 'u': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %n -t <threads>\n" + "-r <rendezvous>\n"), -1); + break; + } + } + + return 0; +} + +static void * +run_reactor_event_loop (void *) +{ + ACE_Thread_Control tc (ACE_Service_Config::thr_mgr ()); + ACE_DEBUG ((LM_DEBUG, "(%t) worker thread starting\n")); + + ACE_Service_Config::run_proactor_event_loop (); + return 0; +} + +int +IPC_Server::svc (void) +{ + // Performs the iterative server activities. + while (ACE_Service_Config::reactor_event_loop_done () == 0) + { + Svc_Handler sh; + + // Create a new SH endpoint, which performs all processing in + // its open() method (note no automatic restart if errno == + // EINTR). + if (this->accept (&sh, 0) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "accept"), 1); + // SH's destructor closes the stream implicitly but the + // listening endpoint stays open. + else + { + // Run single-threaded. + if (n_threads_ <= 1) + run_reactor_event_loop (0); + else + { + // Run thread pool. + if (ACE_Service_Config::thr_mgr ()->spawn_n (n_threads_, + run_reactor_event_loop, + 0, THR_NEW_LWP) + == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "spawn_n"), 1); + + ACE_Service_Config::thr_mgr ()->wait (); + } + + ACE_DEBUG ((LM_DEBUG, "(%t) main thread exiting.\n")); + } + } + + /* NOTREACHED */ + return 0; +} + +#endif /* SPIPE_ACCEPTOR_C */ diff --git a/examples/Connection/blocking/SPIPE-acceptor.h b/examples/Connection/blocking/SPIPE-acceptor.h new file mode 100644 index 00000000000..42d0e106ede --- /dev/null +++ b/examples/Connection/blocking/SPIPE-acceptor.h @@ -0,0 +1,63 @@ +/* -*- C++ -*- */ +// @(#)SPIPE-acceptor.h 1.1 10/18/96 + +#if !defined (SP_ACCEPTOR_H) +#define SP_ACCEPTOR_H + +#include "ace/Svc_Handler.h" +#include "ace/Acceptor.h" +#include "ace/SPIPE_Stream.h" +#include "ace/SPIPE_Acceptor.h" + +// 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: + Svc_Handler (void); + ~Svc_Handler (void); + + virtual int open (void *); + + virtual ACE_Message_Block *get_message (void); + + virtual int handle_input_complete (ACE_Message_Block *msg, + long bytes_transfered); + // Handle data from the client. + +private: +}; + +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, char *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, char *argv[]); + // Parse command-line arguments. + + int n_threads_; + // Size of thread pool to use. + + const char *rendezvous_; + // Meeting place for pipe. + + ACE_Sig_Adapter done_handler_; + // Keeps track of when we shut down due to receipt of the SIGINT + // signal. +}; + +#endif /* SP_ACCEPTOR_H */ diff --git a/examples/Connection/blocking/SPIPE-connector.cpp b/examples/Connection/blocking/SPIPE-connector.cpp new file mode 100644 index 00000000000..584c16cd9f2 --- /dev/null +++ b/examples/Connection/blocking/SPIPE-connector.cpp @@ -0,0 +1,182 @@ +#if !defined (SPIPE_CONNECTOR_C) +// @(#)SPIPE-connector.cpp 1.1 10/18/96 + +#define SPIPE_CONNECTOR_C + +#include "ace/Log_Msg.h" +#include "ace/SPIPE_Addr.h" +#include "ace/SPIPE_Connector.h" +#include "ace/Get_Opt.h" +#include "SPIPE-connector.h" + +Peer_Handler::Peer_Handler (int iterations) + : iterations_ (iterations) +{ +} + +Peer_Handler::~Peer_Handler () +{ +} + +int +Peer_Handler::open (void *) +{ + ACE_DEBUG ((LM_DEBUG, "activating %d\n", this->get_handle ())); + + // If iterations_ has not been set, read from stdin. + if (iterations_ == 0) + { + this->display_menu (); + if (ACE::register_stdin_handler (this, + ACE_Service_Config::reactor (), + ACE_Service_Config::thr_mgr ()) == -1) + ACE_ERROR ((LM_ERROR, "%p\n", "register_stdin_handler")); + } + else // If iterations_ has been set, send iterations_ buffers. + { + char *buffer = + "Oh give me a home\n" + "Where the buffalo roam,\n" + "And the deer and the antelope play.\n" + "Where seldom is heard\n" + "A discouraging word,\n" + "And the skies are not cloudy all day.\n"; + int length = ACE_OS::strlen (buffer); + + while (iterations_-- > 0 + && this->peer ().send_n (buffer, length) == length) + continue; + + return this->peer ().close (); + } +} + +int +Peer_Handler::handle_input (ACE_HANDLE) +{ + char buf[BUFSIZ]; + + ssize_t n = ACE_OS::read (ACE_STDIN, buf, sizeof buf); + + if (n > 0) + if (this->peer ().send (buf, n) != n) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write failed"), -1); + else if (n == 0) /* Explicitly close the connection. */ + { + if (this->peer ().close () == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), 1); + return -1; + } + else + this->display_menu (); + return 0; +} + +int +Peer_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + ACE_DEBUG ((LM_DEBUG, "Shutting down\n")); + return 0; +} + +ACE_HANDLE +Peer_Handler::get_handle (void) const +{ + return this->peer ().get_handle (); +} + +void +Peer_Handler::display_menu (void) +{ + ACE_DEBUG ((LM_DEBUG, "\nplease enter input..: ")); +} + +IPC_Client::IPC_Client (void) + : rendezvous_ ("acepipe"), + iterations_ (0), + done_handler_ (ACE_Sig_Handler_Ex (ACE_Service_Config::end_proactor_event_loop)) +{ +} + +IPC_Client::~IPC_Client (void) +{ +} + +// Dynamic linking hooks. + +int +IPC_Client::init (int argc, char *argv[]) +{ + if (this->parse_args (argc, argv) == -1) + return -1; + // Handle signals through the ACE_Reactor. + else if (ACE_Service_Config::reactor ()->register_handler + (SIGINT, &this->done_handler_) == -1) + return -1; + + ACE_DEBUG ((LM_DEBUG, "Opening %s\n", rendezvous_)); + + // Connect to the peer, reusing the local addr if necessary. + if (this->connect (new Peer_Handler (iterations_), + ACE_SPIPE_Addr (rendezvous_), + ACE_Synch_Options::defaults, + *((ACE_SPIPE_Addr *) &ACE_Addr::sap_any), + 0, + O_RDWR | FILE_FLAG_OVERLAPPED, + 0) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connect"), -1); + + return 0; +} + +int +IPC_Client::fini (void) +{ + return 0; +} + +int +IPC_Client::svc (void) +{ + ACE_Service_Config::run_reactor_event_loop (); + return 0; +} + +int +IPC_Client::handle_close (ACE_HANDLE, ACE_Reactor_Mask) +{ + return 0; +} + +int +IPC_Client::parse_args (int argc, char *argv[]) +{ + ACE_LOG_MSG->open (argv[0]); + + ACE_Get_Opt get_opt (argc, argv, "ui:r:"); + + for (int c; (c = get_opt ()) != -1; ) + { + switch (c) + { + case 'r': + rendezvous_ = get_opt.optarg; + break; + case 'i': + iterations_ = ACE_OS::atoi (get_opt.optarg); + break; + case 'u': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %n -i <iterations>\n" + "-r <rendezvous>\n"), -1); + break; + } + } + + return 0; +} + + +#endif /* SPIPE_CONNECTOR */ diff --git a/examples/Connection/blocking/SPIPE-connector.h b/examples/Connection/blocking/SPIPE-connector.h new file mode 100644 index 00000000000..81525f0a0eb --- /dev/null +++ b/examples/Connection/blocking/SPIPE-connector.h @@ -0,0 +1,75 @@ +/* -*- C++ -*- */ +// @(#)SPIPE-connector.h 1.1 10/18/96 + +#if !defined (SP_CONNECTOR_H) +#define SP_CONNECTOR_H + +#include "ace/Svc_Handler.h" +#include "ace/SPIPE_Stream.h" +#include "ace/Connector.h" +#include "ace/SPIPE_Connector.h" + +class Peer_Handler : public ACE_Svc_Handler<ACE_SPIPE_STREAM, ACE_NULL_SYNCH> +{ +public: + // = Initialization + + Peer_Handler (int iterations); + // <iterations> is the number of buffers to send. If <iterations> + // == 0, then read from stdin. + + ~Peer_Handler (void); + + virtual int open (void * = 0); + // Activate the handler when connection is established. + + // = Demultiplexing hooks. + virtual int handle_input (ACE_HANDLE); + virtual int handle_close (ACE_HANDLE handle = ACE_INVALID_HANDLE, + ACE_Reactor_Mask mask = ACE_Event_Handler::RWE_MASK); + + virtual ACE_HANDLE get_handle (void) const; + +private: + void display_menu (void); + + int iterations_; + // No. of buffers to send. +}; + +class IPC_Client : public ACE_Connector<Peer_Handler, ACE_SPIPE_CONNECTOR> +{ +public: + // Initialization + IPC_Client (void); + ~IPC_Client (void); + + // = Dynamic linking hooks. + virtual int init (int argc, char *argv[]); + // Initialize the IPC client. + + virtual int fini (void); + // Destroy the IPC client. + + virtual int svc (void); + // Run the svc. + + virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); + // Report connection errors. + +private: + int parse_args (int argc, char *argv[]); + // Parse command-line arguments. + + int iterations_; + // Number of times to send a buffer. + + const char *rendezvous_; + // Meeting place for pipe. + + ACE_Sig_Adapter done_handler_; + // Keeps track of when we shut down due to receipt of the SIGINT + // signal. +}; + +#endif /* SP_CONNECTOR_H */ diff --git a/examples/Connection/blocking/test_spipe_acceptor.cpp b/examples/Connection/blocking/test_spipe_acceptor.cpp new file mode 100644 index 00000000000..2ef842022f8 --- /dev/null +++ b/examples/Connection/blocking/test_spipe_acceptor.cpp @@ -0,0 +1,22 @@ +// ACE_SPIPE Server. +// @(#)test_spipe_acceptor.cpp 1.1 10/18/96 + + +#include "ace/SPIPE_Acceptor.h" +#include "ace/SPIPE_Addr.h" +#include "SPIPE-acceptor.h" + +int +main (int argc, char *argv[]) +{ + // Perform Service_Config initializations + ACE_Service_Config daemon (argv[0]); + + IPC_Server acceptor; + + if (acceptor.init (argc, argv) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "init"), -1); + + return acceptor.svc (); +} + diff --git a/examples/Connection/blocking/test_spipe_connector.cpp b/examples/Connection/blocking/test_spipe_connector.cpp new file mode 100644 index 00000000000..2dbc1b7d5e0 --- /dev/null +++ b/examples/Connection/blocking/test_spipe_connector.cpp @@ -0,0 +1,22 @@ +// ACE_SPIPE Client. +// @(#)test_spipe_connector.cpp 1.1 10/18/96 + + +#include "ace/SPIPE_Connector.h" +#include "ace/SPIPE_Addr.h" +#include "SPIPE-connector.h" + +int +main (int argc, char *argv[]) +{ + // Perform Service_Config initializations + ACE_Service_Config daemon (argv[0]); + + IPC_Client peer_connector; + + if (peer_connector.init (argc, argv) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "init"), -1); + + return peer_connector.svc (); +} + |