ns3::Buffer::Buffer::Iterator Class Reference

iterator in a Buffer instance More...

#include <buffer.h>

List of all members.

Public Member Functions

void Next (void)
void Prev (void)
void Next (uint32_t delta)
void Prev (uint32_t delta)
uint32_t GetDistanceFrom (Iterator const &o) const
bool IsEnd (void) const
bool IsStart (void) const
BUFFER_INLINE void WriteU8 (uint8_t data)
BUFFER_INLINE void WriteU8 (uint8_t data, uint32_t len)
void WriteU16 (uint16_t data)
void WriteU32 (uint32_t data)
void WriteU64 (uint64_t data)
void WriteHtolsbU16 (uint16_t data)
void WriteHtolsbU32 (uint32_t data)
void WriteHtolsbU64 (uint64_t data)
void WriteHtonU16 (uint16_t data)
void WriteHtonU32 (uint32_t data)
void WriteHtonU64 (uint64_t data)
void Write (uint8_t const *buffer, uint32_t size)
void Write (Iterator start, Iterator end)
BUFFER_INLINE uint8_t ReadU8 (void)
uint16_t ReadU16 (void)
uint32_t ReadU32 (void)
uint64_t ReadU64 (void)
uint16_t ReadNtohU16 (void)
uint32_t ReadNtohU32 (void)
uint64_t ReadNtohU64 (void)
uint16_t ReadLsbtohU16 (void)
uint32_t ReadLsbtohU32 (void)
uint64_t ReadLsbtohU64 (void)
void Read (uint8_t *buffer, uint32_t size)
uint16_t CalculateIpChecksum (uint16_t size)
 Calculate the checksum.
uint16_t CalculateIpChecksum (uint16_t size, uint32_t initialChecksum)
 Calculate the checksum.
uint32_t GetSize (void) const


Detailed Description

iterator in a Buffer instance

Member Function Documentation

uint16_t ns3::Buffer::Buffer::Iterator::CalculateIpChecksum ( uint16_t  size,
uint32_t  initialChecksum 
)

Calculate the checksum.

Parameters:
size size of the buffer.
initialChecksum initial value
Returns:
checksum

uint16_t ns3::Buffer::Buffer::Iterator::CalculateIpChecksum ( uint16_t  size  ) 

Calculate the checksum.

Parameters:
size size of the buffer.
Returns:
checksum

uint32_t ns3::Buffer::Buffer::Iterator::GetDistanceFrom ( Iterator const &  o  )  const

Parameters:
o the second iterator
Returns:
number of bytes included between the two iterators
This method works only if the two iterators point to the same underlying buffer. Debug builds ensure this with an assert.

uint32_t ns3::Buffer::Buffer::Iterator::GetSize ( void   )  const

Returns:
the size of the underlying buffer we are iterating

bool ns3::Buffer::Buffer::Iterator::IsEnd ( void   )  const

Returns:
true if this iterator points to the end of the byte array. false otherwise.

bool ns3::Buffer::Buffer::Iterator::IsStart ( void   )  const

Returns:
true if this iterator points to the start of the byte array. false otherwise.

void ns3::Buffer::Buffer::Iterator::Next ( uint32_t  delta  ) 

Parameters:
delta number of bytes to go forward

void ns3::Buffer::Buffer::Iterator::Next ( void   ) 

go forward by one byte

void ns3::Buffer::Buffer::Iterator::Prev ( uint32_t  delta  ) 

Parameters:
delta number of bytes to go backward

void ns3::Buffer::Buffer::Iterator::Prev ( void   ) 

go backward by one byte

void ns3::Buffer::Buffer::Iterator::Read ( uint8_t *  buffer,
uint32_t  size 
)

Parameters:
buffer buffer to copy data into
size number of bytes to copy
Copy size bytes of data from the internal buffer to the input buffer and avance the Iterator by the number of bytes read.

uint16_t ns3::Buffer::Buffer::Iterator::ReadLsbtohU16 ( void   ) 

Returns:
the two bytes read in the buffer.
Read data and advance the Iterator by the number of bytes read. The data is read in network format and return in host format.

uint32_t ns3::Buffer::Buffer::Iterator::ReadLsbtohU32 ( void   ) 

Returns:
the four bytes read in the buffer.
Read data and advance the Iterator by the number of bytes read. The data is read in network format and return in host format.

uint64_t ns3::Buffer::Buffer::Iterator::ReadLsbtohU64 ( void   ) 

Returns:
the eight bytes read in the buffer.
Read data and advance the Iterator by the number of bytes read. The data is read in network format and return in host format.

