read and write tag data More...
#include "tag-buffer.h"
Collaboration diagram for ns3::TagBuffer:Public Member Functions | |
| TagBuffer (uint8_t *start, uint8_t *end) | |
| Constructor. | |
| void | CopyFrom (TagBuffer o) |
| Copy the nternal structure of another TagBuffer. | |
| void | Read (uint8_t *buffer, uint32_t size) |
| double | ReadDouble () |
| TAG_BUFFER_INLINE uint16_t | ReadU16 () |
| TAG_BUFFER_INLINE uint32_t | ReadU32 () |
| uint64_t | ReadU64 () |
| TAG_BUFFER_INLINE uint8_t | ReadU8 () |
| void | TrimAtEnd (uint32_t trim) |
| Trim some space from the end. | |
| 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 |
| current TagBuffer position | |
| uint8_t * | m_end |
| end TagBuffer position | |
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 every time 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 40 of file tag-buffer.h.
| ns3::TagBuffer::TagBuffer | ( | uint8_t * | start, |
| uint8_t * | end | ||
| ) |
Constructor.
| start | start position |
| end | end position |
Definition at line 180 of file tag-buffer.cc.
References NS_LOG_FUNCTION.
Copy the nternal structure of another TagBuffer.
| o | the TagBuffer to copy from |
Definition at line 196 of file tag-buffer.cc.
References ns3::Create(), 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 call graph for this function:
Here is the caller graph for this function:| 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 172 of file tag-buffer.cc.
References m_current, m_end, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::Ipv4FlowProbeTag::Deserialize(), and ns3::Address::Deserialize().
Here is the caller graph for this function:| double ns3::TagBuffer::ReadDouble | ( | ) |
Read a double, advance the "current" point by the size of the data read, and, return the value read.
Definition at line 159 of file tag-buffer.cc.
References ns3::Create(), NS_LOG_FUNCTION, and ReadU8().
Here is the call graph for this function:| uint16_t ns3::TagBuffer::ReadU16 | ( | ) |
Read two bytes, advance the "current" point by two, and return the value read.
Definition at line 195 of file tag-buffer.h.
References ns3::Create(), data, and ReadU8().
Here is the call graph for this function:| uint32_t ns3::TagBuffer::ReadU32 | ( | ) |
Read four bytes, advance the "current" point by four, and return the value read.
Definition at line 206 of file tag-buffer.h.
References ns3::Create(), data, and ReadU8().
Referenced by ns3::Ipv4FlowProbeTag::Deserialize(), ns3::Ipv6FlowProbeTag::Deserialize(), ns3::FlowIdTag::Deserialize(), ns3::PyVizPacketTag::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 | ( | ) |
Read eight bytes, advance the "current" point by eight, and return the value read.
Definition at line 128 of file tag-buffer.cc.
References ns3::Create(), data, NS_LOG_FUNCTION, and ReadU8().
Referenced by IPv4TestTag::Deserialize(), and IPv6TestTag::Deserialize().
Here is the call graph for this function:
Here is the caller graph for this function:| uint8_t ns3::TagBuffer::ReadU8 | ( | ) |
Read one byte, advance the "current" point by one, and return the value read.
Definition at line 185 of file tag-buffer.h.
References m_current, m_end, and NS_ASSERT.
Referenced by anonymous_namespace{packet-test-suite.cc}::ATestTag< N >::Deserialize(), anonymous_namespace{packet-test-suite.cc}::ALargeTestTag::Deserialize(), BenchTag< N >::Deserialize(), ns3::Address::Deserialize(), ReadDouble(), ReadU16(), ReadU32(), and ReadU64().
Here is the caller graph for this function:Trim some space from the end.
| trim | space to remove |
Definition at line 188 of file tag-buffer.cc.
References ns3::Create(), m_current, m_end, NS_ASSERT, and NS_LOG_FUNCTION.
Here is the call graph for this function:| 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 118 of file tag-buffer.cc.
References ns3::Create(), NS_LOG_FUNCTION, and WriteU8().
Referenced by ns3::ByteTagList::Deserialize(), ns3::Ipv4FlowProbeTag::Serialize(), and ns3::Address::Serialize().
Here is the call graph for this function:
Here is the caller graph for this function:| v | the value to write |
Write a double and advance the "current" point by the size of the data written.
Definition at line 107 of file tag-buffer.cc.
References ns3::Create(), NS_LOG_FUNCTION, and WriteU8().
Here is the call graph for this function:| void ns3::TagBuffer::WriteU16 | ( | uint16_t | v | ) |
| v | the value to write |
Write two bytes and advance the "current" point by two.
Definition at line 169 of file tag-buffer.h.
References data, and WriteU8().
Here is the call graph for this function:| v | the value to write |
Write four bytes and advance the "current" point by four.
Definition at line 176 of file tag-buffer.h.
References data, and WriteU8().
Referenced by ns3::Ipv4FlowProbeTag::Serialize(), ns3::Ipv6FlowProbeTag::Serialize(), ns3::FlowIdTag::Serialize(), and ns3::PyVizPacketTag::Serialize().
Here is the call graph for this function:
Here is the caller graph for this function:| void ns3::TagBuffer::WriteU64 | ( | uint64_t | v | ) |
| 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 data, NS_LOG_FUNCTION, and WriteU8().
Referenced by IPv4TestTag::Serialize(), and IPv6TestTag::Serialize().
Here is the call graph for this function:
Here is the caller graph for this function:| void ns3::TagBuffer::WriteU8 | ( | uint8_t | v | ) |
| v | the value to write |
Write one byte and advance the "current" point by one.
Definition at line 161 of file tag-buffer.h.
References m_current, m_end, and NS_ASSERT.
Referenced by anonymous_namespace{packet-test-suite.cc}::ATestTag< N >::Serialize(), anonymous_namespace{packet-test-suite.cc}::ALargeTestTag::Serialize(), BenchTag< N >::Serialize(), ns3::Address::Serialize(), Write(), WriteDouble(), WriteU16(), WriteU32(), and WriteU64().
Here is the caller graph for this function:
|
private |
current TagBuffer position
Definition at line 147 of file tag-buffer.h.
Referenced by CopyFrom(), Read(), ReadU8(), TrimAtEnd(), and WriteU8().
|
private |
end TagBuffer position
Definition at line 148 of file tag-buffer.h.
Referenced by CopyFrom(), Read(), ReadU8(), TrimAtEnd(), and WriteU8().