Bug 331 - Shouldn't the method Packet::PeekHeader be const?
Shouldn't the method Packet::PeekHeader be const?
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
ns-3.2
All All
: P2 normal
Assigned To: Mathieu Lacage
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-10 10:50 UTC by Gustavo J. A. M. Carneiro
Modified: 2008-10-10 05:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2008-09-10 10:50:26 UTC
Marking as P1 due to potential API impact.

  /**
   * Deserialize but does _not_ remove the header from the internal buffer.
   * This method invokes Header::Deserialize.
   *
   * \param header a reference to the header to read from the internal buffer.
   * \returns the number of bytes read from the packet.
   */  
  uint32_t PeekHeader (Header &header);

It sounds like the method does not modify the packet in any way.  If so, why is not const?  This has impact since most our trace callbacks now receive const packets, and packet->Copy ()->PeekHeader (header) seems kind of silly.
Comment 1 Mathieu Lacage 2008-09-10 11:43:59 UTC
I don't consider that to be a P1
Comment 2 Gustavo J. A. M. Carneiro 2008-09-10 11:48:16 UTC
I was thinking if it was trivial to fix it would be nice to include it in 3.2, that's all.
Comment 3 Mathieu Lacage 2008-10-10 05:25:12 UTC
changeset 011897c60e9c