03.08.2013 Views

Design and Implementation of TinyGALS: A Programming Model for ...

Design and Implementation of TinyGALS: A Programming Model for ...

Design and Implementation of TinyGALS: A Programming Model for ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ut elements can create <strong>and</strong> export arbitrary additional interfaces. An element may also<br />

have an optional configuration string which contains additional arguments that are passed<br />

to the element at router initialization time. The Click configuration language allows users<br />

to define compound elements, which are router configuration fragments that behave like<br />

element classes. At initialization time, each use <strong>of</strong> a compound element is compiled into<br />

the corresponding collection <strong>of</strong> simple elements.<br />

Figure 21 shows an example Click element that belongs to the Tee element class, which<br />

sends a copy <strong>of</strong> each incoming packet to each output port. The element has one input port.<br />

It is initialized with the configuration string “2”, which in this case configures the element<br />

to have two output ports.<br />

element class<br />

input port Tee(2) output ports<br />

configuration string<br />

Figure 21: An example Click element.<br />

Connections in Click A connection represents a possible path <strong>for</strong> packet h<strong>and</strong><strong>of</strong>f <strong>and</strong><br />

attaches the output port <strong>of</strong> an element to the input port <strong>of</strong> another element. A connection<br />

is implemented as a single virtual function call. A connection between two push ports is<br />

a push connection, where packet h<strong>and</strong><strong>of</strong>f along the connection is initiated by the source<br />

element (or source end, in the case <strong>of</strong> a chain <strong>of</strong> push connections). A connection between<br />

two pull ports is a pull connection, where packet h<strong>and</strong><strong>of</strong>f along the connection is initiated by<br />

the destination element (or destination end, in the case <strong>of</strong> a chain <strong>of</strong> pull connections). An<br />

agnostic port behaves as a push port when connected to push ports <strong>and</strong> as a pull port when<br />

connected to pull ports, but each agnostic port must be used as push or pull exclusively.<br />

In addition, if packets arriving on an agnostic input might be emitted immediately on an<br />

agnostic output, then both input <strong>and</strong> output must be used in the same way (either push<br />

or pull). When a Click router is initialized, the system propagates constraints until every<br />

agnostic port has been assigned to either push or pull. A connection between a push port<br />

47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!