[Click] Calling "Handlers"

Bow-Nan Cheng bcheng at nanwob.net
Mon Dec 1 11:10:26 EST 2003


Hi,

I'm a little confused as to how "Handlers" work. I've read through the 
info on them in the click documentation as well as perused through the old 
mailman archives. I don't understand ControlSocket and PokeHandlers at 
all and am not sure whether they need to be used in my case.

Basically, what I'm trying to do is implement GPSR for Click. I 
need to create routing tables for the protocol and was perusing 
through IPRouteTable and LinearIPLookup. Within those elements, 
there's element handlers for adding and removing routing entries. How are 
these elements handled when I call them in a .click file? For instance, 
doing something like this (from documentation) :

  ... -> GetIPAddress(16) -> rt;
  rt :: LinearIPLookup(18.26.4.24/32 0,
                       18.26.4.255/32 0,
                       18.26.4.0/32 0,
                       18.26.4/24 1,
                       0/0 18.26.4.1 1);
  rt[0] -> ToHost;
  rt[1] -> ... -> ToDevice(eth0);

basically takes a packet and searches through the routes inputted as
variables to LinearIPLookup and finds the correct port to forward the 
packet to. 

But, how do I Add and remove routes? There doesn't seem to be variables 
within LinearIPLookup that allow me to "add" the route or "remove" the 
route. I guess what I mean is, I was expecting was something like:

LinearIPLookup(element IPRoutingTable, String Whattodo, Entry entry)

where IPRoutingTable is a routing table (maybe with entries stored in some 
kind of array). and "Whattodo" is whether to "add", "remove" etc. and 
entry is the entry to add,remove or left blank if just printing routing 
table.

Is the concept of what I'm thinking about even correct? Because I just 
don' tunderstand handlers at all. Any help would be great. Thanks



More information about the click mailing list