[Click] Handlers

Eddie Kohler kohler at CS.UCLA.EDU
Wed Feb 4 00:58:02 EST 2004


Hi Michael,

It's doubtful that String or EtherEncap::unparse() is broken.

Going back to your earlier mail:

> The GetNextHop element is one that I implemented. It determines the next hop
> for the packet (stub code for now). Now what I want to happen than is that
> EtherEncap encapsulates the IP packet with the correct destination Ethernet
> address in the Ethernet header. So for that I need to pass the next hop
> Ethernet address to EtherEncap. I want to do this with handlers, so I gave
> EtherEncap a name and obtained a pointer to it in the GetNextHop code. So
> far so good. I then get the handler object "dst":
> 
> In GetNextHop.push();
> 		This->router()->handler("dst", _etherEncap);
> 
> _etherEncap points to the EtherEncap object.

Is this a direct quote?  Because it type-matches none of Router's
"handler()" methods.  In those methods the element comes *first*, not last.

> This gets me the handler, and then I call call_write( next_hop_ether.s(),
> _etherEncap,_errh);

Rather than call these methods directly, have you tried using a HandlerCall
object?  #include <click/handlercall.hh>.  For instance, if you #include
<click/handlercall.hh>, then you could say:

	int success = HandlerCall::call_write(_etherEncap, "dst", next_hop_ether.unparse(), _errh);

without bothering with the intermediate methods.  Try this, just to make
sure.

Eddie


More information about the click mailing list