[ndnSIM] How can application detect change in point of attachment to the Internet

Natalya Rozhnova rozhnova.natalya at gmail.com
Thu Apr 28 02:06:41 PDT 2016


Hi Monika,

First, don't be afraid and don't hesitate to look more attentively into the
code. That's how we all learn. :)

So, you can use the traced callbacks as following (Example for a function
YOURFUNCTION implemented at the Producer application):

wifi_mac->TraceConnectWithoutContext("Assoc",
MakeCallback(&Producer::YOURFUNCTION, this));
wifi_mac->TraceConnectWithoutContext("DeAssoc",
MakeCallback(&Producer::YOURFUNCTION, this));

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.

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.

So basically, the algorithm will be as follows:
You iterate all NetDevices in your node and try to find the WifiNetDevice
(if any).
For example, you can use the ns3::DynamicCast<ns3::WifiNetDevice> to
convert from NetDevice to WifiNetDevice.
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();

Note that all of the described above should be done only once. So, try to
select a good place where to do this.
That's all actually. :)

Best,
Natalya


2016-04-27 23:55 GMT+02:00 Monika Dangi <monikabaraut at gmail.com>:

> Hello Rozhonova,
> 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.
> Can you please elaborate it. i can tell you my algorithm:
> this shold be done by the application installed on mobile node.
> on_association()
> {  start_time=scheduler::now(); // start_time a variable defined in
> application header
>   rto=double(2.0) // rto is variable defined in application header
> }
>
> 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??
>
> please guide me here as i have no body to ask to and i am confused after
> reading so much about callbacks in ns3.
>
> Thank-you in advance
>
> On Sun, Apr 24, 2016 at 9:56 AM, Natalya Rozhnova <
> rozhnova.natalya at gmail.com> wrote:
>
>> Hi Monika,
>>
>> This is not a very trivial problem :)
>>
>> 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.
>> 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.
>>
>> Hope it helps,
>> Best,
>> Natalya
>>
>> > Le 24 avr. 2016 à 15:19, Monika Dangi <monikabaraut at gmail.com> a écrit
>> :
>> >
>> > Thank you Lixia Zhang for your reply.
>> > 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.
>> >
>> > 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.
>> > i hope you understand the scenario.
>> > Thank-you
>> >
>> > On Wed, Apr 20, 2016 at 8:13 PM, Lixia Zhang <lixia at cs.ucla.edu> wrote:
>> >
>> >> On Apr 20, 2016, at 4:24 AM, Monika Dangi <monikabaraut at gmail.com>
>> wrote:
>> >>
>> >> Hey All,
>> >> 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.
>> >
>> > Not sure I understand the picture in your mind.
>> > 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.
>> > 2/ if the mobile nodes are consumers, consumers do not need to do
>> anything special when moving.
>> > 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.
>> > 4/ there is a recent paper on
>> > "A Survey of Mobility Support in Named Data Networking"
>> >
>> http://lasr.cs.ucla.edu/afanasyev/data/files/Zhang/nom16-ndn-mobility-survey.pdf
>> >
>> >> Is there anybody working on similar problem? or can anybody provide me
>> literature so that i can look myself?
>> >>
>> >> Thank-you
>> >>
>> >> --
>> >> Monika
>> >> MTech CSE
>> >> IIT Roorkee
>> >> _______________________________________________
>> >> ndnSIM mailing list
>> >> ndnSIM at lists.cs.ucla.edu
>> >> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>> >
>> >
>> >
>> >
>> > --
>> > Monika
>> > MTech CSE
>> > IIT Roorkee
>> > _______________________________________________
>> > ndnSIM mailing list
>> > ndnSIM at lists.cs.ucla.edu
>> > http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>>
>>
>
>
> --
> Monika
> MTech CSE
> IIT Roorkee
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160428/d556b669/attachment.html>


More information about the ndnSIM mailing list