Thursday, July 16, 2009

[AIT 09] HashClassifier

These questions are from Nakrop:

1. What are the differences between PortClassifier and HashClassfier?
What are their the based classes?
2. How important is a hash table is important to a hash classifier? Why? What information is stored in the hash table?
3. In the implementation of function classify(p)of class DestHashClassifier, what does the statement "set_hash(0,d,0,slot)" do?
4. How is OOP used to implement function hashkey(...) of class HashClassifier?

5 comments:

Unknown said...

(Hasanain/106000)

1) In NS2 the difference between them is that, a HashClassifier classifies packets based on a hash table and is used as an entry point for the node. Where as the PortClassifer classifies packets based on the destination port and is used as a demultiplexer which bridges a node to a receiving transport agent. Their base class is Classifier.


2) With the help of hash table it examines the header of an incoming packet, searches in the hash table for a hash entry whose key matches with information provided in the packet header, and returns the hash value (i.e., slot number) of the matched entry. Its importance is highlighted in the fact that a hash function has low complexity, the search time when using hash table is usually much smaller than that when using a sequential search.


3) set_hash(0,d,0,slot) Inserts an entry with source address “0”, destination address “d”, and flow ID “0” to the hash table, and associates the entry to slot number “slot”.


4) This function is pure virtual and should be overridden by child classes of HashClassifier.

Unknown said...

1)Classifier is the base class of PortClassifier and HashClassfier.
The main difference b/w them is the approach of classification of the packets, In PortClassifier, the packets are classified on the bases of destination port which is used as demultiplexer while in HashClassfier the packets classification is depend upon the Hash table which contains entries for the node.

2)Hash table is very important to hash classifier becoz it facilitate a key-value lookup process.It eliminates the need to sequentially search for a matched key and retrieve the corresponding value. A hash table uses a hash function to transform a hash key into a hash index, and stores the corresponding hash value in an array entry (i.e., a record of the hash table). Given a hash key, the search process transforms the hash key into a hash index using a hash function, and directly accesses the array entry corresponding to the hash index. Since a hash function has low complexity,the search time when using hash table is usually much smaller than that when using a sequential search. The info storein the Hash table is Flow ID, source address, and destination address.

3)In the implementation of function classify(p),the statement
set_hash(s,r,0,slot) introduce an entry of receiver address “r”, sender address “s”, , and flow ID “0” into the hash table, and correlates the entry with a slot number “slot”.

4)As declared as pure virtual in class HashClassifier, function hashkey(...) which computes a hash index from a hash key, should be overridden by the child classes of class HashClassifier.
u can also see Program 6.7 in NS2 book on page 113.

Tech News said...

Thein Tun Aung / st108032
1) In portClassifier, a node acts as a computer host.
A computer host connects a node to transport layer protocol and may have serveral attached TL protocol.
In HashClassifier, a node acts as a router.
Their base class is Classifier.

2)Hash classifiers use a hash table internally to assign packets to flows. These objects are used where flow-level
information is required (e.g. in flow-specific queuing disciplines and statistics collection).The hash classifier is created with an integer argument specifying the initial
size of its hash table. The current hash table size may be subsequently altered with the resize method .
When created, the instance variables shift_ and mask_ are initialized with the simulator's current NodeShift and
NodeMask values, respectively.

4)Returns an identifier for a hash entry corresponding to the input hash key. This function is pure virtual and should be overriden by
child classes of Hashclassifier.
Class DestHashClassifier overrides function hashkey (...)
by returning the destination address.
Function lookup(p) and get_hash(...)belong to class
HashClassifier,while function hashkey(...) is attributed
to class DestHashClassifier.This is a beauty of oop,since we only need to override one function for a derived class( DesthashClassifier )and are able ruse the rest of code from the parent class( HashClassifier).

Rujipol said...

[Rujipol, 108109]
1. PortClassifier act as a computer host filtering which defines the table of ports which store by an array of mapping port and slot but AddressClassifier act as the router which consider addressing between nodes, the type is linked list.
Their base class is Classifier

Lisa said...

This was lovely thanks for writing this