[Click] Accessing element handlers from within a click script
Peter De Cleyn
peter.decleyn at gmail.com
Fri Aug 7 08:58:43 EDT 2009
Hi David,
You can certainly pass a handler as a parameter to an another element. This
is well documented in the handlerCall reference in
http://www.read.cs.ucla.edu/click/doxygen/classHandlerCall.html. Look for
the HandlerCall Objects section. An example is given how to parse and call
a handler.
Regards,
Peter
Peter De Cleyn
IBBT - PATS research group
Dept. of Mathematics and Computer Sciences
University of Antwerp
Campus Middelheim, G3.26
Middelheimlaan 1
B-2020 Antwerpen, Belgium
Phone: +32 (0)3 265.33.64
Fax: +32 (0)3 265.37.77
Web: www.pats.ua.ac.be/peter.decleyn
On Fri, Aug 7, 2009 at 2:15 PM, david johnson <david.lloyd.johnson at gmail.com
> wrote:
> Hi
>
> I've got the following example code in which I'm continuously scanning
> for beacons and storing the results in bs.scan. I then want to send the
> results of the scan to other nodes in the network when I get a certain
> request message.
>
> To do this I need to access the BeaconScanner handler "scan". I'm new to
> click and maybe I'm breaking some fundamental rule in a click config
> script but is it possible to pass an element handler as a parameter to
> another element.
>
> I need to do it at this point in the code:
> 25 -> send_scan_results(### pass bs.scan handler to element ###)
>
> Thanks
> David
>
> =========================================
>
> 1 control :: ControlSocket("TCP", 7777);
> 2
> 3 rates :: AvailableRates(DEFAULT 2 4 11 22);
> 4
> 5 FromDevice(ath0, PROMISC true)
> 6 -> RadiotapDecap()
> 7 -> c1 :: Counter
> 8 -> wifi_cl :: Classifier(0/00%0c, /mgt
> 9 0/08%0c, /data);
> 10
> 11 wifi_cl [0] -> Classifier(0/80%f0)
> 12 -> c2 :: Counter
> 13 -> bs :: BeaconScanner()
> 14 -> Discard;
> 15
> 16 wifi_cl [1]
> 17 -> WifiDecap()
> 18 -> cognitive :: -> Classifier(//some String 1,
> 19 // Some String 2,
> 20 // Some String 3,
> 21 );
> 22
> 23 // Respond to Get beacons stored in node
> 24 cognitive [0]
> 25 -> send_scan_results(### pass bs.scan handler to element ###)
> 26 -> q;
> 27
> 28
> 29 q :: Queue(10)
> 30 -> wep_encap :: WepEncap(ACTIVE false)
> 31 -> set_rate :: SetTXRate(2)
> 32 -> rate :: ProbeTXRate(OFFSET 4,
> 33 THRESHOLD 0,
> 34 WINDOW 10000,
> 35 RT rates)
> 36 -> SetTXPower(63)
> 37 -> extra_encap :: ExtraEncap()
> 38 -> to_dev :: ToDevice (ath0);
>
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
More information about the click
mailing list