View | Details | Raw Unified | Return to bug 1294
Collapse All | Expand All

(-)a/RELEASE_NOTES (+1 lines)
 Lines 31-36    Link Here 
31
31
32
Bugs fixed
32
Bugs fixed
33
----------
33
----------
34
- Bug 1294 - New PeekU8 () and Read (Buffer::Iterator start, uint32_t size) methods in Buffer::Iterator
34
- Bug 1739 - The endpoint is not deallocated for UDP sockets
35
- Bug 1739 - The endpoint is not deallocated for UDP sockets
35
- Bug 1786 - os << int64x64_t prints un-normalized fractional values
36
- Bug 1786 - os << int64x64_t prints un-normalized fractional values
36
- Bug 1787 - Runtime error when using AnimationInterface::EnablePacketMetadata() to fetch metadata of CSMA packet
37
- Bug 1787 - Runtime error when using AnimationInterface::EnablePacketMetadata() to fetch metadata of CSMA packet
(-)a/src/network/model/buffer.h (-5 / +37 lines)
 Lines 253-258    Link Here 
253
    /**
253
    /**
254
     * \return the byte read in the buffer.
254
     * \return the byte read in the buffer.
255
     *
255
     *
256
     * Read data, but do not advance the Iterator read.
257
     */
258
    inline uint8_t  PeekU8 (void);
259
260
    /**
261
     * \return the byte read in the buffer.
262
     *
256
     * Read data and advance the Iterator by the number of bytes
263
     * Read data and advance the Iterator by the number of bytes
257
     * read.
264
     * read.
258
     */
265
     */
 Lines 334-345    Link Here 
334
     * \param size number of bytes to copy
341
     * \param size number of bytes to copy
335
     *
342
     *
336
     * Copy size bytes of data from the internal buffer to the
343
     * Copy size bytes of data from the internal buffer to the
337
     * input buffer and avance the Iterator by the number of
344
     * input buffer and advance the Iterator by the number of
338
     * bytes read.
345
     * bytes read.
339
     */
346
     */
340
    void Read (uint8_t *buffer, uint32_t size);
347
    void Read (uint8_t *buffer, uint32_t size);
341
348
342
    /**
349
    /**
350
     * \param start start iterator of the buffer to copy data into
351
     * \param size  number of bytes to copy
352
     *
353
     * Copy size bytes of data from the internal buffer to the input buffer via
354
     * the provided iterator and advance the Iterator by the number of bytes
355
     * read.
356
     */
357
    inline void Read (Iterator start, uint32_t size);
358
359
    /**
343
     * \brief Calculate the checksum.
360
     * \brief Calculate the checksum.
344
     * \param size size of the buffer.
361
     * \param size size of the buffer.
345
     * \return checksum
362
     * \return checksum
 Lines 816-822    Link Here 
816
}
833
}
817
834
818
uint8_t
835
uint8_t
819
Buffer::Iterator::ReadU8 (void)
836
Buffer::Iterator::PeekU8 (void)
820
{
837
{
821
  NS_ASSERT_MSG (m_current >= m_dataStart &&
838
  NS_ASSERT_MSG (m_current >= m_dataStart &&
822
                 m_current <= m_dataEnd,
839
                 m_current <= m_dataEnd,
 Lines 825-846    Link Here 
825
  if (m_current < m_zeroStart)
842
  if (m_current < m_zeroStart)
826
    {
843
    {
827
      uint8_t data = m_data[m_current];
844
      uint8_t data = m_data[m_current];
828
      m_current++;
829
      return data;
845
      return data;
830
    }
846
    }
831
  else if (m_current < m_zeroEnd)
847
  else if (m_current < m_zeroEnd)
832
    {
848
    {
833
      m_current++;
834
      return 0;
849
      return 0;
835
    }
850
    }
836
  else
851
  else
837
    {
852
    {
838
      uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)];
853
      uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)];
839
      m_current++;
840
      return data;
854
      return data;
841
    }
855
    }
842
}
856
}
843
857
858
uint8_t
859
Buffer::Iterator::ReadU8 (void)
860
{
861
  uint8_t ret = PeekU8 ();
862
  m_current ++;
863
  return ret;
864
}
865
844
uint16_t 
866
uint16_t 
845
Buffer::Iterator::ReadU16 (void)
867
Buffer::Iterator::ReadU16 (void)
846
{
868
{
 Lines 853-858    Link Here 
853
  return data;
875
  return data;
854
}
876
}
855
877
878
void
879
Buffer::Iterator::Read (Buffer::Iterator start, uint32_t size)
880
{
881
  Buffer::Iterator end = *this;
882
  end.Next (size);
883
  
884
  start.Write (*this, end);
885
}
886
887
856
Buffer::Buffer (Buffer const&o)
888
Buffer::Buffer (Buffer const&o)
857
  : m_data (o.m_data),
889
  : m_data (o.m_data),
858
    m_maxZeroAreaStart (o.m_zeroAreaStart),
890
    m_maxZeroAreaStart (o.m_zeroAreaStart),

Return to bug 1294