[Click] Elements handlers
Rafael Paoliello Guimaraes
rafael.guimaraes at ac.upc.edu
Fri Mar 11 07:30:48 EST 2005
Ok, I know this. I have done this with read handlers and write
handlers... I have even read that if I want a read/write handler, I
should register two handlers with the same name, one for write and one
for read. But my case is different. I want to register a handler that is
read and write at the same time. For example, in the LinearIPLookup
table there is a read handler called "table" that simply returns the
routing table. Well, suppose I wanted to provide an additional handler
(routes) that given a destination address, would return the entries on
the routing table that could be use to route data to this address... How
thid could be done?
Example:
if the routing table is:
DST OUT
10.0.2.0/24 1
20.7.4.0/24 2
10.0.0.0/16 1
if I called this new handler like this: routes(10.0.2.1)
it would return me the following string:
10.0.2.0/24 1
10.0.0.0/16 1
Is it possible to be implemented (or is there any alternative way to do
this), or would I have to modify the Element class?
Cheers,
===========================================
Rafael Paoliello Guimaraes
PhD Student - Computer Networking Group
Department of Computer Architecture (DAC)
Polytechnic University of Catalonia (UPC)
Phone: +34-934017187 Fax: +34-934017055
URL: http://people.ac.upc.es/rpaoliel
===========================================
Marko Zec wrote:
> On Thursday 10 March 2005 21:22, Rafael Paoliello Guimaraes wrote:
>>Hi,
>>
>>I am writing some new Click elements and I have a doubt concerning
>>the handlers of an element. I have seen read handler and write
>>handlers implemented, but I have not seen any read/write handler. Is
>>there this possibility? I want the handler to return me a string
>>based on some arguments I introduce.
>>
>>I have implemented the following handler:
>>
>>String
>>MyElement::thehandler_handler(const String &conf_in, Element *e, void
>>*thunk, ErrorHandler *errh)
>>
>>
>>But I don't know how to add it to the element? Is this right? How
>>should I do it?
>
>
> The Element class provides the add_handlers() virtual function which you
> may override to explicitely export custom handler hooks. Just grep
> through existing elements for add_handlers...
>
> Marko
>
More information about the click
mailing list