next up previous contents index
Next: 11.2 Packet Classes Up: 11.1 A Protocol-Specific Packet Previous: 11.1 A Protocol-Specific Packet

11.1.1 Adding a New Packet Header Type

Assuming we wish to create a new header called newhdr the following steps are performed:

1.
sep0pt
2.
create a new structure defining the raw fields (called hdr_newhdr), define offset_ and access methods.
3.
define member functions for needed fields.
4.
create a static class to perform OTcl linkage (defines PacketHeader/Newhdr), do bind_offset() in its constructor.
5.
edit tcl/lib/ns-packet.tcl to enable new packet format (see 11.2.2, 11.2.4). Alternatively, one may call create-packet-header in one's own code (see tcl/lib/ns-packet.tcl for example of using this Tcl function.




2000-08-24