[Click] How to write the actions on the incoming packets
Beyers Cronje
bcronje at gmail.com
Wed Dec 19 03:53:45 EST 2007
>
> Suppose I have 2i/p and 2o/p ports.How do I specify that if the input
> packet
> comes on port1 ,I want method1 and method2 to act on it and if the packet
> comes in port2 I want only method2 to act on it.
An element's push() function has a parameter that indicates what port the
packet is coming from, i.e.
void YourElement::push(int port, Packet *p)
{
.....
if (port == 0) {
// First input port
method0(p);
} else if (port == 1) {
// Second input port
method1(p);
}
....
}
More information about the click
mailing list