next up previous
Next: Packet Tracing Up: Technical documentation Previous: Symbol export

Dynamic Packet Types

Packet types in ns have traditionally been encoded as a enum and therefore determined at compilation time. Developers introducing new packet types needed to manually insert a new enum value toward the end of the list (right before PT_NTYPES). This is a big limitation for the development of dynamic loadable modules which cannot rely on this manual modification.

To overcome this limitation, a new interface for the dynamic registration of packet types has been added, which allows to request to the simulator the allocations of new packet types. This registration is supposed to be performed at initialization time by each module willing to define new packet types.

The registration interface consists of a new method added to the p_info class:

int p_info::addPacket(char *name)

nsmiracle-users mailing list