A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::TagBuffer Class Reference

read and write tag data More...

#include <tag-buffer.h>

Public Member Functions

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

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 184 of file tag-buffer.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

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

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

References m_current, m_end, NS_ASSERT, and NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

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.

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

References NS_LOG_FUNCTION, and ReadU8().

Referenced by ns3::HigherDataTxVectorTag::Deserialize(), ns3::RlcTag::Deserialize(), ns3::PdcpTag::Deserialize(), ns3::HighLatencyDataTxVectorTag::Deserialize(), ns3::Ipv4PacketInfoTag::Deserialize(), TimestampTag::Deserialize(), ns3::Ipv6PacketInfoTag::Deserialize(), ns3::HighLatencyRtsTxVectorTag::Deserialize(), ns3::HighLatencyCtsToSelfTxVectorTag::Deserialize(), ns3::Address::Deserialize(), and ns3::DeviceNameTag::Deserialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 164 of file tag-buffer.cc.

References NS_LOG_FUNCTION, and ReadU8().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 189 of file tag-buffer.h.

References data, and ReadU8().

Referenced by ns3::LtePhyTag::Deserialize(), ns3::EpsBearerTag::Deserialize(), and ns3::LteRadioBearerTag::Deserialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 199 of file tag-buffer.h.

References data, and ReadU8().

Referenced by ns3::FlowIdTag::Deserialize(), ns3::Ipv4FlowProbeTag::Deserialize(), ns3::dot11s::HwmpTag::Deserialize(), ns3::PyVizPacketTag::Deserialize(), ns3::dsdv::DeferredRouteOutputTag::Deserialize(), ns3::aodv::DeferredRouteOutputTag::Deserialize(), ns3::Ipv4PacketInfoTag::Deserialize(), and ns3::ByteTagList::Iterator::PrepareForNext().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 134 of file tag-buffer.cc.

References data, NS_LOG_FUNCTION, and ReadU8().

Referenced by ns3::DelayJitterEstimationTimestampTag::Deserialize(), and ns3::AnimByteTag::Deserialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References m_current, m_end, NS_ASSERT, and NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

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.

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

References NS_LOG_FUNCTION, and WriteU8().

Referenced by ns3::HigherDataTxVectorTag::Serialize(), ns3::RlcTag::Serialize(), ns3::PdcpTag::Serialize(), ns3::HighLatencyDataTxVectorTag::Serialize(), ns3::Ipv4PacketInfoTag::Serialize(), TimestampTag::Serialize(), ns3::Ipv6PacketInfoTag::Serialize(), ns3::HighLatencyRtsTxVectorTag::Serialize(), ns3::HighLatencyCtsToSelfTxVectorTag::Serialize(), ns3::Address::Serialize(), and ns3::DeviceNameTag::Serialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

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

References NS_LOG_FUNCTION, and WriteU8().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

References WriteU8().

Referenced by ns3::LtePhyTag::Serialize(), ns3::EpsBearerTag::Serialize(), and ns3::LteRadioBearerTag::Serialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

References WriteU8().

Referenced by ns3::ByteTagList::Add(), ns3::FlowIdTag::Serialize(), ns3::Ipv4FlowProbeTag::Serialize(), ns3::dot11s::HwmpTag::Serialize(), ns3::PyVizPacketTag::Serialize(), ns3::dsdv::DeferredRouteOutputTag::Serialize(), ns3::aodv::DeferredRouteOutputTag::Serialize(), and ns3::Ipv4PacketInfoTag::Serialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

References NS_LOG_FUNCTION, and WriteU8().

Referenced by ns3::DelayJitterEstimationTimestampTag::Serialize(), and ns3::AnimByteTag::Serialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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: