[Click] AGNOSTIC vs. PUSH/PULL

Jesse Brown jesse.r.brown at lmco.com
Mon Mar 1 16:12:06 EST 2010


All:

I am currently working on a router config that looks similar to the 
following:

   elementclass Monitor {
      input ->
      ipc :: IPClassifier (tcp, udp, icmp, -);
      f :: Foo;

      ipc[0] -> Print("tcp-in") -> [0]f[0] -> Print("tcp-out") -> output;
      ipc[1] -> Print("udp-in") -> [1]f[1] -> Print("udp-out") -> output;
      ipc[2] -> Print("icmp-in") -> [2]f[2] -> Print("icmp-out") -> output;
      ipc[3] -> Print("other-in") -> [3]f[3] -> Print("other-out") -> 
output;
   }

   FromDevice(eth0, PROMISC true) ->
      ... ->
      Monitor ->
      ... ->
      Queue -> ToDevice(eth1);


This is obviously simplified but conveys my point, I think.
If I define Foo as
   const char *class_name() const    { return "Foo"; }
   const char *port_count() const    { return "-/-"; }
   const char *processing() const    { return AGNOSTIC; }

   Packet *simple_action(Packet *);

Then I will always get

   icmp-in:   98 | 00151715 a8e50015 17163621 08004500 00540000 40004001
   tcp-out:   98 | 00151715 a8e50015 17163621 08004500 00540000 40004001

Due to how Element::push behaves.

In order to have a single copy of this element that can be located 
anywhere in a router I have to define Foo::simple_action, Foo::pull, and 
Foo::push. Is there a more standard way to get the behavior I am after? 
My desired result would look like:

   icmp-in:   98 | 00151715 a8e50015 17163621 08004500 00540000 40004001
   icmp-out:   98 | 00151715 a8e50015 17163621 08004500 00540000 40004001

in the above example.

Also, is there a reason that both Element::push and Element::pull ignore 
the port by default? Would the attached patch break existing behavior?

Thanks,

Jesse

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: port.patch
Url: http://amsterdam.lcs.mit.edu/pipermail/click/attachments/20100301/c1f0d913/attachment.txt 


More information about the click mailing list