Bug 653 - NetDevice link change callback proposal
NetDevice link change callback proposal
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: devices
ns-3-dev
All All
: P5 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-06 17:56 UTC by Tom Henderson
Modified: 2009-09-15 03:06 UTC (History)
1 user (show)

See Also:


Attachments
proposed patch (14.11 KB, patch)
2009-08-06 17:58 UTC, Tom Henderson
Details | Diff
std::list<Callback> => TracedCallback (13.10 KB, patch)
2009-08-14 03:13 UTC, Sebastien Vincent
Details | Diff
Use TracedCallback object in *-net-device (14.56 KB, patch)
2009-08-24 04:13 UTC, Sebastien Vincent
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Henderson 2009-08-06 17:56:47 UTC
From Sebastien Vincent:

In NetDevice, there is a callback when device change state (UP or DOWN). 
It is used mainly by ArpL3Protocol to flush ARP cache.
But for future IPv6 integration, it would be also useful to use it to 
purge Neighbor Discovery cache.

So I propose to replace single callback in NetDevice base and sub 
classes by a list of link change callback.

The main API change would be :

NetDevice::SetLinkChangeCallback(Callback<void> callback) => 
NetDevice::AddLinkChangeCallback(Callback<void> callback)

In all NetDevice's subclasses, replace all Callback<void> 
m_linkChangeCallback by std::list<Callback<void> m_linkChangeCallbacks.
When link change, call every callbacks of the list.


Thread/discussion started on developers list:
http://mailman.isi.edu/pipermail/ns-developers/2009-July/006280.html
Comment 1 Tom Henderson 2009-08-06 17:58:16 UTC
Created attachment 544 [details]
proposed patch

from Sebastien Vincent, July 27 2009
Comment 2 Sebastien Vincent 2009-08-14 03:13:13 UTC
Created attachment 560 [details]
std::list<Callback> => TracedCallback

Update patch :
- typedef TracedCallback to ListCallback;
- use ListCallback in NetDevice (csma, point-to-point, wifi, emu).
Comment 3 Tom Henderson 2009-08-24 00:58:23 UTC
(In reply to comment #2)
> Created an attachment (id=560) [details]
> std::list<Callback> => TracedCallback
> 
> Update patch :
> - typedef TracedCallback to ListCallback;
> - use ListCallback in NetDevice (csma, point-to-point, wifi, emu).
> 

For the moment, how about just removing the typedef until requirements for a ListCallback are better sorted out, and just using a TracedCallback (with your other changes)?

Plus, we need to patch CHANGES.html.
Comment 4 Sebastien Vincent 2009-08-24 04:13:32 UTC
Created attachment 570 [details]
Use TracedCallback object in *-net-device

Update patch. 

It also add code to flush IPv6 neighbor discovery cache (in Icmpv6L4Protocol) and some text in CHANGES.html.
Comment 5 Tom Henderson 2009-09-05 00:43:06 UTC
(In reply to comment #4)
> Created an attachment (id=570) [details]
> Use TracedCallback object in *-net-device
> 
> Update patch. 
> 
> It also add code to flush IPv6 neighbor discovery cache (in Icmpv6L4Protocol)
> and some text in CHANGES.html.
> 

+1 on this; I suggest to merge it next week and close this if no further comments.
Comment 6 Sebastien Vincent 2009-09-15 03:06:28 UTC
Changeset: e90e1ef585b0