In ns2.35, satroute. CC ,~. H implements centralized Routing
@@In. H files, there are mainly the following types:
1. satrouteagent
ClassSatrouteagent: Public agent
Inheritance relationship:
Satrouteagent <-Agent <-connector <-nsobject <-tclobject, Handler
2. satrouteobject
ClassSatrouteobject: Public routelogic
Inheritance relationship:
Satrouteobject <-routelogic <-tclobject
@@In. CC files, there are mainly the following classes:
static class SatRouteClass:public TclClass{ public:SatRouteClass ():TclClass ("Agent/SatRoute") { }TclObject *create (int, const char *const *) { return (new SatRouteAgent ());}} class_satroute;static class SatRouteObjectClass:public TclClass{ public: SatRouteObjectClass ():TclClass ("SatRouteObject") { } TclObject *create (int, const char *const *) { return (new SatRouteObject ()); }} class_satrouteobject;
The above two classes are mainly used to realize the interaction between C ++ and TCL, which is a general definition.
In the. CC file, we mainly implement the methods of the two classes defined in. h.
@ Satrouteobject implements a routing algorithm, including computing network topology, computing routing, and route table distribution.
Computing network topology: void satrouteobject: compute_topology ()
Computing route: void satrouteobject: node_compute_routes (intnode)
Voidsatrouteobject: recompute ()
Distribution Route: voidsatrouteobject: populate_routing_tables (INT node)
There are two computing routes. The first is to calculate the route of a node, the second is to calculate the route of the entire network, and the second is to call the basic routelogic method.
Computing routing is said to be a centralized shortest path algorithm. Is it Dijkstra?
@@Route table Organization
In route. H,Neighbor Link Cost Table, route table
struct adj_entry {double cost;void* entry;};struct route_entry {public:int next_hop;void* entry;};
Defined in satroute. hForwarding Table
// Entry in theforwarding tablestruct slot_entry { int next_hop; NsObject* entry;};
What is the difference between a route table and a forwarding table?