Bug 280 - trace helpers too inclusive
trace helpers too inclusive
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: helpers
ns-3.1
All All
: P3 normal
Assigned To: Mathieu Lacage
:
Depends on: 284
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-11 00:36 EDT by Tom Henderson
Modified: 2008-10-24 07:22 EDT (History)
3 users (show)

See Also:


Attachments
possible run-time check (924 bytes, patch)
2008-08-11 00:40 EDT, Tom Henderson
Details | Diff
patch based on API in bug 284 (3.00 KB, patch)
2008-10-20 07:26 EDT, Mathieu Lacage
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Henderson 2008-08-11 00:36:08 EDT
When trace helpers (e.g. CsmaHelper::EnablePcap()) are called, they do not check whether the trace path exists; i.e., whether there is actually a device to trace of the appropriate type.  Empty tracefiles may be generated as a result.  This could be a troublesome soft error because it may not be clear to the user debugging a script whether the trace file is empty because packets are not being sent or because the trace file itself is bogus.  

Some simple type checking on the devices when iterating through containers can help to avoid this problem (e.g., see attached patch for CsmaHelper::EnablePcap, but note that this problem also applies to WifiHelper and PointToPointHelper).
Comment 1 Tom Henderson 2008-08-11 00:40:40 EDT
Created attachment 226 [details]
possible run-time check

This patch is not complete; it could be extended to add checks to the EnablePcap() variants using nodeId and deviceId, and also to EnableAscii() methods.

Similar patch needed for WifiHelper and PointToPointHelper.
Comment 2 Mathieu Lacage 2008-08-11 12:15:43 EDT
While the additional error checking you mention here is not a bad idea, I am worried that doing this adds a lot more intelligence in the helpers than we would like. 

I think that a much better and much more useful solution would be to try to figure out better semantics for Config::Connect* and figure out a way to report useful and meaningful trace connection errors and successes to the user. The hard part is defining exactly the user-model here (other than "do-what-i-mean").
Comment 3 Mathieu Lacage 2008-10-20 03:35:07 EDT
With the API in bug 284, we don't need to check explicitely for the right device type here. We can just iterate over all matching objects.
Comment 4 Mathieu Lacage 2008-10-20 07:26:33 EDT
Created attachment 273 [details]
patch based on API in bug 284
Comment 5 Tom Henderson 2008-10-23 00:27:24 EDT
(In reply to comment #4)
> Created an attachment (id=273) [details]
> patch based on API in bug 284
> 

Yes, this looks like a good solution-- OK by me.
Comment 6 Mathieu Lacage 2008-10-24 07:22:27 EDT
I pushed a simpler patch along the same lines for csma, point to point, and wifi.
changeset: 616c83eeb4b9