[ndnSIM] node names find matching prefix

Alex Afanasyev alexander.afanasyev at ucla.edu
Sun May 11 23:03:42 PDT 2014


Hi Josh,

Unfortunately, as of right now, you have to do a little bit more job than that.  

You have to iterate over all nodes (NS-3 has a global variable for that) and check their names. Something like that:

for (NodeList::Iterator node = NodeList::Begin(); node != NodeList::End(); node++)
  {
    if (Names::FindName (*node).compare (0, sizeof("consumer-"), "consumer-") == 0)
      {
        consumerHelper.Install (*node);
      }
  }

If you can spend some time and implement a generic way for doing this in AppHelper, I would be happy to merge that code in.

---
Alex


On May 11, 2014, at 10:27 PM, Josh J <joshjdevl at gmail.com> wrote:

> Hi,
> 
> I would like to install the consumer helper on all nodes which begin with "consumer", so I tried the following though receive a segfault. Is there a way I can find and match all nodes beginning with a certain name?
> 
>   // Consumer
>   ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerZipfMandelbrot");
>   // Consumer will request /prefix/0, /prefix/1, ...
>   consumerHelper.SetPrefix ("/producer1");
>   consumerHelper.SetAttribute ("Frequency", StringValue ("10")); // 10 interests a second
>   consumerHelper.SetAttribute("Randomize",    StringValue ("uniform"));
>   consumerHelper.Install (Names::Find<Node>("consumer*"));
> 
> 
> Thanks,
> Josh
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim





More information about the ndnSIM mailing list