[Click] control packetflow
Eddie Kohler
kohler at cs.ucla.edu
Mon May 24 09:47:24 EDT 2004
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