Every packet in the simulator has a ``common'' header which is defined in packet.h as follows:
struct hdr_cmn { double ts_; /* timestamp: for q-delay measurement / packet_t ptype_; /* packet type (see above) / int uid_; /* unique id / int size_; /* simulated packet size / int iface_; /* receiving interface (label) / /* Packet header access functions */ static int offset_; inline static int& offset() { return offset_; } inline static hdr_cmn* access(Packet* p) { return (hdr_cmn*) p-\>access(offset_); } /* per-field member functions */ int& ptype() { return (ptype_); } int& uid() { return (uid_); } int& size() { return (size_); } int& iface() { return (iface_); } double& timestamp() { return (ts_); } };This structure primarily defines fields used for tracing the flow of packets or measuring other quantities. The time stamp field is used to measure queuing delay at switch nodes. The ptype_ field is used to identify the type of packets, which makes reading traces simpler. The uid_ field is used by the scheduler in scheduling packet arrivals. The size_ field is of general use and gives the simulated packet's size in bytes. Note that the actual number of bytes consumed in the simulation may not relate to the value of this field (i.e., size_ has no relationship to sizeof(struct hdr_cmn) or other ns structures). Rather, it is used most often in computing the time required for a packet to be delivered along a network link. As such it should be set to the sum of the application data size and IP-, transport-, and application-level headers for the simulated packet. The iface_ field is used by the simulator when performing multicast distribution tree computations. It is a label indicating (typically) on which link a packet was received.