[ndnSIM] Multi-hop wireless Ad-hoc
Mohamed Benahmed
art_med_ahmed at yahoo.fr
Sat Apr 9 16:18:09 PDT 2016
I have an problem in multi-hop wireless Adhoc i need to install NDN in 3 node A--->B----->c (A:consumer ; B: forwarder ; C: producer ) but the problem is B does not forward the interest towards C my code :-----------------------------------------------------------#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/ndnSIM-module.h"
using namespace std;namespace ns3 {
NS_LOG_COMPONENT_DEFINE("ndn.WifiExample");
int main(int argc, char* argv[]){ CommandLine cmd; cmd.Parse(argc, argv);
WifiHelper wifi = WifiHelper::Default(); wifi.SetStandard(WIFI_PHY_STANDARD_80211a); wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "DataMode", StringValue("OfdmRate24Mbps"));
YansWifiChannelHelper wifiChannel; // = YansWifiChannelHelper::Default (); wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel"); wifiChannel.AddPropagationLoss("ns3::ThreeLogDistancePropagationLossModel"); wifiChannel.AddPropagationLoss("ns3::NakagamiPropagationLossModel");
// YansWifiPhy wifiPhy = YansWifiPhy::Default(); YansWifiPhyHelper wifiPhyHelper = YansWifiPhyHelper::Default(); wifiPhyHelper.SetChannel(wifiChannel.Create()); // wifiPhyHelper.Set("TxPowerStart", DoubleValue(5)); // wifiPhyHelper.Set("TxPowerEnd", DoubleValue(5));
NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default(); wifiMacHelper.SetType("ns3::AdhocWifiMac"); NodeContainer nodes; nodes.Create(3); MobilityHelper mobility; // Put everybody into a line Ptr<ListPositionAllocator> initialAlloc = CreateObject<ListPositionAllocator> (); for (uint32_t i = 0; i < nodes.GetN (); ++i) { initialAlloc->Add (Vector (i*400, i,i)); mobility.SetPositionAllocator(initialAlloc);
//////////////// // 1. Install Wifi NetDeviceContainer wifiNetDevices = wifi.Install(wifiPhyHelper, wifiMacHelper, nodes);
// 2. Install Mobility model mobility.Install(nodes);
// 3. Install NDN stack NS_LOG_INFO("Installing NDN stack"); ndn::StackHelper ndnHelper; // ndnHelper.AddNetDeviceFaceCreateCallback (WifiNetDevice::GetTypeId (), MakeCallback // (MyNetDeviceFaceCallback)); ndnHelper.SetOldContentStore("ns3::ndn::cs::Lru", "MaxSize", "1000"); ndnHelper.SetDefaultRoutes(true); ndnHelper.Install(nodes);
// Set BestRoute strategy ndn::StrategyChoiceHelper::Install(nodes, "/", "/localhost/nfd/strategy/brodcast");
// 4. Set up applications NS_LOG_INFO("Installing Applications");
ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr"); consumerHelper.SetPrefix("/prefix"); consumerHelper.SetAttribute("Frequency", StringValue("1")); ApplicationContainer consumer = consumerHelper.Install(nodes.Get(0)); consumer.Start(Seconds(2)); consumer.Stop(Seconds(6));
ndn::AppHelper producerHelper("ns3::ndn::Producer"); producerHelper.SetPrefix("/prefix"); producerHelper.SetAttribute("PayloadSize", StringValue("1200")); producerHelper.Install(nodes.Get(2));
Simulator::Stop(Seconds(10.0));
Simulator::Run(); Simulator::Destroy();
return 0;}
} // namespace ns3
intmain(int argc, char* argv[]){ return ns3::main(argc, argv);}-------------------------------------------------------------------------------------I would like to express my gratitude for all your help in this matter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160409/6861aebd/attachment.html>
More information about the ndnSIM
mailing list