[Ns-bugs] [Bug 491] It is painful to enable all checksums

code@nsnam.ece.gatech.edu code at nsnam.ece.gatech.edu
Mon Apr 27 23:53:14 PDT 2009


http://www.nsnam.org/bugzilla/show_bug.cgi?id=491





--- Comment #12 from Mathieu Lacage <mathieu.lacage at sophia.inria.fr>  2009-04-28 02:53:14 EDT ---
(In reply to comment #9)
> Forgot to hg add the two new (very small) files.
> 
> You now have a singleton object with global configuration information.  From
> examples/emu-ping.cc turning on checksums is a one-liner:
> 
>   System ()->SetAttribute ("CalcChecksum", BooleanValue (true));
> 
> The protocols do something like,
> 
>   BooleanValue b;
>   System ()->GetAttribute ("CalcChecksum", b);
> 
>   if(m_calcChecksum || b.Get ())
>     {
>       ...

low-level details:
  - why do you bother with keeping the m_calcChecksum attribute ? It seems to
just increase the number of options for no good reason.

  - the SystemObject should be registered in the global config namespace as
/System with Config::RegisterRootNamespaceObject.

high-level comments:
While I see why it sort of makes sense to do this for this specific attribute
because it has to be used in multiple locations, most other uses of GlobalValue
should not be converted to that API because it's not nice to have to define
them all in a single global source file and that is why we have been using
GlobalValues: to distribute the definition of each global attribute to where
it's really used in the code.

To summarize, unless there are other clear usecases of needing an attribute
which is readonly shared among multiple source files (which is not the case for
all other GlobalValue instances), I do not support adding this new generic API
and I would support instead coming up with an adhoc solution for that specific
usecase of a checksum.

i.e., I would support instead what I suggested earlier, that is, a static or
non-static Node::ChecksumEnabled method implemented using either a GlobalValue
or a node attribute. (The static/GlobalValue variant feels somewhat better).
(feel free to come up with a better name).


-- 
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the Ns-bugs mailing list