Merge remote-tracking branch 'git.irl/car2car'
diff --git a/.gitignore b/.gitignore
index cbdfd81..070f0ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,7 @@
waf
*~
.DS_Store
+*\#
+*.txt
+*.pdf
+*.dot
\ No newline at end of file
diff --git a/apps/ccnx-consumer.cc b/apps/ccnx-consumer.cc
index d9d1ec8..eafa77d 100644
--- a/apps/ccnx-consumer.cc
+++ b/apps/ccnx-consumer.cc
@@ -108,7 +108,7 @@
, m_seqMax (0) // don't request anything
{
NS_LOG_FUNCTION_NOARGS ();
-
+
m_rtt = CreateObject<RttMeanDeviation> ();
}
@@ -136,7 +136,7 @@
Time now = Simulator::Now ();
Time rto = m_rtt->RetransmitTimeout ();
-
+
while (!m_seqTimeouts.empty ())
{
SeqTimeoutsContainer::index<i_timestamp>::type::iterator entry =
@@ -189,7 +189,7 @@
uint32_t seq=std::numeric_limits<uint32_t>::max (); //invalid
// std::cout << Simulator::Now ().ToDouble (Time::S) << "s max -> " << m_seqMax << "\n";
-
+
while (m_retxSeqs.size ())
{
seq = *m_retxSeqs.begin ();
@@ -218,7 +218,7 @@
seq = m_seq++;
}
-
+
// std::cout << Simulator::Now ().ToDouble (Time::S) << "s -> " << seq << "\n";
//
@@ -297,7 +297,7 @@
m_pathWeightsTrace (GetNode (), tag->GetSourceNode (), seq, tag->GetTotalWeight ());
// if (Names::FindName (GetNode ()) == "36")// || Names::FindName (GetNode ()) == "40"|| Names::FindName (GetNode ()) == "5")
// std::cout << Simulator::Now () << "\t" << boost::cref(*tag) << " = " << tag->GetTotalWeight () << "\n";
- }
+}
}
void
diff --git a/apps/ccnx-producer.cc b/apps/ccnx-producer.cc
index 1148767..37209b3 100644
--- a/apps/ccnx-producer.cc
+++ b/apps/ccnx-producer.cc
@@ -111,7 +111,7 @@
Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
header->SetName (Create<CcnxNameComponents> (interest->GetName ()));
- NS_LOG_INFO ("Respodning with ContentObject:\n" << boost::cref(*header));
+ NS_LOG_INFO ("node("<< GetNode()->GetId() <<") respodning with ContentObject:\n" << boost::cref(*header));
Ptr<Packet> packet = Create<Packet> (m_virtualPayloadSize);
// Ptr<const WeightsPathStretchTag> tag = origPacket->RemovePacketTag<WeightsPathStretchTag> ();
diff --git a/examples/car2car-wifi.cc b/examples/car2car-wifi.cc
new file mode 100644
index 0000000..2ef9f5e
--- /dev/null
+++ b/examples/car2car-wifi.cc
@@ -0,0 +1,106 @@
+#include "ns3/core-module.h"
+#include "ns3/network-module.h"
+#include "ns3/applications-module.h"
+#include "ns3/wifi-module.h"
+#include "ns3/mobility-module.h"
+#include "ns3/internet-module.h"
+#include "ns3/NDNabstraction-module.h"
+
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE ("ThirdScriptExample");
+
+int
+main (int argc, char *argv[])
+{
+ CommandLine cmd;
+ cmd.Parse (argc,argv);
+ NodeContainer producerNode;
+ producerNode.Create (1);
+ NodeContainer consumerNodes;
+ consumerNodes.Create(2);
+ YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
+ YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
+ phy.SetChannel (channel.Create ());
+ WifiHelper wifi = WifiHelper::Default ();
+ wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
+ NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
+ /*Ssid ssid = Ssid ("ns-3-ssid");
+ mac.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));*/
+ mac.SetType("ns3::AdhocWifiMac");
+ NetDeviceContainer producerDevices;
+ producerDevices = wifi.Install (phy, mac, producerNode);
+ /*mac.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
+ */
+ NetDeviceContainer consumerDevices;
+ consumerDevices = wifi.Install (phy, mac, consumerNodes);
+
+ MobilityHelper mobility;
+ mobility.SetPositionAllocator ("ns3::HighwayPositionAllocator",
+ "Start", VectorValue(Vector(0.0, 0.0, 0.0)),
+ "Direction", DoubleValue(0.0),
+ "Length", DoubleValue(1000.0));
+
+ mobility.SetMobilityModel("ns3::ConstantVelocityMobilityModel",
+ "ConstantVelocity", VectorValue(Vector(26.8224, 0, 0)));
+ mobility.Install (producerNode);
+
+ mobility.SetMobilityModel("ns3::ConstantVelocityMobilityModel",
+ "ConstantVelocity", VectorValue(Vector(26.8224, 0, 0)));
+ mobility.Install (consumerNodes);
+
+
+ // 1. Set RoutingHelper to support prefix
+ //InternetStackHelper stack;
+ //Ipv4GlobalRoutingHelper ipv4RoutingHelper ("ns3::Ipv4GlobalRoutingOrderedNexthops");
+ //stack.SetRoutingHelper (ipv4RoutingHelper);
+
+ // 2. Install CCNx stack
+ NS_LOG_INFO ("Installing CCNx stack");
+ CcnxStackHelper ccnxHelper;
+ std::string strategy = "ns3::CcnxFloodingStrategy";
+ ccnxHelper.SetForwardingStrategy (strategy);
+ ccnxHelper.SetDefaultRoutes(true);
+ //ccnxHelper.EnableLimits (false, Seconds(0.1));
+ ccnxHelper.InstallAll ();
+
+ // 3. Install IP stack
+ //stack.Install (consumerNode);
+ //stack.Install (producerNode);
+
+ // 4. Assign Addresses
+ //Ipv4AddressHelper address;
+ //address.SetBase ("10.1.3.0", "255.255.255.0");
+ //address.Assign (consumerDevices);
+ //Ipv4InterfaceContainer producerInterface = address.Assign (producerDevices);
+
+ // 5. Populate FIB based on IPv4 global routing controller
+ //ccnxHelper.InstallFakeGlobalRoutes ();
+ //ccnxHelper.InstallRouteTo (producerNode.Get(0));
+
+ // 6. Set up applications
+ NS_LOG_INFO ("Installing Applications");
+ std::ostringstream prefix;
+ prefix << "/" << producerNode.Get(0)->GetId ();
+
+ CcnxAppHelper consumerHelper ("ns3::CcnxConsumer");
+ consumerHelper.SetPrefix (prefix.str ());
+ consumerHelper.SetAttribute ("MeanRate", StringValue ("1Mbps"));
+ ApplicationContainer consumers = consumerHelper.Install (consumerNodes);
+
+ // consumers.Start (Seconds (0.0));
+ // consumers.Stop (finishTime);
+
+ CcnxAppHelper producerHelper ("ns3::CcnxProducer");
+ producerHelper.SetPrefix (prefix.str ());
+ producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ ApplicationContainer producers = producerHelper.Install (producerNode);
+
+ Simulator::Stop (Seconds (10.0));
+ Simulator::Run ();
+ Simulator::Destroy ();
+ return 0;
+}
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index 781bb72..78266fe 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -124,8 +124,10 @@
/// \todo Implement tracing, if requested
- if (!IsUp ())
+ if (!IsUp ()){
+ NS_LOG_INFO("CcnxFace is not up.");
return false;
+ }
LeakBucket ();
diff --git a/wscript b/wscript
index a1fbfb7..2643c67 100644
--- a/wscript
+++ b/wscript
@@ -126,4 +126,8 @@
obj = bld.create_ns3_program('vanet-ccnx', ['NDNabstraction', 'highway-mobility'])
obj.source = 'examples/vanet-ccnx.cc'
+ obj = bld.create_ns3_program('car2car-wifi', ['internet', 'applications', 'visualizer', 'NDNabstraction'])
+ obj.source = 'examples/car2car-wifi.cc'
+
+
bld.ns3_python_bindings()