DescriptionThis is the first of three of patches to address Bug 582,
"Tags are not serialized and deserialized from Packet::Serialize and Packet::Deserialize"
https://www.nsnam.org/bugzilla/show_bug.cgi?id=582
One issue is to serialize the *type* of the derived Tag, when the Packet only has a PacketTagList to work from. This serialization has to produce a consistent result on every compute node in a parallel cluster, even one with heterogeneous nodes. This can be particularly tricky if the different instances of ns3 don't create TypeId's in the same order, which results in a single type (by name) being represented by different TypeId values (integers) on different nodes.
One approach, partially implemented by Jeffrey Young at Georgia Tech, is to serialize the TypeId name (a string). This seems unattractive because it takes time and space, typically much more space than the tag data itself (which is limited to 20 bytes).
The alternative approach proposed here is to add a consistent 32-bit hash to the TypeId, then pass that to identify the tag type.
To simplify review, I've split this into three patches:
1. Add class Hash: generic hash function interface, with two implementations (this review).
2. Add hashes to TypeId.
3. Use TypeId hash to serialize Tags.
This review covers the Hash class and implementation. The class itself provides a simple API for callers to hash objects. It wraps multiple underlying hash function implementations. This patch includes the venerable FNV1a, and murmur3.
It is straightforward to add new implementations. If your hash function has the right signature, it can be as simple as:
Hash (Ptr<HashImplementation> (Hash32Implementation<&hashf>))
Patch Set 1 #
Total comments: 8
Patch Set 2 : Respond to comments, add incremental hashing, fix hash function ptr, additional test cases, check-s… #
Total comments: 2
Patch Set 3 : Respond to review comments #
Total comments: 1
MessagesTotal messages: 12
|