summaryrefslogtreecommitdiff
path: root/ACE/examples/Service_Configurator
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/examples/Service_Configurator')
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/Makefile.am14
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/README125
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/.cvsignore10
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/Makefile.am180
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/Svc_Cfg_IPC_Client.mpc70
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/broadcast_client_test.cpp62
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/local_data22
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp117
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/local_fifo_client_test.cpp101
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/local_pipe_client_test.cpp150
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/local_spipe_client_test.cpp106
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/local_stream_client_test.cpp113
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/remote_data22
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/remote_data122
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/remote_data222
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/remote_data322
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/remote_data422
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/remote_dgram_client_test.cpp92
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/remote_service_directory_test.cpp111
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/remote_stream_client_test.cpp134
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/client/remote_thr_stream_client_test.cpp122
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/.cvsignore1
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.cpp38
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.h50
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.i116
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.cpp19
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.h51
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.i123
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.cpp18
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.h51
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.i116
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.cpp38
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.h49
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.i101
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.cpp66
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.h55
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.i96
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.cpp18
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.h52
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.i131
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.cpp22
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.h53
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.i149
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.cpp38
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.h47
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.i111
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.cpp42
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.h53
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.i153
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp195
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.h73
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.cpp36
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.h45
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.i86
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Makefile.am106
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/Svc_Cfg_IPC_Server.mpc30
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/server_test.cpp54
-rw-r--r--ACE/examples/Service_Configurator/IPC-tests/server/svc.conf19
-rw-r--r--ACE/examples/Service_Configurator/Makefile.am14
-rw-r--r--ACE/examples/Service_Configurator/Misc/.cvsignore1
-rw-r--r--ACE/examples/Service_Configurator/Misc/Makefile.am50
-rw-r--r--ACE/examples/Service_Configurator/Misc/README23
-rw-r--r--ACE/examples/Service_Configurator/Misc/Service_Configurator_Misc.mpc18
-rw-r--r--ACE/examples/Service_Configurator/Misc/Timer_Service.cpp135
-rw-r--r--ACE/examples/Service_Configurator/Misc/Timer_Service.h71
-rw-r--r--ACE/examples/Service_Configurator/Misc/main.cpp80
-rw-r--r--ACE/examples/Service_Configurator/Misc/svc.conf18
-rw-r--r--ACE/examples/Service_Configurator/Misc/svc.conf28
68 files changed, 4548 insertions, 0 deletions
diff --git a/ACE/examples/Service_Configurator/IPC-tests/Makefile.am b/ACE/examples/Service_Configurator/IPC-tests/Makefile.am
new file mode 100644
index 00000000000..0a99932ce34
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/Makefile.am
@@ -0,0 +1,14 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## /acebuilds/ACE_wrappers-repository/bin/mwc.pl -include /acebuilds/MPC/config -include /acebuilds/MPC/templates -feature_file /acebuilds/ACE_wrappers-repository/local.features -noreldefs -type automake -exclude build,Kokyu
+
+SUBDIRS = \
+ client \
+ server
+
diff --git a/ACE/examples/Service_Configurator/IPC-tests/README b/ACE/examples/Service_Configurator/IPC-tests/README
new file mode 100644
index 00000000000..6f491296af7
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/README
@@ -0,0 +1,125 @@
+This file describes how to invoke the tests in the
+$ACE_ROOT/examples/Service_Configurator/IPC-test/{client,server}
+directories. These tests exercise all of the ACE IPC SAP
+communication mechanisms, the Reactor event demultiplexor, and the
+Service Configurator dynamic service configuration framework. To gain
+a deeper understanding of what is going on, you should read the the
+Wrapper Facade, Reactor, and Component Configurator patterns in POSA2
+<http://www.cs.wustl.edu/~schmidt/POSA/> and check out the following
+papers on the ACE framework components:
+
+http://www.cs.wustl.edu/~schmidt/PDF/IPC_SAP-92.pdf
+http://www.cs.wustl.edu/~schmidt/PDF/Reactor1-93.pdf
+http://www.cs.wustl.edu/~schmidt/PDF/Reactor2-93.pdf
+http://www.cs.wustl.edu/~schmidt/PDF/reactor-rules.pdf
+http://www.cs.wustl.edu/~schmidt/PDF/Svc-Conf.pdf
+
+The key to running these client/server tests is to understand the
+purpose of the svc.conf file located in the
+$ACE_ROOT/examples/Service_Configurator/IPC-test/server/ directory.
+This file contains a list of services that may be dynamically
+configured into a the address space of a network daemon process. If
+you look at the example svc.conf file included in the tests you'll see
+that some entries are commented out (the comment symbol is the '#',
+which is an "ignore until end-of-line comment" with the same semantics
+as the UNIX C and Bourne shells). Before reading any further, take a
+look at this svc.conf file with your favorite editor or file browser.
+
+There are several types of entries in this file. The two most
+important are the lines beginning with the keywords "static" and
+"dynamic". For example, the first non-commented line says:
+
+static ACE_Service_Manager "-d -p 3911"
+
+When this line is parsed at startup time by the Service Configurator
+object in the ./server_test executable, it causes the pre-configured
+Svc_Manager object to be initialized with an "argv" argument of "-d -p
+3911." This results in TCP port 3911 being created to listen
+connection requests from clients. To see how this works do the
+following:
+
+1. Comment out all the other lines except
+
+ static Svc_Manager "-d -p 3911"
+
+ in the svc.conf file
+
+2. Start up the ./server_test executable in one window, as follows:
+
+ % ./server_test -d
+
+3. Make another window on the *same* host and cd to the ./client/
+ directory
+
+4. Run the ./remote_service_directory_test program as follows:
+
+ % ./remote_service_directory_test -p 3911 -h localhost
+
+If everything has been compiled and initialized correctly, you should
+get the following message:
+
+ Svc_Manager 3911/tcp # lists all services in the daemon
+
+This message is telling you that the Svc_Manager is currently the only
+service that is active within the ./server_test program. To configure
+and activate another service dynamically, perform the following steps:
+
+1. *Without* shutting down the ./server_test program, edit the svc.conf
+ file. Comment out the Svc_Manager line by adding a '#' at the
+ front, i.e.:
+
+ # static Svc_Manager "-d -p 3911"
+
+ and then uncomment the second line:
+
+ dynamic Remote_Brdcast Service_Object * ./IPC_Tests_Server:remote_broadcast "-p 10001"
+
+2. If you're running on an OS platform that supports SIGHUP, send the
+ SIGHUP signal to the process running the ./server_test program.
+ This will cause the ./server_test program to reconfigure itself
+ based on the new contents of the svc.conf file. Not every platform
+ supports SIGHUP. However, the remote_service_directory_test in
+ ./client/ can be used to reconfigure services, e.g., by passing it
+ parameters as follows:
+
+ % ./remote_service_directory_test -p 3911 -h localhost -r
+
+ The '-r' flag instructs the server to reconfigure itself.
+
+ After reconfiguration, you'll now have a second active service in
+ the address space of the ./server_test daemon. To see this, rerun
+ the remote_service_directory_test command, e.g.:
+
+ % ./remote_service_directory_test -p 3911 -h localhost
+
+ You should now see the following output:
+
+ Svc_Manager 3911/tcp # lists all services in the daemon
+ Remote_Brdcast 10001/udp # tests broadcasting
+
+ which indicates that the remote broadcast service is now active.
+
+3. To test the remote broadcast service, run the following program
+ in the ./client/ directory:
+
+ % ./broadcast_client_test -p 10001
+
+ This should cause the window running the ./server_test to
+ display the following output:
+
+ received broadcast datagram from host spare.ics.uci.edu
+ ----------------------------------------
+ testing socket broadcast service
+ ----------------------------------------
+
+If you want to run other tests, using other configurations, simply
+uncomment the appropriate lines in the svc.conf file and experiment
+with the corresponding test drivers in the ./client/ directory. All
+the source code is available so once you get the hang of what is
+happening, you might want to take a look at how it is all implemented.
+You may be surprised at how much of the ACE framework code is
+reused for each different service. Moreover, writing a new service is
+often simply a matter of copying an existing file and filling in the
+behavior of some of the methods (e.g., the handle_input() method and
+the init() method).
+
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/.cvsignore b/ACE/examples/Service_Configurator/IPC-tests/client/.cvsignore
new file mode 100644
index 00000000000..121d4de020f
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/.cvsignore
@@ -0,0 +1,10 @@
+local_dgram_test
+local_fifo_test
+local_pipe_test
+local_spipe_test
+local_stream_test
+remote_broadcast_test
+remote_dgram_test
+remote_service_directory_test
+remote_stream_test
+remote_thr_stream_test
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/Makefile.am b/ACE/examples/Service_Configurator/IPC-tests/client/Makefile.am
new file mode 100644
index 00000000000..b6dd5a3d7b8
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/Makefile.am
@@ -0,0 +1,180 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## /acebuilds/ACE_wrappers-repository/bin/mwc.pl -include /acebuilds/MPC/config -include /acebuilds/MPC/templates -feature_file /acebuilds/ACE_wrappers-repository/local.features -noreldefs -type automake -exclude build,Kokyu
+
+ACE_BUILDDIR = $(top_builddir)
+ACE_ROOT = $(top_srcdir)
+
+noinst_PROGRAMS =
+
+## Makefile.Svc_Cfg_IPC_Client_Bcast.am
+
+if !BUILD_ACE_FOR_TAO
+noinst_PROGRAMS += remote_broadcast_test
+
+remote_broadcast_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+remote_broadcast_test_SOURCES = \
+ broadcast_client_test.cpp
+
+remote_broadcast_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Svc_Cfg_IPC_Client_Loc_Dgram.am
+
+if !BUILD_ACE_FOR_TAO
+noinst_PROGRAMS += local_dgram_test
+
+local_dgram_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+local_dgram_test_SOURCES = \
+ local_dgram_client_test.cpp
+
+local_dgram_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Svc_Cfg_IPC_Client_Loc_Fifo.am
+
+if !BUILD_ACE_FOR_TAO
+noinst_PROGRAMS += local_fifo_test
+
+local_fifo_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+local_fifo_test_SOURCES = \
+ local_fifo_client_test.cpp
+
+local_fifo_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Svc_Cfg_IPC_Client_Loc_Pipe.am
+
+if !BUILD_ACE_FOR_TAO
+noinst_PROGRAMS += local_pipe_test
+
+local_pipe_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+local_pipe_test_SOURCES = \
+ local_pipe_client_test.cpp
+
+local_pipe_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Svc_Cfg_IPC_Client_Loc_Spipe.am
+noinst_PROGRAMS += local_spipe_test
+
+local_spipe_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+local_spipe_test_SOURCES = \
+ local_spipe_client_test.cpp
+
+local_spipe_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Makefile.Svc_Cfg_IPC_Client_Loc_Stream.am
+
+if !BUILD_ACE_FOR_TAO
+noinst_PROGRAMS += local_stream_test
+
+local_stream_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+local_stream_test_SOURCES = \
+ local_stream_client_test.cpp
+
+local_stream_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Svc_Cfg_IPC_Client_Rem_Dgram.am
+
+if !BUILD_ACE_FOR_TAO
+noinst_PROGRAMS += remote_dgram_test
+
+remote_dgram_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+remote_dgram_test_SOURCES = \
+ remote_dgram_client_test.cpp
+
+remote_dgram_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Svc_Cfg_IPC_Client_Rem_Stream.am
+
+if !BUILD_ACE_FOR_TAO
+noinst_PROGRAMS += remote_stream_test
+
+remote_stream_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+remote_stream_test_SOURCES = \
+ remote_stream_client_test.cpp
+
+remote_stream_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Svc_Cfg_IPC_Client_Rem_Svc_Dir.am
+noinst_PROGRAMS += remote_service_directory_test
+
+remote_service_directory_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+remote_service_directory_test_SOURCES = \
+ remote_service_directory_test.cpp
+
+remote_service_directory_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Makefile.Svc_Cfg_IPC_Client_Rem_Thr_Stream.am
+noinst_PROGRAMS += remote_thr_stream_test
+
+remote_thr_stream_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+remote_thr_stream_test_SOURCES = \
+ remote_thr_stream_client_test.cpp
+
+remote_thr_stream_test_LDADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/Svc_Cfg_IPC_Client.mpc b/ACE/examples/Service_Configurator/IPC-tests/client/Svc_Cfg_IPC_Client.mpc
new file mode 100644
index 00000000000..6876c4aac4d
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/Svc_Cfg_IPC_Client.mpc
@@ -0,0 +1,70 @@
+// -*- MPC -*-
+// $Id$
+
+project(*loc dgram) : aceexe {
+ avoids += ace_for_tao
+ exename = local_dgram_test
+ Source_Files {
+ local_dgram_client_test.cpp
+ }
+}
+project(*loc fifo) : aceexe {
+ avoids += ace_for_tao
+ exename = local_fifo_test
+ Source_Files {
+ local_fifo_client_test.cpp
+ }
+}
+project(*loc pipe) : aceexe {
+ avoids += ace_for_tao
+ exename = local_pipe_test
+ Source_Files {
+ local_pipe_client_test.cpp
+ }
+}
+project(*loc spipe) : aceexe {
+ exename = local_spipe_test
+ Source_Files {
+ local_spipe_client_test.cpp
+ }
+}
+project(*loc stream) : aceexe {
+ avoids += ace_for_tao
+ exename = local_stream_test
+ Source_Files {
+ local_stream_client_test.cpp
+ }
+}
+project(*rem dgram) : aceexe {
+ avoids += ace_for_tao
+ exename = remote_dgram_test
+ Source_Files {
+ remote_dgram_client_test.cpp
+ }
+}
+project(*rem svc dir) : aceexe {
+ exename = remote_service_directory_test
+ Source_Files {
+ remote_service_directory_test.cpp
+ }
+}
+project(*rem stream) : aceexe {
+ avoids += ace_for_tao
+ exename = remote_stream_test
+ Source_Files {
+ remote_stream_client_test.cpp
+ }
+}
+project(*rem thr_stream) : aceexe {
+ exename = remote_thr_stream_test
+ Source_Files {
+ remote_thr_stream_client_test.cpp
+ }
+}
+project(*bcast) : aceexe {
+ avoids += ace_for_tao
+ exename = remote_broadcast_test
+ Source_Files {
+ broadcast_client_test.cpp
+ }
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/broadcast_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/broadcast_client_test.cpp
new file mode 100644
index 00000000000..4cbb964cd74
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/broadcast_client_test.cpp
@@ -0,0 +1,62 @@
+// $Id$
+
+// Tests out the broadcast service of the
+// Internet domain IPC-SAP dgram abstraction.
+
+#include "ace/OS_main.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_stdlib.h"
+#include "ace/INET_Addr.h"
+#include "ace/SOCK_Dgram_Bcast.h"
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(client, broadcast_client_test, "$Id$")
+
+/* Name of the program. */
+static ACE_TCHAR *program_name;
+
+/* Port number to use. */
+static unsigned short broadcast_port_number = ACE_DEFAULT_BROADCAST_PORT;
+
+static void
+print_usage_and_die (void)
+{
+ ACE_OS::fprintf (stderr, "usage: %s [-p broadcast portnum]\n",
+ program_name);
+ ACE_OS::exit (1);
+}
+
+void
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("p:"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'p':
+ broadcast_port_number = ACE_OS::atoi (get_opt.opt_arg ());
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ program_name = argv[0];
+ parse_args (argc, argv);
+
+ ACE_SOCK_Dgram_Bcast sd (ACE_Addr::sap_any);
+
+ static char buf[] = "testing socket broadcast service";
+
+ if (sd.send (buf, ACE_OS::strlen (buf), broadcast_port_number) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "can't send broadcast"), -1);
+
+ return 0;
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/local_data b/ACE/examples/Service_Configurator/IPC-tests/client/local_data
new file mode 100644
index 00000000000..1faba1b8091
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/local_data
@@ -0,0 +1,22 @@
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
+locallocallocallocallocallocallocallocal
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp
new file mode 100644
index 00000000000..3f8ed3db866
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp
@@ -0,0 +1,117 @@
+// $Id$
+
+// Tests out the UNIX domain IPC-SAP abstraction.
+
+#include "ace/OS_main.h"
+#include "ace/LSOCK_CODgram.h"
+#include "ace/LSOCK_Dgram.h"
+#include "ace/UNIX_Addr.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_stdlib.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_fcntl.h"
+
+ACE_RCSID(client, local_dgram_client_test, "$Id$")
+
+#if defined (ACE_HAS_MSG) && !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+// Name of the program.
+static ACE_TCHAR *program_name;
+
+// Name of rendezvous point.
+static const ACE_TCHAR *rendezvous_codgram = ACE_TEXT ("/tmp/foo_codgram");
+static const ACE_TCHAR *rendezvous_dgram = ACE_TEXT ("/tmp/foo_dgram");
+
+// Name of file to send.
+static const ACE_TCHAR *file_name = ACE_TEXT ("local_data");
+
+static void
+print_usage_and_die (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("usage: %s [-r rendezvous_dgram] ")
+ ACE_TEXT ("[-c rendezvous_codgram] [-f file]\n"),
+ program_name));
+ ACE_OS::exit (1);
+}
+
+void
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("c:f:r:"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'f':
+ file_name = get_opt.opt_arg ();
+ break;
+ case 'r':
+ rendezvous_dgram = get_opt.opt_arg ();
+ break;
+ case 'c':
+ rendezvous_codgram = get_opt.opt_arg ();
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ program_name = argv[0];
+
+ parse_args (argc, argv);
+
+ char *sock_client = ACE_OS::tempnam ();
+
+ ACE_LSOCK_Dgram sd ((ACE_UNIX_Addr) (sock_client));
+ if (ACE_OS::unlink (sock_client))
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("unlink")),
+ -1);
+ ACE_OS::free ((void *) sock_client);
+
+ ACE_LSOCK_CODgram sc;
+
+ if (sc.open (ACE_UNIX_Addr (rendezvous_codgram),
+ ACE_Addr::sap_any) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")),
+ -1);
+
+ ACE_HANDLE handle = ACE_OS::open (file_name, O_RDONLY);
+
+ if (handle == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")),
+ -1);
+
+ // Send the open file descriptor to the server!
+
+ if (sc.send_handle (handle) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send")),
+ -1);
+
+ char name[ACE_MAX_USERID];
+ ACE_OS::cuserid (name);
+
+ if (sd.send (name,
+ ACE_OS::strlen (name) + 1,
+ ACE_UNIX_Addr (rendezvous_dgram)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send")),
+ -1);
+
+ if (ACE_OS::close (handle) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("close")),
+ -1);
+ return 0;
+}
+#else
+int ACE_TMAIN (int, ACE_TCHAR *[])
+{
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("your platform must support sendmsg/recvmsg to run this test\n")),
+ -1);
+}
+#endif /* ACE_HAS_MSG */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/local_fifo_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/local_fifo_client_test.cpp
new file mode 100644
index 00000000000..9fb26b4088e
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/local_fifo_client_test.cpp
@@ -0,0 +1,101 @@
+// $Id$
+
+// Send a file through ACE_FIFO communication channel by
+// breaking it (the file) into pieces.
+
+#include "ace/OS_main.h"
+#include "ace/Mem_Map.h"
+#include "ace/FIFO_Send_Msg.h"
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_stdlib.h"
+#include "ace/OS_NS_stropts.h"
+
+ACE_RCSID(client, local_fifo_client_test, "$Id$")
+
+// Name of the program.
+static ACE_TCHAR *program_name;
+
+// debug state on or off
+static int debug = 0;
+
+static const ACE_TCHAR *rendezvous_fifo = ACE_TEXT("/tmp/foo_fifo");
+
+// Name of file to send.
+static const ACE_TCHAR *file_name = ACE_TEXT("./local_data");
+
+static void
+print_usage_and_die (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ "usage: %s [-d] [-f rendezvous_fifo]\n",
+ program_name));
+ ACE_OS::exit (1);
+}
+
+static void
+parse_arguments (int argc, ACE_TCHAR *argv[])
+{
+ int tracing = 1;
+ program_name = argv[0];
+
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("df:"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'd':
+ debug = 1;
+ break;
+ case 'f':
+ rendezvous_fifo = get_opt.opt_arg ();
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+
+ if (debug)
+ ACE_DEBUG ((LM_DEBUG,
+ "rendezvous_fifo = %s\n"
+ "trace = %s\n",
+ rendezvous_fifo,
+ tracing ? "on" : "off"));
+}
+
+int
+ACE_TMAIN(int argc, ACE_TCHAR *argv[])
+{
+ parse_arguments (argc, argv);
+
+ ACE_FIFO_Send_Msg fifo;
+
+ if (fifo.open (rendezvous_fifo,
+ O_WRONLY,
+ 0666) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open %s for requesting a new communication channel"
+ "in local_fifo_client_test\n",
+ rendezvous_fifo),
+ -1);
+ void *cp = 0;
+ ACE_Mem_Map mmap (file_name);
+
+ if (mmap (cp) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "mmap"),
+ -1);
+
+ // Next, send the file's contents.
+
+ ACE_Str_Buf msg (cp,
+ int (mmap.size ()));
+
+ if (fifo.send (msg) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "send"),
+ -1);
+ return 0;
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/local_pipe_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/local_pipe_client_test.cpp
new file mode 100644
index 00000000000..7193440b440
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/local_pipe_client_test.cpp
@@ -0,0 +1,150 @@
+// $Id$
+
+// Another test of UNIX domain IPC-SAP abstraction. This one opens 2
+// pipes and then ships certain ends over to the server to act as a
+// filter!
+
+#include "ace/OS_main.h"
+#include "ace/LSOCK_Connector.h"
+#include "ace/UNIX_Addr.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdlib.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_fcntl.h"
+
+ACE_RCSID(client, local_pipe_client_test, "$Id$")
+
+#if defined (ACE_HAS_MSG) && !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+// Name of the program.
+static ACE_TCHAR *program_name;
+
+// Name of rendezvous point.
+static const ACE_TCHAR *rendezvous = ACE_TEXT ("/tmp/foo_pipe");
+
+// Name of file to send.
+static const ACE_TCHAR *file_name = ACE_TEXT ("local_data");
+
+static void
+print_usage_and_die (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("usage: %s [-r rendezvous] [-f file]\n"),
+ program_name));
+ ACE_OS::exit (1);
+}
+
+void
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ program_name = argv[0];
+
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("f:r:"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'f':
+ file_name = get_opt.opt_arg ();
+ break;
+ case 'r':
+ rendezvous = get_opt.opt_arg ();
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+}
+
+static int
+do_client_processing (ACE_LSOCK_Stream &sc)
+{
+ ACE_HANDLE fd_read[2];
+ ACE_HANDLE fd_write[2];
+ char buf[BUFSIZ];
+ int n;
+
+ if (ACE_OS::pipe (fd_read) == -1 || ACE_OS::pipe (fd_write) == -1)
+ return -1;
+
+ if (sc.send_handle (fd_write[0]) == -1 || sc.send_handle (fd_read[1]) == -1)
+ return -1;
+
+ // Close off the ends we aren't interested in.
+
+ if (ACE_OS::close (fd_read[1]) || ACE_OS::close (fd_write[0]) == -1)
+ return -1;
+
+ // Do a silly dup just for fun...
+
+ ACE_HANDLE fd1 = ACE_OS::open (file_name, O_RDONLY);
+
+ if (fd1 == ACE_INVALID_HANDLE)
+ return -1;
+
+ while ((n = ACE_OS::read (fd1, buf, sizeof buf)) > 0)
+ {
+ if (ACE_OS::write (fd_write[1],
+ buf,
+ n) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("write")),
+ -1);
+ if ((n = ACE_OS::read (fd_read[0],
+ buf,
+ sizeof buf)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("read")),
+ -1);
+ if (ACE_OS::write (ACE_STDOUT,
+ buf,
+ n) == -1)
+ return -1;
+ }
+
+ if (ACE_OS::close (fd_read[0]) == -1
+ || ACE_OS::close (fd_write[1]) == -1
+ || ACE_OS::close (fd1) == -1)
+ ACE_OS::exit (1);
+
+ return 0;
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ parse_args (argc, argv);
+
+ ACE_LSOCK_Stream sc;
+ ACE_LSOCK_Connector con;
+
+ if (con.connect (sc,
+ ACE_UNIX_Addr (rendezvous)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("connect")),
+ -1);
+
+ if (do_client_processing (sc) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("do_client_processing")),
+ -1);
+
+ if (sc.close () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("close")),
+ -1);
+
+ return 0;
+}
+#else
+int ACE_TMAIN (int, ACE_TCHAR *[])
+{
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("your platform must support sendmsg/recvmsg to run this test\n")),
+ -1);
+}
+#endif /* ACE_HAS_MSG */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/local_spipe_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/local_spipe_client_test.cpp
new file mode 100644
index 00000000000..91d81338ea1
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/local_spipe_client_test.cpp
@@ -0,0 +1,106 @@
+// $Id$
+
+// Send a file through ACE_SPIPE communication channel by
+// breaking it (the file) into pieces.
+
+#include "ace/OS_main.h"
+#include "ace/Mem_Map.h"
+#include "ace/SPIPE_Connector.h"
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(client, local_spipe_client_test, "$Id$")
+
+#if defined (ACE_HAS_STREAM_PIPES)
+
+static ACE_TCHAR *program_name;
+
+// debug state on or off
+static int debug = 0;
+
+static const ACE_TCHAR *rendezvous_spipe = ACE_TEXT ("/tmp/foo_spipe");
+
+// Name of file to send.
+static const ACE_TCHAR *file_name = ACE_TEXT ("./local_data");
+
+static void
+print_usage_and_die (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("usage: %s [-d] [-r rendezvous_spipe]\n"),
+ program_name));
+ ACE_OS::exit (1);
+}
+
+static void
+parse_arguments (int argc, ACE_TCHAR *argv[])
+{
+ program_name = argv[0];
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("dr:"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'd':
+ debug = 1;
+ break;
+ case 'r':
+ rendezvous_spipe = get_opt.opt_arg ();
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+ if (debug)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("rendezvous_spipe = %s\n"),
+ rendezvous_spipe));
+}
+
+int
+ACE_TMAIN(int argc, ACE_TCHAR *argv[])
+{
+ parse_arguments (argc, argv);
+
+ ACE_SPIPE_Stream spipe;
+ ACE_SPIPE_Connector con;
+
+ if (con.connect (spipe,
+ ACE_SPIPE_Addr (rendezvous_spipe)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Cannot open %s for requesting a new ")
+ ACE_TEXT ("communication channel in %p\n"),
+ rendezvous_spipe,
+ ACE_TEXT ("local_spipe_client_test")),
+ -1);
+
+ ACE_Mem_Map mmap (file_name);
+ void *cp;
+
+ if (mmap (cp) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("mmap")),
+ -1);
+
+ // Next, send the file's contents.
+
+ ACE_Str_Buf msg (cp, int (mmap.size ()));
+
+ if (spipe.send ((ACE_Str_Buf *) 0, &msg) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("send")),
+ -1);
+ return 0;
+}
+#else
+#include <stdio.h>
+int
+ACE_TMAIN (int, ACE_TCHAR *[])
+{
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("This feature is not supported\n")),
+ -1);
+}
+#endif /* ACE_HAS_STREAM_PIPES */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/local_stream_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/local_stream_client_test.cpp
new file mode 100644
index 00000000000..390b14e19b8
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/local_stream_client_test.cpp
@@ -0,0 +1,113 @@
+// $Id$
+
+// Tests out the UNIX domain IPC-SAP abstraction.
+
+#include "ace/OS_main.h"
+#include "ace/LSOCK_Connector.h"
+#include "ace/UNIX_Addr.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdlib.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_fcntl.h"
+
+ACE_RCSID(client, local_stream_client_test, "$Id$")
+
+#if defined (ACE_HAS_MSG) && !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+// Name of the program.
+static ACE_TCHAR *program_name;
+
+// Name of rendezvous point.
+static const ACE_TCHAR *rendezvous = ACE_TEXT ("/tmp/foo_stream");
+
+// Name of file to send.
+static const ACE_TCHAR *file_name = ACE_TEXT ("local_data");
+
+static void
+print_usage_and_die (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("usage: %s [-r rendezvous] [-f file]\n"),
+ program_name));
+ ACE_OS::exit (1);
+}
+
+void
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ program_name = argv[0];
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("f:r:"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'f':
+ file_name = get_opt.opt_arg ();
+ break;
+ case 'r':
+ rendezvous = get_opt.opt_arg ();
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ parse_args (argc, argv);
+
+ int fd;
+ char buf[BUFSIZ];
+ int n;
+
+ ACE_LSOCK_Stream sc;
+ ACE_LSOCK_Connector con;
+
+ if (con.connect (sc,
+ ACE_UNIX_Addr (rendezvous)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("connect")),
+ -1);
+
+ if ((fd = ACE_OS::open (file_name,
+ O_RDONLY)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("open")),
+ -1);
+
+ // Send the open file descriptor to the server!
+
+ if (sc.send_handle (fd) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("send_handle")),
+ -1);
+
+ if ((n = sc.recv_n (buf,
+ sizeof buf)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("recv")),
+ -1);
+ else
+ ACE_OS::write (ACE_STDOUT, buf, n);
+
+ if (ACE_OS::close (fd) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("close")),
+ -1);
+
+ return 0;
+}
+#else
+int ACE_TMAIN (int, ACE_TCHAR *[])
+{
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("your platform must support sendmsg/recvmsg to run this test\n")),
+ -1);
+}
+#endif /* ACE_HAS_MSG */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/remote_data b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data
new file mode 100644
index 00000000000..ae7e1fbb88e
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data
@@ -0,0 +1,22 @@
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
+remoteremoteremoteremoteremoteremoteremoteremote
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/remote_data1 b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data1
new file mode 100644
index 00000000000..6faaee46729
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data1
@@ -0,0 +1,22 @@
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
+remote1remote1remote1remote1remote1remote1remote1remote1
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/remote_data2 b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data2
new file mode 100644
index 00000000000..ae6bf12d49f
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data2
@@ -0,0 +1,22 @@
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
+remote2remote2remote2remote2remote2remote2remote2remote2
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/remote_data3 b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data3
new file mode 100644
index 00000000000..7f2ec1aa81b
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data3
@@ -0,0 +1,22 @@
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
+remote3remote3remote3remote3remote3remote3remote3remote3
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/remote_data4 b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data4
new file mode 100644
index 00000000000..6c5a9633d56
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/remote_data4
@@ -0,0 +1,22 @@
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
+remote4remote4remote4remote4remote4remote4remote4remote4
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/remote_dgram_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/remote_dgram_client_test.cpp
new file mode 100644
index 00000000000..e5bec64d8c6
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/remote_dgram_client_test.cpp
@@ -0,0 +1,92 @@
+// $Id$
+
+// Tests out the Internet domain IPC-SAP dgram abstraction.
+
+#include "ace/OS_main.h"
+#include "ace/OS_NS_stdlib.h"
+#include "ace/Mem_Map.h"
+#include "ace/SOCK_Dgram.h"
+#include "ace/INET_Addr.h"
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(client, remote_dgram_client_test, "$Id$")
+
+// Name of the program.
+static const ACE_TCHAR *program_name;
+
+// Port number to use.
+static u_short port_number = ACE_DEFAULT_SERVER_PORT;
+
+// Name of remote host.
+static const ACE_TCHAR *host_name = ACE_DEFAULT_SERVER_HOST;
+
+// Name of file to send.
+static const ACE_TCHAR *file_name = ACE_TEXT("./remote_data");
+
+static void print_usage_and_die (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ "usage: %s [-p portnum] [-h host_name] [-f file]\n",
+ program_name));
+ ACE_OS::exit (1);
+}
+
+void
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ program_name = argv[0];
+
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("f:h:p:"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'f':
+ file_name = get_opt.opt_arg ();
+ break;
+ case 'h':
+ host_name = get_opt.opt_arg ();
+ break;
+ case 'p':
+ port_number = ACE_OS::atoi (get_opt.opt_arg ());
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ parse_args (argc, argv);
+
+ ACE_SOCK_Dgram sd (ACE_Addr::sap_any);
+ void *cp = 0;
+ ACE_INET_Addr sa (port_number, host_name);
+
+ ACE_Mem_Map mmap (file_name);
+
+ if (mmap (cp) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "mmap"),
+ -1);
+
+ // Next, send the file's contents.
+
+ ssize_t cc = sd.send (cp, mmap.size (), sa);
+
+ if (cc == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "send"),
+ -1);
+ else if (cc != (ssize_t) mmap.size ())
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "Not all the contents of mmap file are sent."),
+ -1);
+ return 0;
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/remote_service_directory_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/remote_service_directory_test.cpp
new file mode 100644
index 00000000000..cee8ca1469f
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/remote_service_directory_test.cpp
@@ -0,0 +1,111 @@
+// $Id$
+
+// Test program for the INET IPC-SAPs...
+
+#include "ace/OS_main.h"
+#include "ace/OS_NS_stdlib.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_string.h"
+#include "ace/SOCK_Connector.h"
+#include "ace/INET_Addr.h"
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(client, remote_service_directory_test, "$Id$")
+
+// Port number to use.
+static unsigned short port_number = ACE_DEFAULT_SERVICE_PORT;
+
+// Name of remote host.
+static const ACE_TCHAR *host_name = ACE_DEFAULT_SERVER_HOST;
+
+// Trigger a remote reconfiguration.
+static int remote_reconfigure = 0;
+
+static void
+print_usage_and_die (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ "usage: %n [-p portnum] [-h host_name] [-r]\n"));
+ ACE_OS::exit (1);
+}
+
+void
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("p:h:r"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'h':
+ host_name = get_opt.opt_arg ();
+ break;
+ case 'p':
+ port_number = ACE_OS::atoi (get_opt.opt_arg ());
+ break;
+ case 'r':
+ remote_reconfigure = 1;
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ ACE_LOG_MSG->open (argv[0]);
+
+ parse_args (argc, argv);
+ // Default is to ask the server for ``help.''
+ static char buf[BUFSIZ] = "help\n";
+ int n;
+ ACE_SOCK_Stream sc;
+ ACE_SOCK_Connector con;
+
+ if (con.connect (sc,
+ ACE_INET_Addr (port_number,
+ host_name)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n%a",
+ "connect",
+ 1),
+ -1);
+
+ if (remote_reconfigure)
+ // Remotely instruct the server to reconfigure itself.
+ ACE_OS::strcpy (buf, "reconfigure\n");
+
+ // Send the command.
+
+ if (sc.send_n (buf,
+ ACE_OS::strlen (buf) + 1) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n%a",
+ "send",
+ 1), -1);
+
+ // Next, read the response.
+
+ while ((n = sc.recv (buf,
+ sizeof buf)) > 0)
+ if (ACE_OS::write (ACE_STDOUT,
+ buf,
+ n) != n)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n%a",
+ "write",
+ 1),
+ -1);
+
+ if (sc.close () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n%a",
+ "close",
+ 1),
+ -1);
+
+ return 0;
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/remote_stream_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/remote_stream_client_test.cpp
new file mode 100644
index 00000000000..d7d4ef7346c
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/remote_stream_client_test.cpp
@@ -0,0 +1,134 @@
+// $Id$
+
+// Test program for the INET IPC-SAPs...
+
+#include "ace/OS_main.h"
+#include "ace/OS_NS_stdlib.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/Mem_Map.h"
+#include "ace/SOCK_Connector.h"
+#include "ace/SOCK_CODgram.h"
+#include "ace/INET_Addr.h"
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(client, remote_stream_client_test, "$Id$")
+
+// Name of the program.
+static const ACE_TCHAR *program_name;
+
+// Port number to use.
+static u_short port_number = ACE_DEFAULT_SERVER_PORT;
+
+// Name of remote host.
+static const ACE_TCHAR *host_name = ACE_DEFAULT_SERVER_HOST;
+
+// Name of file to send.
+static const ACE_TCHAR *file_name = ACE_TEXT("./remote_data");
+
+static void
+print_usage_and_die (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ "usage: %s [-p portnum] [-h host_name] [-f file]\n",
+ program_name));
+ ACE_OS::exit (1);
+}
+
+void
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ program_name = argv[0];
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("f:h:p:"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'f':
+ file_name = get_opt.opt_arg ();
+ break;
+ case 'h':
+ host_name = get_opt.opt_arg ();
+ break;
+ case 'p':
+ port_number = ACE_OS::atoi (get_opt.opt_arg ());
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ parse_args (argc, argv);
+ ACE_INET_Addr sa (port_number, host_name);
+ void *cp = 0;
+ char buf[BUFSIZ];
+ int n;
+ ACE_SOCK_CODgram dc;
+
+ if (dc.open (sa, ACE_Addr::sap_any) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "open"),
+ -1);
+
+ // First send the name of the file as a datagram.
+
+ iovec iov[2];
+
+ iov[0].iov_base = (char *) "filename: ";
+ iov[0].iov_len = 11;
+ iov[1].iov_base = (char *) file_name;
+ iov[1].iov_len = ACE_OS::strlen (file_name);
+
+ if (dc.send (iov, 2) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "send"),
+ -1);
+
+ ACE_SOCK_Stream sc;
+ ACE_SOCK_Connector con;
+
+ if (con.connect (sc, sa) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "connect"),
+ -1);
+
+ ACE_Mem_Map mmap (file_name);
+
+ if (mmap (cp) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "mmap"),
+ -1);
+
+ // Next, send the file's contents.
+
+ if (sc.send_n (cp, mmap.size ()) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "send_urg"),
+ -1);
+
+ if (sc.close_writer () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "close_writer"),
+ -1);
+
+ if ((n = sc.recv_n (buf, sizeof buf)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "recv"),
+ -1);
+ else
+ ACE_OS::write (ACE_STDOUT, buf, n);
+
+ return 0;
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/remote_thr_stream_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/remote_thr_stream_client_test.cpp
new file mode 100644
index 00000000000..113c809069d
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/client/remote_thr_stream_client_test.cpp
@@ -0,0 +1,122 @@
+// $Id$
+
+// Test program for the INET ACE_TLI-SAPs...
+
+#include "ace/OS_main.h"
+#include "ace/OS_NS_stdlib.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/Mem_Map.h"
+#include "ace/TLI_Connector.h"
+#include "ace/INET_Addr.h"
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(client, remote_thr_stream_client_test, "$Id$")
+
+#if defined (ACE_HAS_TLI)
+
+// Name of the program.
+static const ACE_TCHAR *program_name;
+
+// Port number to use.
+static u_short port_number = ACE_DEFAULT_THR_PORT;
+
+// Name of remote host.
+static const ACE_TCHAR *host_name = ACE_DEFAULT_SERVER_HOST;
+
+// Name of file to send.
+static const ACE_TCHAR *file_name = ACE_TEXT ("./remote_data");
+
+static void print_usage_and_die (void)
+{
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("usage: %s [-p portnum] [-h host_name] [-f file]\n"),
+ program_name));
+ ACE_OS::exit (1);
+}
+
+void
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ program_name = argv[0];
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("f:h:p:"));
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'f':
+ file_name = get_opt.opt_arg ();
+ break;
+ case 'h':
+ host_name = get_opt.opt_arg ();
+ break;
+ case 'p':
+ port_number = ACE_OS::atoi (get_opt.opt_arg ());
+ break;
+ default:
+ print_usage_and_die ();
+ break;
+ }
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ parse_args (argc, argv);
+ void *cp;
+ char buf[BUFSIZ];
+ ACE_TLI_Stream sc;
+ ACE_TLI_Connector con;
+
+ if (con.connect (sc,
+ ACE_INET_Addr (port_number,
+ host_name)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("open")),
+ -1);
+
+ ACE_Mem_Map mmap (file_name, PROT_READ);
+
+ if (mmap (cp) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("mmap")), -1);
+
+ // Next, send the file's contents.
+
+ if (sc.send_n (cp, mmap.size ()) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("send_n")),
+ -1);
+
+ if (sc.sndrel () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("close_writer")),
+ -1);
+
+ for (int n; (n = sc.recv (buf, sizeof buf)) > 0; )
+ if (ACE_OS::write (ACE_STDOUT, buf, n) != n)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("write")),
+ -1);
+
+ if (sc.close () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("close")),
+ -1);
+ return 0;
+}
+#else
+int
+ACE_TMAIN (int, ACE_TCHAR *[])
+{
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("you must have TLI to run this test\n")),
+ 1);
+}
+#endif /* ACE_HAS_TLI */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/.cvsignore b/ACE/examples/Service_Configurator/IPC-tests/server/.cvsignore
new file mode 100644
index 00000000000..74fdfbc7f93
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/.cvsignore
@@ -0,0 +1 @@
+server_test
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.cpp
new file mode 100644
index 00000000000..30db7825244
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.cpp
@@ -0,0 +1,38 @@
+// $Id$
+
+#include "Handle_Broadcast.h"
+
+ACE_RCSID(server, Handle_Broadcast, "$Id$")
+
+#if defined (SunOS4)
+extern "C"
+{
+ int init (void);
+ int fini (void);
+ void __sti__Handle_Broadcast_C_init_();
+ void __std__Handle_Broadcast_C_init_();
+}
+
+int
+init (void)
+{
+ __sti__Handle_Broadcast_C_init_();
+ return 0;
+}
+
+int
+fini (void)
+{
+ __std__Handle_Broadcast_C_init_();
+ return 0;
+}
+#endif /* SunOS4 */
+
+unsigned short Handle_Broadcast::DEFAULT_PORT = ACE_DEFAULT_BROADCAST_PORT;
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_Broadcast.i"
+#endif /* __ACE_INLINE__ */
+
+Handle_Broadcast remote_broadcast;
+ACE_Service_Object_Type rb (&remote_broadcast, ACE_TEXT("Remote_Brdcast"));
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.h
new file mode 100644
index 00000000000..8b382f9fd73
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+//
+// $Id$
+
+/* Handles INET broadcast datagram messages from remote hosts on the local subnet. */
+
+#ifndef _HANDLE_BROADCAST_H
+#define _HANDLE_BROADCAST_H
+
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/INET_Addr.h"
+#include "ace/SOCK_Dgram.h"
+#include "ace/Log_Msg.h"
+#include "ace/svc_export.h"
+
+class ACE_Svc_Export Handle_Broadcast : public ACE_Service_Object, public ACE_SOCK_Dgram
+{
+public:
+ Handle_Broadcast (void);
+ ~Handle_Broadcast (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ int open (const ACE_INET_Addr &r, int async = 0);
+ virtual ACE_HANDLE get_handle (void) const;
+ virtual int handle_input (ACE_HANDLE fd);
+ virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask);
+
+ static unsigned short DEFAULT_PORT;
+};
+
+extern ACE_Service_Object_Type rb;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_Broadcast.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+#endif /* _HANDLE_BROADCAST_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.i
new file mode 100644
index 00000000000..ce7f42617e7
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Broadcast.i
@@ -0,0 +1,116 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_INLINE
+Handle_Broadcast::~Handle_Broadcast (void)
+{
+}
+
+ACE_INLINE
+Handle_Broadcast::Handle_Broadcast (void)
+{
+}
+
+ACE_INLINE int
+Handle_Broadcast::open (const ACE_INET_Addr &r, int async)
+{
+ if (this->ACE_SOCK_Dgram::open (r) == -1)
+ return -1;
+ else if (async && ACE_SOCK_Dgram::enable (ACE_SIGIO) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_Broadcast::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ ACE_INET_Addr sa;
+
+ if (this->get_local_addr (sa) == -1)
+ return -1;
+
+ ACE_OS::sprintf (buf, ACE_TEXT("%d/"), sa.get_port_number ());
+ ACE_OS::strcat (buf, ACE_TEXT("udp # tests broadcasting\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_Broadcast::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_INET_Addr sba (Handle_Broadcast::DEFAULT_PORT);
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("p:"), 0);
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'p':
+ sba.set (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ default:
+ break;
+ }
+
+ if (this->open (sba) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+ else if (ACE_Reactor::instance ()->register_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"),
+ ACE_TEXT ("registering service with ACE_Reactor")), -1);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_Broadcast::fini (void)
+{
+ return ACE_Reactor::instance ()->remove_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+ACE_INLINE ACE_HANDLE
+Handle_Broadcast::get_handle (void) const
+{
+ return this->ACE_SOCK_Dgram::get_handle ();
+}
+
+ACE_INLINE int
+Handle_Broadcast::handle_input (ACE_HANDLE)
+{
+ ACE_INET_Addr sa;
+ char buf[8 * 1024]; /* 8 k buffer */
+ ssize_t n = this->recv (buf, sizeof buf, sa);
+
+ if (n== -1)
+ return -1;
+ else
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("received broadcast datagram from host %C\n"),
+ sa.get_host_name ()));
+
+ ACE_OS::puts (ACE_TEXT ("----------------------------------------"));
+ ACE_OS::write (ACE_STDOUT, buf, n);
+
+ if (buf[n - 1] != '\n')
+ putchar ('\n');
+
+ ACE_OS::puts (ACE_TEXT ("----------------------------------------"));
+
+ return 0;
+}
+
+ACE_INLINE int
+Handle_Broadcast::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
+{
+ return this->ACE_SOCK_Dgram::close ();
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.cpp
new file mode 100644
index 00000000000..6fe631fdb41
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.cpp
@@ -0,0 +1,19 @@
+// $Id$
+
+#include "Handle_L_CODgram.h"
+
+#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
+ACE_RCSID(server, Handle_L_CODgram, "$Id$")
+
+const ACE_TCHAR *Handle_L_CODgram::DEFAULT_RENDEZVOUS =
+ ACE_TEXT ("/tmp/foo_codgram");
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_L_CODgram.i"
+#endif /* __ACE_INLINE__ */
+
+Handle_L_CODgram local_codgram;
+ACE_Service_Object_Type lc (&local_codgram, ACE_TEXT ("Local_CODgram"));
+
+#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.h
new file mode 100644
index 00000000000..852c0557cda
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.h
@@ -0,0 +1,51 @@
+/* -*- C++ -*- */
+// $Id$
+
+// Handles UNIX datagram messages from local host.
+
+#ifndef _HANDLE_L_CODGRAM_H
+#define _HANDLE_L_CODGRAM_H
+
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/LSOCK_CODgram.h"
+#include "ace/UNIX_Addr.h"
+#include "ace/svc_export.h"
+
+#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
+class ACE_Svc_Export Handle_L_CODgram : public ACE_Service_Object, public ACE_LSOCK_CODgram
+{
+public:
+ Handle_L_CODgram (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+public:
+ int open (const ACE_UNIX_Addr &suad, int async = 0);
+ virtual ACE_HANDLE get_handle (void) const;
+ virtual int handle_input (ACE_HANDLE);
+ virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
+
+ ACE_TCHAR rendezvous[MAXPATHLEN + 1];
+ static const ACE_TCHAR *DEFAULT_RENDEZVOUS;
+};
+
+extern ACE_Service_Object_Type lc;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_L_CODgram.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
+#endif /* _HANDLE_L_CODGRAM_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.i
new file mode 100644
index 00000000000..a77d75e1fa8
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_CODgram.i
@@ -0,0 +1,123 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_INLINE
+Handle_L_CODgram::Handle_L_CODgram (void)
+{
+}
+
+ACE_INLINE int
+Handle_L_CODgram::open (const ACE_UNIX_Addr &suad, int async)
+{
+ if (this->ACE_LSOCK_CODgram::open (ACE_Addr::sap_any, suad) == -1)
+ return -1;
+ else if (async && this->ACE_LSOCK_CODgram::enable (ACE_SIGIO) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_CODgram::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ ACE_UNIX_Addr sa;
+
+ if (ACE_LSOCK_CODgram::get_local_addr (sa) == -1)
+ return -1;
+
+ ACE_OS::strcpy (buf, ACE_TEXT_CHAR_TO_TCHAR (sa.get_path_name ()));
+ ACE_OS::strcat (buf, ACE_TEXT (" # tests local connected datagram\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_L_CODgram::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_UNIX_Addr sucd;
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("r:"), 0);
+ const ACE_TCHAR *r = Handle_L_CODgram::DEFAULT_RENDEZVOUS;
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'r':
+ r = get_opt.opt_arg ();
+ break;
+ default:
+ break;
+ }
+
+ ACE_OS::strncpy (this->rendezvous, r, MAXPATHLEN);
+ ACE_OS::unlink (this->rendezvous);
+ sucd.set (this->rendezvous);
+ if (this->open (sucd) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+ else if (ACE_Reactor::instance ()->register_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"),
+ ACE_TEXT ("registering service with ACE_Reactor")),
+ -1);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_CODgram::fini(void)
+{
+ return ACE_Reactor::instance ()->remove_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+ACE_INLINE ACE_HANDLE
+Handle_L_CODgram::get_handle (void) const
+{
+ return ACE_LSOCK_CODgram::get_handle ();
+}
+
+ACE_INLINE int
+Handle_L_CODgram::handle_input (ACE_HANDLE)
+{
+ ACE_HANDLE handle = ACE_INVALID_HANDLE;
+ char buf[BUFSIZ];
+
+ if (this->recv_handle (handle) == -1)
+ return -1;
+ else
+ ACE_DEBUG ((LM_INFO, ACE_TEXT ("received handle (%d)\n"), handle));
+
+ ACE_OS::puts ("----------------------------------------");
+
+ for (;;)
+ {
+ ssize_t n = ACE_OS::read (handle, buf, sizeof buf);
+
+ if (n <= 0)
+ break;
+
+ ACE_OS::write (ACE_STDOUT, buf, n);
+ }
+
+ ACE_OS::puts ("----------------------------------------");
+
+ if (ACE_OS::close (handle) == -1)
+ return -1;
+
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_CODgram::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
+{
+ this->ACE_LSOCK_CODgram::close ();
+ return ACE_OS::unlink (this->rendezvous);
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.cpp
new file mode 100644
index 00000000000..c502da057f7
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.cpp
@@ -0,0 +1,18 @@
+// $Id$
+
+#include "Handle_L_Dgram.h"
+
+ACE_RCSID(server, Handle_L_Dgram, "$Id$")
+
+#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
+const ACE_TCHAR *Handle_L_Dgram::DEFAULT_RENDEZVOUS =
+ ACE_TEXT ("/tmp/foo_dgram");
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_L_Dgram.i"
+#endif /* __ACE_INLINE__ */
+
+Handle_L_Dgram local_dgram;
+ACE_Service_Object_Type ld (&local_dgram, ACE_TEXT ("Local_Dgram"));
+#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.h
new file mode 100644
index 00000000000..ac1eac69117
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.h
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+// $Id$
+
+// Handles UNIX datagram messages from local host.
+
+#ifndef _HANDLE_L_DGRAM_H
+#define _HANDLE_L_DGRAM_H
+
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/LSOCK_Dgram.h"
+#include "ace/UNIX_Addr.h"
+#include "ace/svc_export.h"
+
+#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
+class ACE_Svc_Export Handle_L_Dgram : public ACE_Service_Object, public ACE_LSOCK_Dgram
+{
+public:
+ Handle_L_Dgram (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ int open (const ACE_UNIX_Addr &suad, int async = 0);
+ virtual int get_handle (void) const;
+ virtual int handle_input (int fd);
+ virtual int handle_close (int fd, ACE_Reactor_Mask);
+
+ ACE_TCHAR rendezvous[MAXPATHLEN + 1];
+ static const ACE_TCHAR *DEFAULT_RENDEZVOUS;
+};
+
+extern ACE_Service_Object_Type ld;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_L_Dgram.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
+#endif /* _HANDLE_L_DGRAM_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.i
new file mode 100644
index 00000000000..3b2ab29331f
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Dgram.i
@@ -0,0 +1,116 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_INLINE
+Handle_L_Dgram::Handle_L_Dgram (void)
+{
+}
+
+ACE_INLINE int
+Handle_L_Dgram::open (const ACE_UNIX_Addr &suad, int async)
+{
+ if (this->ACE_LSOCK_Dgram::open (suad) == -1)
+ return -1;
+ else if (async && this->ACE_LSOCK_Dgram::enable (ACE_SIGIO) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_Dgram::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ ACE_UNIX_Addr sa;
+
+ if (this->ACE_LSOCK_Dgram::get_local_addr (sa) == -1)
+ return -1;
+
+ ACE_OS::strcpy (buf, ACE_TEXT_CHAR_TO_TCHAR (sa.get_path_name ()));
+ ACE_OS::strcat (buf, ACE_TEXT (" # tests local datagram\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_L_Dgram::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_UNIX_Addr sudg;
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("r:"), 0);
+ const ACE_TCHAR *r = Handle_L_Dgram::DEFAULT_RENDEZVOUS;
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'r':
+ r = get_opt.opt_arg ();
+ break;
+ default:
+ break;
+ }
+
+ ACE_OS::strncpy (this->rendezvous, r, MAXPATHLEN);
+ ACE_OS::unlink (this->rendezvous);
+ sudg.set (this->rendezvous);
+ if (this->open (sudg) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+ else if (ACE_Reactor::instance ()->register_handler (this,
+ ACE_Event_Handler::ACCEPT_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("registering service with ACE_Reactor")),
+ -1);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_Dgram::fini (void)
+{
+ return ACE_Reactor::instance ()->remove_handler (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+ACE_INLINE int
+Handle_L_Dgram::get_handle (void) const
+{
+ return this->ACE_LSOCK_Dgram::get_handle ();
+}
+
+ACE_INLINE int
+Handle_L_Dgram::handle_input (int)
+{
+ ACE_UNIX_Addr sa;
+ char buf[8 * 1024]; /* 8 k buffer */
+ int n;
+
+ if ((n = this->recv (buf, sizeof buf, sa)) == -1)
+ return -1;
+ else
+ ACE_DEBUG ((LM_INFO, ACE_TEXT ("received datagram from %s\n"),
+ sa.get_path_name ()));
+
+ ACE_OS::puts ("----------------------------------------");
+ ACE_OS::write (ACE_STDOUT, buf, n);
+
+ if (buf[n - 1] != '\n')
+ putchar ('\n');
+
+ ACE_OS::puts ("----------------------------------------");
+
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_Dgram::handle_close (int, ACE_Reactor_Mask)
+{
+ this->ACE_LSOCK_Dgram::close ();
+ return ACE_OS::unlink (this->rendezvous);
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.cpp
new file mode 100644
index 00000000000..609f7b3c24f
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.cpp
@@ -0,0 +1,38 @@
+// $Id$
+
+#include "Handle_L_FIFO.h"
+
+ACE_RCSID(server, Handle_L_FIFO, "$Id$")
+
+#if defined (SunOS4)
+extern "C"
+{
+ int init (void);
+ int fini (void);
+ void __sti__Handle_L_FIFO_C_init_();
+ void __std__Handle_L_FIFO_C_init_();
+}
+
+int
+init (void)
+{
+ __sti__Handle_L_FIFO_C_init_();
+ return 0;
+}
+
+int
+fini (void)
+{
+ __std__Handle_L_FIFO_C_init_();
+ return 0;
+}
+#endif /* SunOS4 */
+
+const ACE_TCHAR *Handle_L_FIFO::DEFAULT_RENDEZVOUS = ACE_TEXT("/tmp/foo_fifo");
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_L_FIFO.i"
+#endif /* __ACE_INLINE__ */
+
+Handle_L_FIFO local_fifo;
+ACE_Service_Object_Type lf (&local_fifo, ACE_TEXT("Local_FIFO"));
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.h
new file mode 100644
index 00000000000..4375b2d105c
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//
+// $Id$
+
+/* Handle connections from local UNIX ACE_FIFO */
+/* Read from a well known ACE_FIFO and write to stdout. */
+
+#ifndef _HANDLE_L_FIFO_H
+#define _HANDLE_L_FIFO_H
+
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/FIFO_Recv_Msg.h"
+#include "ace/Log_Msg.h"
+#include "ace/svc_export.h"
+
+class ACE_Svc_Export Handle_L_FIFO : public ACE_Service_Object, public ACE_FIFO_Recv_Msg
+{
+public:
+ Handle_L_FIFO (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ int open (const ACE_TCHAR *rendezvous_fifo);
+ virtual ACE_HANDLE get_handle (void) const;
+ virtual int handle_input (ACE_HANDLE fd);
+ virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask);
+
+ static const ACE_TCHAR *DEFAULT_RENDEZVOUS;
+};
+
+extern ACE_Service_Object_Type lf;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_L_FIFO.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+#endif /* _HANDLE_L_FIFO_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.i
new file mode 100644
index 00000000000..f6cd0cda734
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.i
@@ -0,0 +1,101 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_stropts.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_INLINE
+Handle_L_FIFO::Handle_L_FIFO (void)
+{
+}
+
+ACE_INLINE int
+Handle_L_FIFO::open (const ACE_TCHAR *rendezvous_fifo)
+{
+ if (this->ACE_FIFO_Recv_Msg::open (rendezvous_fifo) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_FIFO::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ const ACE_TCHAR *rendezvous_fifo;
+
+ this->get_local_addr (rendezvous_fifo);
+
+ ACE_OS::strcpy (buf, rendezvous_fifo);
+ ACE_OS::strcat (buf, ACE_TEXT(" # tests local ACE_FIFO\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_L_FIFO::init (int argc, ACE_TCHAR *argv[])
+{
+ const ACE_TCHAR *rendezvous_fifo = Handle_L_FIFO::DEFAULT_RENDEZVOUS;
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("r:"), 0);
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'r':
+ rendezvous_fifo = get_opt.opt_arg ();
+ break;
+ default:
+ break;
+ }
+
+ ACE_OS::unlink (rendezvous_fifo);
+ if (this->open (rendezvous_fifo) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+ else if (ACE_Reactor::instance ()->register_handler
+ (this, ACE_Event_Handler::READ_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"),
+ ACE_TEXT ("registering service with ACE_Reactor")),
+ -1);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_FIFO::fini (void)
+{
+ return ACE_Reactor::instance ()->remove_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+ACE_INLINE ACE_HANDLE
+Handle_L_FIFO::get_handle (void) const
+{
+ return this->ACE_FIFO::get_handle ();
+}
+
+ACE_INLINE int
+Handle_L_FIFO::handle_input (ACE_HANDLE)
+{
+ char buf[PIPE_BUF];
+ ACE_Str_Buf msg (buf, 0, sizeof buf);
+
+ /* Accept communication requests */
+ if (this->recv (msg) == -1)
+ return -1;
+ else
+
+ ACE_OS::write (ACE_STDOUT, (const char *) msg.buf, (int) msg.len);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_FIFO::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
+{
+ return this->ACE_FIFO::remove ();
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.cpp
new file mode 100644
index 00000000000..a4508266363
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.cpp
@@ -0,0 +1,66 @@
+// $Id$
+
+#include "Handle_L_Pipe.h"
+#include "ace/OS_NS_ctype.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_RCSID(server, Handle_L_Pipe, "$Id$")
+
+#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
+// Uppercase N bytes of S.
+
+char *
+Handle_L_Pipe::upper_case (char s[], int n)
+{
+ while (--n >= 0)
+ if (ACE_OS::ace_islower (s[n]))
+ s[n] = ACE_OS::ace_toupper (s[n]);
+
+ return s;
+}
+
+int
+Handle_L_Pipe::handle_input (ACE_HANDLE)
+{
+ ACE_LSOCK_Stream new_local_stream;
+ int n;
+ ACE_HANDLE fd1 = ACE_INVALID_HANDLE;
+ ACE_HANDLE fd2 = ACE_INVALID_HANDLE;
+ char buf[BUFSIZ];
+
+ if (this->accept (new_local_stream) == -1)
+ return -1;
+
+ if (new_local_stream.recv_handle (fd1) == -1
+ || new_local_stream.recv_handle (fd2) == -1)
+ return -1;
+ else
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("received file descriptors %d and %d\n"),
+ fd1,
+ fd2));
+
+ if ((n = ACE_OS::read (fd1, buf, sizeof buf)) == -1)
+ return -1;
+ else if (ACE_OS::write (fd2, this->upper_case (buf, n), n) == -1)
+ return -1;
+ if (ACE_OS::close (fd1) == -1
+ || ACE_OS::close (fd2) == -1)
+ return -1;
+ if (new_local_stream.close () == -1)
+ return -1;
+
+ return 0;
+}
+
+const ACE_TCHAR *Handle_L_Pipe::DEFAULT_RENDEZVOUS = ACE_TEXT ("/tmp/foo_pipe");
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_L_Pipe.i"
+#endif /* __ACE_INLINE__ */
+
+Handle_L_Pipe local_pipe;
+ACE_Service_Object_Type lp (&local_pipe, ACE_TEXT ("Local_Pipe"));
+
+#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.h
new file mode 100644
index 00000000000..51d5bae1dac
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+// $Id$
+
+// Handle connections from local UNIX domain sockets that are sending
+// end-points from a pipe!
+
+#ifndef _HANDLE_L_PIPE_H
+#define _HANDLE_L_PIPE_H
+
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/UNIX_Addr.h"
+#include "ace/LSOCK_Acceptor.h"
+#include "ace/svc_export.h"
+
+#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
+class ACE_Svc_Export Handle_L_Pipe : public ACE_Service_Object, public ACE_LSOCK_Acceptor
+{
+public:
+ Handle_L_Pipe (void);
+ ~Handle_L_Pipe (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ int open (const ACE_UNIX_Addr &suap, int async = 0);
+ virtual ACE_HANDLE get_handle (void) const;
+ virtual int handle_input (ACE_HANDLE fd);
+ virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask);
+
+ char *upper_case (char s[], int n);
+
+ ACE_TCHAR rendezvous[MAXPATHLEN + 1];
+ static const ACE_TCHAR *DEFAULT_RENDEZVOUS;
+};
+
+extern ACE_Service_Object_Type lp;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_L_Pipe.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
+#endif /* _HANDLE_L_PIPE_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.i
new file mode 100644
index 00000000000..ce978aa85ea
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Pipe.i
@@ -0,0 +1,96 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_INLINE
+Handle_L_Pipe::~Handle_L_Pipe (void)
+{
+}
+
+ACE_INLINE
+Handle_L_Pipe::Handle_L_Pipe (void)
+{
+}
+
+ACE_INLINE int
+Handle_L_Pipe::open (const ACE_UNIX_Addr &suap, int async)
+{
+ if (this->ACE_LSOCK_Acceptor::open (suap) == -1)
+ return -1;
+ else if (async && this->ACE_LSOCK_Acceptor::enable (ACE_SIGIO) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_Pipe::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ ACE_UNIX_Addr sa;
+
+ if (ACE_LSOCK_Acceptor::get_local_addr (sa) == -1)
+ return -1;
+
+ ACE_OS::strcpy (buf, ACE_TEXT_CHAR_TO_TCHAR (sa.get_path_name ()));
+ ACE_OS::strcat (buf, ACE_TEXT (" # tests local pipe\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_L_Pipe::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_UNIX_Addr sup;
+ const ACE_TCHAR *r = Handle_L_Pipe::DEFAULT_RENDEZVOUS;
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("r:"), 0);
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'r':
+ r = get_opt.opt_arg ();
+ break;
+ default:
+ break;
+ }
+
+ ACE_OS::strncpy (this->rendezvous, r, MAXPATHLEN);
+ ACE_OS::unlink (this->rendezvous);
+ sup.set (this->rendezvous);
+ if (this->open (sup) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+ else if (ACE_Reactor::instance ()->register_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"),
+ ACE_TEXT ("registering service with ACE_Reactor")), -1);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_Pipe::fini (void)
+{
+ return ACE_Reactor::instance ()->remove_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+ACE_INLINE int
+Handle_L_Pipe::get_handle (void) const
+{
+ return ACE_LSOCK_Acceptor::get_handle ();
+}
+
+ACE_INLINE int
+Handle_L_Pipe::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
+{
+ this->ACE_LSOCK_Acceptor::close ();
+ return ACE_OS::unlink (this->rendezvous);
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.cpp
new file mode 100644
index 00000000000..9bbb4e7ead7
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.cpp
@@ -0,0 +1,18 @@
+// $Id$
+
+#include "Handle_L_SPIPE.h"
+
+ACE_RCSID(server, Handle_L_SPIPE, "$Id$")
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_L_SPIPE.i"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_HAS_STREAM_PIPES)
+
+const ACE_TCHAR *Handle_L_SPIPE::DEFAULT_RENDEZVOUS = ACE_TEXT ("/tmp/foo_spipe");
+
+Handle_L_SPIPE local_spipe;
+ACE_Service_Object_Type lsp (&local_spipe, ACE_TEXT ("Local_SPIPE"));
+
+#endif /* ACE_HAS_STREAM_PIPES */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.h
new file mode 100644
index 00000000000..02a4aba2044
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.h
@@ -0,0 +1,52 @@
+/* -*- C++ -*- */
+// $Id$
+
+/* Handle connections from local UNIX ACE_SPIPE */
+/* Read from a well known ACE_SPIPE and write to stdout. */
+
+#ifndef _HANDLE_L_SPIPE_H
+#define _HANDLE_L_SPIPE_H
+
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/SPIPE_Acceptor.h"
+#include "ace/Log_Msg.h"
+#include "ace/svc_export.h"
+
+#if defined (ACE_HAS_STREAM_PIPES)
+
+class ACE_Svc_Export Handle_L_SPIPE : public ACE_Service_Object, public ACE_SPIPE_Acceptor
+{
+public:
+ Handle_L_SPIPE (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ int open (const ACE_SPIPE_Addr &rendezvous_spipe);
+ virtual int get_handle (void) const;
+ virtual int handle_input (int fd);
+ virtual int handle_close (int fd, ACE_Reactor_Mask);
+
+ static const ACE_TCHAR *DEFAULT_RENDEZVOUS;
+};
+
+extern ACE_Service_Object_Type lsp;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_L_SPIPE.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+#endif /* _HANDLE_L_SPIPE_H */
+
+
+#endif /* ACE_HAS_STREAM_PIPES */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.i
new file mode 100644
index 00000000000..910938d8648
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_SPIPE.i
@@ -0,0 +1,131 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+#include "ace/SPIPE_Stream.h"
+
+#if defined (ACE_HAS_STREAM_PIPES)
+
+#include "ace/Reactor.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_INLINE
+Handle_L_SPIPE::Handle_L_SPIPE (void)
+{
+}
+
+ACE_INLINE int
+Handle_L_SPIPE::open (const ACE_SPIPE_Addr &rendezvous_spipe)
+{
+ if (this->ACE_SPIPE_Acceptor::open (rendezvous_spipe) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_SPIPE::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ ACE_SPIPE_Addr sa;
+
+ if (ACE_SPIPE_Acceptor::get_local_addr (sa) == -1)
+ return -1;
+
+ ACE_OS::strcpy (buf, sa.get_path_name ());
+ ACE_OS::strcat (buf, ACE_TEXT (" # tests local STREAM pipe\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_L_SPIPE::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_SPIPE_Addr susp;
+ const ACE_TCHAR *rendezvous = Handle_L_SPIPE::DEFAULT_RENDEZVOUS;
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("r:"), 0);
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'r':
+ rendezvous = get_opt.opt_arg ();
+ break;
+ default:
+ break;
+ }
+
+ ACE_OS::unlink (rendezvous);
+ susp.set (rendezvous);
+ if (this->open (susp) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+ else if (ACE_Reactor::instance ()->register_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("registering service with ACE_Reactor")),
+ -1);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_SPIPE::fini (void)
+{
+ return ACE_Reactor::instance ()->remove_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+ACE_INLINE int
+Handle_L_SPIPE::get_handle (void) const
+{
+ return ACE_SPIPE::get_handle();
+}
+
+ACE_INLINE int
+Handle_L_SPIPE::handle_input (int)
+{
+ ACE_SPIPE_Stream new_spipe;
+ char buf[PIPE_BUF];
+ ACE_Str_Buf msg (buf, 0, sizeof buf);
+ int flags = 0;
+
+ /* Accept communication requests */
+ if (this->ACE_SPIPE_Acceptor::accept (new_spipe) == -1)
+ return -1;
+ else
+ {
+ ACE_SPIPE_Addr sa;
+
+ new_spipe.get_remote_addr (sa);
+
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("accepted request from %s (gid = %d, uid = %d)\n"),
+ sa.get_path_name (), sa.group_id (), sa.user_id ()));
+ }
+
+ while (new_spipe.recv ((ACE_Str_Buf *) 0, &msg, &flags) >= 0)
+ if (msg.len != 0)
+ ACE_OS::write (ACE_STDOUT, (const char *) msg.buf, (int) msg.len);
+ else
+ break;
+
+ if (new_spipe.close () == -1)
+ return -1;
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_SPIPE::handle_close (int, ACE_Reactor_Mask)
+{
+ return this->ACE_SPIPE_Acceptor::remove ();
+}
+#endif /* ACE_HAS_STREAM_PIPES */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.cpp
new file mode 100644
index 00000000000..074f0057e74
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.cpp
@@ -0,0 +1,22 @@
+// $Id$
+
+#include "Handle_L_Stream.h"
+
+ACE_RCSID(server, Handle_L_Stream, "$Id$")
+
+#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
+// Static variables.
+
+const ACE_TCHAR *Handle_L_Stream::DEFAULT_RENDEZVOUS = ACE_TEXT ("/tmp/foo_stream");
+char *Handle_L_Stream::login_name = 0;
+char Handle_L_Stream::login[ACE_MAX_USERID];
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_L_Stream.i"
+#endif /* __ACE_INLINE__ */
+
+Handle_L_Stream local_stream;
+ACE_Service_Object_Type ls (&local_stream, ACE_TEXT ("Local_Stream"));
+
+#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.h
new file mode 100644
index 00000000000..912af48a292
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+// $Id$
+
+// Handle connections from local UNIX domain sockets.
+
+#ifndef _HANDLE_L_STREAM_H
+#define _HANDLE_L_STREAM_H
+
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/UNIX_Addr.h"
+#include "ace/LSOCK_Acceptor.h"
+#include "ace/svc_export.h"
+
+#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+
+class ACE_Svc_Export Handle_L_Stream : public ACE_Service_Object, public ACE_LSOCK_Acceptor
+{
+public:
+ Handle_L_Stream (void);
+ ~Handle_L_Stream (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ int open (const ACE_UNIX_Addr &suas, int async = 0);
+ virtual ACE_HANDLE get_handle (void) const;
+ virtual int handle_input (ACE_HANDLE fd);
+ virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask);
+
+ ACE_TCHAR rendezvous[MAXPATHLEN + 1];
+ static const ACE_TCHAR *DEFAULT_RENDEZVOUS;
+ static char *login_name;
+ static char login[ACE_MAX_USERID];
+};
+
+extern ACE_Service_Object_Type ls;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_L_Stream.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
+#endif /* _HANDLE_L_STREAM_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.i
new file mode 100644
index 00000000000..80b21852293
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.i
@@ -0,0 +1,149 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_time.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_INLINE
+Handle_L_Stream::~Handle_L_Stream (void)
+{
+}
+
+ACE_INLINE
+Handle_L_Stream::Handle_L_Stream (void)
+{
+ if (Handle_L_Stream::login_name == 0)
+ Handle_L_Stream::login_name = ACE_OS::cuserid (Handle_L_Stream::login);
+}
+
+ACE_INLINE int
+Handle_L_Stream::open (const ACE_UNIX_Addr &suas,
+ int async)
+{
+ if (this->ACE_LSOCK_Acceptor::open (suas) == -1)
+ return -1;
+ else if (async && this->ACE_LSOCK_Acceptor::enable (ACE_SIGIO) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_Stream::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ ACE_UNIX_Addr sa;
+
+ if (this->get_local_addr (sa) == -1)
+ return -1;
+
+ ACE_OS::strcpy (buf, ACE_TEXT_CHAR_TO_TCHAR (sa.get_path_name ()));
+ ACE_OS::strcat (buf, ACE_TEXT (" # tests local ACE_Stream\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_L_Stream::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_UNIX_Addr sus;
+ const ACE_TCHAR *r = Handle_L_Stream::DEFAULT_RENDEZVOUS;
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("r:"), 0);
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'r':
+ r = get_opt.opt_arg ();
+ break;
+ default:
+ break;
+ }
+
+ ACE_OS::strncpy (this->rendezvous, r, MAXPATHLEN);
+ ACE_OS::unlink (this->rendezvous);
+ sus.set (this->rendezvous);
+
+ if (this->open (sus) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+ else if (ACE_Reactor::instance ()->register_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"),
+ ACE_TEXT ("registering service with ACE_Reactor")), -1);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_Stream::fini (void)
+{
+ return ACE_Reactor::instance ()->remove_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+ACE_INLINE ACE_HANDLE
+Handle_L_Stream::get_handle (void) const
+{
+ return ACE_LSOCK_Acceptor::get_handle ();
+}
+
+ACE_INLINE int
+Handle_L_Stream::handle_input (ACE_HANDLE)
+{
+ ACE_LSOCK_Stream new_local_stream;
+ ACE_UNIX_Addr sa;
+ ACE_HANDLE handle = ACE_INVALID_HANDLE;
+ char buf[BUFSIZ];
+
+ if (this->accept (new_local_stream, &sa) == -1)
+ return -1;
+ else if (new_local_stream.recv_handle (handle) == -1)
+ return -1;
+ else
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("received file descriptor %d on ACE_Stream %s\n"),
+ handle, sa.get_path_name ()));
+
+ ACE_OS::puts ("----------------------------------------");
+
+ for (;;)
+ {
+ ssize_t n = ACE_OS::read (handle, buf, sizeof buf);
+
+ if (n <= 0)
+ break;
+
+ ACE_OS::write (ACE_STDOUT, buf, n);
+ }
+
+ ACE_OS::puts ("----------------------------------------");
+
+ time_t t = ACE_OS::time (0L);
+ ACE_TCHAR *cs = ACE_OS::ctime (&t);
+
+ if (new_local_stream.send (4,
+ Handle_L_Stream::login_name,
+ ACE_OS::strlen (Handle_L_Stream::login_name),
+ ACE_TEXT_ALWAYS_CHAR (cs),
+ ACE_OS::strlen (cs)) == -1)
+ return -1;
+ else if (ACE_OS::close (handle) == -1)
+ return -1;
+ else if (new_local_stream.close () == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_L_Stream::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
+{
+ this->ACE_LSOCK_Acceptor::close ();
+ return ACE_OS::unlink (this->rendezvous);
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.cpp
new file mode 100644
index 00000000000..0cab7190ca8
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.cpp
@@ -0,0 +1,38 @@
+// $Id$
+
+#include "Handle_R_Dgram.h"
+
+ACE_RCSID(server, Handle_R_Dgram, "Handle_R_Dgram.cpp,v 4.2 1998/07/31 22:55:19 gonzo Exp")
+
+#if defined (SunOS4)
+extern "C"
+{
+ int init (void);
+ int fini (void);
+ void __sti__Handle_R_Dgram_C_init_();
+ void __std__Handle_R_Dgram_C_init_();
+}
+
+int
+init (void)
+{
+ __sti__Handle_R_Dgram_C_init_();
+ return 0;
+}
+
+int
+fini (void)
+{
+ __std__Handle_R_Dgram_C_init_();
+ return 0;
+}
+#endif /* SunOS4 */
+
+unsigned short Handle_R_Dgram::DEFAULT_PORT = ACE_DEFAULT_SERVER_PORT;
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_R_Dgram.i"
+#endif /* __ACE_INLINE__ */
+
+Handle_R_Dgram remote_dgram;
+ACE_Service_Object_Type rd (&remote_dgram, ACE_TEXT ("Remote_Dgram"));
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.h
new file mode 100644
index 00000000000..858d72ff993
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.h
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+// $Id$
+
+/* Handles INET datagram messages from remote hosts. */
+
+#ifndef _HANDLE_R_DGRAM_H
+#define _HANDLE_R_DGRAM_H
+
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/INET_Addr.h"
+#include "ace/SOCK_Dgram.h"
+#include "ace/Log_Msg.h"
+#include "ace/svc_export.h"
+
+class ACE_Svc_Export Handle_R_Dgram : public ACE_Service_Object, public ACE_SOCK_Dgram
+{
+public:
+ Handle_R_Dgram (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ int open (const ACE_INET_Addr &r, int async = 0);
+ virtual ACE_HANDLE get_handle (void) const;
+ virtual int handle_input (ACE_HANDLE fd);
+ virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask);
+
+ static u_short DEFAULT_PORT;
+};
+
+extern ACE_Service_Object_Type rd;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_R_Dgram.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+#endif /* _HANDLE_R_DGRAM_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.i
new file mode 100644
index 00000000000..88212a988f0
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Dgram.i
@@ -0,0 +1,111 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_INLINE
+Handle_R_Dgram::Handle_R_Dgram (void)
+{
+}
+
+ACE_INLINE int
+Handle_R_Dgram::open (const ACE_INET_Addr &r, int async)
+{
+ if (this->ACE_SOCK_Dgram::open (r) == -1)
+ return -1;
+ else if (async && this->ACE_SOCK_Dgram::enable (ACE_SIGIO) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_R_Dgram::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ ACE_INET_Addr sa;
+
+ if (this->get_local_addr (sa) == -1)
+ return -1;
+
+ ACE_OS::sprintf (buf, ACE_TEXT ("%d/"), sa.get_port_number ());
+ ACE_OS::strcat (buf, ACE_TEXT ("udp # tests remote dgram\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_R_Dgram::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_INET_Addr sidg (Handle_R_Dgram::DEFAULT_PORT);
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("p:"), 0);
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'p':
+ sidg.set (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ default:
+ break;
+ }
+
+ if (this->open (sidg) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+ else if (ACE_Reactor::instance ()->register_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"),
+ ACE_TEXT ("registering service with ACE_Reactor")), -1);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_R_Dgram::fini (void)
+{
+ return ACE_Reactor::instance ()->remove_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+ACE_INLINE ACE_HANDLE
+Handle_R_Dgram::get_handle (void) const
+{
+ return ACE_SOCK_Dgram::get_handle ();
+}
+
+ACE_INLINE int
+Handle_R_Dgram::handle_input (ACE_HANDLE)
+{
+ ACE_INET_Addr sa;
+ char buf[8 * 1024]; /* 8 k buffer */
+ ssize_t n = this->recv (buf, sizeof buf, sa);
+
+ if (n == -1)
+ return -1;
+ else
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("received datagram from host %C on port %d\n"),
+ sa.get_host_name (), sa.get_port_number ()));
+
+ ACE_OS::puts ("----------------------------------------");
+ ACE_OS::write (ACE_STDOUT, buf, n);
+
+ if (buf[n - 1] != '\n')
+ putchar ('\n');
+
+ ACE_OS::puts ("----------------------------------------");
+
+ return 0;
+}
+
+ACE_INLINE int
+Handle_R_Dgram::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
+{
+ return this->ACE_SOCK_Dgram::close ();
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.cpp
new file mode 100644
index 00000000000..95553833e72
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.cpp
@@ -0,0 +1,42 @@
+// $Id$
+
+#include "Handle_R_Stream.h"
+
+ACE_RCSID(server, Handle_R_Stream, "$Id$")
+
+#if defined (SunOS4)
+extern "C"
+{
+ int init (void);
+ int fini (void);
+ void __sti__Handle_R_Stream_C_recv_n_();
+ void __std__Handle_R_Stream_C_recv_n_();
+}
+
+int
+init (void)
+{
+ __sti__Handle_R_Stream_C_recv_n_();
+ return 0;
+}
+
+int
+fini (void)
+{
+ __std__Handle_R_Stream_C_recv_n_();
+ return 0;
+}
+#endif /* SunOS4 */
+
+// Static variables.
+
+u_short Handle_R_Stream::DEFAULT_PORT = ACE_DEFAULT_SERVER_PORT;
+char *Handle_R_Stream::login_name = 0;
+char Handle_R_Stream::login[ACE_MAX_USERID];
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_R_Stream.i"
+#endif /* __ACE_INLINE__ */
+
+Handle_R_Stream remote_stream;
+ACE_Service_Object_Type rs (&remote_stream, ACE_TEXT("Remote_Stream"));
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.h
new file mode 100644
index 00000000000..9878321cec8
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//
+// $Id$
+
+/* Handle connections from remote INET connections. */
+
+#ifndef _HANDLE_R_STREAM_H
+#define _HANDLE_R_STREAM_H
+
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/SOCK_Stream.h"
+#include "ace/SOCK_Acceptor.h"
+#include "ace/INET_Addr.h"
+#include "ace/Log_Msg.h"
+#include "ace/svc_export.h"
+
+class ACE_Svc_Export Handle_R_Stream : public ACE_Service_Object, public ACE_SOCK_Acceptor
+{
+public:
+ Handle_R_Stream (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ int open (const ACE_INET_Addr &sia, int async = 0);
+ virtual ACE_HANDLE get_handle (void) const;
+ virtual int handle_input (ACE_HANDLE fd);
+ virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask);
+
+ ACE_SOCK_Stream new_remote_stream;
+ static u_short DEFAULT_PORT;
+ static char *login_name;
+ static char login[ACE_MAX_USERID];
+};
+
+extern ACE_Service_Object_Type rs;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_R_Stream.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+#endif /* _HANDLE_R_STREAM_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.i
new file mode 100644
index 00000000000..f126cd13aee
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.i
@@ -0,0 +1,153 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ace/WFMO_Reactor.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_time.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_INLINE
+Handle_R_Stream::Handle_R_Stream (void)
+{
+ if (Handle_R_Stream::login_name == 0)
+ Handle_R_Stream::login_name = ACE_OS::cuserid (Handle_R_Stream::login);
+}
+
+ACE_INLINE int
+Handle_R_Stream::open (const ACE_INET_Addr &sia, int async)
+{
+ if (this->ACE_SOCK_Acceptor::open (sia) == -1)
+ return -1;
+ else if (async && this->ACE_SOCK_Acceptor::enable (ACE_SIGIO) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_R_Stream::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ ACE_INET_Addr sa;
+
+ if (this->get_local_addr (sa) == -1)
+ return -1;
+
+ ACE_OS::sprintf (buf,
+ ACE_TEXT("%d/%s %s"),
+ sa.get_port_number (),
+ ACE_TEXT("tcp"),
+ ACE_TEXT("# tests remote stream\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_R_Stream::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_INET_Addr sis (Handle_R_Stream::DEFAULT_PORT);
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("p:"), 0);
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'p':
+ sis.set (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ default:
+ break;
+ }
+
+ if (this->open (sis) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
+
+ else if (ACE_Reactor::instance ()->register_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "registering service with ACE_Reactor\n"),
+ -1);
+ return 0;
+}
+
+ACE_INLINE int
+Handle_R_Stream::fini (void)
+{
+ return ACE_Reactor::instance ()->remove_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+ACE_INLINE ACE_HANDLE
+Handle_R_Stream::get_handle (void) const
+{
+ return ACE_SOCK_Acceptor::get_handle ();
+}
+
+ACE_INLINE int
+Handle_R_Stream::handle_input (ACE_HANDLE)
+{
+ char buf[BUFSIZ];
+ int bytes;
+
+ // Try to find out if the implementation of the reactor that we are
+ // using requires us to reset the event association for the newly
+ // created handle. This is because the newly created handle will
+ // inherit the properties of the listen handle, including its event
+ // associations.
+ int reset_new_handle =
+ ACE_Reactor::instance ()->uses_event_associations ();
+
+ if (this->accept (this->new_remote_stream, // stream
+ 0, // remote address
+ 0, // timeout
+ 1, // restart
+ reset_new_handle // reset new handler
+ ) == -1)
+ return -1;
+ else
+ ACE_DEBUG ((LM_INFO, "new_remote_stream fd = %d\n",
+ this->new_remote_stream.get_handle ()));
+
+ ACE_INET_Addr sa;
+
+ if (this->new_remote_stream.get_remote_addr (sa) == -1)
+ return -1;
+
+ ACE_DEBUG ((LM_INFO,
+ "accepted from host %s at port %d\n",
+ sa.get_host_name (),
+ sa.get_port_number ()));
+
+ ACE_OS::puts (ACE_TEXT ("----------------------------------------"));
+
+ while ((bytes = this->new_remote_stream.recv (buf, sizeof buf)) > 0)
+ ACE_OS::write (ACE_STDOUT, buf, bytes);
+
+ ACE_OS::puts (ACE_TEXT ("----------------------------------------"));
+
+ time_t t = ACE_OS::time (0L);
+ ACE_TCHAR *cs = ACE_OS::ctime (&t);
+
+ if (this->new_remote_stream.send (4,
+ Handle_R_Stream::login_name,
+ ACE_OS::strlen (Handle_R_Stream::login_name),
+ cs,
+ ACE_OS::strlen (cs)) == -1)
+ return -1;
+
+ if (this->new_remote_stream.close () == -1)
+ return -1;
+
+ return 0;
+}
+
+ACE_INLINE int
+Handle_R_Stream::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
+{
+ return this->ACE_SOCK_Acceptor::close ();
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp
new file mode 100644
index 00000000000..fb53c0f8d70
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp
@@ -0,0 +1,195 @@
+// $Id$
+
+#if !defined (ACE_HANDLE_THR_STREAM_C)
+#define ACE_HANDLE_THR_STREAM_C
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/Get_Opt.h"
+#include "ace/INET_Addr.h"
+#include "ace/TLI_Acceptor.h"
+#include "Handle_Thr_Stream.h"
+
+ACE_RCSID(server, Handle_Thr_Stream, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+#include "ace/OS_NS_time.h"
+
+// Shorthand names.
+#define SVH SVC_HANDLER
+#define PR_AC_1 ACE_PEER_ACCEPTOR_1
+#define PR_AC_2 ACE_PEER_ACCEPTOR_2
+#define PR_ST_1 ACE_PEER_STREAM_1
+#define PR_ST_2 ACE_PEER_STREAM_2
+
+template <class SVH, PR_AC_1>
+Handle_Thr_Acceptor<SVH, PR_AC_2>::~Handle_Thr_Acceptor (void)
+{
+}
+
+template <class SVH, PR_AC_1>
+Handle_Thr_Acceptor<SVH, PR_AC_2>::Handle_Thr_Acceptor (void)
+ : thr_flags_ (THR_DETACHED | THR_NEW_LWP)
+{
+}
+
+template <class SVH, PR_AC_1> int
+Handle_Thr_Acceptor<SVH, PR_AC_2>::info (ACE_TCHAR **strp,
+ size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+ ACE_INET_Addr sa;
+
+ if (this->acceptor ().get_local_addr (sa) == -1)
+ return -1;
+
+ ACE_OS::sprintf (buf, ACE_TEXT("%d/"), sa.get_port_number ());
+ ACE_OS::strcat (buf, ACE_TEXT("tcp # tests threaded remote stream\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+template <class SVH, PR_AC_1> int
+Handle_Thr_Acceptor<SVH, PR_AC_2>::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_INET_Addr local_addr (ACE_DEFAULT_THR_PORT);
+ int n_threads = ACE_DEFAULT_THREADS;
+
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("p:t:"), 0);
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'p':
+ local_addr.set (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 't':
+ n_threads = ACE_OS::atoi (get_opt.opt_arg ());
+ break;
+ default:
+ break;
+ }
+
+ // Initialize the threading strategy.
+ if (this->thr_strategy_.open (&this->thr_mgr_,
+ this->thr_flags_,
+ n_threads) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+
+ // Initialize the Acceptor base class, passing in the desired
+ // concurrency strategy.
+ else if (this->open (local_addr,
+ ACE_Reactor::instance (),
+ 0,
+ 0,
+ &this->thr_strategy_) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1);
+ else
+ return 0;
+}
+
+template <class SVH, PR_AC_1> int
+Handle_Thr_Acceptor<SVH, PR_AC_2>::fini (void)
+{
+ return ACE_Reactor::instance ()->remove_handler
+ (this, ACE_Event_Handler::ACCEPT_MASK);
+}
+
+template <PR_ST_1>
+CLI_Stream<PR_ST_2>::CLI_Stream (ACE_Thread_Manager *thr_mgr)
+ : inherited (thr_mgr)
+{
+}
+
+template <PR_ST_1> int
+CLI_Stream<PR_ST_2>::close (u_long)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%t) client stream object closing down\n")));
+ this->peer ().close ();
+
+ // Must be allocated dynamically!
+ delete this;
+ return 0;
+}
+
+template <PR_ST_1> int
+CLI_Stream<PR_ST_2>::open (void *)
+{
+ ACE_INET_Addr sa;
+
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) client handle = %d\n"),
+ this->peer ().get_handle ()));
+
+ if (this->peer ().get_remote_addr (sa) == -1)
+ return -1;
+
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) accepted at port %d\n"),
+ sa.get_port_number ()));
+ return 0;
+}
+
+template <PR_ST_1> int
+CLI_Stream<PR_ST_2>::svc (void)
+{
+ char buf[BUFSIZ];
+ char login_name[ACE_MAX_USERID];
+ int bytes;
+
+ ACE_OS::puts ("----------------------------------------");
+
+ while ((bytes = this->peer ().recv (buf, sizeof buf)) > 0)
+ ACE_OS::write (ACE_STDOUT, buf, bytes);
+
+ ACE_OS::puts ("----------------------------------------");
+ ACE_OS::fflush (stdout);
+
+ time_t t = ACE_OS::time (0L);
+ ACE_OS::cuserid (login_name);
+ ACE_OS::sprintf (buf, "user %s %s",
+ login_name,
+ ACE_TEXT_ALWAYS_CHAR (ACE_OS::ctime ((const time_t *) &t)));
+
+ if (this->peer ().send_n (buf, ACE_OS::strlen (buf) + 1) == -1)
+ return -1;
+
+ ACE_DEBUG ((LM_DEBUG, "(%t) sent reply %s", buf));
+ return 0;
+}
+
+#undef SVH
+#undef PR_AC_1
+#undef PR_AC_2
+#undef PR_ST_1
+#undef PR_ST_2
+
+//----------------------------------------
+
+#if defined (ACE_HAS_TLI)
+#include "ace/TLI_Stream.h"
+#include "ace/TLI_Acceptor.h"
+#define THR_STREAM ACE_TLI_STREAM
+#define THR_ACCEPTOR ACE_TLI_ACCEPTOR
+#else
+#include "ace/SOCK_Stream.h"
+#include "ace/SOCK_Acceptor.h"
+#define THR_STREAM ACE_SOCK_STREAM
+#define THR_ACCEPTOR ACE_SOCK_ACCEPTOR
+#endif /* ACE_HAS_TLI */
+#include "ace/INET_Addr.h"
+
+typedef CLI_Stream <THR_STREAM> CLI_STREAM;
+typedef Handle_Thr_Acceptor<CLI_STREAM, THR_ACCEPTOR> HANDLE_THR_ACCEPTOR;
+
+// Service object.
+HANDLE_THR_ACCEPTOR remote_thr_stream;
+ACE_Service_Object_Type rts (&remote_thr_stream, ACE_TEXT("Remote_Thr_Stream"));
+
+#endif /* ACE_HAS_THREADS */
+#endif /* ACE_HANDLE_THR_STREAM_C */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.h
new file mode 100644
index 00000000000..994a70009c0
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.h
@@ -0,0 +1,73 @@
+/* -*- C++ -*- */
+// $Id$
+
+#ifndef _HANDLE_THR_STREAM_H
+#define _HANDLE_THR_STREAM_H
+
+#include "ace/Acceptor.h"
+#include "ace/Svc_Handler.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+
+#if defined (ACE_HAS_THREADS)
+
+template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
+class Handle_Thr_Acceptor : public ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>
+ // = TITLE
+ // This factory creates new <SVC_HANDLERS> and runs them with the
+ // configured <ACE_Thread_Strategy>.
+{
+public:
+ // = Initialization and termination.
+ Handle_Thr_Acceptor (void);
+ ~Handle_Thr_Acceptor (void);
+
+ // = Dynamic linking hooks.
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ ACE_Thread_Manager thr_mgr_;
+ // Thread manager.
+
+ ACE_Thread_Strategy<SVC_HANDLER> thr_strategy_;
+ // Threading strategy.
+
+ int thr_flags_;
+ // Threading flags.
+};
+
+template <ACE_PEER_STREAM_1>
+class CLI_Stream : public ACE_Svc_Handler<ACE_PEER_STREAM_2, ACE_MT_SYNCH>
+ // = TITLE
+ // This class interacts with the client, running in a separate
+ // thread and handles connections from remote TCP/IP connections.
+{
+public:
+ CLI_Stream (ACE_Thread_Manager * = 0);
+
+ virtual int open (void *);
+ // Open the service.
+
+ virtual int close (u_long);
+ // Close down the service.
+
+ virtual int svc (void);
+ // Execute the service.
+
+protected:
+ typedef ACE_Svc_Handler<ACE_PEER_STREAM_2, ACE_MT_SYNCH> inherited;
+};
+
+extern ACE_Service_Object_Type rts;
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Handle_Thr_Stream.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+#endif /* ACE_HAS_THREADS */
+#endif /* _HANDLE_THR_STREAM_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.cpp
new file mode 100644
index 00000000000..9eccf88ef43
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.cpp
@@ -0,0 +1,36 @@
+// $Id$
+
+#include "Handle_Timeout.h"
+
+ACE_RCSID(server, Handle_Timeout, "$Id$")
+
+#if defined (SunOS4)
+extern "C"
+{
+ int init (void);
+ int fini (void);
+ void __sti__Handle_Timeout_C_init_();
+ void __std__Handle_Timeout_C_init_();
+}
+
+int
+init (void)
+{
+ __sti__Handle_Timeout_C_init_();
+ return 0;
+}
+
+int
+fini (void)
+{
+ __std__Handle_Timeout_C_init_();
+ return 0;
+}
+#endif /* SunOS4 */
+
+#if !defined (__ACE_INLINE__)
+#include "Handle_Timeout.i"
+#endif /* __ACE_INLINE__ */
+
+Handle_Timeout timer_1;
+ACE_Service_Object_Type t1 (&timer_1, ACE_TEXT("Timer_1"));
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.h b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.h
new file mode 100644
index 00000000000..88b6e673aaf
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.h
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+//
+// $Id$
+
+/* Handles timeouts. */
+
+#ifndef _HANDLE_TIMEOUT_H
+#define _HANDLE_TIMEOUT_H
+
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Types.h"
+#include "ace/Log_Msg.h"
+#include "ace/svc_export.h"
+
+class ACE_Svc_Export Handle_Timeout : public ACE_Service_Object
+{
+public:
+ Handle_Timeout (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+
+private:
+ virtual ACE_HANDLE get_handle (void) const;
+ virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg);
+
+ int count;
+};
+
+extern ACE_Service_Object_Type t1;
+
+#if defined (__ACE_INLINE__)
+#define ACE_INLINE inline
+#include "Handle_Timeout.i"
+#else
+#define ACE_INLINE
+#endif /* __ACE_INLINE__ */
+
+#endif /* _HANDLE_TIMEOUT_H */
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.i b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.i
new file mode 100644
index 00000000000..346a22e773c
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.i
@@ -0,0 +1,86 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Service_Config.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+
+ACE_INLINE
+Handle_Timeout::Handle_Timeout (void): count (0)
+{
+}
+
+ACE_INLINE int
+Handle_Timeout::info (ACE_TCHAR **strp, size_t length) const
+{
+ ACE_TCHAR buf[BUFSIZ];
+
+ ACE_OS::strcpy (buf, ACE_TEXT("# tests timeout facility\n"));
+
+ if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
+ return -1;
+ else
+ ACE_OS::strncpy (*strp, buf, length);
+ return ACE_OS::strlen (buf);
+}
+
+ACE_INLINE int
+Handle_Timeout::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Time_Value delta (10);
+ ACE_Time_Value interval (1);
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("a:d:i:"), 0);
+ int arg = 0;
+
+ for (int c; (c = get_opt ()) != -1; )
+ switch (c)
+ {
+ case 'd':
+ delta.sec (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'i':
+ interval.sec (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'a':
+ arg = ACE_OS::atoi (get_opt.opt_arg ());
+ break;
+ default:
+ break;
+ }
+
+ if (ACE_Reactor::instance ()->schedule_timer (this,
+ reinterpret_cast<void *> (arg),
+ delta,
+ interval) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+ACE_INLINE int
+Handle_Timeout::fini (void)
+{
+ return 0;
+}
+
+ACE_INLINE ACE_HANDLE
+Handle_Timeout::get_handle (void) const
+{
+ return ACE_INVALID_HANDLE;
+}
+
+ACE_INLINE int
+Handle_Timeout::handle_timeout (const ACE_Time_Value &tv,
+ const void *arg)
+{
+ if (this->count++ >= 10)
+ return -1; // Automatically cancel periodic timer...
+
+ // Cast arg to a long, first, because a pointer is the same
+ // size as a long on all current ACE platforms.
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("time for this(%u) expired at (%d, %d) with arg = %d\n"),
+ this, tv.sec (), tv.usec (), (int) (long) arg));
+ return 0;
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Makefile.am b/ACE/examples/Service_Configurator/IPC-tests/server/Makefile.am
new file mode 100644
index 00000000000..58a8a80fccf
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Makefile.am
@@ -0,0 +1,106 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## /acebuilds/ACE_wrappers-repository/bin/mwc.pl -include /acebuilds/MPC/config -include /acebuilds/MPC/templates -feature_file /acebuilds/ACE_wrappers-repository/local.features -noreldefs -type automake -exclude build,Kokyu
+
+ACE_BUILDDIR = $(top_builddir)
+ACE_ROOT = $(top_srcdir)
+
+
+## Makefile.Svc_Cfg_IPC_Server_Lib.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_LTLIBRARIES = libIPC_Tests_Server.la
+
+libIPC_Tests_Server_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -DACE_BUILD_SVC_DLL
+
+libIPC_Tests_Server_la_SOURCES = \
+ Handle_Broadcast.cpp \
+ Handle_L_CODgram.cpp \
+ Handle_L_Dgram.cpp \
+ Handle_L_FIFO.cpp \
+ Handle_L_Pipe.cpp \
+ Handle_L_SPIPE.cpp \
+ Handle_L_Stream.cpp \
+ Handle_R_Stream.cpp \
+ Handle_Thr_Stream.cpp \
+ Handle_Timeout.cpp
+
+noinst_HEADERS = \
+ Handle_Broadcast.h \
+ Handle_Broadcast.i \
+ Handle_L_CODgram.h \
+ Handle_L_CODgram.i \
+ Handle_L_Dgram.h \
+ Handle_L_Dgram.i \
+ Handle_L_FIFO.h \
+ Handle_L_FIFO.i \
+ Handle_L_Pipe.h \
+ Handle_L_Pipe.i \
+ Handle_L_SPIPE.h \
+ Handle_L_SPIPE.i \
+ Handle_L_Stream.h \
+ Handle_L_Stream.i \
+ Handle_R_Stream.h \
+ Handle_R_Stream.i \
+ Handle_Thr_Stream.h \
+ Handle_Timeout.h \
+ Handle_Timeout.i
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Svc_Cfg_IPC_Server_Test.am
+
+if !BUILD_ACE_FOR_TAO
+noinst_PROGRAMS = server_test
+
+server_test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+server_test_SOURCES = \
+ server_test.cpp \
+ Handle_Broadcast.h \
+ Handle_Broadcast.i \
+ Handle_L_CODgram.h \
+ Handle_L_CODgram.i \
+ Handle_L_Dgram.h \
+ Handle_L_Dgram.i \
+ Handle_L_FIFO.h \
+ Handle_L_FIFO.i \
+ Handle_L_Pipe.h \
+ Handle_L_Pipe.i \
+ Handle_L_SPIPE.h \
+ Handle_L_SPIPE.i \
+ Handle_L_Stream.h \
+ Handle_L_Stream.i \
+ Handle_R_Dgram.h \
+ Handle_R_Dgram.i \
+ Handle_R_Stream.h \
+ Handle_R_Stream.i \
+ Handle_Thr_Stream.h \
+ Handle_Timeout.h \
+ Handle_Timeout.i
+
+server_test_LDADD = \
+ libIPC_Tests_Server.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Svc_Cfg_IPC_Server.mpc b/ACE/examples/Service_Configurator/IPC-tests/server/Svc_Cfg_IPC_Server.mpc
new file mode 100644
index 00000000000..c44b40c6e32
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/Svc_Cfg_IPC_Server.mpc
@@ -0,0 +1,30 @@
+// -*- MPC -*-
+// $Id$
+
+project(*Lib) : acelib {
+ avoids += ace_for_tao
+ sharedname = IPC_Tests_Server
+ dynamicflags += ACE_BUILD_SVC_DLL
+ Source_Files {
+ Handle_Broadcast.cpp
+ Handle_L_CODgram.cpp
+ Handle_L_Dgram.cpp
+ Handle_L_FIFO.cpp
+ Handle_L_Pipe.cpp
+ Handle_L_SPIPE.cpp
+ Handle_L_Stream.cpp
+ Handle_R_Stream.cpp
+ Handle_Thr_Stream.cpp
+ Handle_Timeout.cpp
+ }
+}
+
+project(*test) : aceexe {
+ avoids += ace_for_tao
+ exename = server_test
+ after += Svc_Cfg_IPC_Server_Lib
+ libs += IPC_Tests_Server
+ Source_Files {
+ server_test.cpp
+ }
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/server_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/server_test.cpp
new file mode 100644
index 00000000000..fe88a3eab8e
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/server_test.cpp
@@ -0,0 +1,54 @@
+// $Id$
+
+// The main test driver for the dynamically configured server.
+
+#include "ace/OS_NS_unistd.h"
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+#include "ace/Log_Msg.h"
+#include "ace/Signal.h"
+#include "ace/Sig_Adapter.h"
+
+ACE_RCSID(server, server_test, "$Id$")
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ if (ACE_Service_Config::open (argc,
+ argv,
+ ACE_DEFAULT_LOGGER_KEY,
+ 0) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("ACE_Service_Config::open")),
+ -1);
+
+ // Create an adapter to end the event loop.
+ ACE_Sig_Adapter sa ((ACE_Sig_Handler_Ex) ACE_Reactor::end_event_loop);
+
+ ACE_Sig_Set sig_set;
+ sig_set.sig_add (SIGINT);
+ sig_set.sig_add (SIGQUIT);
+
+ // Register ourselves to receive signals so we can shut down
+ // gracefully.
+ if (ACE_Reactor::instance ()->register_handler (sig_set,
+ &sa) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"), ACE_TEXT ("register_handler")),
+ -1);
+
+ // This makes the README demo even easier (for sighup).
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("pid = %d\n"),
+ ACE_OS::getpid ()));
+
+ // Run forever, performing the configured services until we are shut
+ // down by a SIGINT/SIGQUIT signal.
+
+ // We use this version of the event loop so that reconfigurations
+ // are triggered properly.
+ ACE_Reactor::run_event_loop ();
+
+ return 0;
+}
diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/svc.conf b/ACE/examples/Service_Configurator/IPC-tests/server/svc.conf
new file mode 100644
index 00000000000..6f4e70a3ca5
--- /dev/null
+++ b/ACE/examples/Service_Configurator/IPC-tests/server/svc.conf
@@ -0,0 +1,19 @@
+# To configure different services, simply uncomment the appropriate lines in this file!
+static ACE_Service_Manager "-d -p 3911"
+dynamic Remote_Brdcast Service_Object * ./IPC_Tests_Server:remote_broadcast "-p 10001"
+dynamic Remote_Stream Service_Object * ./IPC_Tests_Server:remote_stream "-p 20002"
+dynamic Remote_Dgram Service_Object * ./IPC_Tests_Server:remote_dgram "-p 15001"
+dynamic Timer_1 Service_Object * ./IPC_Tests_Server:timer_1 "-d 5 -i 1 -a 100"
+dynamic Local_Stream Service_Object * ./IPC_Tests_Server:local_stream "-r /tmp/foo_stream"
+dynamic Local_Pipe Service_Object * ./IPC_Tests_Server:local_pipe "-r /tmp/foo_pipe"
+dynamic Local_Fifo Service_Object * ./IPC_Tests_Server:local_fifo "-r /tmp/foo_fifo"
+dynamic Local_Dgram Service_Object * ./IPC_Tests_Server:local_dgram "-r /tmp/foo_dgram"
+dynamic Local_CODgram Service_Object * ./IPC_Tests_Server:local_codgram "-r /tmp/foo_codgram"
+dynamic Local_Spipe Service_Object * ./IPC_Tests_Server:local_spipe "-r /tmp/foo_spipe"
+dynamic Remote_Thr_Stream Service_Object * ./IPC_Tests_Server:remote_thr_stream "-p 10001"
+#suspend Remote_Stream
+#resume Local_SPIPE
+#resume Remote_Stream
+#remove Remote_Stream
+#remove Local_Stream
+
diff --git a/ACE/examples/Service_Configurator/Makefile.am b/ACE/examples/Service_Configurator/Makefile.am
new file mode 100644
index 00000000000..1b78bb27757
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Makefile.am
@@ -0,0 +1,14 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## /acebuilds/ACE_wrappers-repository/bin/mwc.pl -include /acebuilds/MPC/config -include /acebuilds/MPC/templates -feature_file /acebuilds/ACE_wrappers-repository/local.features -noreldefs -type automake -exclude build,Kokyu
+
+SUBDIRS = \
+ IPC-tests \
+ Misc
+
diff --git a/ACE/examples/Service_Configurator/Misc/.cvsignore b/ACE/examples/Service_Configurator/Misc/.cvsignore
new file mode 100644
index 00000000000..ba2906d0666
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Misc/.cvsignore
@@ -0,0 +1 @@
+main
diff --git a/ACE/examples/Service_Configurator/Misc/Makefile.am b/ACE/examples/Service_Configurator/Misc/Makefile.am
new file mode 100644
index 00000000000..f0de4232add
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Misc/Makefile.am
@@ -0,0 +1,50 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## /acebuilds/ACE_wrappers-repository/bin/mwc.pl -include /acebuilds/MPC/config -include /acebuilds/MPC/templates -feature_file /acebuilds/ACE_wrappers-repository/local.features -noreldefs -type automake -exclude build,Kokyu
+
+ACE_BUILDDIR = $(top_builddir)
+ACE_ROOT = $(top_srcdir)
+
+## Makefile.Service_Configurator_Misc_Timer.am
+
+noinst_LTLIBRARIES = libtimer.la
+
+libtimer_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -DACE_BUILD_SVC_DLL
+
+libtimer_la_SOURCES = \
+ Timer_Service.cpp
+
+noinst_HEADERS = \
+ Timer_Service.h
+
+## Makefile.Service_Configurator_Misc_Main.am
+noinst_PROGRAMS = main
+
+main_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+main_SOURCES = \
+ main.cpp \
+ Timer_Service.h
+
+main_LDADD = \
+ libtimer.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/examples/Service_Configurator/Misc/README b/ACE/examples/Service_Configurator/Misc/README
new file mode 100644
index 00000000000..c3b22759926
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Misc/README
@@ -0,0 +1,23 @@
+This directory contains an example that illustrates how the ACE
+Service Configurator can configure static and dynamic services, both
+from the command-line and from a svc.config file. We define several
+instances, i.e., Timer_Service_1 and Timer_Service_2 of the SAME
+service just to exercise different configuration options. A "real"
+application would usually define different services.
+
+Windows CE:
+-----------
+
+When using Windows CE (WCE) emulator, make sure that you use the
+following command to copy the svc.conf files into the top-level
+directory in CE emulator.
+
+ empfile -c svc.conf1 wce:\svc.conf1
+ empfile -c svc.conf2 wce:\svc.conf2
+
+The command "empfile" moves the files to emulator's root directory and
+resigters the files with CE emulator's object store.
+
+Also make sure you type in at least one argument (which is argv[0],)
+when the program dialog box requests you to key in the program
+arguments. Otherwise, the program won't run at all.
diff --git a/ACE/examples/Service_Configurator/Misc/Service_Configurator_Misc.mpc b/ACE/examples/Service_Configurator/Misc/Service_Configurator_Misc.mpc
new file mode 100644
index 00000000000..9c9744fd601
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Misc/Service_Configurator_Misc.mpc
@@ -0,0 +1,18 @@
+// -*- MPC -*-
+// $Id$
+
+project(*Timer) : acelib {
+ sharedname = timer
+ dynamicflags += ACE_BUILD_SVC_DLL
+ Source_Files {
+ Timer_Service.cpp
+ }
+}
+project(*Main) : aceexe {
+ exename = main
+ after += Service_Configurator_Misc_Timer
+ libs += timer
+ Source_Files {
+ main.cpp
+ }
+}
diff --git a/ACE/examples/Service_Configurator/Misc/Timer_Service.cpp b/ACE/examples/Service_Configurator/Misc/Timer_Service.cpp
new file mode 100644
index 00000000000..82ace8f657c
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Misc/Timer_Service.cpp
@@ -0,0 +1,135 @@
+// $Id$
+
+#include "ace/OS_NS_string.h"
+#include "Timer_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(Misc, Timer_Service, "$Id$")
+
+Timer_Service_1::Timer_Service_1 (void)
+{
+ ACE_OS::strcpy (this->name_,
+ ACE_TEXT ("Timer_Service_1"));
+}
+
+int
+Timer_Service_1::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("in Timer_Service::init, argv[0] = %s, argc == %d\n"),
+ argv[0], argc));
+
+ // Printout the <argv> values for sanity's sake.
+ for (int i = 0; i < argc; i++)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("argv[%d] = %s\n"),
+ i, argv[i]));
+
+ int interval = Timer_Service_1::TIMEOUT;
+
+ if (argc > 1)
+ {
+ // If the second argument exists use this as the interval for
+ // the periodic timer. Otherwise, go off every TIMEOUT seconds.
+
+ interval = ACE_OS::atoi (argv[1]);
+
+ if (interval == 0)
+ interval = Timer_Service_1::TIMEOUT;
+ }
+
+ if (argc > 2)
+ {
+ // If the third argument exists use it to control the maximum
+ // number of timeouts.
+ this->max_timeouts_ = ACE_OS::atoi (argv[2]);
+
+ if (this->max_timeouts_ == 0)
+ this->max_timeouts_ = Timer_Service_1::MAX_TIMEOUTS;
+ }
+
+ this->cur_timeouts_ = 0;
+
+ // If the fourth argument exists take this as an indication to
+ // enable tracing.
+#if defined (ACE_HAS_TRACE)
+ if (argc > 3)
+ ACE_Trace::start_tracing ();
+ else
+ ACE_Trace::stop_tracing ();
+#endif /* ACE_HAS_TRACE */
+
+ // Register the timer to go off in 1 second, and then to go off
+ // every <interval> seconds.
+ if (ACE_Reactor::instance ()->schedule_timer
+ (this,
+ 0,
+ ACE_Time_Value (1),
+ ACE_Time_Value (interval)) == -1)
+ return -1;
+ else
+ return 0;
+}
+
+int
+Timer_Service_1::handle_timeout (const ACE_Time_Value &tv,
+ const void *)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%x) in %s::handle_timeout sec = %d, usec = %d")
+ ACE_TEXT (" cur_timeouts = %d, max_timeouts = %d\n"),
+ this,
+ this->name_,
+ tv.sec (),
+ tv.usec (),
+ this->cur_timeouts_,
+ this->max_timeouts_));
+
+ this->cur_timeouts_++;
+
+ if (this->cur_timeouts_ == this->max_timeouts_)
+ // Shutdown the test.
+ return -1;
+ else
+ return 0;
+}
+
+int
+Timer_Service_1::handle_close (ACE_HANDLE,
+ ACE_Reactor_Mask)
+{
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("closing down the timer test\n")));
+
+ // Remove ourselves from the timer queue.
+ ACE_Reactor::instance ()->cancel_timer (this);
+
+ ACE_Reactor::end_event_loop();
+ return 0;
+}
+
+Timer_Service_2::Timer_Service_2 (void)
+{
+ ACE_OS::strcpy (this->name_,
+ ACE_TEXT ("Timer_Service_2"));
+}
+
+Timer_Service_3::Timer_Service_3 (void)
+{
+ ACE_OS::strcpy (this->name_,
+ ACE_TEXT ("Timer_Service_3"));
+}
+
+// Define the object that describes the service.
+ACE_STATIC_SVC_DEFINE (Timer_Service_1,
+ ACE_TEXT ("Timer_Service_1"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (Timer_Service_1),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+// The following are "Factories" used by the <ACE_Service_Config> and
+// svc.conf file to dynamically initialize the state of the Timer
+// Services.
+ACE_SVC_FACTORY_DEFINE (Timer_Service_1)
+ACE_SVC_FACTORY_DEFINE (Timer_Service_2)
+ACE_SVC_FACTORY_DEFINE (Timer_Service_3)
diff --git a/ACE/examples/Service_Configurator/Misc/Timer_Service.h b/ACE/examples/Service_Configurator/Misc/Timer_Service.h
new file mode 100644
index 00000000000..01aa77b7317
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Misc/Timer_Service.h
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "ace/svc_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "ace/Reactor.h"
+#include "ace/Service_Object.h"
+
+
+class ACE_Svc_Export Timer_Service_1 : public ACE_Service_Object
+{
+ // = TITLE
+ // Demonstrates a simple timer service that can be configured
+ // statically.
+public:
+ Timer_Service_1 (void);
+ // Default constructor.
+
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ // Initialization hook.
+
+ virtual int handle_timeout (const ACE_Time_Value &,
+ const void *);
+ // Timeout hook.
+
+ virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
+ // Close hook.
+
+protected:
+ ACE_TCHAR name_[BUFSIZ];
+ // Keep track of which service this is!
+
+private:
+ enum
+ {
+ TIMEOUT = 4, // Wait 4 seconds between timeouts
+ MAX_TIMEOUTS = 10 // Don't timeout for more than 10 times.
+ };
+
+ int max_timeouts_;
+ // Maximum number of timeouts before shutting down the test.
+
+ int cur_timeouts_;
+ // Current number of timeouts.
+};
+
+class ACE_Svc_Export Timer_Service_2 : public Timer_Service_1
+{
+public:
+ Timer_Service_2 (void);
+ // Default constructor.
+};
+
+class ACE_Svc_Export Timer_Service_3 : public Timer_Service_1
+{
+public:
+ Timer_Service_3 (void);
+ // Default constructor.
+};
+
+// Declare both static and dynamic services.
+ACE_STATIC_SVC_DECLARE_EXPORT (ACE_Svc, Timer_Service_1)
+ACE_SVC_FACTORY_DECLARE (Timer_Service_1)
+ACE_SVC_FACTORY_DECLARE (Timer_Service_2)
+ACE_SVC_FACTORY_DECLARE (Timer_Service_3)
diff --git a/ACE/examples/Service_Configurator/Misc/main.cpp b/ACE/examples/Service_Configurator/Misc/main.cpp
new file mode 100644
index 00000000000..a7ff6c9da26
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Misc/main.cpp
@@ -0,0 +1,80 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// examples/Service_Configurator/Misc
+//
+// = FILENAME
+// main.cpp
+//
+// = DESCRIPTION
+// This directory contains an example that illustrates how the ACE
+// Service Configurator can configure static and dynamic services,
+// both from the command-line and from a svc.config file.
+//
+// = AUTHOR
+// Doug Schmidt <schmidt@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "ace/OS_main.h"
+#include "ace/Service_Config.h"
+#include "ace/ARGV.h"
+#include "ace/Log_Msg.h"
+#include "Timer_Service.h"
+
+ACE_RCSID(Misc, main, "$Id$")
+
+// Create an object that will insert the <Timer_Service> into the list
+// of statically linked services that the <ACE_Service_Config> will
+// process at run-time.
+ACE_STATIC_SVC_REQUIRE (Timer_Service_1)
+
+int
+ACE_TMAIN (int, ACE_TCHAR *argv[])
+{
+ // Set up an argument vector that we can add entries to!
+ ACE_ARGV args;
+
+ // Manufacture a "fake" svc.conf entry to demonstrate the -S option
+ // that allows us to pass these entries via the "command-line"
+ // rather than the svc.conf file.
+ args.add (argv[0]);
+ args.add (ACE_TEXT ("-y"));
+ args.add (ACE_TEXT ("-d"));
+ args.add (ACE_TEXT ("-S"));
+ args.add (ACE_TEXT ("\"static Timer_Service_1 'timer 1 10 $TRACE'\""));
+ args.add (ACE_TEXT ("-S"));
+ args.add (ACE_TEXT ("\"dynamic Timer_Service_2 Service_Object * ./Timer:_make_Timer_Service_2() 'timer 2 10 $TRACE'\""));
+ // Test the -f option!
+ args.add (ACE_TEXT ("-fsvc.conf1"));
+ args.add (ACE_TEXT ("-fsvc.conf2"));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("argc = %d\n"),
+ args.argc ()));
+
+ // Print the contents of the combined <ACE_ARGV>.
+ for (int i = 0; i < args.argc (); i++)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%d) %s\n"),
+ i,
+ args.argv ()[i]));
+
+ int result = ACE_Service_Config::open (args.argc (),
+ args.argv (),
+ ACE_DEFAULT_LOGGER_KEY,
+ 0);
+ if (result != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("open")),
+ 1);
+
+ // Run forever, performing the configured services until we
+ // shutdown.
+
+ ACE_Reactor::run_event_loop ();
+ return 0;
+}
diff --git a/ACE/examples/Service_Configurator/Misc/svc.conf1 b/ACE/examples/Service_Configurator/Misc/svc.conf1
new file mode 100644
index 00000000000..d0f552caa6e
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Misc/svc.conf1
@@ -0,0 +1,8 @@
+# Dynamically configure the Timer_Service into the application process
+# and pass in up to 4 arguments. The final 3 arguments are retrieved
+# from environment variables, so they can be set by changing your
+# environment before running the main program. If you don't have
+# these variables set they are ignored.
+dynamic Timer_Service_3 Service_Object *
+ ./Timer:_make_Timer_Service_3()
+ "timer $INTERVAL $MAX_TIMEOUTS $TRACE"
diff --git a/ACE/examples/Service_Configurator/Misc/svc.conf2 b/ACE/examples/Service_Configurator/Misc/svc.conf2
new file mode 100644
index 00000000000..1bef63e8d48
--- /dev/null
+++ b/ACE/examples/Service_Configurator/Misc/svc.conf2
@@ -0,0 +1,8 @@
+# Statically configure the Timer_Service, which must have been linked
+# statically into the application process. Up to 4 arguments are
+# passed in. The final 3 arguments are retrieved from environment
+# variables, so they can be set by changing your environment before
+# running the main program. If you don't have these variables set
+# they are ignored.
+static Timer_Service_1
+ "timer $INTERVAL $MAX_TIMEOUTS $TRACE"