keep track of the byte tags stored in a packet. More...
#include "byte-tag-list.h"
Classes | |
class | Iterator |
An iterator for iterating through a byte tag list. More... | |
Public Member Functions | |
ByteTagList () | |
ByteTagList (const ByteTagList &o) | |
Copy constructor, copies the data and increases reference count. More... | |
~ByteTagList () | |
void | Add (const ByteTagList &o) |
TagBuffer | Add (TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) |
void | AddAtEnd (int32_t appendOffset) |
Make sure that all offsets are smaller than appendOffset which represents the location where new bytes have been added to the byte buffer. More... | |
void | AddAtStart (int32_t prependOffset) |
Make sure that all offsets are bigger than prependOffset which represents the location where new bytes have been added to the byte buffer. More... | |
void | Adjust (int32_t adjustment) |
Adjust the offsets stored internally by the adjustment delta. More... | |
ByteTagList::Iterator | Begin (int32_t offsetStart, int32_t offsetEnd) const |
uint32_t | Deserialize (const uint32_t *buffer, uint32_t size) |
Deserialize tag list from the provided buffer. More... | |
uint32_t | GetSerializedSize (void) const |
Returns number of bytes required for packet serialization. More... | |
ByteTagList & | operator= (const ByteTagList &o) |
Assignment operator, deallocates current data and assigns value of passed in ByteTagList. More... | |
void | RemoveAll (void) |
Removes all of the tags from the ByteTagList. More... | |
uint32_t | Serialize (uint32_t *buffer, uint32_t maxSize) const |
Serialize the tag list into a byte buffer. More... | |
Private Member Functions | |
struct ByteTagListData * | Allocate (uint32_t size) |
Allocate the memory for the ByteTagListData. More... | |
ByteTagList::Iterator | BeginAll (void) const |
Returns an iterator pointing to the very first tag in this list. More... | |
void | Deallocate (struct ByteTagListData *data) |
Deallocates a ByteTagListData. More... | |
Private Attributes | |
int32_t | m_adjustment |
adjustment to byte tag offsets More... | |
struct ByteTagListData * | m_data |
the ByteTagListData structure More... | |
int32_t | m_maxEnd |
maximal end offset More... | |
int32_t | m_minStart |
minimal start offset More... | |
uint32_t | m_used |
the number of used bytes in the buffer More... | |
keep track of the byte tags stored in a packet.
This class is mostly private to the Packet implementation and users should never have to access it directly.
Definition at line 63 of file byte-tag-list.h.
ns3::ByteTagList::ByteTagList | ( | ) |
Definition at line 141 of file byte-tag-list.cc.
References NS_LOG_FUNCTION.
ns3::ByteTagList::ByteTagList | ( | const ByteTagList & | o | ) |
Copy constructor, copies the data and increases reference count.
o | The ByteTagList to copy |
Definition at line 150 of file byte-tag-list.cc.
References ns3::ByteTagListData::count, m_data, and NS_LOG_FUNCTION.
ns3::ByteTagList::~ByteTagList | ( | ) |
Definition at line 183 of file byte-tag-list.cc.
References Deallocate(), m_data, m_used, and NS_LOG_FUNCTION.
void ns3::ByteTagList::Add | ( | const ByteTagList & | o | ) |
o | the other list of tags to aggregate. |
Aggregate the two lists of tags.
Definition at line 230 of file byte-tag-list.cc.
References Add(), BeginAll(), ns3::ByteTagList::Iterator::Item::buf, ns3::TagBuffer::CopyFrom(), ns3::ByteTagList::Iterator::Item::end, ns3::ByteTagList::Iterator::HasNext(), ns3::ByteTagList::Iterator::Next(), NS_LOG_FUNCTION, ns3::ByteTagList::Iterator::Item::size, ns3::ByteTagList::Iterator::Item::start, and ns3::ByteTagList::Iterator::Item::tid.
tid | the typeid of the tag added |
bufferSize | the size of the tag when its serialization will be completed. Typically, the return value of Tag::GetSerializedSize |
start | offset which uniquely identifies the first byte tagged by this tag. |
end | offset which uniquely identifies the last byte tagged by this tag. |
Definition at line 192 of file byte-tag-list.cc.
References Allocate(), ns3::ByteTagListData::count, ns3::ByteTagListData::data, Deallocate(), ns3::ByteTagListData::dirty, ns3::TypeId::GetUid(), m_adjustment, m_data, m_maxEnd, m_minStart, m_used, NS_ASSERT, NS_LOG_FUNCTION, ns3::ByteTagListData::size, visualizer.core::start(), and ns3::TagBuffer::WriteU32().
Referenced by Add(), ns3::Packet::AddAtEnd(), and Deserialize().
void ns3::ByteTagList::AddAtEnd | ( | int32_t | appendOffset | ) |
Make sure that all offsets are smaller than appendOffset which represents the location where new bytes have been added to the byte buffer.
appendOffset | maximum offset value |
Definition at line 278 of file byte-tag-list.cc.
References BeginAll(), ns3::ByteTagList::Iterator::Item::buf, ns3::TagBuffer::CopyFrom(), ns3::ByteTagList::Iterator::Item::end, ns3::ByteTagList::Iterator::HasNext(), list, m_adjustment, m_maxEnd, ns3::ByteTagList::Iterator::Next(), NS_LOG_FUNCTION, ns3::ByteTagList::Iterator::Item::size, ns3::ByteTagList::Iterator::Item::start, and ns3::ByteTagList::Iterator::Item::tid.
Referenced by ns3::Packet::AddAtEnd(), ns3::Packet::AddPaddingAtEnd(), and ns3::Packet::AddTrailer().
void ns3::ByteTagList::AddAtStart | ( | int32_t | prependOffset | ) |
Make sure that all offsets are bigger than prependOffset which represents the location where new bytes have been added to the byte buffer.
prependOffset | minimum offset value |
Definition at line 310 of file byte-tag-list.cc.
References BeginAll(), ns3::ByteTagList::Iterator::Item::buf, ns3::TagBuffer::CopyFrom(), ns3::ByteTagList::Iterator::Item::end, ns3::ByteTagList::Iterator::HasNext(), list, m_adjustment, m_minStart, ns3::ByteTagList::Iterator::Next(), NS_LOG_FUNCTION, ns3::ByteTagList::Iterator::Item::size, ns3::ByteTagList::Iterator::Item::start, and ns3::ByteTagList::Iterator::Item::tid.
Referenced by ns3::Packet::AddAtEnd(), and ns3::Packet::AddHeader().
|
inline |
Adjust the offsets stored internally by the adjustment delta.
adjustment | value to change stored offsets by |
Definition at line 286 of file byte-tag-list.h.
References m_adjustment.
Referenced by ns3::Packet::AddAtEnd(), ns3::Packet::AddHeader(), ns3::Packet::CreateFragment(), ns3::Packet::RemoveAtStart(), and ns3::Packet::RemoveHeader().
|
private |
Allocate the memory for the ByteTagListData.
size | the memory to allocate |
Definition at line 345 of file byte-tag-list.cc.
References data, ns3::g_freeList, ns3::g_maxSize, max, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by Add().
ByteTagList::Iterator ns3::ByteTagList::Begin | ( | int32_t | offsetStart, |
int32_t | offsetEnd | ||
) | const |
offsetStart | the offset which uniquely identifies the first data byte present in the byte buffer associated to this ByteTagList. |
offsetEnd | the offset which uniquely identifies the last data byte present in the byte buffer associated to this ByteTagList. |
The returned iterator will allow you to loop through the set of tags present in this list: the boundaries of each tag as reported by their start and end offsets will be included within the input offsetStart and offsetEnd.
Definition at line 264 of file byte-tag-list.cc.
References ns3::ByteTagListData::data, m_adjustment, m_data, m_used, and NS_LOG_FUNCTION.
Referenced by BeginAll(), and ns3::Packet::GetByteTagIterator().
|
private |
Returns an iterator pointing to the very first tag in this list.
Definition at line 255 of file byte-tag-list.cc.
References Begin(), NS_LOG_FUNCTION, and OFFSET_MAX.
Referenced by Add(), AddAtEnd(), AddAtStart(), GetSerializedSize(), and Serialize().
|
private |
Deallocates a ByteTagListData.
data | the ByteTagListData to deallocate |
Definition at line 371 of file byte-tag-list.cc.
References data, FREE_LIST_SIZE, ns3::g_freeList, ns3::g_maxSize, max, and NS_LOG_FUNCTION.
Referenced by ~ByteTagList(), Add(), operator=(), and RemoveAll().
uint32_t ns3::ByteTagList::Deserialize | ( | const uint32_t * | buffer, |
uint32_t | size | ||
) |
Deserialize tag list from the provided buffer.
[in] | buffer | The buffer to read from. |
[in] | size | The number of bytes to deserialize. |
Definition at line 550 of file byte-tag-list.cc.
References Add(), nlohmann::detail::hash(), ns3::TypeId::LookupByHash(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, visualizer.core::start(), and ns3::TagBuffer::Write().
Referenced by ns3::Packet::Deserialize().
uint32_t ns3::ByteTagList::GetSerializedSize | ( | void | ) | const |
Returns number of bytes required for packet serialization.
Definition at line 428 of file byte-tag-list.cc.
References BeginAll(), ns3::ByteTagList::Iterator::HasNext(), ns3::ByteTagList::Iterator::Next(), NS_LOG_FUNCTION_NOARGS, and ns3::ByteTagList::Iterator::Item::size.
Referenced by ns3::Packet::GetSerializedSize(), and ns3::Packet::Serialize().
ByteTagList & ns3::ByteTagList::operator= | ( | const ByteTagList & | o | ) |
Assignment operator, deallocates current data and assigns value of passed in ByteTagList.
Also increases reference count
o | reference to the ByteTagList to copy |
Definition at line 164 of file byte-tag-list.cc.
References ns3::ByteTagListData::count, Deallocate(), m_adjustment, m_data, m_maxEnd, m_minStart, and m_used.
void ns3::ByteTagList::RemoveAll | ( | void | ) |
Removes all of the tags from the ByteTagList.
Definition at line 243 of file byte-tag-list.cc.
References Deallocate(), m_adjustment, m_data, m_maxEnd, m_minStart, m_used, and NS_LOG_FUNCTION.
Referenced by ns3::Packet::RemoveAllByteTags().
uint32_t ns3::ByteTagList::Serialize | ( | uint32_t * | buffer, |
uint32_t | maxSize | ||
) | const |
Serialize the tag list into a byte buffer.
[in,out] | buffer | The byte buffer to which the tag list will be serialized |
[in] | maxSize | Max The max size of the buffer for bounds checking |
Definition at line 457 of file byte-tag-list.cc.
References BeginAll(), ns3::ByteTagList::Iterator::Item::buf, ns3::ByteTagList::Iterator::Item::end, ns3::TypeId::GetHash(), ns3::ByteTagList::Iterator::HasNext(), ns3::ByteTagList::Iterator::Next(), NS_LOG_FUNCTION, NS_LOG_INFO, ns3::TagBuffer::Read(), ns3::ByteTagList::Iterator::Item::size, ns3::ByteTagList::Iterator::Item::start, and ns3::ByteTagList::Iterator::Item::tid.
Referenced by ns3::Packet::Serialize().
|
private |
adjustment to byte tag offsets
Definition at line 280 of file byte-tag-list.h.
Referenced by Add(), AddAtEnd(), AddAtStart(), Adjust(), Begin(), operator=(), and RemoveAll().
|
private |
the ByteTagListData structure
Definition at line 282 of file byte-tag-list.h.
Referenced by ByteTagList(), ~ByteTagList(), Add(), Begin(), operator=(), and RemoveAll().
|
private |
maximal end offset
Definition at line 279 of file byte-tag-list.h.
Referenced by Add(), AddAtEnd(), operator=(), and RemoveAll().
|
private |
minimal start offset
Definition at line 278 of file byte-tag-list.h.
Referenced by Add(), AddAtStart(), operator=(), and RemoveAll().
|
private |
the number of used bytes in the buffer
Definition at line 281 of file byte-tag-list.h.
Referenced by ~ByteTagList(), Add(), Begin(), operator=(), and RemoveAll().