[Ns-developers] tag rework for next release

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Mon Mar 23 13:32:27 PDT 2009


hi,

code: http://code.nsnam.org/mathieu/ns-3-tags

As a preparation for the ipv4 rework for next release, I finally spent
some time to try to deal with some of the issues around the tag API:
there are now two types of tags for each packet: 'packet' tags vs 'byte'
tags. Their semantics are slightly different to try to solve two
different use-cases:

1) byte tags could be typically used for flow ids: they will be
preserved across packet fragmentation and aggregation. byte tags can be
added to a packet but they can't be removed piecemeal: you have to
remove them all all at once or not at all.

2) packet tags will typically be used for cross-layer interactions (they
are presently used, for example, to convey the ipv4 ttl from the udp
layer to the ipv4 layer). They could be used to convey qos tids from
applications to a wifi layer. They can be removed one by one. The
implementation is optimized to be really efficient when the tag removed
is the last tag added (just like a stack).

API is all in src/common/packet.h:

void AddPacketTag (const Tag &tag) const;
bool RemovePacketTag (Tag &tag);
bool PeekPacketTag (Tag &tag) const;
void RemoveAllPacketTags (void);
void PrintPacketTags (std::ostream &os) const;
PacketTagIterator GetPacketTagIterator (void) const;

void AddByteTag (const Tag &tag) const;
bool FindFirstMatchingByteTag (Tag &tag) const;
void RemoveAllByteTags (void);
void PrintByteTags (std::ostream &os) const;
ByteTagIterator GetByteTagIterator (void) const;

Comments would be welcome,
Mathieu



More information about the Ns-developers mailing list