Global state variables in Click??

Eddie Kohler kohler at icir.org
Fri Jan 10 09:47:48 EST 2003


Hi Alessandro, Brecht,

> But to answer your question I don't think there are global variables
> possible. The mechanism used in click is to use packet annotations to
> transfer state (per packet) from one element to an other, but this is
> per packet.
> However, the experts will correct me if I'm wrong :-).

This is sort of right and sort of wrong :) The Click way to implement
global variables is to stick them in a shared element, exactly as
Alessandro suggests. There are a bunch of examples in the distribution:
AddressInfo, AlignmentInfo, ScheduleInfo, DriverManager,
IPRewriterPatterns, PerfCountInfo, .... Some of these elements support
multiple instances -- for instance, you can have multiple AddressInfo
elements, but all the information is collected into exactly one of them.

Eddie




More information about the click mailing list