[Click] Accessing element handlers from within a click script

Beyers Cronje bcronje at gmail.com
Fri Aug 7 08:41:34 EDT 2009


Hi David,

I presume you are developing the send_scan_results element, in which case
you can pass bs as a configuration argument to send_scan_results element. In
your element's configure function you can then use cp_va_parse's cpElement
argument to gain a pointer to the bs object, at which point you can call any
public methods exposed by BeacondScanner. Grep for cpElement in Click's
element directory for examples on how to use it.

I believe there are alternative methods as well, such as traversing
upstream/downstream element configurations during runtime. See
click/elements/standard/unqueue2.cc for an example.

Regards

Beyers Cronje

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