[Ns-developers] tag rework for next release
Tom Henderson
tomh at tomh.org
Fri Apr 3 11:04:46 PDT 2009
Mathieu Lacage wrote:
> 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).
Mathieu,
One thing that I noticed is that packet tags are left out of the
Packet::Serialize() process (while byte tags are included). This is a
bit subtle, but it basically means that packets that are sent to another
node via an ns-3 channel will retain packet tags but if that ns-3
channel happens to utilize a real IP tunnel (in a distributed simulation
use case) the packet tags will be stripped.
It seems like we ought to support packet tags in Serialize, but is there
a reason why not?
We ought to document somewhere the interaction between application-level
tags and NSC, while this is not yet fixed for NSC.
samples/main-packet-tag.cc could be enhanced with a byte example and
more commenting. I would volunteer to contribute this patch if you want.
Also, in udp-echo-server.cc:
NS_LOG_INFO ("Received " << packet->GetSize() << " bytes
from " <<
address.GetIpv4());
- packet->RemoveAllTags ();
+ packet->RemoveAllPacketTags ();
NS_LOG_LOGIC ("Echoing packet");
socket->SendTo (packet, 0, from);
Why not remove all byte tags also? Conceptually, this is a new packet
that is being echoed; i.e., it should behave the same as if the packet
were freed and a new one generated.
CHANGES.html needs some words upon merge.
Other than that, I support the overall concept/approach and would like
to support merging this once the above discussion plays out.
Tom
More information about the Ns-developers
mailing list