[Click] upstream queue
Venky Rama
venky2rama at yahoo.com
Tue Jul 18 00:54:33 EDT 2006
hi - how can say a roundrobinscheduler element get information about an upstream queue? something like
Queue *q = (Queue*)input(j).element();
q->getColor();
in the downstream element does not work...
for example, if the upstream queue has a new member called _color, then the scheduler needs to know if _color of the upstream queue is say red or green....
thanks!
venky
________
details:
________
i tried this in the scheduler's pull function but it gives weird numbers instead...assume the Queue class has a simple int member which stores color and which is returned by public getColor().
Packet *
RoundRobinSched::pull(int)
{
int n = ninputs();
int i = _next;
for (int j = 0; j < n; j++) {
Queue *q = (Queue*)input(j).element();
click_chatter("upstream queue %i has a color %i", j, q->getColor();)
Packet *p = (_signals[i] ? input(i).pull() : 0);
i++;
if (i >= n)
i = 0;
if (p) {
_next = i;
return p;
}
}
return 0;
}
---------------------------------
See the all-new, redesigned Yahoo.com. Check it out.
More information about the click
mailing list