Skip to content

network: Bit serialization and deserialization

Tommaso Pecorella requested to merge tommypec/ns-3-dev:BitSerializer into master

Some time ago I had to serialize (and deserialize) a bit-oriented protocol, i.e., where all the fields were made of bits, and nothing (!) was byte-aligned, except (of course) the full message.

Citing RFC 1925 (it applies to software as well):

(6) It is easier to move a problem around (for example, by moving the problem to a different part of the overall network architecture) than it is to solve it.

Long story short: two new classes: BitSerializer and BitDeserializer. They act as middle men before and after a serialization and deserialization.

A better solution would be to extend Serialize and Deserialize... but it would have been far more complicated, and probably it would have made them slower.

Edited by Tommaso Pecorella

Merge request reports