[Click] read handler with parameters
sam barker
sam.barker0 at gmail.com
Tue Jan 15 18:00:22 EST 2008
Hi Beyers,
I tried it but got the error "read handlers does not take parameters".
Is there anyway way to call the read handler with parameters.[Suppose if you
want to return a value corresponding to the passed parameter]
I was going through a manual called coding concepts which clearly states
that "You can't call a ReadHandler with arguments"
Cheers,
Sam
On Jan 15, 2008 9:01 PM, Beyers Cronje <bcronje at gmail.com> wrote:
> Hi Sam,
>
> I've never passed a parameter to a read handler before, so this might be
> wrong....
>
> Your telnet command should be:
>
> read readelement_name.a_handle 1
>
> Also I believe the prototype of add_handlers is onle 'virtual void
> add_handlers();'
>
> Beyers
>
> On Jan 15, 2008 4:11 AM, sam barker <sam.barker0 at gmail.com> wrote:
>
> > Hi All,
> > I was trying out the read handler with a parameter and I seem to be
> > stuck.
> >
> > Basically I wan t to pass an int parameter to my_func().
> >
> > After I telnet into the localhost how do I call the function?.
> > I had used read readelement_name.a_handle(1);
> >
> > The the partial code of my .cc file is below
> >
> >
> > String readelement::handle(Element *e, void *thunk){
> > readelement * me = (readelement *) e;
> >
> > int *i;
> > i=(int *)thunk;
> > return me->my_func(i);
> > }
> > void readelement::add_handlers(void * thunk){
> > add_read_handler("a_handle", &handle, (void *)thunk);
> > }
> >
> > Regards,
> > Sam
> > _______________________________________________
> > click mailing list
> > click at amsterdam.lcs.mit.edu
> > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> >
>
>
More information about the click
mailing list