[Click] New Print elements behavior or activate/deactivate an element

Manuel Requena manuel.requena at cttc.es
Fri Mar 14 12:09:37 EDT 2008


Hi,

I use Print elements in different points of a Click router to have traces and to debug the router.
But these traces are very verbose when I have different paths for the packets in the click router,
so I want to switch on/off some Print elements in a running config.

My initial idea is to add a flag in the Print element that could be set/reset with a write handler
("print.on / off").

The modification of the Print element would be quite simple, apart from the code related to the
write handler:

Packet *
Print::simple_action(Packet *p)
{
    if (is_on) {
        ....
        click_chatter("%s", sa.c_str());
    }

    return p;
}

What do you think? There is a better solution?

Another more generic solution would be to add a similar feature to the Element class to activate or
deactivate an element. A kind of short-circuit of the deactivated element. The element would be a
wire when it will be deactivated.  But I think this could have more philosophical problems in some
elements (multiple-ports, push-to-pull, pull-to-push, encap/decap...), and maybe the
short-circuiting should be forbidden for this kind of elements. There already exist something
similar?

Best regards,
Manuel



More information about the click mailing list