Bug 653

Summary: NetDevice link change callback proposal
Product: ns-3 Reporter: Tom Henderson <tomh>
Component: devicesAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: vincent
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: proposed patch
std::list<Callback> => TracedCallback
Use TracedCallback object in *-net-device

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