Jan 25, 2006

What the heck is classifier?

A basic function of a node is to receive packets and examine the packet's field (header) by identifying its destination address and source address. This task is performed by classifier that sit in the node.

There are several types of classifiers for different purposes. A classifier provides a way to match a packet against some logical criteria and retrieve reference to another simulation object based on match results. Each packet received will be matched with the slot numbers indexed in the classifier.

The C++ classifier defined in ~ns/classifier.h

class Classifier : public NsObject {
void recv(Packet*, Handler* h = 0);
void install(int slot, NsObject*);
void clear(int slot);
virtual int command(int argc, const char*const* argv);
virtual int classify (Packet *const) = 0;
void alloc(int);
NsObject** slot_; /* table that maps slot number to a NsObject */
int nslot_;
int maxslot_;

Therefore when a classifier received, recv() a packet, it will be handed to the classify() method. The classifier will make sure a slot is assigned to each packet.

** For unicast, address classifier is used. It applies a bitwise shift and mask operation to packet's destination address to produce a slot number.

There is also a multicast classifier.. well that is a total different matter.. :-)

No comments: