[Click] Questions using click read/write handlers

Eddie Kohler kohler at cs.ucla.edu
Sun Jun 12 18:32:59 EDT 2005


Bita

I don't understand your question.  All kinds of handlers access and set 
variables on elements (== not global variables).  What do you mean virtual files.



betamaz wrote:
> Hi,
> 
> I have created an linuxmodule element with a handler called "traffic" that 
> is both read and write. I successfully write some data using read handler to 
> traffic_handler. How do I read that data back out using the handlers? All 
> the elements I've looked at never read data out of these click-made 
> handlers. They just access/set the global variables of the classes element. 
> My goal is to read and write data to a click-created file or to a user 
> defined file. 
> 
> Below is a piece of what the element. For now, the read_handler gets one ip 
> address from get_ips() . The ip gets written to "traffic". It doesnt seem to 
> me that click's handlers can be used to read data from the created virtual 
> files. If so, what other method can I user? 
> 
> String
> UDPTrafficFlows::get_ips() const
> {
> StringAccum sa;
> Entry e;
> e.addr = _sipaddr;
> sa << e << '\n';
> return sa.take_string();
> }
> 
> static String 
> UDPTrafficFlows_traffic_handler
> (Element *e, void *)
> {
> UDPTrafficFlows *u = static_cast <UDPTrafficFlows*>(e);
> String str = u->get_ips();
> return str;
> }
> 
> void
> UDPTrafficFlows::add_handlers()
> {
> . . .
> . . .
> add_read_handler("traffic", UDPTrafficFlows_traffic_handler, 0);
> add_write_handler("traffic", UDPTrafficFlows_traffic_handler, 0);
> }
> 
> Thank you,
> Bita.
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 



More information about the click mailing list