[Click] Click and scripting
Eddie Kohler
kohler at cs.ucla.edu
Sun Dec 18 01:12:48 EST 2005
Hi all,
I just checked in a rather large diff that finally moves Click
towards easy scripting.
In order to print out a count of packets received (with a message)
every 200 bytes, you might do something like this:
... -> c::Counter(BYTE_COUNT_CALL 200 script.run) -> ...
script :: Script(TYPE PASSIVE, // this script runs only when poked
init b 200, // initialize $b to 200
print "reached $b bytes in $(c.count) packets",
set b $(script.add 200 $b), // b += 200
write c.byte_count_call $b script.run);
Scripts can run actively, can control the driver, and can even run in
response to user-level signals.
This required some relatively extensive changes. The DriverManager
element's syntax has changed in incompatible ways; if you used the
"save" or "append" instructions you must replace them with "print".
The PokeHanders element is now deprecated.
Please let me know if anyone encounters any problems!
Eddie
On Dec 8, 2005, at 12:10 PM, Eddie Kohler wrote:
> Counter's BYTE_COUNT_CALL is *almost* enough to do what you want,
> but not quite.
>
> ... -> c::Counter(BYTE_COUNT_CALL NUMBEROFBYTES poker.unpause) -> ...
> poker :: PokeHandlers(pause, read c.count,
> /* WANT TO INCREMENT BYTE_COUNT_CALL HERE BUT NO WAY
> TO DO THE ARITHMETIC */, loop);
>
> Maybe there'll be an easy way at the end of the weekend.
> E
>
>
>
> On Dec 8, 2005, at 11:08 AM, Nicholas Weaver wrote:
>
>>
>> I want to use the Counter or similar to print out a count of packets
>> received (with a message) every N bytes.
>>
>> Does someone have an example of how to do this?
>>
>> Thanks.
>>
>> --
>> Nicholas C. Weaver
>> nweaver at icsi.berkeley.edu
>> This message has been ROT-13 encrypted twice for higher
>> security.
>> _______________________________________________
>> click mailing list
>> click at amsterdam.lcs.mit.edu
>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
More information about the click
mailing list