Hello, all!
I'm trying to make a new classifier, and make it the first classifier
of some node (router).
The simulation code looks like:
#Create two nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set rtr [$ns node]
#Connect the nodes with a link
$ns duplex-link $n0 $rtr 1Mb 10ms DropTail
$ns duplex-link $n1 $rtr 1Mb 10ms DropTail
$ns duplex-link $n2 $rtr 1Mb 10ms DropTail
set cr [new Classifier/Addr/Test]
$rtr insert-entry RtModule/Base $cr 0
And in C++ code I override the classify() method of that class:
static class TestClassifierClass : public TclClass {
public:
TestClassifierClass() : TclClass("Classifier/Addr/Test") {}
TclObject* create(int, const char*const*) {
return (new TestClassifier());
}
} class_test_classifier;
int TestClassifier::classify(Packet *p) {
hdr_ip *iph = hdr_ip::access(p);
std::cout << "[" << Scheduler::instance().clock() << "] test:
gateway received a packet from " << iph->saddr() << " to " <<
iph->daddr() << "." << std::endl;
return 0;
}
But now although I can send data from $no to $n2 successfully, but
there is no output from the TestClassifier, looks like the classify()
is by-passed.
Does any one know what is the problem and how to make the
TestClassifier effective?
Thank you very much!
Best regards,
Kenneth Zhu