Next: 12.1.2 Selectively Including Packet
Up: 12.1 A Protocol-Specific Packet
Previous: 12.1 A Protocol-Specific Packet
Contents
Index
Assuming we wish to create a new header called newhdr
the following steps are performed:
- create a new structure defining the raw fields
(called hdr_newhdr), define offset_ and access
methods.
- define member functions for needed fields.
- create a static class to perform OTcl linkage
(defines PacketHeader/Newhdr), do bind_offset()
in its constructor.
- edit ~ns/tcl/lib/ns-packet.tcl to enable new packet format
(see 12.2.2, 12.2.4).
This is the recommended way to add your packet headers.
If you do
not follow this method, your simulation may still work, but it may
behave in a unpredictable way when more protocols are added into
your simulation.
The reason is that the BOB (Bag of Bits,
Section 12.2.1) in ns packet is a large
sparse space, assigning one wrong packet header offset may not
trigger failure immediately.
2008-12-02