ns3::TagBuffer Class Reference
[Packet]

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)

Private Attributes

uint8_t * m_current
uint8_t * m_end

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.

Definition at line 51 of file tag-buffer.h.


Constructor & Destructor Documentation

ns3::TagBuffer::TagBuffer ( uint8_t *  start,
uint8_t *  end 
)

Definition at line 169 of file tag-buffer.cc.


Member Function Documentation

void ns3::TagBuffer::CopyFrom ( TagBuffer  o  ) 

Definition at line 182 of file tag-buffer.cc.

References m_current, m_end, and NS_ASSERT.

Referenced by ns3::TagList::Add(), ns3::TagList::AddAtEnd(), and ns3::TagList::AddAtStart().

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

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

Definition at line 162 of file tag-buffer.cc.

References ReadU8().

Referenced by ns3::Address::Deserialize(), ns3::TxModeTag::Deserialize(), ns3::WifiPhyRxTag::Deserialize(), and ns3::WifiPhyTxTag::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.

Definition at line 151 of file tag-buffer.cc.

References ReadU8().

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

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

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

Definition at line 63 of file tag-buffer.cc.

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.

Definition at line 73 of file tag-buffer.cc.

References ReadU8().

Referenced by ns3::FlowIdTag::Deserialize(), and ns3::TagList::Iterator::PrepareForNext().

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

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

Definition at line 122 of file tag-buffer.cc.

References ReadU8().

Referenced by ns3::DelayJitterEstimationTimestampTag::Print().

uint8_t ns3::TagBuffer::ReadU8 ( void   ) 
Returns:
the value read

Read one byte, advance the "current" point by one, and return the value read.

Definition at line 53 of file tag-buffer.cc.

References m_current, m_end, and NS_ASSERT.

Referenced by ns3::SocketSetDontFragmentTag::Deserialize(), ns3::SocketIpTtlTag::Deserialize(), ns3::Address::Deserialize(), anonymous_namespace{packet.cc}::ATestTag< N >::Deserialize(), Read(), ReadDouble(), ReadU16(), ReadU32(), and ReadU64().

void ns3::TagBuffer::TrimAtEnd ( uint32_t  trim  ) 

Definition at line 175 of file tag-buffer.cc.

References m_current, m_end, and NS_ASSERT.

Referenced by ns3::TagList::Iterator::Next().

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

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

Definition at line 114 of file tag-buffer.cc.

References WriteU8().

Referenced by ns3::Address::Serialize(), ns3::TxModeTag::Serialize(), ns3::WifiPhyRxTag::Serialize(), and ns3::WifiPhyTxTag::Serialize().

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

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

Definition at line 105 of file tag-buffer.cc.

References WriteU8().

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

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

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

Definition at line 37 of file tag-buffer.cc.

References WriteU8().

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

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

Definition at line 43 of file tag-buffer.cc.

References WriteU8().

Referenced by ns3::TagList::Add(), and ns3::FlowIdTag::Serialize().

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

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

Definition at line 93 of file tag-buffer.cc.

References WriteU8().

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

void ns3::TagBuffer::WriteU8 ( uint8_t  v  ) 
Parameters:
v the value to write

Write one byte and advance the "current" point by one.

Definition at line 29 of file tag-buffer.cc.

References m_current, m_end, and NS_ASSERT.

Referenced by ns3::SocketSetDontFragmentTag::Serialize(), ns3::SocketIpTtlTag::Serialize(), ns3::Address::Serialize(), anonymous_namespace{packet.cc}::ATestTag< N >::Serialize(), Write(), WriteDouble(), WriteU16(), WriteU32(), and WriteU64().


Member Data Documentation

uint8_t* ns3::TagBuffer::m_current [private]

Definition at line 143 of file tag-buffer.h.

Referenced by CopyFrom(), ReadU8(), TrimAtEnd(), and WriteU8().

uint8_t* ns3::TagBuffer::m_end [private]

Definition at line 144 of file tag-buffer.h.

Referenced by CopyFrom(), ReadU8(), TrimAtEnd(), and WriteU8().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:10:00 2009 for NS-3 by  doxygen 1.6.3