[Click] PUSH element with timer...possible?.

Bart Braem bart.braem at ua.ac.be
Fri Feb 4 05:41:02 EST 2011


Please, please, reply to the mailinglist. That way every one can benefit from answers you get.


On 04 Feb 2011, at 11:16, muralidharan at tce.edu wrote:

>> Hi,
>> 
>> On 04 Feb 2011, at 08:45, muralidharan at tce.edu wrote:
>> 
>>> 1)Is it ever possible to write an element with more than one (say three)
>>> PUSH ports for both input and output?.
>>> i tried to create an element with 1/1 pull configuration and initialized
>>> the timer too.
>>> 
>>> but the code in the run_timer() method is never executed...
>>> i was trying to reset a packet counter (in the push() method)
>>> periodically
>>> to zero.
>>> 
>>> 
>> 
>> This should be possible.
>> Please publish your minimal code here, so we can help you fix it.
> 
> Time::Time()
>    : _count(0), _timer(this)
> {
>        avg=0;
> }
> 
> Time::~Time()
> {
> }
> 
> int
> Time::initialize(ErrorHandler *)
> {
>  _timer.initialize(this);
>  return 0;
> }
> 
> void
> Time::run_timer(Timer *)
> {
> 	click_chatter("Timer activated >>>>>>>> Count Reset");
> 	_count=0;
> 	_timer.reschedule_after_s(5);
> }
> 
> void Time::push(int port, Packet *p)
> {
> 	if(port==0)
> 	{
> 		click_chatter("Packet passed");
> 		_count=_count+1;
> 		output(0).push(p);
> 	}
> }
> So here only the push() method is executed. The run_timer() method is
> never executed
> 
>>> 2)Is it possible to have more than one OUTPUT ports for a PULL processed
>>> element?. If so should all output ports except one be agnostic?.
>>> we only have to 'return' the packet's pointer or null pointer in pull
>>> processing.
>>> how do we make forward the packet through a specific output port?
>> 
>> 
>> Yes that is possible too, and all ports can be pull.
>> As you can see in the signature of the pull function at
>> <http://read.cs.ucla.edu/click/doxygen/class_element.html#ce8c7b8b37f177b9a9cc024d8b64f3a3>,
>> the integer specifies the port which is pulled.
>> 
>> regards,
>> Bart
>> 
>> 
> thank you for replying.
> 
> 
> -----------------------------------------
> This email was sent using TCEMail Service.
> Thiagarajar College of Engineering
> Madurai-625 015, India
> 




More information about the click mailing list