--- a/himalis.patch Thu Mar 08 17:19:34 2012 +0900
+++ b/himalis.patch Tue Mar 13 17:18:48 2012 +0900
@@ -1,7 +1,314 @@
+diff -r 15b6876ea9ed example/dce-himalis-handoff.cc
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ b/example/dce-himalis-handoff.cc Tue Mar 13 17:18:36 2012 +0900
+@@ -0,0 +1,303 @@
++/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
++/*
++ * Copyright (c) 2012 NICT
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation;
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ *
++ * Author: Hajime Tazaki <tazaki@nict.go.jp>
++ */
++
++#include "ns3/network-module.h"
++#include "ns3/core-module.h"
++#include "ns3/internet-module.h"
++#include "ns3/csma-helper.h"
++#include "ns3/point-to-point-helper.h"
++#include "ns3/dce-module.h"
++#include "ns3/himalis-helper.h"
++#include "ns3/mobility-module.h"
++#include "ns3/wifi-module.h"
++#include "visual-simulator-impl.h"
++
++using namespace ns3;
++
++NS_LOG_COMPONENT_DEFINE ("HimalisHandoff");
++
++// Parameters
++uint32_t stopTime = 120;
++bool noMobility = false;
++
++std::string host0_srcid = "2001-200-0-e101-0-0-0-beaf";
++std::string host1_srcid = "2001-200-0-e101-0-0-0-3939";
++std::string gw0_sim0 = "2001:3939:0:1::1";
++std::string host0_gw0_sim0 = "2001:3939:0:1::2";
++std::string gw1_sim0 = "2001:5959:0:1::1";
++std::string host0_gw1_sim0 = "2001:5959:0:1::2";
++
++std::string gw0_sim1 = "2002:4949:0:1::1";
++std::string host1_sim0 = "2002:4949:0:1::2";
++
++std::string gw1_sim1 = "2002:6969:0:1::1";
++std::string host1_sim1 = "2002:6969:0:1::2";
++
++NodeContainer hosts, gw;
++
++static void RunIp (Ptr<Node> node, Time at, std::string str)
++{
++ DceApplicationHelper process;
++ ApplicationContainer apps;
++ process.SetBinary ("ip");
++ process.SetStackSize (1<<31);
++ process.ResetArguments();
++ process.ParseArguments(str.c_str ());
++ apps = process.Install (node);
++ apps.Start (at);
++}
++
++void
++AssocCallback (std::string path, Mac48Address bssid)
++{
++ uint8_t gw0[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
++ uint8_t gw1[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x03};
++ uint8_t cur[6];
++ HimalisHelper himalis;
++
++ bssid.CopyTo (cur);
++
++ std::cout << Simulator::Now ().GetSeconds () << " " << path << " with " << bssid;
++ // in case gw0
++ if (memcmp (cur, gw0, 6) == 0)
++ {
++ std::cout << " gw0 " << std::endl;
++ RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 addr del " + host0_gw1_sim0 + "/64 dev sim0");
++ RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 route del default via "+ gw1_sim0);
++ RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 addr add " + host0_gw0_sim0 + "/64 dev sim0");
++ RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 route add default via "+ gw0_sim0);
++#if 1
++ himalis.DelIdlRoute (hosts.Get (0), Simulator::Now (),
++ host0_srcid.c_str (), host1_srcid.c_str ());
++ himalis.AddIdlRoute (hosts.Get (0), Simulator::Now (),
++ "host", host0_srcid.c_str (), host1_srcid.c_str (),
++ host0_gw0_sim0.c_str (), gw0_sim0.c_str (), "sim0");
++
++ himalis.DelIdlRoute (hosts.Get (1), Simulator::Now (),
++ host1_srcid.c_str (), host0_srcid.c_str ());
++ himalis.AddIdlRoute (hosts.Get (1), Simulator::Now (),
++ "host", host1_srcid.c_str (), host0_srcid.c_str (),
++ host1_sim0.c_str (), gw0_sim1.c_str (), "sim0");
++#endif
++ }
++ // in case gw1
++ else if (memcmp (cur, gw1, 6) == 0)
++ {
++ std::cout << " gw1 " << std::endl;
++ RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 addr del " + host0_gw0_sim0 + "/64 dev sim0");
++ RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 route del default via "+ gw0_sim0);
++ RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 addr add " + host0_gw1_sim0 + "/64 dev sim0");
++ RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 route add default via "+ gw1_sim0);
++#if 1
++ himalis.DelIdlRoute (hosts.Get (0), Simulator::Now (),
++ host0_srcid.c_str (), host1_srcid.c_str ());
++ himalis.AddIdlRoute (hosts.Get (0), Simulator::Now (),
++ "host", host0_srcid.c_str (), host1_srcid.c_str (),
++ host0_gw1_sim0.c_str (), gw1_sim0.c_str (), "sim0");
++
++ himalis.DelIdlRoute (hosts.Get (1), Simulator::Now (),
++ host1_srcid.c_str (), host0_srcid.c_str ());
++ himalis.AddIdlRoute (hosts.Get (1), Simulator::Now (),
++ "host", host1_srcid.c_str (), host0_srcid.c_str (),
++ host1_sim1.c_str (), gw1_sim1.c_str (), "sim1");
++ himalis.ShowIdlRoute (hosts.Get (1), Simulator::Now ());
++#endif
++ }
++
++}
++
++
++int main (int argc, char *argv[])
++{
++ CommandLine cmd;
++ cmd.AddValue ("stopTime", "Time to stop(seconds)", stopTime);
++ cmd.AddValue ("noMobility", "Without movement", noMobility);
++ cmd.Parse (argc, argv);
++
++ // nodes
++ gw.Create (2);
++ hosts.Create (2);
++
++ // movement
++ NetDeviceContainer devices;
++ MobilityHelper mobility;
++ Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
++ positionAlloc->Add (Vector (0.0, 10.0, 0.0)); // GW0
++ positionAlloc->Add (Vector (150.0, 10.0, 0.0)); // GW1
++ positionAlloc->Add (Vector (75.0, -50.0, 0.0)); // CN
++ mobility.SetPositionAllocator (positionAlloc);
++ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
++ mobility.Install (gw);
++ mobility.Install (hosts.Get (1));
++
++ Ptr<ns3::RandomDiscPositionAllocator> r_position =
++ CreateObject<RandomDiscPositionAllocator> ();
++ r_position->SetX (100);
++ r_position->SetY (50);
++ r_position->SetRho (UniformVariable (200, 0));
++ mobility.SetPositionAllocator (r_position);
++ mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
++ "Bounds", RectangleValue (Rectangle (0, 200, 30, 60)),
++ "Speed", RandomVariableValue (ConstantVariable (10)),
++ "Pause", RandomVariableValue (ConstantVariable (0.2)));
++ if (noMobility)
++ {
++ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
++ }
++ mobility.Install (hosts.Get (0));
++
++ // net devices
++ // wifi
++ WifiHelper wifi = WifiHelper::Default ();
++ YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
++ YansWifiChannelHelper phyChannel = YansWifiChannelHelper::Default ();
++ Ssid ssid = Ssid ("ns-3-ssid");
++ NqosWifiMacHelper mac;
++ wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
++
++ phy.SetChannel (phyChannel.Create ());
++ mac.SetType ("ns3::StaWifiMac",
++ "Ssid", SsidValue (ssid),
++ "ActiveProbing", BooleanValue (false));
++ wifi.Install (phy, mac, hosts.Get (0));
++ mac.SetType ("ns3::ApWifiMac",
++ "Ssid", SsidValue (ssid));
++ wifi.Install (phy, mac, gw);
++ // ptp netdev
++ PointToPointHelper p2p;
++ p2p.Install (NodeContainer (gw.Get (0), hosts.Get (1))); // CN - GW0
++ p2p.Install (NodeContainer (gw.Get (1), hosts.Get (1))); // CN - GW1
++
++
++
++ // addresses (locators)
++ DceManagerHelper dceManager;
++ HimalisHelper himalis;
++ dceManager.SetTaskManagerAttribute ("FiberManagerType",
++ EnumValue (0));
++ // dceManager.SetLoader ("ns3::DlmLoaderFactory");
++ dceManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
++ "Library", StringValue ("liblinux-2.6.32.27-tpidl.so"));
++ dceManager.Install (NodeContainer (hosts, gw));
++ himalis.Install (NodeContainer (hosts, gw));
++
++ // GW0
++ RunIp (gw.Get (0), Seconds (0.1), "link set lo up");
++ RunIp (gw.Get (0), Seconds (0.1), "link set sim0 up");
++ RunIp (gw.Get (0), Seconds (0.1), "link set sim1 up");
++ RunIp (gw.Get (0), Seconds (0.2), "-f inet6 addr add " + gw0_sim0 + "/64 dev sim0");
++ RunIp (gw.Get (0), Seconds (0.15), "-f inet6 addr add " + gw0_sim1 + "/64 dev sim1");
++ // HIMALIS configuration
++#if 1
++ himalis.AddIdlRoute (gw.Get (0), Seconds (0.2), "forward", host0_srcid.c_str (), host1_srcid.c_str (),
++ gw0_sim1.c_str (), host1_sim0.c_str (), "sim1");
++ himalis.AddIdlRoute (gw.Get (0), Seconds (0.2), "forward", host1_srcid.c_str (), host0_srcid.c_str (),
++ gw0_sim0.c_str (), host0_gw0_sim0.c_str (), "sim0");
++#endif
++#if 0
++ himalis.ShowIdlRoute (gw.Get (0), Seconds (0.2));
++#endif
++ RunIp (gw.Get (0), Seconds (1.0), "addr list");
++
++ // GW1
++ RunIp (gw.Get (1), Seconds (0.1), "link set lo up");
++ RunIp (gw.Get (1), Seconds (0.1), "link set sim0 up");
++ RunIp (gw.Get (1), Seconds (0.1), "link set sim1 up");
++ RunIp (gw.Get (1), Seconds (0.2), "-f inet6 addr add " + gw1_sim0 + "/64 dev sim0");
++ RunIp (gw.Get (1), Seconds (0.2), "-f inet6 addr add " + gw1_sim1 + "/64 dev sim1");
++ // HIMALIS configuration
++#if 1
++ himalis.AddIdlRoute (gw.Get (1), Seconds (0.2), "forward", host0_srcid.c_str (), host1_srcid.c_str (),
++ gw1_sim1.c_str (), host1_sim1.c_str (), "sim1");
++ himalis.AddIdlRoute (gw.Get (1), Seconds (0.2), "forward", host1_srcid.c_str (), host0_srcid.c_str (),
++ gw1_sim0.c_str (), host0_gw1_sim0.c_str (), "sim0");
++#endif
++#if 0
++ himalis.ShowIdlRoute (gw.Get (1), Seconds (0.2));
++#endif
++ RunIp (gw.Get (1), Seconds (1.0), "addr list");
++
++ // Host0 (MN)
++ RunIp (hosts.Get (0), Seconds (0.1), "link set lo up");
++ RunIp (hosts.Get (0), Seconds (0.1), "link set sim0 up");
++ RunIp (hosts.Get (0), Seconds (1.0), "addr list");
++#if 0
++ RunIp (hosts.Get (0), Seconds (0.2), "-f inet6 addr add " + host0_gw1_sim0 + "/64 dev sim0");
++ RunIp (hosts.Get (0), Seconds (0.2), "-f inet6 route add default via "+ gw1_sim0);
++ himalis.AddIdlRoute (hosts.Get (0), Seconds (0.2), "host", host0_srcid.c_str (), host1_srcid.c_str (),
++ host0_gw1_sim0.c_str (), gw1_sim0.c_str (), "sim0");
++#endif
++
++ // Host1 (CN)
++ RunIp (hosts.Get (1), Seconds (0.1), "link set lo up");
++ RunIp (hosts.Get (1), Seconds (0.1), "link set sim0 up");
++ RunIp (hosts.Get (1), Seconds (0.1), "link set sim1 up");
++ RunIp (hosts.Get (1), Seconds (0.3), "-f inet6 addr add " + host1_sim0 + "/64 dev sim0");
++ RunIp (hosts.Get (1), Seconds (0.3), "-f inet6 route add default via " + gw0_sim1);
++ RunIp (hosts.Get (1), Seconds (0.2), "-f inet6 addr add " + host1_sim1 + "/64 dev sim1");
++ RunIp (hosts.Get (1), Seconds (0.2), "-f inet6 route add default via " + gw1_sim1);
++ RunIp (hosts.Get (1), Seconds (1.0), "addr list");
++#if 0
++ himalis.AddIdlRoute (hosts.Get (1), Seconds (0.2), "host", host1_srcid.c_str (), host0_srcid.c_str (),
++ host1_sim0.c_str (), gw0_sim1.c_str (), "sim0");
++#endif
++
++ // Applications
++ DceApplicationHelper process;
++ ApplicationContainer apps;
++#if 1
++ // server install to host1
++ process.SetBinary ("idl-server");
++ process.SetBinary ("idecho-s");
++ process.ResetArguments ();
++ process.ParseArguments ("-s " + host1_srcid);
++ process.SetStackSize (1<<16);
++ apps = process.Install (hosts.Get (1));
++ apps.Start (Seconds (4.0));
++#endif
++
++ // client install to host0
++ process.SetBinary ("idl-client");
++ process.SetBinary ("idecho-c");
++ process.ResetArguments ();
++ process.ParseArguments ("-s " + host0_srcid);
++ process.ParseArguments ("-d " + host1_srcid);
++ process.SetStackSize (1<<16);
++ apps = process.Install (hosts.Get (0));
++ apps.Start (Seconds (5.0));
++
++ p2p.EnablePcapAll ("dce-himalis");
++ phy.EnablePcapAll ("dce-himalis");
++
++ // XXX
++ Ptr<VisualSimulatorImpl> impl = DynamicCast<VisualSimulatorImpl> (Simulator::GetImplementation ());
++ if (GetPointer (impl) == NULL)
++ {
++ Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac/Assoc", MakeCallback (&AssocCallback));
++ }
++
++ Simulator::Stop (Seconds (stopTime));
++ Simulator::Run ();
++ Simulator::Destroy ();
++
++ NS_LOG_INFO ("End of experiment");
++
++ return 0;
++}
diff -r 15b6876ea9ed example/dce-himalis-simple.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/example/dce-himalis-simple.cc Thu Mar 08 17:19:00 2012 +0900
-@@ -0,0 +1,156 @@
++++ b/example/dce-himalis-simple.cc Tue Mar 13 17:18:36 2012 +0900
+@@ -0,0 +1,153 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2012 NICT
@@ -52,9 +359,11 @@
+std::string host0_srcid = "2001-200-0-e101-0-0-0-beaf";
+std::string host1_srcid = "2001-200-0-e101-0-0-0-3939";
+std::string gw_sim0 = "2001:3939:0:1::1";
-+std::string gw_sim1 = "11.0.0.1";
+std::string host0_sim0 = "2001:3939:0:1::2";
-+std::string host1_sim0 = "11.0.0.2";
++std::string gw_sim1_v6 = "2002:4949:0:1::1";
++std::string host1_sim0_v6 = "2002:4949:0:1::2";
++std::string gw_sim1_v4 = "11.0.0.1";
++std::string host1_sim0_v4 = "11.0.0.2";
+
+int main (int argc, char *argv[])
+{
@@ -63,32 +372,27 @@
+ cmd.Parse (argc, argv);
+
+ // nodes
-+ NodeContainer hosts, gw, dnr, hnr;
++ NodeContainer hosts, gw;
+ hosts.Create (2);
+ gw.Create (1);
-+ dnr.Create (1);
-+ hnr.Create (1);
+
+ // net devices
+ CsmaHelper csma;
+ PointToPointHelper p2p;
+ csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps"));
+ csma.SetChannelAttribute ("Delay", StringValue ("2ms"));
++
+ p2p.Install (NodeContainer (gw, hosts.Get (0))); // Host - GW
+ p2p.Install (NodeContainer (gw, hosts.Get (1))); // Host - GW
-+ p2p.Install (NodeContainer (hnr, gw)); // GW - HNR
-+ p2p.Install (NodeContainer (gw, dnr)); // GW - DNR
-+
-+ p2p.EnablePcapAll ("dce-himalis");
+
+ // addresses (locators)
+ DceManagerHelper dceManager;
+ HimalisHelper himalis;
+ // dceManager.SetLoader ("ns3::DlmLoaderFactory");
+ dceManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
-+ "Library", StringValue ("libnet-next-2.6.so"));
-+ dceManager.Install (NodeContainer (hosts, gw, hnr, dnr));
-+ himalis.Install (NodeContainer (hosts, gw, hnr, dnr));
++ "Library", StringValue ("liblinux-2.6.32.27-tpidl.so"));
++ dceManager.Install (NodeContainer (hosts, gw));
++ himalis.Install (NodeContainer (hosts, gw));
+
+ // GW
+ RunIp (gw.Get (0), Seconds (0.1), "link set lo up");
@@ -96,16 +400,15 @@
+ RunIp (gw.Get (0), Seconds (0.1), "link set sim1 up");
+ RunIp (gw.Get (0), Seconds (0.1), "link set sim2 up");
+ RunIp (gw.Get (0), Seconds (0.2), "-f inet addr add 10.0.0.1/24 dev sim0");
-+ RunIp (gw.Get (0), Seconds (0.2), "-f inet addr add " + gw_sim1 + "/24 dev sim1");
-+ RunIp (gw.Get (0), Seconds (0.2), "-f inet addr add 12.0.0.1/24 dev sim2");
-+ RunIp (gw.Get (0), Seconds (0.2), "-f inet addr add 13.0.0.1/24 dev sim3");
+ RunIp (gw.Get (0), Seconds (0.2), "-f inet6 addr add " + gw_sim0 + "/64 dev sim0");
++ RunIp (gw.Get (0), Seconds (0.2), "-f inet addr add " + gw_sim1_v4 + "/24 dev sim1");
++ RunIp (gw.Get (0), Seconds (0.2), "-f inet6 addr add " + gw_sim1_v6 + "/64 dev sim1");
+ // HIMALIS configuration
-+ himalis.AddIdlRoute (gw.Get (0), "forward", host0_srcid.c_str (), host1_srcid.c_str (),
-+ "11.0.0.1", "11.0.0.2");
-+ himalis.AddIdlRoute (gw.Get (0), "forward", host1_srcid.c_str (), host0_srcid.c_str (),
-+ gw_sim0.c_str (), host0_sim0.c_str ());
-+ himalis.ShowIdlRoute (gw.Get (0));
++ himalis.AddIdlRoute (gw.Get (0), Seconds (0.2), "forward", host0_srcid.c_str (), host1_srcid.c_str (),
++ gw_sim1_v6.c_str (), host1_sim0_v6.c_str (), "sim1");
++ himalis.AddIdlRoute (gw.Get (0), Seconds (0.2), "forward", host1_srcid.c_str (), host0_srcid.c_str (),
++ gw_sim0.c_str (), host0_sim0.c_str (), "sim0");
++ himalis.ShowIdlRoute (gw.Get (0), Seconds (0.2));
+ RunIp (gw.Get (0), Seconds (1.0), "addr list");
+
+ // Host0 (MN)
@@ -115,17 +418,19 @@
+ RunIp (hosts.Get (0), Seconds (0.2), "-f inet route add default via 10.0.0.1");
+ RunIp (hosts.Get (0), Seconds (0.2), "-f inet6 addr add " + host0_sim0 + "/64 dev sim0");
+ RunIp (hosts.Get (0), Seconds (0.2), "-f inet6 route add default via "+ gw_sim0);
-+ himalis.AddIdlRoute (hosts.Get (0), "host", host0_srcid.c_str (), host1_srcid.c_str (),
-+ host0_sim0.c_str (), gw_sim0.c_str ());
++ himalis.AddIdlRoute (hosts.Get (0), Seconds (0.2), "host", host0_srcid.c_str (), host1_srcid.c_str (),
++ host0_sim0.c_str (), gw_sim0.c_str (), "sim0");
+ RunIp (hosts.Get (0), Seconds (1.0), "addr list");
+
+ // Host1 (CN)
+ RunIp (hosts.Get (1), Seconds (0.1), "link set lo up");
+ RunIp (hosts.Get (1), Seconds (0.1), "link set sim0 up");
-+ RunIp (hosts.Get (1), Seconds (0.2), "-f inet addr add " + host1_sim0 + "/24 dev sim0");
-+ RunIp (hosts.Get (1), Seconds (0.2), "-f inet route add default via " + gw_sim1);
-+ himalis.AddIdlRoute (hosts.Get (1), "host", host1_srcid.c_str (), host0_srcid.c_str (),
-+ host1_sim0.c_str (), gw_sim1.c_str ());
++ RunIp (hosts.Get (1), Seconds (0.2), "-f inet addr add " + host1_sim0_v4 + "/24 dev sim0");
++ RunIp (hosts.Get (1), Seconds (0.2), "-f inet route add default via " + gw_sim1_v4);
++ RunIp (hosts.Get (1), Seconds (0.2), "-f inet6 addr add " + host1_sim0_v6 + "/64 dev sim0");
++ RunIp (hosts.Get (1), Seconds (0.2), "-f inet6 route add default via " + gw_sim1_v6);
++ himalis.AddIdlRoute (hosts.Get (1), Seconds (0.2), "host", host1_srcid.c_str (), host0_srcid.c_str (),
++ host1_sim0_v6.c_str (), gw_sim1_v6.c_str (), "sim0");
+
+ // Applications
+ DceApplicationHelper process;
@@ -138,7 +443,6 @@
+ apps = process.Install (hosts.Get (1));
+ apps.Start (Seconds (4.0));
+
-+#if 1
+ // client install to host0
+ process.SetBinary ("idecho-c");
+ process.ResetArguments ();
@@ -146,9 +450,9 @@
+ process.ParseArguments ("-d " + host1_srcid);
+ process.SetStackSize (1<<16);
+ apps = process.Install (hosts.Get (0));
-+ apps.Start (Seconds (4.5));
-+#endif
++ apps.Start (Seconds (5.0));
+
++ p2p.EnablePcapAll ("dce-himalis");
+
+ Simulator::Stop (Seconds (stopTime));
+ Simulator::Run ();
@@ -160,7 +464,7 @@
+}
diff -r 15b6876ea9ed example/dce-linux.cc
--- a/example/dce-linux.cc Tue Mar 06 14:44:40 2012 +0900
-+++ b/example/dce-linux.cc Thu Mar 08 17:19:00 2012 +0900
++++ b/example/dce-linux.cc Tue Mar 13 17:18:36 2012 +0900
@@ -103,7 +103,7 @@
}
@@ -172,8 +476,8 @@
processManager.Install (nodes);
diff -r 15b6876ea9ed example/himalis/idecho-c.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/example/himalis/idecho-c.cc Thu Mar 08 17:19:00 2012 +0900
-@@ -0,0 +1,157 @@
++++ b/example/himalis/idecho-c.cc Tue Mar 13 17:18:36 2012 +0900
+@@ -0,0 +1,161 @@
+/*****************************
+ * TP/ID/Locator echo client *
+ * *
@@ -201,7 +505,7 @@
+int connect_sockfd;
+const int one = 1;
+
-+void err_func(char *msg)
++void err_func(const char *msg)
+{
+ perror(msg);
+ exit(EXIT_FAILURE);
@@ -214,13 +518,13 @@
+ exit(EXIT_SUCCESS);
+}
+
++char buf[BUFFER_SIZE], id_src_str[IDL_IDSTRLEN], id_dst_str[IDL_IDSTRLEN];
+int main(int argc, char **argv)
+{
+ int read_siz = 0, write_siz, wrote_siz = 0;
+ int opt, idlconn_ecode, http_status = -1, connect_sockfd;
+ struct idl_id src_id, dst_id;
-+ char buf[BUFFER_SIZE], id_src_str[IDL_IDSTRLEN], id_dst_str[IDL_IDSTRLEN];
-+ struct sockid_idl serv, clnt;
++ struct sockid_idl idaddr;
+ unsigned short port = DEFAULT_SERVER_PORT;
+
+ while ((opt = getopt(argc, argv, "hd:s:p:")) != -1) {
@@ -253,18 +557,18 @@
+ SOL_SOCKET, SO_REUSEADDR, &one, sizeof(int)) < 0)
+ err_func("setsockopt");
+
-+ clnt.sidl_family = IDF_IDL;
-+ clnt.sidl_port = 0;
-+ clnt.sidl_id = src_id;
++ idaddr.sidl_family = IDF_IDL;
++ idaddr.sidl_port = 0;
++ memcpy (&idaddr.sidl_id, &src_id, sizeof (src_id));
+
-+ if (bind(connect_sockfd, (struct sockaddr *)&clnt, sizeof(clnt)) < 0)
++ if (bind(connect_sockfd, (struct sockaddr *)&idaddr, sizeof(idaddr)) < 0)
+ err_func("bind");
+
-+ serv.sidl_family = IDF_IDL;
-+ serv.sidl_port = htons(port);
-+ serv.sidl_id = dst_id;
++ idaddr.sidl_family = IDF_IDL;
++ idaddr.sidl_port = htons(port);
++ memcpy (&idaddr.sidl_id, &dst_id, sizeof (dst_id));
+
-+ if (connect(connect_sockfd, (struct sockaddr *)&serv, sizeof(serv)) < 0)
++ if (connect(connect_sockfd, (struct sockaddr *)&idaddr, sizeof(idaddr)) < 0)
+ err_func("connect");
+
+ fprintf(stderr, "-- Connected --\n");
@@ -275,6 +579,7 @@
+ do
+ {
+ fprintf(stderr, "-> ");
++#if 0
+ if (fgets(buf, BUFFER_SIZE, stdin) == NULL) {
+ if (ferror(stdin))
+ err_func("fgets");
@@ -282,13 +587,16 @@
+ break;
+ }
+ fflush(stdin);
++ write_siz = strlen(buf);
++#endif
+
-+ write_siz = strlen(buf);
+
+ do
+ {
++ char sendbuf[16] = "send echo";
++ write_siz = sizeof (sendbuf);
+ int result = send(connect_sockfd,
-+ buf + wrote_siz,
++ sendbuf + wrote_siz,
+ write_siz - wrote_siz, 0);
+ if (result < 0)
+ err_func("send");
@@ -333,7 +641,7 @@
+}
diff -r 15b6876ea9ed example/himalis/idecho-s.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/example/himalis/idecho-s.cc Thu Mar 08 17:19:00 2012 +0900
++++ b/example/himalis/idecho-s.cc Tue Mar 13 17:18:36 2012 +0900
@@ -0,0 +1,146 @@
+/*****************************
+ * TP/ID/Locator echo server *
@@ -355,14 +663,14 @@
+
+#include "idl.h" /* XXX */
+
-+#define BUFFER_SIZE 256 * 1024
++#define BUFFER_SIZE 1 * 1024
+#define DEFAULT_LISTEN_PORT 6001
+#define RCV_TIMEOUT_SEC 300
+
+int listen_sockfd, accept_sockfd = 0;
+const int TRUE = 1;
+
-+void err_func(char *msg)
++void err_func(const char *msg)
+{
+ perror(msg);
+ exit(EXIT_FAILURE);
@@ -380,13 +688,13 @@
+ exit(EXIT_SUCCESS);
+}
+
++char buf[BUFFER_SIZE], id_str[IDL_IDSTRLEN];
+int main(int argc, char **argv)
+{
+ int read_siz, wrote_siz = 0;
+ int opt;
+ struct idl_id src_id;
-+ char buf[BUFFER_SIZE], id_str[IDL_IDSTRLEN];
-+ struct sockid_idl serv, clnt;
++ struct sockid_idl idaddr;
+ socklen_t sidl_siz;
+ unsigned short port = DEFAULT_LISTEN_PORT;
+
@@ -420,12 +728,12 @@
+ SOL_SOCKET, SO_REUSEADDR, &TRUE, sizeof(int)) < 0)
+ err_func("setsockopt");
+
-+ serv.sidl_family = IDF_IDL;
-+ serv.sidl_port = htons(port);
-+ serv.sidl_id = src_id;
++ idaddr.sidl_family = IDF_IDL;
++ idaddr.sidl_port = htons(port);
++ memcpy (&idaddr.sidl_id, &src_id, sizeof (src_id));
+ sidl_siz = sizeof(struct sockid_idl);
+
-+ if (bind(listen_sockfd, (struct sockaddr *)&serv, sidl_siz) < 0)
++ if (bind(listen_sockfd, (struct sockaddr *)&idaddr, sidl_siz) < 0)
+ err_func("bind");
+
+ fprintf(stderr, "-- Listening --\n");
@@ -438,7 +746,7 @@
+ while (1)
+ {
+ if ((accept_sockfd = accept(listen_sockfd,
-+ (struct sockaddr *)&clnt, &sidl_siz)) < 0)
++ (struct sockaddr *)&idaddr, &sidl_siz)) < 0)
+ err_func("accept");
+
+ if (setsockopt(accept_sockfd,
@@ -446,7 +754,7 @@
+ err_func("setsockopt");
+
+ fprintf(stderr, "-- Connected --\n");
-+ idl_ntop(&clnt.sidl_id, id_str, IDL_IDSTRLEN);
++ idl_ntop(&idaddr.sidl_id, id_str, IDL_IDSTRLEN);
+ fprintf(stderr, "Client ID : %s\n", id_str);
+
+ do
@@ -483,7 +791,7 @@
+}
diff -r 15b6876ea9ed example/himalis/idl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/example/himalis/idl.h Thu Mar 08 17:19:00 2012 +0900
++++ b/example/himalis/idl.h Tue Mar 13 17:18:36 2012 +0900
@@ -0,0 +1,331 @@
+/*
+ * ID/Locator Split Architectur Implementation
@@ -510,7 +818,7 @@
+/*
+ * ID family and protocol family
+ */
-+#define IDF_IDL (38)
++#define IDF_IDL (37)
+#define PF_IDL IDF_IDL
+
+
@@ -818,8 +1126,8 @@
+
diff -r 15b6876ea9ed helper/himalis-helper.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/helper/himalis-helper.cc Thu Mar 08 17:19:00 2012 +0900
-@@ -0,0 +1,209 @@
++++ b/helper/himalis-helper.cc Tue Mar 13 17:18:36 2012 +0900
+@@ -0,0 +1,212 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2012 NICT
@@ -865,7 +1173,8 @@
+ Py_Finalize();
+}
+
-+PyObject *m_pycode;
++PyObject *m_pycode = NULL;
++
+void
+HimalisHelper::InitIdlRoutePy ()
+{
@@ -875,8 +1184,7 @@
+
+ try
+ {
-+ m_pycode = PyImport_ImportModule("idlroute");
-+ PyObject *pDict;
++ m_pycode = PyImport_ImportModule("idlroute");
+ int i=0;
+
+ if(m_pycode == NULL)
@@ -896,17 +1204,18 @@
+}
+
+void
-+HimalisHelper::AddIdlRoute (Ptr<Node> node, const char * host_or_fw,
++HimalisHelper::AddIdlRoute (Ptr<Node> node, Time at, const char * host_or_fw,
+ const char * src_id, const char * dst_id,
-+ const char * src_addr, const char * dst_addr)
++ const char * src_addr, const char * dst_addr,
++ const char *dev_name)
+{
-+ const char *format = "(sssss)";
++ std::string format = "(ssssss)";
+ PyObject* cmd_buf = NULL;
+ std::string value;
+
+ try{
-+ cmd_buf = PyObject_CallMethod(m_pycode, (char *)"mk_add_route_cmd\0", (char *)format,
-+ host_or_fw, src_id, dst_id, src_addr, dst_addr);
++ cmd_buf = PyObject_CallMethod(m_pycode, (char *)"mk_add_route_cmd\0", (char *)format.c_str (),
++ host_or_fw, src_id, dst_id, src_addr, dst_addr, dev_name);
+ if(cmd_buf == NULL)
+ {
+
@@ -929,7 +1238,7 @@
+
+ Ptr<LinuxSocketFdFactory> kern = node->GetObject<LinuxSocketFdFactory>();
+ std::string key (".net.idl.idlrt");
-+ Simulator::ScheduleWithContext (node->GetId (), Seconds (1.0),
++ Simulator::ScheduleWithContext (node->GetId (), at,
+ MakeEvent (&LinuxSocketFdFactory::Set, kern,
+ key, value));
+
@@ -937,11 +1246,12 @@
+}
+
+void
-+HimalisHelper::DelIdlRoute (Ptr<Node> node,
++HimalisHelper::DelIdlRoute (Ptr<Node> node, Time at,
+ const char * src_id, const char * dst_id)
+{
+ std::string value;
+ const char *format = "(ss)";
++
+ PyObject* cmd_buf = PyObject_CallMethod(m_pycode, (char *)"mk_del_route_cmd",
+ (char *)format,
+ src_id, dst_id);
@@ -958,9 +1268,10 @@
+ NS_LOG_DEBUG ("return value from python = " << value);
+ Ptr<LinuxSocketFdFactory> kern = node->GetObject<LinuxSocketFdFactory>();
+ std::string key (".net.idl.idlrt");
-+ Simulator::ScheduleWithContext (node->GetId (), Seconds (2.0),
++ Simulator::ScheduleWithContext (node->GetId (), at,
+ MakeEvent (&LinuxSocketFdFactory::Set, kern,
+ key, value));
++ Py_DECREF(cmd_buf);
+}
+
+void
@@ -973,10 +1284,10 @@
+}
+
+void
-+HimalisHelper::ShowIdlRoute (Ptr<Node> node)
++HimalisHelper::ShowIdlRoute (Ptr<Node> node, Time at)
+{
+ Ptr<LinuxSocketFdFactory> kern = node->GetObject<LinuxSocketFdFactory>();
-+ Simulator::ScheduleWithContext (node->GetId (), Seconds (2.0),
++ Simulator::ScheduleWithContext (node->GetId (), at,
+ &LinuxSocketFdFactory::ScheduleTask, kern,
+ MakeEvent (PrintIdlRoute, node));
+}
@@ -1031,8 +1342,8 @@
+} // namespace ns3
diff -r 15b6876ea9ed helper/himalis-helper.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/helper/himalis-helper.h Thu Mar 08 17:19:00 2012 +0900
-@@ -0,0 +1,101 @@
++++ b/helper/himalis-helper.h Tue Mar 13 17:18:36 2012 +0900
+@@ -0,0 +1,102 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2012 NICT
@@ -1117,12 +1428,13 @@
+ */
+ void SetAttribute (std::string name, const AttributeValue &value);
+
-+ void AddIdlRoute (Ptr<Node> node, const char * host_or_fw,
++ void AddIdlRoute (Ptr<Node> node, Time at, const char * host_or_fw,
+ const char * src_id, const char * dst_id,
-+ const char * src_addr, const char * dst_addr);
-+ void DelIdlRoute (Ptr<Node> node,
++ const char * src_addr, const char * dst_addr,
++ const char *dev_name);
++ void DelIdlRoute (Ptr<Node> node, Time at,
+ const char * src_id, const char * dst_id);
-+ void ShowIdlRoute (Ptr<Node> node);
++ void ShowIdlRoute (Ptr<Node> node, Time at);
+
+private:
+ /**
@@ -1136,7 +1448,7 @@
+#endif /* HIMALIS_HELPER_H */
diff -r 15b6876ea9ed idlroute
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/idlroute Thu Mar 08 17:19:00 2012 +0900
++++ b/idlroute Tue Mar 13 17:18:36 2012 +0900
@@ -0,0 +1,327 @@
+#! /usr/bin/python
+# -*- coding: utf-8 -*-
@@ -1243,7 +1555,7 @@
+ return dev_name
+
+
-+def mk_add_route_cmd(host_or_fw, id_1, id_2, src_addr, dst_addr):
++def mk_add_route_cmd(host_or_fw, id_1, id_2, src_addr, dst_addr, exp_dev_name):
+ buff = ADD + PROC_DELIMITER
+ if (host_or_fw == 'host'):
+ buff += HOST + PROC_DELIMITER
@@ -1302,7 +1614,7 @@
+
+ if (dev_name == None):
+ print 'Error: Network interface not found.'
-+ dev_name = "sim0"
++ dev_name = exp_dev_name
+ #return 1
+
+ buff += src_addr + PROC_DELIMITER
@@ -1465,9 +1777,21 @@
+ print 'The kernel is running which does not support ID/Locator.'
+
+
+diff -r 15b6876ea9ed model/cooja-loader-factory.cc
+--- a/model/cooja-loader-factory.cc Tue Mar 06 14:44:40 2012 +0900
++++ b/model/cooja-loader-factory.cc Tue Mar 13 17:18:36 2012 +0900
+@@ -214,7 +214,7 @@
+ if (sharedModule == 0)
+ {
+ void *handle = dlopen (cached.cachedFilename.c_str (),
+- RTLD_LAZY | RTLD_DEEPBIND | RTLD_LOCAL);
++ RTLD_LAZY | RTLD_DEEPBIND | RTLD_GLOBAL);
+ NS_ASSERT_MSG (handle != 0, "Could not open " << cached.cachedFilename << " " << dlerror ());
+ struct link_map *link_map;
+ dlinfo (handle, RTLD_DI_LINKMAP, &link_map);
diff -r 15b6876ea9ed model/libc-ns3.h
--- a/model/libc-ns3.h Tue Mar 06 14:44:40 2012 +0900
-+++ b/model/libc-ns3.h Thu Mar 08 17:19:00 2012 +0900
++++ b/model/libc-ns3.h Tue Mar 13 17:18:36 2012 +0900
@@ -103,6 +103,8 @@
NATIVE_EXPLICIT (strrchr, char * (*) (char *, int))
NATIVE (strcasecmp)
@@ -1479,7 +1803,7 @@
DCE (strndup)
diff -r 15b6876ea9ed model/linux-socket-fd-factory.cc
--- a/model/linux-socket-fd-factory.cc Tue Mar 06 14:44:40 2012 +0900
-+++ b/model/linux-socket-fd-factory.cc Thu Mar 08 17:19:00 2012 +0900
++++ b/model/linux-socket-fd-factory.cc Tue Mar 13 17:18:36 2012 +0900
@@ -461,6 +461,7 @@
void
LinuxSocketFdFactory::SetTask (std::string path, std::string value)
@@ -1516,9 +1840,12 @@
void
LinuxSocketFdFactory::InitializeStack (void)
{
-@@ -536,6 +558,7 @@
+@@ -534,8 +556,9 @@
+ this));
+ Set (".net.ipv4.conf.all.forwarding", "1");
Set (".net.ipv4.conf.all.log_martians", "1");
- // Set (".net.ipv6.conf.all.forwarding", "1");
+- // Set (".net.ipv6.conf.all.forwarding", "1");
++ Set (".net.ipv6.conf.all.forwarding", "1");
Set (".net.ipv6.conf.all.proxy_ndp", "1");
+ Set (".net.idl.idlrt", "BEAFBEAF");
@@ -1526,7 +1853,7 @@
{
diff -r 15b6876ea9ed model/linux-socket-fd-factory.h
--- a/model/linux-socket-fd-factory.h Tue Mar 06 14:44:40 2012 +0900
-+++ b/model/linux-socket-fd-factory.h Thu Mar 08 17:19:00 2012 +0900
++++ b/model/linux-socket-fd-factory.h Tue Mar 13 17:18:36 2012 +0900
@@ -44,7 +44,8 @@
virtual UnixFd *CreateSocket (int domain, int type, int protocol);
@@ -1547,19 +1874,20 @@
Ptr<EventIdHolder> event);
diff -r 15b6876ea9ed utils/setenv.zsh
--- a/utils/setenv.zsh Tue Mar 06 14:44:40 2012 +0900
-+++ b/utils/setenv.zsh Thu Mar 08 17:19:00 2012 +0900
-@@ -6,7 +6,7 @@
++++ b/utils/setenv.zsh Tue Mar 13 17:18:36 2012 +0900
+@@ -6,7 +6,8 @@
LD_LIBRARY_PATH="$BASE/ns-3-dce/build/lib:$BASE/build/lib:$BASE/build/bin:$BASE/ns-3-dce/build/bin:.:/usr/local/mpi/gcc/openmpi-1.4.3/lib/"
PKG_CONFIG_PATH="$BASE/build/lib/pkgconfig"
PATH="$BASE/build/bin:$BASE/build/sbin:/home/tazaki/hgworks/ns-3-dce-thehajime/build/bin:/home/tazaki/hgworks/ns-3-dce-thehajime/build/sbin:$PATH"
-PYTHONPATH=$BASE/ns-3-dev/build/debug/bindings/python:$BASE/ns-3-dev/src/visualizer:$BASE/pybindgen-0.15.0.795:$BASE/build/lib/python2.6/site-packages/
++DCE_PATH=`pwd`/build/bin_dce
+PYTHONPATH=$BASE/ns-3-dev/build/debug/bindings/python:$BASE/ns-3-dev/src/visualizer:$BASE/pybindgen-0.15.0.795:$BASE/build/lib/python2.6/site-packages/:$BASE/ns-3-dce
export LD_LIBRARY_PATH PKG_CONFIG_PATH PATH PYTHONPATH
cd $BASE/ns-3-dce
diff -r 15b6876ea9ed wscript
--- a/wscript Tue Mar 06 14:44:40 2012 +0900
-+++ b/wscript Thu Mar 08 17:19:00 2012 +0900
++++ b/wscript Tue Mar 13 17:18:36 2012 +0900
@@ -35,6 +35,7 @@
conf.check(header_name='sys/stat.h', define_name='HAVE_SYS_STAT_H', mandatory=False)
conf.check(header_name='dirent.h', define_name='HAVE_DIRENT_H', mandatory=False)
@@ -1568,13 +1896,23 @@
conf.env.prepend_value('LINKFLAGS', '-Wl,--no-as-needed')
conf.env.append_value('LINKFLAGS', '-pthread')
conf.env.append_value('LINKFLAGS', '-Wl,--dynamic-linker=' +
-@@ -307,6 +308,18 @@
+@@ -192,6 +193,8 @@
+ ['unix-client', []],
+ ['udp-echo-server', []],
+ ['udp-echo-client', []],
++ ['idl-server', []],
++ ['idl-client', []],
+ # ['little-cout', []],
+ ]
+ for name,lib in dce_examples:
+@@ -307,6 +310,23 @@
target='bin/dce-fga-crawdad',
source=['example/dce-fga-crawdad.cc'])
+ module.add_example(**dce_kw(target = 'bin_dce/idecho-s',
+ source = ['example/himalis/idecho-s.cc'],
+ cflags = ['-fPIC -I../ns-3-linux/net-next2.6/include']))
++
+
+ module.add_example(**dce_kw(target = 'bin_dce/idecho-c',
+ source = ['example/himalis/idecho-c.cc'],
@@ -1584,10 +1922,14 @@
+ target='bin/dce-himalis-simple',
+ source=['example/dce-himalis-simple.cc'])
+
++ module.add_example(needed = ['core', 'dce', 'csma', 'point-to-point','visualizer'],
++ target='bin/dce-himalis-handoff',
++ source=['example/dce-himalis-handoff.cc'])
++
def build(bld):
build_netlink(bld)
-@@ -396,6 +409,7 @@
+@@ -396,6 +416,7 @@
'helper/quagga-helper.cc',
'helper/ccn-client-helper.cc',
'helper/mip6d-helper.cc',
@@ -1595,7 +1937,7 @@
]
module_headers = [
-@@ -411,6 +425,7 @@
+@@ -411,6 +432,7 @@
'helper/quagga-helper.h',
'helper/ccn-client-helper.h',
'helper/mip6d-helper.h',
@@ -1603,7 +1945,7 @@
]
module_source = module_source + kernel_source
module_headers = module_headers + kernel_headers
-@@ -420,7 +435,7 @@
+@@ -420,7 +442,7 @@
headers=module_headers,
use=uselib,
includes=kernel_includes,