ndnSIM:劫持者无法工作并清空PIT

时间:2013-11-24 21:37:53

标签: c++ ns-3

我正在研究一种简单的树形拓扑。我希望一个特定节点(路由器)像劫持者一样工作,所以我尝试将此节点设置为Hijacker,但此节点的工作方式与普通节点类似,并将所有节点转发到正确的目的地。

此外,我无法填充拓扑的每个节点的PIT,如果我尝试模拟应用程序,每个PIT都是空的,但是使用可视化工具,我可以看到每个数据包都传递给每个节点。

这是我的代码:

// Install CCNx stack on all nodes
    ndn::StackHelper ccnxHelper;
    ccnxHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");  
    ccnxHelper.SetPit ("ns3::ndn::pit::SerializedSize", "MaxSize", "100");
    ccnxHelper.SetContentStore ("ns3::ndn::cs::Lru", "MaxSize", "1");   // Content Store OFF
    ccnxHelper.InstallAll ();

    // Installing global routing interface on all nodes
    ndn::GlobalRoutingHelper ccnxGlobalRoutingHelper;
    ccnxGlobalRoutingHelper.InstallAll ();

    // Getting containers for the consumer/producer
    Ptr<Node> consumer1 = Names::Find<Node> ("leaf-1");
    Ptr<Node> consumer2 = Names::Find<Node> ("leaf-2");
    Ptr<Node> consumer4 = Names::Find<Node> ("leaf-4");
    Ptr<Node> producer = Names::Find<Node> ("leaf-3");
    Ptr<Node> router3 = Names::Find<Node> ("rtr-3");
    Ptr<Node> router2 = Names::Find<Node> ("rtr-2");
    Ptr<Node> router1 = Names::Find<Node> ("rtr-1");


    //consumerswindow
    ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerWindow");
    consumerHelper.SetAttribute ("Window", UintegerValue (100)); 
    consumerHelper.SetAttribute ("Size", StringValue("0.1"));   
    consumerHelper.SetPrefix ("/rtr-3/leaf-3");
    consumerHelper.Install (consumer1);
    consumerHelper.SetPrefix ("/rtr-3/leaf-3");
    consumerHelper.Install (consumer2);

   //hijaker router1
   ndn::AppHelper hijackerHelper ("Hijacker");
   hijackerHelper.Install (router1);

   //attacker consumercbr
   ndn::AppHelper consumerHelper_attack ("ns3::ndn::ConsumerCbr");
   consumerHelper_attack.SetAttribute ("Frequency", StringValue ("1")); 
   consumerHelper_attack.SetPrefix ("/rtr-3/leaf-3");
   consumerHelper_attack.Install (consumer4);


   //producer leaf-3
   ndn::AppHelper producerHelper ("ns3::ndn::Producer");
   producerHelper.SetAttribute ("PayloadSize", StringValue("1024")); 

   ccnxGlobalRoutingHelper.AddOrigins ("/rtr-3", producer);
   producerHelper.SetPrefix ("/rtr-3");
   producerHelper.Install (producer);

   // Calculate and install FIBs
   ccnxGlobalRoutingHelper.CalculateRoutes ();

   Simulator::Schedule (Seconds (1.0), printPitStats, router1); //print statistics about PIT
   Simulator::Stop (Seconds (5.0));
   Simulator::Run ();
   Simulator::Destroy (); 

我哪里错了?

1 个答案:

答案 0 :(得分:0)

此对话已移至ndnSIM电子邮件列表。