[ndnSIM] ndnSIM Digest, Vol 63, Issue 10
Rajvardhan Deshmukh
rdeshmukh at umass.edu
Tue Feb 13 12:14:56 PST 2018
Hi Iel,
> Message: 3
> Date: Mon, 12 Feb 2018 17:48:02 +0800
> From: Iel Cadence <ielumiere97 at gmail.com>
> To: ndnsim at lists.cs.ucla.edu
> Subject: [ndnSIM] Dynamically changing prefixes
> Message-ID:
> <CAMtwkqeEtMuUYwY8Lo3N5dKY5BEdUNUo=sRYSCR76yCxwg5K4A at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Good day! Is it possible for me to set the prefixes of the consumer and
> producer (through the App Helpers) as something that always changes?
> Like for example, I wanted to set the prefix as the node's current
> location
> in the simulation. Where can I start to make changes?
>
> P.S. sorry, I am new to ndnSIM (and to ns3, really) and this is for our
> group's thesis. Thank you!
void handler ( NodeContainer &nodes,AppHelper &consumerHelper)
{
string s_geoName;
for(int i=1;i<(int)nodes.GetN();i++)
{
Ptr<ConstantVelocityMobilityModel> mob =
nodes.Get(i)->GetObject<ConstantVelocityMobilityModel>();
Vector v_value=mob->GetPosition();
s_geoName=Gname(v_value.x,v_value.y);
consumerHelper.SetPrefix (s_geoName);
consumerHelper.Install (nodes.Get (i));
s_geoName.clear();
}
}
You can use th ns3 Scheduler to call a function that updates prefix
every i_t (time units)
for(int i_t=0;i_t<STOP_TIME;i_t++)
{
Simulator::Schedule(Seconds(i_t), &handler,nodes,consumerHelper);
}
More information about the ndnSIM
mailing list