12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

flow-specific queuing disciplines <strong>and</strong> st<strong>at</strong>istics collection). Several “flow granularities” are available. In particular, packetsmay be assigned to flows based on flow ID, destin<strong>at</strong>ion address, source/destin<strong>at</strong>ion addresses, or the combin<strong>at</strong>ion ofsource/destin<strong>at</strong>ion addresses plus flow ID. <strong>The</strong> fields accessed by the hash classifier are limited to the ip header: src(),dst(), flowid() (see ip.h).<strong>The</strong> hash classifier is cre<strong>at</strong>ed with an integer argument specifying the initial size of its hash table. <strong>The</strong> current hash tablesize may be subsequently altered with the resize method (see below). When cre<strong>at</strong>ed, the i<strong>ns</strong>tance variables shift_ <strong>and</strong>mask_ are initialized with the simul<strong>at</strong>or’s current NodeShift <strong>and</strong> NodeMask values, respectively. <strong>The</strong>se values are retrievedfrom the AddrParams object when the hash classifier is i<strong>ns</strong>tanti<strong>at</strong>ed. <strong>The</strong> hash classifier will fail to oper<strong>at</strong>e properly if theAddrParams structure is not initialized. <strong>The</strong> following co<strong>ns</strong>tructors are used for the various hash classifiers:Classifier/Hash/SrcDestClassifier/Hash/DestClassifier/Hash/FidClassifier/Hash/SrcDestFid<strong>The</strong> hash classifier receives packets, classifies them according to their flow criteria, <strong>and</strong> retrieves the classifier slot indic<strong>at</strong>ingthe next node th<strong>at</strong> should receive the packet. In several circumstances with hash classifiers, most packets should be associ<strong>at</strong>edwith a single slot, while only a few flows should be directed elsewhere. <strong>The</strong> hash classifier includes a default_ i<strong>ns</strong>tancevariable indic<strong>at</strong>ing which slot is to be used for packets th<strong>at</strong> do not m<strong>at</strong>ch any of the per-flow criteria. <strong>The</strong> default_ may beset optionally.<strong>The</strong> methods for a hash classifier are as follows:$hashcl set-hash buck src dst fid slot$hashcl lookup buck src dst fid$hashcl del-hash src dst fid$hashcl resize nbuck<strong>The</strong> set-hash() method i<strong>ns</strong>erts a new entry into the hash table within the hash classifier. <strong>The</strong> buck argument specifiesthe hash table bucket number to use for the i<strong>ns</strong>ertion of this entry. When the bucket number is not known, buck may bespecified as auto. <strong>The</strong> src, dst <strong>and</strong> fid arguments specify the IP source, destin<strong>at</strong>ion, <strong>and</strong> flow IDs to be m<strong>at</strong>ched forflow classific<strong>at</strong>ion. Fields not used by a particular classifier (e.g. specifying src for a flow-id classifier) is ignored. <strong>The</strong> slotargument indic<strong>at</strong>es the index into the underlying slot table in the base Classifier object from which the hash classifier isderived. <strong>The</strong> lookup function retur<strong>ns</strong> the name of the object associ<strong>at</strong>ed with the given buck/src/dst/fid tuple. <strong>The</strong>buck argument may be auto, as for set-hash. <strong>The</strong> del-hash function removes the specified entry from the hash table.Currently, this is done by simply marking the entry as inactive, so it is possible to popul<strong>at</strong>e the hash table with unused entries.<strong>The</strong> resize function resizes the hash table to include the number of buckets specified by the argument nbuck.Provided no default is defined, a hash classifier will perform a call into OTcl when it receives a packet which m<strong>at</strong>ches no flowcriteria. <strong>The</strong> call takes the following form:$obj unknown-flow src dst flowid buckThus, when a packet m<strong>at</strong>ching no flow criteria is received, the method unknown-flow of the i<strong>ns</strong>tanti<strong>at</strong>ed hash classifierobject is invoked with the source, destin<strong>at</strong>ion, <strong>and</strong> flow id fields from the packet. In addition, the buck field indic<strong>at</strong>es the hashbucket which should contain this flow if it were i<strong>ns</strong>erted using set-hash. This arrangement avoids another hash lookupwhen performing i<strong>ns</strong>ertio<strong>ns</strong> into the classifier when the bucket is already known.56

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!