[ns] [help] accessing node id from drop-tail.cc

P.Reena p050001ee at nitc.ac.in
Wed Aug 30 03:53:38 PDT 2006


Hello,

In a multi hop wireless network, I want to get the queue length at
different intermediate nodes, during simulation. I was able to get  the
variables q_->length and time and write it to a file by adding a few
lines in drop-tail.cc code. But it displays the q_->length at all
nodes. I tried to display the node id using the following lines in
drop-tail.cc
        hdr_cmn* hdrcmn = hdr_cmn::access(p);
        nsaddr_t nodeaddr = hdrcmn->next_hope_;
        Node* thisnode = Node::get_node_by_address(nodeaddr);
        int nid = thisnode->nodeid();

        At this point this gives segmentation fault. Wwhy this happens?
        Also i assume that the above nodeaddr will give only the next hop
    node's id. Pl help me to get the node id of current node when the
    packet is
        reached an intermediate node?
     Reena






More information about the Ns-users mailing list