Bugzilla – Bug 2018
Packet::EnableChecking() also enables printing
Last modified: 2014-11-14 18:16:08 EST
Created attachment 1919 [details] patch to documentation (if this solution is decided) In contrast to the doxygen in packet.h, which states that Packet::EnableChecking() does not invoke the more expensive Packet::EnablePrinting() in the packet metadata, the current implementation behaves differently. Packet::EnableChecking() calls PacketMetadata::Enable(), just as does Packet::EnablePrinting(). So Packet::EnableChecking() enables both printing and checking. The attached doxygen patch would align the doxygen to the current implementation. However, if the doxygen is to stay the same and the implementation to change back to the documentation, then PacketMetadata::EnableChecking() should not call Enable(), and the conditional that returns from RemoveHeader() if m_enable is false needs to be removed. (this just from reading the code; I haven't tested it)
I wonder whether it ever worked as documented, since I found the first instance of PacketMetadata::EnableChecking() in revision 3553 also calls Enable(): hg diff -r3552:3553 diff -r b822851cb95d -r 065488d0420c src/common/packet-metadata.cc --- a/src/common/packet-metadata.cc Mon Aug 25 15:16:35 2008 -0700 +++ b/src/common/packet-metadata.cc Mon Aug 25 15:21:01 2008 -0700 @@ -32,6 +32,7 @@ namespace ns3 { bool PacketMetadata::m_enable = false; +bool PacketMetadata::m_enableChecking = false; bool PacketMetadata::m_metadataSkipped = false; uint32_t PacketMetadata::m_maxSize = 0; uint16_t PacketMetadata::m_chunkUid = 0; @@ -59,6 +60,13 @@ m_enable = true; } +void +PacketMetadata::EnableChecking (void) +{ + Enable (); + m_enableChecking = true; +} +