[ns] Calculating Queue Length at a wireless node

JyothiR vjreddy246 at gmail.com
Sat Oct 15 15:00:23 PDT 2011


Hi,

I am trying to implement a new routing protocol for MANETs, for which I need
to calculate the number of packets waiting at a node (Or) the length of the
queue.
I know how to calculate the queue length on a wired network (for which the
queue is on the link instead of on the node, I am guessing so). I have also
seen a solution to dump the queue length into the trace from tcl file.

But, what I need is to access the length of the queue in my C++ code (the
routing protocol).

>From some post I have read, the Queue length can be accessed from the
"priqueue.cc" file by adding a procedure, because that is where all the
packets are 'enqued'. Which I did, but the problem is I am unable to access
the q_ variable, which holds the queue information. I am unable to figure
out how the variable can be accessed.

This is the code I am trying to execute.

PriQueue *myqueue;

int res = myqueue->QueueLength(node_id);

QueueLength is the procedure defined in priqueue.cc file which is defined
as,

int PriQueue:QueueLength(nsaddr_t id)
{
    struct hdr_cmn *ch;
    int QLength = 0;
    Packet *p = 0;

    for(p = q_->head(); p; p = p->next_) {
        Packet *p = q_->lookup(i);
        ch = HDR_CMN(p);
        if(ch->next_hop() == id)
            QLength++;
    }
    return QLength;
}

The point to access the q_ variable "q_->head()" throws a segmentation fault
(core dumped) error. I have seen that q_ variable is not showing any values
when I called this procedure (Something to do with the instances of a class
I guess).

Any help (not necessarily solutions- suggestions and hints will also do) is
greatly appreciated. I have done all the research I could, from the ns
manual and also the mailing lists, but couldn't get a solution.


Regds,
Jyothi
-- 
View this message in context: http://old.nabble.com/-ns--Calculating-Queue-Length-at-a-wireless-node-tp32659587p32659587.html
Sent from the ns-users mailing list archive at Nabble.com.



More information about the Ns-users mailing list