Each packet contains a packet type field used by Trace::format to print out the type of packet encountered. The type field is defined in the TraceHeader class, and is considered to be part of the trace support; it is not interpreted elsewhere in the simulator. Initialization of the type field in packets is performed by the Agent::allocpkt method. The type field is set to integer values associated with the definition passed to the Agent constructor (Section 10.6.3). The currently-supported definitions, their values, and their associated symblic names are as follows (defined in ~ns/packet.h):
enum packet_t { PT_TCP, PT_UDP, PT_CBR, PT_AUDIO, PT_VIDEO, PT_ACK, PT_START, PT_STOP, PT_PRUNE, PT_GRAFT, PT_GRAFTACK, PT_JOIN, PT_ASSERT, PT_MESSAGE, PT_RTCP, PT_RTP, PT_RTPROTO_DV, PT_CtrMcast_Encap, PT_CtrMcast_Decap, PT_SRM, /* simple signalling messages */ PT_REQUEST, PT_ACCEPT, PT_CONFIRM, PT_TEARDOWN, PT_LIVE, // packet from live network PT_REJECT, PT_TELNET, // not needed: telnet use TCP PT_FTP, PT_PARETO, PT_EXP, PT_INVAL, PT_HTTP, /* new encapsulator */ PT_ENCAPSULATED, PT_MFTP, /* CMU/Monarch's extnsions */ PT_ARP, PT_MAC, PT_TORA, PT_DSR, PT_AODV, PT_AOMDV, /* DCCP */ PT_DCCP, ... PT_MDART, // insert new packet types here PT_NTYPE // This MUST be the LAST one };The constructor of class p_info glues these constants with their string values:
p_info() { name_[PT_TCP]= "tcp"; name_[PT_UDP]= "udp"; name_[PT_CBR]= "cbr"; name_[PT_AUDIO]= "audio"; ... name_[PT_NTYPE]= "undefined"; }See also section 12.2.2 for more details.