--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/more-test.patch Thu Jun 20 09:56:26 2013 +0900
@@ -0,0 +1,304 @@
+diff --git a/example/dce-tcp-ns3-nsc-comparison.cc b/example/dce-tcp-ns3-nsc-comparison.cc
+--- a/example/dce-tcp-ns3-nsc-comparison.cc
++++ b/example/dce-tcp-ns3-nsc-comparison.cc
+@@ -202,6 +202,16 @@
+ // dceManager.RunIp (rights.Get (1), Seconds (0.2), "route add default via 10.2.1.1");
+ // dceManager.RunIp (rights.Get (0), Seconds (0.2), "route show");
+
++ // dceManager.RunIp (lefts.Get (0), Seconds (0.2), "route add default via 10.0.0.2");
++ // dceManager.RunIp (lefts.Get (1), Seconds (0.2), "route add default via 10.0.1.2");
++ // dceManager.RunIp (routers.Get (0), Seconds (0.2), "route add 10.2.0.0/16 via 10.1.0.2");
++ // dceManager.RunIp (routers.Get (1), Seconds (0.2), "route add 10.0.0.0/16 via 10.1.0.1");
++ // dceManager.RunIp (routers.Get (1), Seconds (0.2), "route show");
++ // dceManager.RunIp (routers.Get (1), Seconds (0.2), "link set lo up");
++ // dceManager.RunIp (rights.Get (0), Seconds (0.2), "route add 0.0.0.0/0 via 10.2.0.1");
++ // dceManager.RunIp (rights.Get (1), Seconds (0.2), "route add default via 10.2.1.1");
++ // dceManager.RunIp (rights.Get (0), Seconds (0.2), "route show");
++
+ ApplicationContainer apps;
+ DceApplicationHelper process;
+
+diff --git a/example/dce-trinity.cc b/example/dce-trinity.cc
+new file mode 100644
+--- /dev/null
++++ b/example/dce-trinity.cc
+@@ -0,0 +1,99 @@
++#include "ns3/core-module.h"
++#include "ns3/network-module.h"
++#include "ns3/dce-module.h"
++#include "ns3/point-to-point-module.h"
++#include "ns3/csma-module.h"
++#include "ns3/wifi-module.h"
++#include "ns3/mobility-module.h"
++#include "ns3/internet-module.h"
++#include <fstream>
++
++using namespace ns3;
++NS_LOG_COMPONENT_DEFINE ("DceLinux");
++
++static void RunIp (Ptr<Node> node, Time at, std::string str)
++{
++ DceApplicationHelper process;
++ ApplicationContainer apps;
++ process.SetBinary ("ip");
++ process.SetStackSize (1<<16);
++ process.ResetArguments();
++ process.ParseArguments(str.c_str ());
++ apps = process.Install (node);
++ apps.Start (at);
++}
++
++void
++PrintTcpFlags (std::string key, std::string value)
++{
++ NS_LOG_INFO (key << "=" << value);
++}
++
++int main (int argc, char *argv[])
++{
++ CommandLine cmd;
++ char linkType = 'p'; // P2P
++ bool reliable = true;
++
++ cmd.Parse (argc, argv);
++ NodeContainer nodes;
++ nodes.Create (2);
++
++ NetDeviceContainer devices;
++ PointToPointHelper p2p;
++ p2p.SetDeviceAttribute ("DataRate", StringValue ("5Gbps"));
++ p2p.SetChannelAttribute ("Delay", StringValue ("1ms"));
++ devices = p2p.Install (nodes);
++ p2p.EnablePcapAll ("trinity");
++
++ DceManagerHelper processManager;
++ // processManager.SetLoader ("ns3::DlmLoaderFactory");
++ // processManager.SetLoader ("ns3::CopyLoaderFactory");
++ processManager.SetTaskManagerAttribute ("FiberManagerType",
++ StringValue ("UcontextFiberManager"));
++ processManager.SetNetworkStack("ns3::LinuxSocketFdFactory", "Library", StringValue ("liblinux.so"));
++ LinuxStackHelper stack;
++ stack.Install (nodes);
++
++ Ipv4AddressHelper address;
++ address.SetBase ("10.0.0.0", "255.255.255.0");
++ Ipv4InterfaceContainer interfaces = address.Assign (devices);
++
++ processManager.Install (nodes);
++
++
++ for (int n=0; n < 2; n++)
++ {
++ RunIp (nodes.Get (n), Seconds (0.2), "link show");
++ RunIp (nodes.Get (n), Seconds (0.3), "route show table all");
++ RunIp (nodes.Get (n), Seconds (0.4), "addr list");
++ }
++
++ DceApplicationHelper process;
++ ApplicationContainer apps;
++
++ process.SetBinary ("tcp-server");
++ process.ResetArguments ();
++ process.SetStackSize (1<<16);
++ apps = process.Install (nodes.Get (0));
++ apps.Start (Seconds (1.0));
++
++ process.SetBinary ("trinity");
++ process.SetUid (1000);
++ //process.SetBinary ("tcp-client");
++ process.ResetArguments ();
++ // process.ParseArguments ("-L");
++ //process.ParseArguments ("10.0.0.1");
++ apps = process.Install (nodes.Get (1));
++ apps.Start (Seconds (1.5));
++
++ // print tcp sysctl value
++ LinuxStackHelper::SysctlGet (nodes.Get (0), Seconds (1.0),
++ ".net.ipv4.tcp_available_congestion_control", &PrintTcpFlags);
++
++ Simulator::Stop (Seconds (200.0));
++ Simulator::Run ();
++ Simulator::Destroy ();
++
++ return 0;
++}
+diff --git a/model/dce-alloc.cc b/model/dce-alloc.cc
+--- a/model/dce-alloc.cc
++++ b/model/dce-alloc.cc
+@@ -77,3 +77,8 @@
+ {
+ return sysconf (_SC_PAGESIZE);
+ }
++void *dce_memalign(size_t boundary, size_t size)
++{
++ // XXX
++ return dce_malloc (size);
++}
+diff --git a/model/dce-stdlib.h b/model/dce-stdlib.h
+--- a/model/dce-stdlib.h
++++ b/model/dce-stdlib.h
+@@ -24,6 +24,7 @@
+ int dce_clearenv (void);
+ int dce_mkstemp (char *temp);
+ int dce_rename (const char *oldpath, const char *newpath);
++void *dce_memalign(size_t boundary, size_t size);
+
+ #ifdef __cplusplus
+ }
+diff --git a/model/libc-dce.cc b/model/libc-dce.cc
+--- a/model/libc-dce.cc
++++ b/model/libc-dce.cc
+@@ -96,6 +96,10 @@
+ #include <langinfo.h>
+ #include <sys/vfs.h>
+ #include <termio.h>
++#include <sys/ipc.h>
++#include <sys/shm.h>
++#include <malloc.h>
++#include <sys/prctl.h>
+
+ extern void __cxa_finalize (void *d);
+ extern int __cxa_atexit (void (*func)(void *), void *arg, void *d);
+diff --git a/model/libc-ns3.h b/model/libc-ns3.h
+--- a/model/libc-ns3.h
++++ b/model/libc-ns3.h
+@@ -104,6 +104,7 @@
+ DCE (abort)
+ DCE (mkstemp)
+ DCE (rename)
++DCE (memalign)
+
+ // STRING.H
+ NATIVE (strerror)
+@@ -315,6 +316,7 @@
+ DCE (open)
+ DCE (open64)
+ DCE (unlinkat)
++DCE (creat)
+
+ // TIME.H
+ DCE (nanosleep)
+@@ -546,6 +548,15 @@
+ DCE (tcgetattr)
+ DCE (tcsetattr)
+
++/* shm.h */
++NATIVE (shmget)
++NATIVE (shmat)
++NATIVE (shmctl)
++NATIVE (shmdt)
++
++NATIVE (prctl)
++NATIVE (chmod)
++
+ ///////////////////// END OF INVENTAIRE //////////////////////////////////////////////////
+
+ // ctype.h
+diff --git a/utils/run-all-test-coverage.sh b/utils/run-all-test-coverage.sh
+--- a/utils/run-all-test-coverage.sh
++++ b/utils/run-all-test-coverage.sh
+@@ -1,27 +1,68 @@
+ #!/bin/bash
+-set -x
++#set -x
+
+-export NS_ATTRIBUTE_DEFAULT='ns3::DceManagerHelper::LoaderFactory=ns3::DlmLoaderFactory[];ns3::TaskManager::FiberManagerType=UcontextFiberManager'
+
+-../build/bin/ns3test-dce-vdl
+-./build/bin/dce-runner ../build/bin/dce-dccp
+-./build/bin/dce-runner ../build/bin/dce-iperf --kernel=1
+-../build/bin/ns3test-dce-quagga-vdl |& grep -v sockopt
+-./build/bin/dce-runner ../build/bin/dce-quagga-radvd
+-./build/bin/dce-runner ../build/bin/dce-quagga-bgpd
+-./build/bin/dce-runner ../build/bin/dce-quagga-ospfd --netStack=linux
+-./build/bin/dce-runner ../build/bin/dce-quagga-ospf6d --netStack=linux
+-#./build/bin/dce-runner ../build/bin/dce-quagga-ospfd-rocketfuel --netStack=linux
+-./build/bin/dce-runner ../build/bin/dce-quagga-ripd
+-./build/bin/dce-runner ../build/bin/dce-quagga-ripngd
+-./build/bin/dce-runner ../build/bin/dce-umip-cmip6
+-./build/bin/dce-runner ../build/bin/dce-umip-nemo |& grep -v bytes
+-../build/bin/ns3test-dce-umip-vdl
+-./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=icmp
+-./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=udp
+-./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=tcp
+-./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=dccp
+-./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=dccp -ccid=3
+-./build/bin/dce-runner ../build/bin/dce-tcp-ns3-nsc-comparison --stack=dce
++echo ${NS_ATTRIBUTE_DEFAULT}
+
+
++run_test() {
++
++$2 >& /dev/null
++case "$?" in
++0)
++ echo $1 " PASS " $2
++ ;;
++1)
++ echo $1 " FAIL " $2
++ ;;
++*)
++ echo $1 " CRASH " $2
++ ;;
++esac
++
++}
++
++SEED=`seq 1 10 100`
++SEED=`seq 1 10 30`
++RUNS=`seq 1 1 5`
++ERROR_RATES=`seq 0.0 0.0001 0.0005`
++
++for seed in ${SEED}
++do
++for run in ${RUNS}
++do
++for err in ${ERROR_RATES}
++do
++
++export NS_ATTRIBUTE_DEFAULT='ns3::DceManagerHelper::LoaderFactory=ns3::DlmLoaderFactory[];ns3::TaskManager::FiberManagerType=UcontextFiberManager;ns3::LinuxSocketFdFactory::ErrorRate='$err';'
++echo $NS_ATTRIBUTE_DEFAULT
++export NS_GLOBAL_VALUE='RngSeed=$seed:RngRun=$run'
++echo $NS_GLOBAL_VALUE
++echo "RndSeed=$seed, RngRun=$run, ErrRatio=$err"
++
++run_test "DCE" "../build/bin/ns3test-dce-vdl"
++run_test "DCCP" "./build/bin/dce-runner ../build/bin/dce-dccp"
++run_test "iperf" "./build/bin/dce-runner ../build/bin/dce-iperf --kernel=1"
++run_test "quagga" "../build/bin/ns3test-dce-quagga-vdl"
++run_test "radvd" "./build/bin/dce-runner ../build/bin/dce-quagga-radvd"
++run_test "bgpd" "./build/bin/dce-runner ../build/bin/dce-quagga-bgpd"
++run_test "ospfd" "./build/bin/dce-runner ../build/bin/dce-quagga-ospfd --netStack=linux"
++run_test "ospf6d" "./build/bin/dce-runner ../build/bin/dce-quagga-ospf6d --netStack=linux"
++#run_test "Test1" "./build/bin/dce-runner ../build/bin/dce-quagga-ospfd-rocketfuel --netStack=linux"
++run_test "ripd" "./build/bin/dce-runner ../build/bin/dce-quagga-ripd"
++run_test "ripngd" "./build/bin/dce-runner ../build/bin/dce-quagga-ripngd"
++run_test "cmip6" "./build/bin/dce-runner ../build/bin/dce-umip-cmip6"
++run_test "nemo" "./build/bin/dce-runner ../build/bin/dce-umip-nemo"
++run_test "umip" "../build/bin/ns3test-dce-umip-vdl"
++run_test "icmp" "./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=icmp"
++run_test "udp" "./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=udp"
++run_test "tcp" "./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=tcp"
++run_test "dccp" "./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=dccp"
++run_test "dccp ccid=3" "./build/bin/dce-runner ../build/bin/dce-ns3-onoff --rate=10kbps --proto=dccp -ccid=3"
++run_test "dumbbel" "./build/bin/dce-runner ../build/bin/dce-tcp-ns3-nsc-comparison --stack=dce"
++run_test "fuzzer" "./build/bin/dce-runner ./build/bin/dce-trinity"
++
++
++done
++done
++done
+diff --git a/wscript b/wscript
+--- a/wscript
++++ b/wscript
+@@ -342,6 +342,10 @@
+ target='bin/dce-tcp-ns3-nsc-comparison',
+ source=['example/dce-tcp-ns3-nsc-comparison.cc'])
+
++ module.add_example(needed = ['core', 'network', 'dce', 'wifi', 'point-to-point', 'csma', 'mobility' ],
++ target='bin/dce-trinity',
++ source=['example/dce-trinity.cc'])
++
+ # Add a script to build system
+ def build_a_script(bld, name, needed = [], **kw):
+ external = [i for i in needed if not i == name]