25 #define USE_FREE_LIST 1
26 #define FREE_LIST_SIZE 1000
27 #define OFFSET_MAX (2147483647)
65 for (ByteTagListDataFreeList::iterator i = begin ();
68 uint8_t *buffer = (uint8_t *)(*i);
135 return m_offsetStart;
184 uint32_t spaceNeeded =
m_used + bufferSize + 4 + 4 + 4 + 4;
247 return Iterator (0, 0, offsetStart, offsetEnd);
263 if (item.
end > appendOffset)
279 if (item.
start < prependOffset)
300 item.
start += adjustment;
301 item.
end += adjustment;
303 if (item.
start >= appendOffset)
307 else if (item.
start < appendOffset && item.
end > appendOffset)
309 item.
end = appendOffset;
334 item.
start += adjustment;
335 item.
end += adjustment;
337 if (item.
end <= prependOffset)
341 else if (item.
end > prependOffset && item.
start < prependOffset)
343 item.
start = prependOffset;
366 if (data->
size >= size)
372 uint8_t *buffer = (uint8_t *)data;
375 uint8_t *buffer =
new uint8_t [std::max (size, g_maxSize) +
sizeof (
struct ByteTagListData) - 4];
391 g_maxSize = std::max (g_maxSize, data->
size);
393 if (data->
count == 0)
398 uint8_t *buffer = (uint8_t *)data;
414 uint8_t *buffer =
new uint8_t [size +
sizeof (
struct ByteTagListData) - 4];
431 if (data->count == 0)
433 uint8_t *buffer = (uint8_t *)data;
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint32_t dirty
number of bytes actually in use
ByteTagList & operator=(const ByteTagList &o)
Assignment operator, deallocates current data and assigns value of passed in ByteTagList.
Iterator(uint8_t *start, uint8_t *end, int32_t offsetStart, int32_t offsetEnd)
Constructor.
struct ByteTagListData * m_data
the ByteTagListData structure
uint32_t count
use counter (for smart deallocation)
keep track of the byte tags stored in a packet.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
bool HasNext(void) const
Used to determine if the iterator is at the end of the byteTagList.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
TagBuffer Add(TypeId tid, uint32_t bufferSize, int32_t start, int32_t end)
void TrimAtEnd(uint32_t trim)
Trim some space from the end.
uint32_t m_nextTid
TypeId of the next tag.
TAG_BUFFER_INLINE uint32_t ReadU32(void)
ns3::ByteTagListDataFreeList g_freeList
Container for struct ByteTagListData.
void Deallocate(struct ByteTagListData *data)
Deallocates a ByteTagListData.
uint8_t * m_current
Current tag.
int32_t m_offsetEnd
Offset to the end of the tag from the virtual byte buffer.
void PrepareForNext(void)
Prepare the iterator for the next tag.
void RemoveAll(void)
Removes all of the tags from the ByteTagList.
Internal representation of the byte tags stored in a packet.
uint32_t m_nextSize
Size of the next tag.
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
uint16_t m_used
the number of used bytes in the buffer
int32_t start
offset to the start of the tag from the virtual byte buffer
void AddAtEnd(int32_t adjustment, int32_t appendOffset)
Adjust the offsets stored internally by the adjustment delta and make sure that all offsets are small...
struct ByteTagList::Iterator::Item Next(void)
Returns the next Item from the ByteTagList.
struct ByteTagListData * Allocate(uint32_t size)
Allocate the memory for the ByteTagListData.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetUid(uint16_t tid)
int32_t m_nextStart
Start of the next tag.
uint32_t GetOffsetStart(void) const
Returns the offset from the start of the virtual byte buffer to the ByteTagList.
int32_t end
offset to the end of the tag from the virtual byte buffer
uint16_t GetUid(void) const
ByteTagList::Iterator BeginAll(void) const
Returns an iterator pointing to the very first tag in this list.
int32_t m_offsetStart
Offset to the start of the tag from the virtual byte buffer.
Container class for struct ByteTagListData.
TypeId tid
type of the tag
uint32_t size
size of tag data
uint32_t size
size of the data
bool IsDirtyAtStart(int32_t prependOffset)
Check that all offsets are bigger than prependOffset.
~ByteTagListDataFreeList()
ByteTagList::Iterator Begin(int32_t offsetStart, int32_t offsetEnd) const
TagBuffer buf
the data for the tag as generated by Tag::Serialize
An iterator for iterating through a byte tag list.
int32_t m_nextEnd
End of the next tag.
Item(TagBuffer buf)
constructs an item with the given TagBuffer
bool IsDirtyAtEnd(int32_t appendOffset)
Check that all offsets are smaller than appendOffset.
static uint32_t g_maxSize
maximum data size (used for allocation)
a unique identifier for an interface.
void CopyFrom(TagBuffer o)
Copy the nternal structure of another TagBuffer.
void AddAtStart(int32_t adjustment, int32_t prependOffset)
Adjust the offsets stored internally by the adjustment delta and make sure that all offsets are bigge...
An item specifies an individual tag within a byte buffer.