[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pandora] Component::notify()
From: |
uaca |
Subject: |
[Pandora] Component::notify() |
Date: |
Thu, 5 Dec 2002 18:20:05 +0100 |
User-agent: |
Mutt/1.3.28i |
Hi (all?)
Please imagine the following stack:
@tcpscan [ $reject = false ];
@demux [ $algo = "tcpcnx"] < @mycomponent >
This will pass each TCP flow (both ways) to am instance of a "mycomponent"
component
What happens if @mycomponent just wants few packets?
mycomponent when it's finished will return "true" from mycomponent::add()
method so tcpcnx will destroy the branch with demux::notify(), that's fine
but next packets of the same TCP flow will come again and then another
branch/instance of a "mycomponent" will be created, but remember:
we are no longer interested in this TCP flow!
my propossal:
add to the Packet class a new virtual method (name it ::accept()) so
DemuxComponent::add() in this case would be something like:
bool DemuxComponent::add(Packet *pkt)
{
if (func == NULL) {
pandora_warning("null demux function");
cleanPacket(pkt);
return true;
}
if (!(*func)(pkt, &key)) {
cleanPacket(pkt);
return false;
}
int b = kmap.valAtOrNil(key);
if (b == 0) {
if (!pkt->accept()) { <<< Here
cleanPacket(pkt); <<< Here
return false; <<< Here
} <<< Here
++idx;
/* idx may overflow, but previously created branches are likely to
be dead at this time. */
if (idx < 0) idx = 1;
b = -idx;
//pandora_debug("inserting branch #" << b);
kmap.atPut(key, b);
}
push(pkt, b);
return false;
}
I'm supossing there's no other method for doing this already
Why do I think this should be this way?
_because kmap is in the demux component_
Any comment would be greatly appreciated
Simon: please, let me make this patch :-)
regards
Ulisses
Debian GNU/Linux: a dream come true
-----------------------------------------------------------------------------
"Computers are useless. They can only give answers." Pablo Picasso
---> Visita http://www.valux.org/ para saber acerca de la <---
---> AsociaciĆ³n Valenciana de Usuarios de Linux <---
- [Pandora] Component::notify(),
uaca <=