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

Eddie Kohler kohler at cs.ucla.edu
Fri Mar 14 17:05:51 EDT 2008


Hi Manuel,

The "Click" way to do this might be to use a Switch element:


elementclass SwitchablePrint {
    input -> s :: Switch -> Print -> output;
    s[1] -> output;
}

... sp :: SwitchablePrint ...

A PullSwitch could be used for pull context.  If you set the "sp.switch" 
handler to 0, Print will print.  If you set it to 1, Print will not print, 
because it's bypassed.

But an "active" flag is easier so now Print has ACTIVE argument and "active" 
handler.

Your short-circuiting idea is best implemented via Switches.

Eddie


Manuel Requena wrote:
> 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
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list