summaryrefslogtreecommitdiff
path: root/ACE/protocols/examples
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 13:56:48 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 13:56:48 +0000
commitc4078c377d74290ebe4e66da0b4975da91732376 (patch)
tree1816ef391e42a07929304908ac0e21f4c2f6cb7b /ACE/protocols/examples
parent700d1c1a6be348c6c70a2085e559baeb8f4a62ea (diff)
downloadATCD-c4078c377d74290ebe4e66da0b4975da91732376.tar.gz
swap in externals for ACE and TAO
Diffstat (limited to 'ACE/protocols/examples')
-rw-r--r--ACE/protocols/examples/Makefile.am14
-rw-r--r--ACE/protocols/examples/RMCast/Makefile.am13
-rw-r--r--ACE/protocols/examples/RMCast/Send_Msg/Makefile.am72
-rw-r--r--ACE/protocols/examples/RMCast/Send_Msg/Protocol.h18
-rw-r--r--ACE/protocols/examples/RMCast/Send_Msg/README18
-rw-r--r--ACE/protocols/examples/RMCast/Send_Msg/Receiver.cpp206
-rw-r--r--ACE/protocols/examples/RMCast/Send_Msg/Send_Msg.mpc17
-rw-r--r--ACE/protocols/examples/RMCast/Send_Msg/Sender.cpp53
-rw-r--r--ACE/protocols/examples/TMCast/Makefile.am13
-rw-r--r--ACE/protocols/examples/TMCast/Member/Makefile.am45
-rw-r--r--ACE/protocols/examples/TMCast/Member/Member.mpc7
-rw-r--r--ACE/protocols/examples/TMCast/Member/README36
-rw-r--r--ACE/protocols/examples/TMCast/Member/member.cpp93
-rw-r--r--ACE/protocols/examples/examples.mwc5
14 files changed, 0 insertions, 610 deletions
diff --git a/ACE/protocols/examples/Makefile.am b/ACE/protocols/examples/Makefile.am
deleted file mode 100644
index b435d1c3fe2..00000000000
--- a/ACE/protocols/examples/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-## 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:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-SUBDIRS = \
- RMCast \
- TMCast
-
diff --git a/ACE/protocols/examples/RMCast/Makefile.am b/ACE/protocols/examples/RMCast/Makefile.am
deleted file mode 100644
index ef4f29c4f65..00000000000
--- a/ACE/protocols/examples/RMCast/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-## 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:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-SUBDIRS = \
- Send_Msg
-
diff --git a/ACE/protocols/examples/RMCast/Send_Msg/Makefile.am b/ACE/protocols/examples/RMCast/Send_Msg/Makefile.am
deleted file mode 100644
index eb9a09d771f..00000000000
--- a/ACE/protocols/examples/RMCast/Send_Msg/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-## 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:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-ACE_BUILDDIR = $(top_builddir)
-ACE_ROOT = $(top_srcdir)
-
-noinst_PROGRAMS =
-
-## Makefile.Send_Msg_Receiver.am
-
-if BUILD_EXCEPTIONS
-if BUILD_THREADS
-if !BUILD_ACE_FOR_TAO
-
-noinst_PROGRAMS += receiver
-
-receiver_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(ACE_ROOT)/protocols
-
-receiver_SOURCES = \
- Receiver.cpp \
- Protocol.h
-
-receiver_LDADD = \
- $(ACE_BUILDDIR)/protocols/ace/RMCast/libACE_RMCast.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_ACE_FOR_TAO
-endif BUILD_THREADS
-endif BUILD_EXCEPTIONS
-
-## Makefile.Send_Msg_Sender.am
-
-if BUILD_EXCEPTIONS
-if BUILD_THREADS
-if !BUILD_ACE_FOR_TAO
-
-noinst_PROGRAMS += sender
-
-sender_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(ACE_ROOT)/protocols
-
-sender_SOURCES = \
- Sender.cpp \
- Protocol.h
-
-sender_LDADD = \
- $(ACE_BUILDDIR)/protocols/ace/RMCast/libACE_RMCast.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_ACE_FOR_TAO
-endif BUILD_THREADS
-endif BUILD_EXCEPTIONS
-
-## 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/protocols/examples/RMCast/Send_Msg/Protocol.h b/ACE/protocols/examples/RMCast/Send_Msg/Protocol.h
deleted file mode 100644
index 88fdb4d6a51..00000000000
--- a/ACE/protocols/examples/RMCast/Send_Msg/Protocol.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// file : Protocol.h
-// author : Boris Kolpackov <boris@kolpackov.net>
-// cvs-id : $Id$
-
-#ifndef PROTOCOL_H
-#define PROTOCOL_H
-
-unsigned short const payload_size = 702;
-unsigned long const message_count = 80000;
-
-struct Message
-{
- unsigned int sn;
-
- unsigned short payload[payload_size];
-};
-
-#endif // PROTOCOL_H
diff --git a/ACE/protocols/examples/RMCast/Send_Msg/README b/ACE/protocols/examples/RMCast/Send_Msg/README
deleted file mode 100644
index b02056bf0cf..00000000000
--- a/ACE/protocols/examples/RMCast/Send_Msg/README
+++ /dev/null
@@ -1,18 +0,0 @@
-In this example SENDER sends a number (defined in Protocol.h, 10000
-by default) of messages to the multicast group. Each message has
-an application-level sequence number. RECEIVER tries to receive them
-and checks for damaged, lost, and reordered messages. Since reliable
-multicast is used there should be no damaged or reordered messages.
-There could be some number of lost messages at the beginning,
-howevere (standard race condition).
-
-To run the example start a one or more RECEIVERS, e.g.,
-
-$ ./receiver 224.1.0.1:10000
-
-Then start one SENDER:
-
-$ ./sender 224.1.0.1:10000
-
---
-Boris Kolpackov <boris@kolpackov.net>
diff --git a/ACE/protocols/examples/RMCast/Send_Msg/Receiver.cpp b/ACE/protocols/examples/RMCast/Send_Msg/Receiver.cpp
deleted file mode 100644
index c6378948fc8..00000000000
--- a/ACE/protocols/examples/RMCast/Send_Msg/Receiver.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-// file : Receiver.cpp
-// author : Boris Kolpackov <boris@kolpackov.net>
-// cvs-id : $Id$
-
-#include "ace/Vector_T.h"
-#include "ace/Log_Msg.h"
-#include "ace/OS_NS_string.h"
-#include "ace/Time_Value.h" // ACE_Time_Value
-#include "ace/OS_NS_sys_time.h" // gettimeofday
-
-#include "ace/RMCast/Socket.h"
-
-#include "Protocol.h"
-
-typedef
-ACE_Vector<unsigned char, ACE_VECTOR_DEFAULT_SIZE>
-Status_List;
-
-class args {};
-
-int
-ACE_TMAIN (int argc, ACE_TCHAR* argv[])
-{
- try
- {
- if (argc < 2) throw args ();
-
- ACE_INET_Addr addr (argv[1]);
-
- //FUZZ: disable check_for_lack_ACE_OS
- ACE_RMCast::Socket socket (addr, false);
- //FUZZ: enable check_for_lack_ACE_OS
-
- Message expected_msg;
- expected_msg.sn = 0;
-
- // VC6 does not know about the new rules.
- //
- {
- for (unsigned short i = 0; i < payload_size; i++)
- {
- expected_msg.payload[i] = i;
- }
- }
-
- Status_List received (message_count);
- Status_List damaged (message_count);
- Status_List duplicate (message_count);
-
- // VC6 does not know about new rules.
- //
- {
- for (unsigned int i = 0; i < message_count; ++i)
- {
- received.push_back (0);
- damaged.push_back (0);
- duplicate.push_back (0);
- }
- }
-
-
- Message msg;
- bool first (true);
- ACE_Time_Value start_time, time;
-
- while (true)
- {
- ssize_t s = socket.size ();
-
- if (first)
- {
- start_time = ACE_OS::gettimeofday ();
- first = false;
- }
-
- if (s == -1 && errno == ENOENT)
- {
- ACE_ERROR ((LM_ERROR, "unavailable message detected\n"));
-
- // Receive it.
- //
- socket.recv (&msg, sizeof (msg));
-
- continue;
- }
-
- if (s != sizeof (msg))
- {
- ACE_ERROR ((LM_ERROR, "unexpected message size %d, expected %d\n",
- s, sizeof (msg)));
- continue;
- }
-
- if (socket.recv (&msg, sizeof (msg)) != s)
- {
- ACE_ERROR ((LM_ERROR,
- "recv() reported different size than size()\n"));
- continue;
- }
-
- if (received[msg.sn] == 1)
- {
- duplicate[msg.sn] = 1;
- }
- else
- {
- received[msg.sn] = 1;
-
- if (ACE_OS::memcmp (expected_msg.payload,
- msg.payload,
- payload_size) != 0)
- {
- damaged[msg.sn] = 1;
- }
- }
-
- if (msg.sn + 1 == message_count) break;
- }
-
- time = ACE_OS::gettimeofday () - start_time;
-
- unsigned int lost_count (0), damaged_count (0), duplicate_count (0);
-
- {
- for (Status_List::Iterator i (received); !i.done (); i.advance ())
- {
- unsigned char* e;
- i.next (e);
-
- if (*e == 0) ++lost_count;
- }
- }
-
-
- {
- for (Status_List::Iterator i (damaged); !i.done (); i.advance ())
- {
- unsigned char* e;
- i.next (e);
-
- if (*e == 1) ++damaged_count;
- }
- }
-
-
- {
- for (Status_List::Iterator i (duplicate); !i.done (); i.advance ())
- {
- unsigned char* e;
- i.next (e);
-
- if (*e == 1) ++duplicate_count;
- }
- }
-
- unsigned long tput =
- (sizeof (msg) * message_count) / (time.msec () == 0 ? 1 : time.msec ());
-
- ACE_DEBUG ((LM_DEBUG,
- "lost : %d\n"
- "damaged : %d\n"
- "duplicate : %d\n"
- "throughput : %d KB/sec\n",
- lost_count,
- damaged_count,
- duplicate_count,
- tput));
-
- /*
- cout << "lost message dump:" << endl;
-
- unsigned long total = 0;
-
- for (Status_List::iterator
- begin (received.begin ()), i (begin), end (received.end ());
- i != end;)
- {
- if (*i == 0)
- {
- unsigned long count = 1;
-
- for (Status_List::iterator j = i + 1;
- j < end && *j == 0;
- j++, count++);
-
- cout << '\t' << i - begin << " : " << count << endl;
-
- i += count;
- total += count;
- }
- else ++i;
- }
-
- if (total != lost_count) cerr << "trouble" << endl;
- */
-
- return 0;
- }
- catch (args const&)
- {
- ACE_ERROR ((LM_ERROR,
- "usage: %s <IPv4 multicast address>:<port>\n", argv[0]));
- }
-
- return 1;
-}
diff --git a/ACE/protocols/examples/RMCast/Send_Msg/Send_Msg.mpc b/ACE/protocols/examples/RMCast/Send_Msg/Send_Msg.mpc
deleted file mode 100644
index 981df7ec8a7..00000000000
--- a/ACE/protocols/examples/RMCast/Send_Msg/Send_Msg.mpc
+++ /dev/null
@@ -1,17 +0,0 @@
-// -*- MPC -*-
-// $Id$
-
-project(*Sender) : aceexe, exceptions, rmcast {
- avoids = ace_for_tao
- exename = sender
- Source_Files {
- Sender.cpp
- }
-}
-project(*Receiver) : aceexe, exceptions, rmcast {
- avoids = ace_for_tao
- exename = receiver
- Source_Files {
- Receiver.cpp
- }
-}
diff --git a/ACE/protocols/examples/RMCast/Send_Msg/Sender.cpp b/ACE/protocols/examples/RMCast/Send_Msg/Sender.cpp
deleted file mode 100644
index 5a1ed1674d6..00000000000
--- a/ACE/protocols/examples/RMCast/Send_Msg/Sender.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// file : Sender.cpp
-// author : Boris Kolpackov <boris@kolpackov.net>
-// cvs-id : $Id$
-
-#include "ace/OS.h"
-#include "ace/Log_Msg.h"
-
-#include "ace/RMCast/Socket.h"
-
-#include "Protocol.h"
-
-class args {};
-
-int
-ACE_TMAIN (int argc, ACE_TCHAR* argv[])
-{
- try
- {
- if (argc < 2) throw args ();
-
- ACE_INET_Addr addr (argv[1]);
-
- //FUZZ: disable check_for_lack_ACE_OS
- ACE_RMCast::Socket socket (addr, false);
- //FUZZ: enable check_for_lack_ACE_OS
-
- Message msg;
- msg.sn = 0;
-
- for (unsigned short i = 0; i < payload_size; i++)
- {
- msg.payload[i] = i;
- }
-
- for (; msg.sn < message_count; msg.sn++)
- {
- socket.send (&msg, sizeof (msg));
- }
-
- // Keep running in case retransmissions are needed.
- //
- ACE_OS::sleep (ACE_Time_Value (50, 0));
-
- return 0;
- }
- catch (args const&)
- {
- ACE_ERROR ((LM_ERROR,
- "usage: %s <IPv4 multicast address>:<port>\n", argv[0]));
- }
-
- return 1;
-}
diff --git a/ACE/protocols/examples/TMCast/Makefile.am b/ACE/protocols/examples/TMCast/Makefile.am
deleted file mode 100644
index 358fc18ef31..00000000000
--- a/ACE/protocols/examples/TMCast/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-## 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:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-SUBDIRS = \
- Member
-
diff --git a/ACE/protocols/examples/TMCast/Member/Makefile.am b/ACE/protocols/examples/TMCast/Member/Makefile.am
deleted file mode 100644
index c5c5c31c34f..00000000000
--- a/ACE/protocols/examples/TMCast/Member/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-## 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:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-ACE_BUILDDIR = $(top_builddir)
-ACE_ROOT = $(top_srcdir)
-
-
-## Makefile.Member.am
-
-if BUILD_EXCEPTIONS
-if BUILD_THREADS
-if !BUILD_ACE_FOR_TAO
-
-noinst_PROGRAMS = member
-
-member_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(ACE_ROOT)/protocols
-
-member_SOURCES = \
- member.cpp
-
-member_LDADD = \
- $(ACE_BUILDDIR)/protocols/ace/TMCast/libACE_TMCast.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_ACE_FOR_TAO
-endif BUILD_THREADS
-endif BUILD_EXCEPTIONS
-
-## 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/protocols/examples/TMCast/Member/Member.mpc b/ACE/protocols/examples/TMCast/Member/Member.mpc
deleted file mode 100644
index 29f274f51f3..00000000000
--- a/ACE/protocols/examples/TMCast/Member/Member.mpc
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- MPC -*-
-// $Id$
-
-project: aceexe, tmcast {
- exename = member
-}
-
diff --git a/ACE/protocols/examples/TMCast/Member/README b/ACE/protocols/examples/TMCast/Member/README
deleted file mode 100644
index 6a62a107a77..00000000000
--- a/ACE/protocols/examples/TMCast/Member/README
+++ /dev/null
@@ -1,36 +0,0 @@
-Member example shows how you can build a simple multicast group
-using transactional multicast (TMCast). Each member can be either
-a sender or a receiver.
-
-The sender sends small messages to the multicast group with a random
-wait period in [0, 1] second range. The receiver is simply receiving
-those messages and prints them out.
-
-To start the sender you can execute something like this:
-
-$ ./member s sender-1 239.255.0.1:10000
-
-Here the first argument ('s') indicates that new member will be
-a sender. The second argument ('sender-1') is an id of the new
-member (each member of the group should have a unique id). And
-the third argument ('239.255.0.1:10000') specifies IPv4 multicast
-address and port (you can choose you own).
-
-To start the receiver you can execute similar command:
-
-$ ./member r receiver-1 239.255.0.1:10000
-
-After you have started both the receiver and the sender you
-should see a sequence of messages printed by the receiver.
-
-Note, since the group can exist with only one member for a
-very short period of time you should start first two members
-virtually at the same time. See TMCast documentation for more
-information about why it behaves this way.
-
-You may want to add more than one sender to the group if you
-want to see how TMCast operates in a totally-ordered mode.
-
-
---
-Boris Kolpackov <boris@dre.vanderbilt.edu>
diff --git a/ACE/protocols/examples/TMCast/Member/member.cpp b/ACE/protocols/examples/TMCast/Member/member.cpp
deleted file mode 100644
index 7aad7736ccf..00000000000
--- a/ACE/protocols/examples/TMCast/Member/member.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// file : TMCast/Member/member.cpp
-// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
-// cvs-id : $Id$
-
-#include "ace/Log_Msg.h"
-#include "ace/Time_Value.h"
-#include "ace/OS_NS_stdlib.h"
-#include "ace/OS_NS_unistd.h"
-#include "ace/OS_NS_stdio.h"
-#include "ace/OS_NS_time.h"
-#include "ace/OS_NS_string.h"
-
-#include "ace/TMCast/Group.hpp"
-
-class Args {};
-
-int
-ACE_TMAIN (int argc, ACE_TCHAR* argv[])
-{
- int status = 0;
- try
- {
- if (argc < 4) throw Args ();
-
- bool receiver (true);
-
- if (argv[1][0] == 'r') receiver = true;
- else if (argv[1][0] == 's') receiver = false;
- else throw Args ();
-
- if (!receiver) ACE_OS::srand ((u_int) ACE_OS::time ());
-
- ACE_INET_Addr address (argv[3]);
-
- ACE_TMCast::Group group (address, ACE_TEXT_ALWAYS_CHAR (argv[2]));
-
- if (receiver)
- {
- for (char buffer[256];;)
- {
- group.recv (buffer, sizeof (buffer));
-
- ACE_DEBUG ((LM_DEBUG, "%s\n", buffer));
- }
- }
- else
- {
- char buffer[256];
-
- for (unsigned long i = 0; i < 1000; i++)
- {
- // Sleep some random time around 1 sec.
-
- ACE_UINT64 tmpl = 1000000U;
- unsigned long t =
- static_cast<unsigned long> (((tmpl * ACE_OS::rand ()) / RAND_MAX));
-
- // ACE_DEBUG ((LM_DEBUG, "sleeping for %u\n", t));
-
- ACE_OS::sleep (ACE_Time_Value (0, t));
-
- ACE_OS::sprintf (buffer, "message # %lu", i);
-
- try
- {
- group.send (buffer, ACE_OS::strlen (buffer) + 1);
- }
- catch (ACE_TMCast::Group::Aborted const&)
- {
- ACE_ERROR ((LM_ERROR, "%s has been aborted\n", buffer));
- }
- }
- }
- }
- catch (Args const&)
- {
- ACE_ERROR ((LM_ERROR,
- "Usage: member {r|s} <id> <IPv4 mcast address>:<port>\n"));
- status++;
- }
- catch (ACE_TMCast::Group::Failed const&)
- {
- ACE_ERROR ((LM_ERROR,
- "Group failure. Perhaps I am alone in the group.\n"));
- status++;
- }
- catch (ACE_TMCast::Group::InsufficienSpace const&)
- {
- ACE_ERROR ((LM_ERROR, "Insufficient space in receive buffer.\n"));
- status++;
- }
- return status;
-}
diff --git a/ACE/protocols/examples/examples.mwc b/ACE/protocols/examples/examples.mwc
deleted file mode 100644
index dd297256b34..00000000000
--- a/ACE/protocols/examples/examples.mwc
+++ /dev/null
@@ -1,5 +0,0 @@
-// -*- MPC -*-
-// $Id$
-
-workspace {
-}