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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Global Actio<strong>ns</strong> Once the detailed actio<strong>ns</strong> <strong>at</strong> each of the affected nodes is completed, the network dynamics models willnotify the RouteLogic i<strong>ns</strong>tance (RouteLogic::notify{}) of changes to topology. This procedure invokes the procedurecompute-all{} for each of the protocols th<strong>at</strong> were ever i<strong>ns</strong>talled <strong>at</strong> any of the nodes. Centralized routing protocols suchas session routing use this signal to recompute the routes to the topology. Finally, the RouteLogic::notify{} procedurenotifies any i<strong>ns</strong>tances of centralized multicast th<strong>at</strong> are oper<strong>at</strong>ing <strong>at</strong> the node.29.5 Protocol InternalsIn this section, we describe any leftover details of each of the routing protocol agents. Note th<strong>at</strong> this is the only place wherewe describe the internal route protocol agent, “Direct” routing.Direct Routing This protocol tracks the st<strong>at</strong>e of the incident links, <strong>and</strong> maintai<strong>ns</strong> routes to immedi<strong>at</strong>ely adjacent neighborsonly. As with the other protocols, it maintai<strong>ns</strong> i<strong>ns</strong>tance variable arrays of nextHop_, rtpref_, <strong>and</strong> metric_, indexed bythe h<strong>and</strong>le of each of the possible destin<strong>at</strong>io<strong>ns</strong> in the topology.<strong>The</strong> i<strong>ns</strong>tance procedure compute-routes{} computes routes based on the current st<strong>at</strong>e of the link, <strong>and</strong> the previouslyknown st<strong>at</strong>e of the incident links.No other procedures or i<strong>ns</strong>tance procedures are defined for this protocol.St<strong>at</strong>ic Routing <strong>The</strong> procedure compute-routes{} in the class RouteLogic first cre<strong>at</strong>es the adjacency m<strong>at</strong>rix, <strong>and</strong>then invokes the C++ method, compute_routes() of the shadow object. Finally, the procedure retrieves the result of theroute comput<strong>at</strong>ion, <strong>and</strong> i<strong>ns</strong>erts the appropri<strong>at</strong>e routes <strong>at</strong> each of the nodes in the topology.<strong>The</strong> class only defines the procedure init-all{} th<strong>at</strong> invokes compute-routes{}.Session Routing <strong>The</strong> class defines the procedure init-all{} to compute the routes <strong>at</strong> the start of the simul<strong>at</strong>ion. It alsodefines the procedure compute-all{} to compute the routes when the topology changes. Each of these procedures directlyinvokes compute-routes{}.DV Routing In a dynamic routing str<strong>at</strong>egy, nodes send <strong>and</strong> receive messages, <strong>and</strong> compute the routes in the topology basedon the messages exchanged. <strong>The</strong> procedure init-all{} takes a list of nodes as the argument; the default is the list ofnodes in the topology. At each of the nodes in the argument, the procedure starts the class rtObject <strong>and</strong> a classAgent/rtProto/DV agents. It then determines the DV peers for each of the newly cre<strong>at</strong>ed DV agents, <strong>and</strong> cre<strong>at</strong>es therelevant rtPeer objects.<strong>The</strong> co<strong>ns</strong>tructor for the DV agent initializes a number of i<strong>ns</strong>tance variables; each agent stores an array, indexed by thedestin<strong>at</strong>ion node h<strong>and</strong>le, of the preference <strong>and</strong> metric, the interface (or link) to the next hop, <strong>and</strong> the remote peer incident onthe interface, for the best route to each destin<strong>at</strong>ion computed by the agent. <strong>The</strong> agent cre<strong>at</strong>es these i<strong>ns</strong>tance variables, <strong>and</strong>then schedules sending its first upd<strong>at</strong>e within the first 0.5 seconds of simul<strong>at</strong>ion start.Each agent stores the list of its peers indexed by the h<strong>and</strong>le of the peer node. Each peer is a separ<strong>at</strong>e peer structure th<strong>at</strong> holdsthe address of the peer agent, the metric <strong>and</strong> preference of the route to each destin<strong>at</strong>ion advertised by th<strong>at</strong> peer. We discuss thertPeer structure l<strong>at</strong>er when discuss the route architecture. <strong>The</strong> peer structures are initialized by the procedure add-peer{}invoked by init-all{}.258

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

Saved successfully!

Ooh no, something went wrong!