ns-3
ns3::TagBuffer Class Reference

read and write tag data More...

#include <tag-buffer.h>

List of all members.

Public Member Functions

 TagBuffer (uint8_t *start, uint8_t *end)
void TrimAtEnd (uint32_t trim)
void CopyFrom (TagBuffer o)
TAG_BUFFER_INLINE void WriteU8 (uint8_t v)
TAG_BUFFER_INLINE void WriteU16 (uint16_t v)
TAG_BUFFER_INLINE void WriteU32 (uint32_t v)
void WriteU64 (uint64_t v)
void WriteDouble (double v)
void Write (const uint8_t *buffer, uint32_t size)
TAG_BUFFER_INLINE uint8_t ReadU8 (void)
TAG_BUFFER_INLINE uint16_t ReadU16 (void)
TAG_BUFFER_INLINE uint32_t ReadU32 (void)
uint64_t ReadU64 (void)
double ReadDouble (void)
void Read (uint8_t *buffer, uint32_t size)

Detailed Description

read and write tag data

This class allows subclasses of the ns3::Tag base class to serialize and deserialize their data through a stream-like API. This class keeps track of the "current" point in the buffer and advances that "current" point everytime data is written. The in-memory format of the data written by this class is unspecified.

If the user attempts to write more data in the buffer than he allocated with Tag::GetSerializedSize, he will trigger an NS_ASSERT error.


Member Function Documentation

void ns3::TagBuffer::Read ( uint8_t *  buffer,
uint32_t  size 
)
Parameters:
buffera pointer to the buffer where data should be written.
sizethe number of bytes to read.

Read the number of bytes requested, advance the "current" point by the number of bytes read, return.

References ReadU8().

Referenced by ns3::Ipv4PacketInfoTag::Deserialize(), ns3::Ipv6PacketInfoTag::Deserialize(), and ns3::Address::Deserialize().

double ns3::TagBuffer::ReadDouble ( void  )
Returns:
the value read

Read a double, advance the "current" point by the size of the data read, and, return the value read.

References ReadU8().

uint16_t ns3::TagBuffer::ReadU16 ( void  )
Returns:
the value read

Read two bytes, advance the "current" point by two, and return the value read.

References ReadU8().

uint32_t ns3::TagBuffer::ReadU32 ( void  )
Returns:
the value read

Read four bytes, advance the "current" point by four, and return the value read.

References ReadU8().

Referenced by ns3::FlowIdTag::Deserialize(), ns3::Ipv4PacketInfoTag::Deserialize(), and ns3::dot11s::HwmpTag::Deserialize().

uint64_t ns3::TagBuffer::ReadU64 ( void  )
Returns:
the value read

Read eight bytes, advance the "current" point by eight, and return the value read.

References ReadU8().

Referenced by ns3::AnimByteTag::Deserialize().

void ns3::TagBuffer::Write ( const uint8_t *  buffer,
uint32_t  size 
)
Parameters:
buffera pointer to data to write
sizethe size of the data to write

Write all the input data and advance the "current" point by the size of the data written.

References WriteU8().

Referenced by ns3::Ipv4PacketInfoTag::Serialize(), ns3::Ipv6PacketInfoTag::Serialize(), and ns3::Address::Serialize().

void ns3::TagBuffer::WriteDouble ( double  v)
Parameters:
vthe value to write

Write a double and advance the "current" point by the size of the data written.

References WriteU8().

void ns3::TagBuffer::WriteU16 ( uint16_t  v)
Parameters:
vthe value to write

Write two bytes and advance the "current" point by two.

References WriteU8().

void ns3::TagBuffer::WriteU32 ( uint32_t  v)
Parameters:
vthe value to write

Write four bytes and advance the "current" point by four.

References WriteU8().

Referenced by ns3::ByteTagList::Add(), ns3::FlowIdTag::Serialize(), ns3::Ipv4PacketInfoTag::Serialize(), and ns3::dot11s::HwmpTag::Serialize().

void ns3::TagBuffer::WriteU64 ( uint64_t  v)
Parameters:
vthe value to write

Write eight bytes and advance the "current" point by eight.

References WriteU8().

Referenced by ns3::AnimByteTag::Serialize().


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