29 #include "ns3/fatal-error.h" 37 PacketTagList::TagData *
42 "Requested TagData size " << dataSize
43 <<
" exceeds maximum " 46 void * p = std::malloc (
sizeof (
TagData) + dataSize - 1);
82 else if (cur->
tid == tid)
84 NS_LOG_INFO (
"found tid before initial merge, calling writer");
85 found = (this->*Writer)(tag,
true, cur, prevNext);
91 prevNext = &cur->
next;
97 if (cur == 0 || found)
99 NS_LOG_INFO (
"returning after header with found: " << found);
107 for (it = cur; it != 0; it = it->
next)
148 while ( cur->
tid != tid)
161 prevNext = ©->
next;
170 found = (this->*Writer)(tag,
false, cur, prevNext);
192 *prevNext = cur->
next;
267 "Error: cannot add the same kind of tag twice.");
bool Remove(Tag &tag)
Remove (the first instance of) tag from the list.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
struct TagData * next
Pointer to next in list.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
virtual uint32_t GetSerializedSize(void) const =0
List of the packet 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...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
const struct PacketTagList::TagData * Head(void) const
static TagData * CreateTagData(size_t dataSize)
Allocate and construct a TagData struct, sizing the data area large enough to serialize dataSize byte...
bool ReplaceWriter(Tag &tag, bool preMerge, struct TagData *cur, struct TagData **prevNext)
Copy-on-write implementing Replace.
Tree node for sharing serialized tags.
bool(PacketTagList::* COWWriter)(Tag &tag, bool preMerge, struct TagData *cur, struct TagData **prevNext)
Typedef of method function pointer for copy-on-write operations.
bool Replace(Tag &tag)
Replace the value of a tag.
bool RemoveWriter(Tag &tag, bool preMerge, struct TagData *cur, struct TagData **prevNext)
Copy-on-write implementing Remove.
uint32_t size
Size of the data buffer.
Defines a linked list of Packet tags, including copy-on-write semantics.
uint8_t data[1]
Serialization buffer.
virtual void Serialize(TagBuffer i) const =0
tag a set of bytes in a packet
bool COWTraverse(Tag &tag, PacketTagList::COWWriter Writer)
Traverse the list implementing copy-on-write, using Writer.
struct TagData * m_next
Pointer to first TagData on the list.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void Deserialize(TagBuffer i)=0
bool Peek(Tag &tag) const
Find a tag and return its value.
void Add(Tag const &tag) const
Add a tag to the head of this branch.
virtual TypeId GetInstanceTypeId(void) const =0
Get the most derived TypeId for this Object.
TypeId tid
Type of the tag serialized into data.
a unique identifier for an interface.
uint32_t count
Number of incoming links.