5.4.1 Address Classifiers

An address classifier is used in supporting unicast packet forwarding. It applies a bitwise shift and mask operation to a packet's destination address to produce a slot number. The slot number is returned from the []classify method. The AddressClassifier../ns-2/classifier-addr.cc (defined in ~ns/classifier-addr.cc) ide defined as follows:

        class AddressClassifier : public Classifier {
        public:
                AddressClassifier() : mask_(~0), shift_(0) {
                        bind("mask_", (int*)&mask_);
                        bind("shift_", &shift_);
                }
        protected:
                int classify(Packet *const p) {
                        IPHeader *h = IPHeader::access(p-\>bits());
                        return ((h-\>dst() \>\> shift_) & mask_);
                }
                nsaddr_t mask_;
                int shift_;
        };
The class imposes no direct semantic meaning on a packet's destination address field. Rather, it returns some number of bits from the packet's dst_ field as the slot number used in the []Classifier::recv../ns-2/classifier.ccClassifier::recv method. The mask_ and shift_ values are set through OTcl.



Tom Henderson 2011-11-05