Bug 331

Summary: Shouldn't the method Packet::PeekHeader be const?
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: coreAssignee: Mathieu Lacage <mathieu.lacage>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs
Priority: P2    
Version: ns-3.2   
Hardware: All   
OS: All   

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