Bug 2887

Summary: Incorrect trace callback signature
Product: ns-3 Reporter: Dizhi Zhou <dizhizhou>
Component: documentationAssignee: Tom Henderson <tomh>
Status: NEEDINFO ---    
Severity: trivial CC: ns-bugs, pdbarnes
Priority: P3    
Version: ns-3.27   
Hardware: All   
OS: All   

Description Dizhi Zhou 2018-03-04 11:08:29 EST
Since AddTraceSource() doesn't valid the callback signature, I found some incorrect signature format in release 3.27.


Correct format: ns3::TracedValueCallback::Uint32
src/internet/model/tcp-socket-base.cc:                     "ns3::TracedValue::Uint32Callback")
src/internet/model/tcp-socket-base.cc:                     "ns3::TracedValue::Uint32Callback")
src/wifi/model/edca-txop-n.cc:                     "ns3::TracedValue::Uint32Callback")
src/wifi/model/edca-txop-n.cc:                     "ns3::TracedValue::Uint32Callback")

Correct format: ns3::TracedValueCallback::Double
src/internet/model/tcp-hybla.cc:                     "ns3::TracedValue::DoubleCallback")


Correct format: ns3::Packet::TracedCallback
src/spectrum/model/half-duplex-ideal-phy.cc:                     "ns3::Packet::TraceCallback")
src/spectrum/model/half-duplex-ideal-phy.cc:                     "ns3::Packet::TraceCallback")
src/spectrum/model/half-duplex-ideal-phy.cc:                     "ns3::Packet::TraceCallback")
src/spectrum/model/half-duplex-ideal-phy.cc:                     "ns3::Packet::TraceCallback")
src/spectrum/model/half-duplex-ideal-phy.cc:                     "ns3::Packet::TraceCallback")
src/spectrum/model/half-duplex-ideal-phy.cc:                     "ns3::Packet::TraceCallback")

Correct format: ns3::Time::TracedValueCallback::Time
src/energy/model/rv-battery-model.cc:                     "ns3::Time::TracedValueCallback")
src/internet/model/tcp-socket-base.cc:                     "ns3::Time::TracedValueCallback")
src/internet/model/tcp-socket-base.cc:                     "ns3::Time::TracedValueCallback")
src/traffic-control/model/queue-disc.cc:                     "ns3::Time::TracedValueCallback")
src/stats/examples/time-probe-example.cc:                     "ns3::Time::TracedValueCallback")
src/wifi/model/edca-txop-n.cc:                     "ns3::TracedValueCallback::Time")

There might be more!
Comment 1 Peter Barnes 2018-03-10 00:37:19 EST
This one:

  ns3::Time::TracedValueCallback::Time 

should really be

  ns3::TracedValueCallback::Time

as defined in nstime.h:719.
Comment 2 Tom Henderson 2018-03-10 11:25:39 EST
I'm fixing the ones Dizhi mentioned below; there are probably more.  In particular, there are some new ones that need to be defined in the standard way (tcp-socket-base.cc).  We probably need to audit all uses of TracedValue in our headers.

> 
> Correct format: ns3::TracedValueCallback::Uint32
> src/internet/model/tcp-socket-base.cc:                    
> "ns3::TracedValue::Uint32Callback")
> src/internet/model/tcp-socket-base.cc:                    
> "ns3::TracedValue::Uint32Callback")
> src/wifi/model/edca-txop-n.cc:                    
> "ns3::TracedValue::Uint32Callback")
> src/wifi/model/edca-txop-n.cc:                    
> "ns3::TracedValue::Uint32Callback")

Fixed.  But I have a question, there is a signature for a 'ns3::TracedCallback::Uint32Callback' with a comment that:

  // Uint32Callback appears to be the only one used at the moment.
  // Feel free to add typedef's for any other POD you need.

The above that Dizhi listed should clearly be ns3::TracedValueCallback::Uint32, but once I fix those, I can't find other instances of that Uint32Callback in our codebase.  Should 'ns3::TracedCallback::Uint32Callback' be removed (is it obsolete)?
Comment 3 Peter Barnes 2019-11-05 19:15:45 EST
`ns3::TracedCallback::Uint32Callback` is NOT obsolete:

"$ns3::RegularWifiMac/Txop/BackoffTrace" uses it.

Is this bug now complete?