[Click] control packetflow

Peter De Cleyn peter.decleyn at ua.ac.be
Tue May 25 11:09:30 EDT 2004


Thanks Michael and Eddie for your suggestions,

I think the solution of Eddie fits best my problem so I'll try this one
first!

Peter

 ______________
/Peter De Cleyn\
-------------------------------------
University of Antwerp
Dep. Math. and Computer Science
PATS research group
-------------------------------------
Middelheimlaan 1
Building G
B-2020 Antwerp
-------------------------------------
http://www.ua.ac.be
http://win-www.ruca.ua.ac.be
peter.decleyn at ua.ac.be
+32 3 265 33 64


On Mon, 24 May 2004, Eddie Kohler wrote:

> Michael Neufeld wrote:
> > If you aren't already using the "Paint" annotation for something, I'd be
> > tempted to use that. So instead of Element A controlling Element B
> > directly, it'd paint packets depending on its current state. Downstream,
> > Element B would examine the Paint annotation and do the approprate
> > splitting/duplication.
> ...
>
> Hi all,
>
> Mike's solution will totally work.
>
> Another way to do it would be with a plain old Switch element (plus a Tee).
> Then you could change the flow control with a write handler, rather than the
> per-packet Paint annotation.
>
> elementclass SwitchFlowControl {
>     input -> sw :: Switch(0) -> [0] output;
>     sw [1] -> [1] output;
>     sw [2] -> t :: Tee -> [0] output;
>               t [1] -> [1] output;
> }
> sfc :: SwitchFlowControl; ...
>
> Then:   echo 0 > /click/sfc/sw/switch      # sends only to sfc's 1st output
>          echo 1 > /click/sfc/sw/switch      # sends only to sfc's 2nd output
>          echo 2 > /click/sfc/sw/switch      # sends to both sfc's outputs
>
> Elements can call each others' handlers too, of course.
>
> Eddie
>


More information about the click mailing list