[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Questions about classifier
Hi, ns-experts:
I got following questions about classifier class.
Q.1 In the classifier class there is recv function as following
/*
* objects only ever see "packet" events, which come either
* from an incoming link or a local agent (i.e., packet source).
*/ void Classifier::recv(Packet* p, Handler*h) {
NsObject* node = find(p);
if (node == NULL) {
/*
* XXX this should be "dropped" somehow. Right now,
* these events aren't traced.
*/
Packet::free(p);
return;
}
node->recv(p,h);
}
It is understandable in processing a received packet and then calling
node->recv(p,h).
However, I check the NsObject::recv (node is an object of
NsObject) fuction as following:
/*
* Packets may be handed to NsObjects at sheduled points
* in time since a node is an event handler and a packet
* is an event. Packets should be the only type of event
* scheduled on a node so we can carry out the cast below.
*/
void NsObject::handle(Event* e) {
recv((Packet*)e); }
void NsObject::recv(Packet *p, const char*) {
Packet::free(p);
}
Why does it free this packet in the recv fuction? Am I correct?
Q2. If a node received a packet, it will go througt the classifier::recv.
After the classifier::recv(pkt, h), what is the next process to deal
with this packets? Does it send the incoming packet to "agent"
or any other process missed? Are the processes like:
classifier::recv()--> agent:recv-->routing process
or
classifier:recv(pkt, h)--(need forward)--> routing--->forwarding--->out
|
|
+--for this node--> agent::recv
Q3. If I want to see all of pkt-types traffic, where can I insert the
fuction? in the agent::recv or in the classfier::recv() or
somewhereelse?
Any help will be appreciated. Thanks.
Regards,
Chien-Lung Wu