uint16_t ns3::Buffer::Buffer::Iterator::ReadNtohU16 ( void   ) 

Returns:
the two bytes read in the buffer.
Read data and advance the Iterator by the number of bytes read. The data is read in network format and return in host format.

uint32_t ns3::Buffer::Buffer::Iterator::ReadNtohU32 ( void   ) 

Returns:
the four bytes read in the buffer.
Read data and advance the Iterator by the number of bytes read. The data is read in network format and return in host format.

uint64_t ns3::Buffer::Buffer::Iterator::ReadNtohU64 ( void   ) 

Returns:
the eight bytes read in the buffer.
Read data and advance the Iterator by the number of bytes read. The data is read in network format and return in host format.

uint16_t ns3::Buffer::Buffer::Iterator::ReadU16 ( void   ) 

Returns:
the two bytes read in the buffer.
Read data and advance the Iterator by the number of bytes read. The data is read in the format written by writeU16.

uint32_t ns3::Buffer::Buffer::Iterator::ReadU32 ( void   ) 

Returns:
the four bytes read in the buffer.
Read data and advance the Iterator by the number of bytes read. The data is read in the format written by writeU32.

uint64_t ns3::Buffer::Buffer::Iterator::ReadU64 ( void   ) 

Returns:
the eight bytes read in the buffer.
Read data and advance the Iterator by the number of bytes read. The data is read in the format written by writeU64.

uint8_t ns3::Buffer::Buffer::Iterator::ReadU8 ( void   ) 

Returns:
the byte read in the buffer.
Read data and advance the Iterator by the number of bytes read.

References NS_ASSERT.

void ns3::Buffer::Buffer::Iterator::Write ( Iterator  start,
Iterator  end 
)

Parameters:
start the start of the data to copy
end the end of the data to copy
Write the data delimited by start and end in internal buffer and avance the iterator position by the number of bytes copied. The input interators _must_ not point to the same Buffer as we do to avoid overlapping copies. This is enforced in debug builds by asserts.

void ns3::Buffer::Buffer::Iterator::Write ( uint8_t const *  buffer,
uint32_t  size 
)

Parameters:
buffer a byte buffer to copy in the internal buffer.
size number of bytes to copy.
Write the data in buffer and avance the iterator position by size bytes.

void ns3::Buffer::Buffer::Iterator::WriteHtolsbU16 ( uint16_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by two bytes. The data is written in network order and the input data is expected to be in host order.

void ns3::Buffer::Buffer::Iterator::WriteHtolsbU32 ( uint32_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by four bytes. The data is written in least significant byte order and the input data is expected to be in host order.

void ns3::Buffer::Buffer::Iterator::WriteHtolsbU64 ( uint64_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by eight bytes. The data is written in least significant byte order and the input data is expected to be in host order.

void ns3::Buffer::Buffer::Iterator::WriteHtonU16 ( uint16_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by two bytes. The data is written in least significant byte order and the input data is expected to be in host order.

void ns3::Buffer::Buffer::Iterator::WriteHtonU32 ( uint32_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by four bytes. The data is written in network order and the input data is expected to be in host order.

void ns3::Buffer::Buffer::Iterator::WriteHtonU64 ( uint64_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by eight bytes. The data is written in network order and the input data is expected to be in host order.

void ns3::Buffer::Buffer::Iterator::WriteU16 ( uint16_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by two bytes. The format of the data written in the byte buffer is non-portable. We only ensure that readU16 will return exactly what we wrote with writeU16 if the program is run on the same machine.

void ns3::Buffer::Buffer::Iterator::WriteU32 ( uint32_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by four bytes. The format of the data written in the byte buffer is non-portable. We only ensure that readU32 will return exactly what we wrote with writeU32 if the program is run on the same machine.

void ns3::Buffer::Buffer::Iterator::WriteU64 ( uint64_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by eight bytes. The format of the data written in the byte buffer is non-portable. We only ensure that readU64 will return exactly what we wrote with writeU64 if the program is run on the same machine.

void ns3::Buffer::Buffer::Iterator::WriteU8 ( uint8_t  data,
uint32_t  len 
)

Parameters:
data data to write in buffer
len number of times data must be written in buffer
Write the data in buffer len times and avance the iterator position by len byte.

References NS_ASSERT.

void ns3::Buffer::Buffer::Iterator::WriteU8 ( uint8_t  data  ) 

Parameters:
data data to write in buffer
Write the data in buffer and avance the iterator position by one byte.

References NS_ASSERT.


The documentation for this class was generated from the following file:

Generated on Fri Apr 9 15:01:08 2010 for NS-3 by  doxygen 1.5.8