By default, ns includes ALL packet headers of ALL protocols in ns in EVERY packet in your simulation. This is a LOT of overhead, and will increase as more protocols are added into ns. For ``packet-intensive'' simulations, this could be a huge overhead. For instance, as of now (Aug 30, 2000), the size of packet headers of all protocols in ns is about 1.9KB; however, if you turn on only the common header, the IP header and the TCP header, they add up to about 100 bytes. If you are doing large-scale web traffic simulation with many big fat pipes, reducing unused packet headers can lead to major memory saving.
To include only the packet headers that are of interest to you in your specific simulation, follow this pattern (e.g., you want to remove AODV and ARP headers from your simulation):
remove-packet-header AODV ARP ...... set ns [new Simulator]Notice that remove-packet-header MUST go before the simulator is created. All packet header names are in the forms of PacketHeader/[hdr]. You only need to supply the [hdr] part, not the prefix. To find the names of packet headers, you may either look them up in ~ns/tcl/lib/ns-packet.tcl, or run the following simple commands in ns:
foreach cl [PacketHeader info subclass] { puts $cl }
To include only a specific set of headers in your simulation, e.g., IP and TCP, follow this pattern:
remove-all-packet-headers add-packet-header IP TCP ...... set ns [new Simulator]IMPORTANT: You MUST never remove common header from your simulation. As you can see in ~ns/tcl/lib/ns-packet.tcl, this is enforced by these header manipulation procs.
Notice that by default, all packet headers are included.
Tom Henderson 2011-11-05