19#include "ns3/fatal-error.h" 
   33                  "Requested TagData size " << dataSize << 
" exceeds maximum " 
   36    void* p = std::malloc(
sizeof(
TagData) + dataSize - 1);
 
 
   64    while (cur != 
nullptr)
 
   72        else if (cur->
tid == tid)
 
   74            NS_LOG_INFO(
"found tid before initial merge, calling writer");
 
   75            found = (this->*Writer)(tag, 
true, cur, prevNext);
 
   81            prevNext = &cur->
next;
 
   87    if (cur == 
nullptr || found)
 
   89        NS_LOG_INFO(
"returning after header with found: " << found);
 
   97    for (it = cur; it != 
nullptr; it = it->
next)
 
  138    while ( cur->
tid != tid)
 
  151        prevNext = ©->
next; 
 
  160    found = (this->*Writer)(tag, 
false, cur, prevNext);
 
 
  182    *prevNext = cur->
next; 
 
  195        if (cur->
next != 
nullptr)
 
 
  241        if (copy->
next != 
nullptr)
 
 
  258                      "Error: cannot add the same kind of tag twice. The tag type is " 
  263    head->
next = 
nullptr;
 
 
  313        uint32_t tagWordSize = (cur->size + 3) & (~3);
 
 
  365        uint32_t tagWordSize = (cur->size + 3) & (~3);
 
  373        memcpy(p, cur->data, cur->size);
 
  374        p += tagWordSize / 4;
 
 
  394    NS_LOG_INFO(
"Deserializing number of tags " << numberOfTags);
 
  397    for (
uint32_t i = 0; i < numberOfTags; ++i)
 
  408        sizeCheck -= hashSize;
 
  416        newTag->
next = 
nullptr;
 
  420        memcpy(newTag->
data, p, tagSize);
 
  423        uint32_t tagWordSize = (tagSize + 3) & (~3);
 
  424        p += tagWordSize / 4;
 
  425        sizeCheck -= tagWordSize;
 
  434            prevTag->
next = newTag;
 
  444    return (sizeCheck != 0) ? 0 : 1;
 
 
virtual TypeId GetInstanceTypeId() const =0
Get the most derived TypeId for this Object.
bool Remove(Tag &tag)
Remove (the first instance of) tag from the list.
void Add(const Tag &tag) const
Add a tag to the head of this branch.
uint32_t Deserialize(const uint32_t *buffer, uint32_t size)
Deserialize tag list from the provided buffer.
uint32_t Serialize(uint32_t *buffer, uint32_t maxSize) const
Serialize the tag list into a byte buffer.
bool ReplaceWriter(Tag &tag, bool preMerge, TagData *cur, TagData **prevNext)
Copy-on-write implementing Replace.
bool Replace(Tag &tag)
Replace the value of a tag.
bool Peek(Tag &tag) const
Find a tag and return its value.
uint32_t GetSerializedSize() const
Returns number of bytes required for packet serialization.
bool COWTraverse(Tag &tag, PacketTagList::COWWriter Writer)
Traverse the list implementing copy-on-write, using Writer.
bool RemoveWriter(Tag &tag, bool preMerge, TagData *cur, TagData **prevNext)
Copy-on-write implementing Remove.
const PacketTagList::TagData * Head() const
PacketTagList()
Create a new PacketTagList.
TagData * m_next
Pointer to first TagData on the list.
static TagData * CreateTagData(size_t dataSize)
Allocate and construct a TagData struct, sizing the data area large enough to serialize dataSize byte...
bool(PacketTagList::* COWWriter)(Tag &tag, bool preMerge, TagData *cur, TagData **prevNext)
Typedef of method function pointer for copy-on-write operations.
tag a set of bytes in a packet
virtual uint32_t GetSerializedSize() const =0
virtual void Serialize(TagBuffer i) const =0
virtual void Deserialize(TagBuffer i)=0
a unique identifier for an interface.
static TypeId LookupByHash(hash_t hash)
Get a TypeId by hash.
uint32_t hash_t
Type of hash values.
std::string GetName() const
Get the name.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Defines a linked list of Packet tags, including copy-on-write semantics.
Tree node for sharing serialized tags.
TagData * next
Pointer to next in list.
TypeId tid
Type of the tag serialized into data.
uint32_t size
Size of the data buffer.
uint32_t count
Number of incoming links.
uint8_t data[1]
Serialization buffer.