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.

5.5 Routing Module <strong>and</strong> Classifier Organiz<strong>at</strong>ionAs we have seen, a <strong>ns</strong> node is essentially a collection of classifiers. <strong>The</strong> simplest node (unicast) contai<strong>ns</strong> only one addressclassifier <strong>and</strong> one port classifier, as shown in Figure 5.1. When one extends the functionality of the node, more classifiers areadded into the base node, for i<strong>ns</strong>tance, the multicast node shown in Figure 5.2. As more function blocks is added, <strong>and</strong> each ofthese blocks requires its own classifier(s), it becomes important for the node to provide a uniform interface to organize theseclassifiers <strong>and</strong> to bridge these classifiers to the route comput<strong>at</strong>ion blocks.<strong>The</strong> classical method to h<strong>and</strong>le this case is through class inheritance. For i<strong>ns</strong>tance, if one wants a node th<strong>at</strong> supports hierarchicalrouting, one simply derive a Node/Hier from the base node <strong>and</strong> override the classifier setup methods to i<strong>ns</strong>ert hierarchicalclassifiers. This method works well when the new function blocks are independent <strong>and</strong> cannot be “arbitrarily” mixed. Fori<strong>ns</strong>tance, both hierarchical routing <strong>and</strong> ad hoc routing use their own set of classifiers. Inheritance would require th<strong>at</strong> we haveNode/Hier th<strong>at</strong> supports the former, <strong>and</strong> Node/Mobile for the l<strong>at</strong>ter. This becomes slightly problem<strong>at</strong>ic when one wants an adhoc routing node th<strong>at</strong> supports hierarchical routing. In this simple case one may use multiple inheritance to solve the problem,but this quickly becomes infeasible as the number of such function blocks increases.<strong>The</strong> only method to solve this problem is object composition. <strong>The</strong> base node needs to define a set of interfaces for classifieraccess <strong>and</strong> organiz<strong>at</strong>ion. <strong>The</strong>se interfaces should• allow individual routing modules th<strong>at</strong> implement their own classifiers to i<strong>ns</strong>ert their classifiers into the node;• allow route comput<strong>at</strong>ion blocks to popul<strong>at</strong>e routes to classifiers in all routing modules th<strong>at</strong> need this inform<strong>at</strong>ion,• provide a single point of management for existing routing modules.In addition, we should also define a uniform interface for routing modules to connect to the node interfaces, so as to providea system<strong>at</strong>ic approach to extending node functionality. In this section we will describe the design of routing modules as wellas th<strong>at</strong> of the corresponding node interfaces.5.5.1 Routing ModuleIn general, every routing implement<strong>at</strong>ion in <strong>ns</strong> co<strong>ns</strong>ists of three function blocks:• Routing agent exchanges routing packet with neighbors,• Route logic uses the inform<strong>at</strong>ion g<strong>at</strong>hered by routing agents (or the global topology d<strong>at</strong>abase in the case of st<strong>at</strong>ic routing)to perform the actual route comput<strong>at</strong>ion,• Classifiers sit i<strong>ns</strong>ide a Node. <strong>The</strong>y use the computed routing table to perform packet forwarding.Notice th<strong>at</strong> when implementing a new routing protocol, one does not necessarily implement all of these three blocks. Fori<strong>ns</strong>tance, when one implements a link st<strong>at</strong>e routing protocol, one simply implement a routing agent th<strong>at</strong> exchanges inform<strong>at</strong>ionin the link st<strong>at</strong>e manner, <strong>and</strong> a route logic th<strong>at</strong> does Dijkstra on the resulting topology d<strong>at</strong>abase. It can then use the sameclassifiers as other unicast routing protocols.When a new routing protocol implement<strong>at</strong>ion includes more than one function blocks, especially when it contai<strong>ns</strong> its ownclassifier, it is desirable to have another object, which we call a routing module, th<strong>at</strong> manages all these function blocks <strong>and</strong> tointerface with node to organize its classifiers. Figure 5.3 shows functional rel<strong>at</strong>ion among these objects. Notice th<strong>at</strong> routingmodules may have direct rel<strong>at</strong>io<strong>ns</strong>hip with route comput<strong>at</strong>ion blocks, i.e., route logic <strong>and</strong>/or routing agents. However, routecomput<strong>at</strong>ion MAY not i<strong>ns</strong>tall their routes directly through a routing module, because there may exists other modules th<strong>at</strong>58

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

Saved successfully!

Ooh no, something went wrong!