<div dir="ltr"><div><div><div><div>Hi Monika,<br><br></div>First, don't be afraid and don't hesitate to look more attentively into the code. That's how we all learn. :)<br></div><br>So, you can use the traced callbacks as following (Example for a function YOURFUNCTION implemented at the Producer application):<br><br>wifi_mac->TraceConnectWithoutContext("Assoc", MakeCallback(&Producer::YOURFUNCTION, this));<br>wifi_mac->TraceConnectWithoutContext("DeAssoc", MakeCallback(&Producer::YOURFUNCTION, this));<br></div><div><br>How
 it works actually (I will try to explain it easier...): when the event 
of association happens, the traced callback at the sta-wifi-mac will be 
called. Here, you catch this event and extend its functionnalities as 
you want precising your own function. The same principle is for the 
Deassoc.<br></div><br></div>Well, now as you can see you will need to 
retrieve the WifiMac of your node. I think that at the application class
 you have a pointer to the node and, thus, you can easily get the access
 to WifiNetDevice and then to WifiMac. To get this stuff, I invite you 
to look at the corresponding functions of the corresponding objects.<br><div><br></div><div>So basically, the algorithm will be as follows:<br></div><div>You iterate all NetDevices in your node and try to find the WifiNetDevice (if any).<br></div><div>For example, you can use the ns3::DynamicCast<ns3::WifiNetDevice> to convert from NetDevice to WifiNetDevice.<br></div><div>Then,
 you try to get the WifiMac using an attributed function (GetMac() in 
this case ;-)). In my example above, I called this parameter wifi_mac 
but you can choose another name. It will be something like: 
Ptr<WifiMac> wifi_mac = wireless_net_device->GetMac();<br><br>Note that all of the described above should be done only once. So, try to select a good place where to do this.<br></div><div>That's all actually. :)<br><br></div><div>Best,<br></div>Natalya<div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-04-27 23:55 GMT+02:00 Monika Dangi <span dir="ltr"><<a href="mailto:monikabaraut@gmail.com" target="_blank">monikabaraut@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hello Rozhonova,<br></div>Thank-you for your reply. I am new to ndnSIM and ns3. i read extensive on what are callbacks and how to use them. But i am learner, i could not called callbacks on association and deassociation event.<br></div>Can you please elaborate it. i can tell you my algorithm:<br></div><div>this shold be done by the application installed on mobile node.<br></div>on_association()<br></div>{  start_time=scheduler::now(); // start_time a variable defined in application header<br></div>  rto=double(2.0) // rto is variable defined in application header <div>}<br><br></div><div>It may be small problem for you but really i m not getting how to start, i mean where to write the callback signature and where to setup write makecallback(). do i need to write this(on_association) function signature in ns3::sta-wifi-mac or in application.cc file?? i can see only tracecallback on association, can i do the required functionality on these tracecall or do i need to add new callbacks?? <br><br></div><div>please guide me here as i have no body to ask to and i am confused after reading so much about callbacks in ns3. <br></div><div><br>Thank-you in advance<br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 24, 2016 at 9:56 AM, Natalya Rozhnova <span dir="ltr"><<a href="mailto:rozhnova.natalya@gmail.com" target="_blank">rozhnova.natalya@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Monika,<br>
<br>
This is not a very trivial problem :)<br>
<br>
Well, what you can do is to look into the ns3/wifi module and use the callbacks provided by the sta-wifi-mac on association and disassociation events.<br>
You can use these callbacks from your producer node and activate whatever you want when this events happen. Or, if the implemented callbacks are not sufficient for your goal, you can add your own ones.<br>
<br>
Hope it helps,<br>
Best,<br>
Natalya<br>
<div><div><br>
> Le 24 avr. 2016 à 15:19, Monika Dangi <<a href="mailto:monikabaraut@gmail.com" target="_blank">monikabaraut@gmail.com</a>> a écrit :<br>
><br>
> Thank you Lixia Zhang for your reply.<br>
> well my problem is the producer is mobile, and i want the producer application to know when the point of attachment to a router is changed so that the retransmission timer is set accordingly. Is there any function in ns3/mobility-module.h or in the ns3/wifi-module.h( perhaps in YansWifiPhyHelper ) that returns the node id of the router to which the mobile node ( producer ) is attached????  The scenario is, there is a grid of nodes and an mobile node which is moving randomly in any direction and may get attached to any grid node and starts sending packet.<br>
><br>
> i just want to know the time till a mobile node stays attached to a router(grid node), so i thought if there is any function in ns3/mobility-module.h or ns3/wifi-module.h, that can tell the current attached router node's id then i can calculate the time mobile node stays attached to a router.<br>
> i hope you understand the scenario.<br>
> Thank-you<br>
><br>
> On Wed, Apr 20, 2016 at 8:13 PM, Lixia Zhang <<a href="mailto:lixia@cs.ucla.edu" target="_blank">lixia@cs.ucla.edu</a>> wrote:<br>
><br>
>> On Apr 20, 2016, at 4:24 AM, Monika Dangi <<a href="mailto:monikabaraut@gmail.com" target="_blank">monikabaraut@gmail.com</a>> wrote:<br>
>><br>
>> Hey All,<br>
>> i am working on mobility model in NDN, well there is a way of communication from application layer to network layer. But I am stuck at how to tell application layer that the mobile node has moved and now the point of attachment is changed.<br>
><br>
> Not sure I understand the picture in your mind.<br>
> 1/ NDN's communication model is data fetching: consumer app sends interest packets, that either successfully bring back data packets, or fail to do do.<br>
> 2/ if the mobile nodes are consumers, consumers do not need to do anything special when moving.<br>
> 3/ if the mobile nodes are producers, depending how producer mobility is handled, consumers figure out ways to get the data produced by mobile producers.<br>
> 4/ there is a recent paper on<br>
> "A Survey of Mobility Support in Named Data Networking"<br>
> <a href="http://lasr.cs.ucla.edu/afanasyev/data/files/Zhang/nom16-ndn-mobility-survey.pdf" rel="noreferrer" target="_blank">http://lasr.cs.ucla.edu/afanasyev/data/files/Zhang/nom16-ndn-mobility-survey.pdf</a><br>
><br>
>> Is there anybody working on similar problem? or can anybody provide me literature so that i can look myself?<br>
>><br>
>> Thank-you<br>
>><br>
>> --<br>
>> Monika<br>
>> MTech CSE<br>
>> IIT Roorkee<br>
>> _______________________________________________<br>
>> ndnSIM mailing list<br>
>> <a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank">ndnSIM@lists.cs.ucla.edu</a><br>
>> <a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a><br>
><br>
><br>
><br>
><br>
> --<br>
> Monika<br>
> MTech CSE<br>
> IIT Roorkee<br>
> _______________________________________________<br>
> ndnSIM mailing list<br>
> <a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank">ndnSIM@lists.cs.ucla.edu</a><br>
> <a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div><div dir="ltr"><div><div>Monika<br></div>MTech CSE<br></div>IIT Roorkee<br></div></div>
</div>
</div></div></blockquote></div><br></div>