[Click] Click language changes

Eddie Kohler kohler at cs.ucla.edu
Sat Jan 22 01:39:16 EST 2011


Hey all,

I've just checked in some changes to the Click language that should make 
it easier and prettier to describe certain types of configuration graph.

Perhaps the easiest way do describe this is with an example.  Here is a 
typical classify-then-split-then-rejoin pattern, not using new features:

        c :: Classifier(10/01, -);
        post_classification :: ARPQuerier(...);
        analyzer :: TrafficAnalyzer;
        c [0] -> [1] analyzer [1] -> post_classification;
        c [1] -> c2 :: Classifier(12/02, -);
                 c2 [0] -> post_classification;
                 c2 [1] -> Paint(1) -> post_classification;

Note that the linear flow through c to post_classification is basically 
lost.

Here is the same configuration using new features:

        analyzer :: TrafficAnalyzer;
        c :: Classifier(10/01, -) => (
            [0] -> [1] analyzer [1] -> [0];
            [1] -> c2 :: Classifier(12/02, -) => (
                 [0] -> [0]; [1] -> Paint(1) -> [1]
            ) -> [0]
        ) -> post_classification :: ARPQuerier(...);

Things to note:

* The new => many-to-many connection operator, which maps several ports 
in parallel.  For example, a[0,1,2] => [0,1,2]b means a->b; a[1]->[1]b; 
a[2]->[2]b.  You can also say a[0],a[1],a[2] => [0]b,[1]b,[2]b.

* Element groups written in parentheses.  These superficially resemble 
compound elements, but do not introduce a new scope.  They can be used 
only in connections.

* Inferred "input" and "output" (there are a couple other improvements).

To learn more, check out Click, make install, and "man 5 click".  Or 
"man CLICKDIR/doc/click.5".

Cliff Frey gave a lot of good feedback on and motivation for these 
patches, thanks.

Feedback welcome!
Eddie

P.S. The following text is now a valid Click configuration:

Idle->(->)=>(->)->(->(=>)->)->(->)=>(->)->Idle

which if nothing else is good for a kind of laugh.


More information about the click mailing list