next up previous contents index
Next: 12.2.3 The hdr_cmn Class Up: 12.2 Packet Classes Previous: 12.2.1 The Packet Class   Contents   Index


12.2.2 p_info Class

This class is used as a ``glue'' to bind numeric packet type values with their symbolic names. When a new packet type is defined, its numeric code should be added to the enumeration packet_t (see ~ns/packet.h) 12.2 and its symbolic name should be added to the constructor of p_info:

enum packet_t {
        PT_TCP,
        ...
        PT_NTYPE // This MUST be the LAST one
};

class p_info {
public:
        p_info() {
                name_[PT_TCP]= "tcp";
                ...
        }
}


2008-07-04