Skip to content

Problem ‘undefined’ Protocol in Trace File

After I’ve ported & installed my new protocol into NS-2.34 on my Ubuntu 10.4, I’ve got something unusual in my trace file. It should be my protocol showed in trace file, but my trace file looks like this:
…..
…..
f -t 100.617533225 -Hs 9 -Hd 0 -Ni 9 -Nx 216.96 -Ny 129.62 -Nz 0.00 -Ne -1.000000 -Nl RTR -Nw — -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 12582914.255 -Id -1.255 -It undefined -Il 44 -If 0 -Ii 1949 -Iv 4
s -t 100.617708225 -Hs 9 -Hd 0 -Ni 9 -Nx 216.96 -Ny 129.62 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw — -Ma 0 -Md ffffffff -Ms 5 -Mt 800 -Is 12582914.255 -Id -1.255 -It undefined -Il 102 -If 0 -Ii 1949 -Iv 4
r -t 100.618524510 -Hs 5 -Hd 0 -Ni 5 -Nx 300.00 -Ny 150.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw — -Ma 0 -Md ffffffff -Ms 5 -Mt 800 -Is 12582914.255 -Id -1.255 -It undefined -Il 44 -If 0 -Ii 1949 -Iv 4
….
….
Almost 2 weeks I’ve been stuck in this problem. And, Alhamdulillah (*Thanks God*), now it’s SOLVED. The problem is I have to modified the packet.h file. Since NS-2.33 changed with adding support for dynamic libraries. The packet_t is changed from enum to unsigned int in order to allow dynamic definition of new packet types within dynamic libraries. Pre-defined packet types are implemented as static constanta.
And the packet.h file will added line as follows:
// PT_MYPROTO; ———————————> Changed!
static const packet_t PT_MYPROTO = 62;
// insert new packet types here
static packet_t PT_NTYPE = 63; // This MUST be the LAST. The original value is 62.
And add “type == PT_MYPROTO” on line 260.
static packetClass classify(packet_t type) {
if (type == PT_DSR ||
type == PT_MESSAGE ||
type == PT_TORA ||
type == PT_AODV ||
type == PT_MYPROTO)
return ROUTING;

1 thought on “Problem ‘undefined’ Protocol in Trace File”

  1. in the packet.h file scroll to the list of name_[TYPE] = “some_name” and add yours.
    For example:
    name_[PT_MYPROTO] = “SomeProtocolName”

Leave a Reply

Your email address will not be published. Required fields are marked *