[Click] How to write to /proc in a click element

Harald Schiöberg harald at net.t-labs.tu-berlin.de
Tue Aug 11 04:57:59 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eddie Kohler wrote:
> Hey Harald,
> 
> I'm not sure what you mean by "proper callback handlers".  The
> END_CALL/COUNT_CALL pattern is one type of callback, and Click supports
> *that* pretty well.  Are you looking for something where elements could
> register or unregister callbacks dynamically?
> 
Hi Eddie,

For Ashish' example, I could imagine a  ControlSocket session like that:

- -> register control_packet_handler.arrive
<- 200 OK callback registered

...other stuff...

... every time a packet arrives:..

<- 299-callback returned
<- 299 handler control_packet_handler.arrive
<- DATA xxx
<- <control pkt message>


Just to give another use case: I needed a distributed dhcp server, where
leases are stored externally, but didn't use click in the end, because
that would have required something like:

- -> register dhcp_server.request_arrive

later
<- DATA
<- request from 00:01:02:03:04:05
- -> write dhcp_server.new_lease 1.2.3.4

well, looking at it, I seriously have no idea how much work this is, an
whether it's worth it, but still....

best,
	harald




> Eddie
> 
> 
> Harald Schiöberg wrote:
> Ashish Sharma wrote:
>>>> Hi,
>>>>
>>>> Can someone please advise me how to write something in /proc/sys in a
>>>> click
>>>> event? I need to change the channel in MadWifi upon reception of a
>>>> control
>>>> packet. I am planning on writing a sysctl handler in madwifi to
>>>> change the
>>>> channel upon request, and I need to trigger it using Click. If
>>>> someone has a
>>>> better suggestion to do this - I'll be glad to know!
>>>>
>>>> Thanks for your help and time.
> 
> Since there are no proper callback handlers in click
> ( hidden feature request ;-) ,
> that is my way of doing these things for userlevel click:
> 
> * Your element:
> click_chatter("CHANGE_PROC: yourstuff")
> 
> 
> * Some script.pl (or whatever you like)
> 
> chattersock=IO::Socket.new(stuff)
> while ( line = chattersock.read_line ) {
>     if line = ~ /^CHANGE_PROC: (.*)/ {
>         doing stuff with $1
>     }
> }
>     
> 
> kernel level click should have a similar output channel....
> 
> 
>>
_______________________________________________
click mailing list
click at amsterdam.lcs.mit.edu
https://amsterdam.lcs.mit.edu/mailman/listinfo/click

- --
Harald Schiöberg
Technische Universität Berlin | T-Laboratories | FG INET
www: http://www.net.t-labs.tu-berlin.de
Phone: +49-(0)30-8353-58476 | Fax: +49-(0)391 534 783 47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKgTKWy8wrZ9OvkU0RApsCAJ9HwaXRHo6GGX7Ar6WO5/imOcymuQCgjIg6
wFx0zkHjgy75HV7Vb8n7L+4=
=HAdn
-----END PGP SIGNATURE-----



More information about the click mailing list