author | Tom Henderson <tomh@tomh.org> |
Fri, 12 Dec 2008 17:18:29 -0800 | |
changeset 4020 | 4fa0b1ed5240 |
parent 3314 | 27443ac75474 |
child 4024 | dfd0bc16dc99 |
permissions | -rw-r--r-- |
3314
27443ac75474
Add chapter on random numbers to manual
Tom Henderson <tomh@tomh.org>
parents:
3274
diff
changeset
|
1 |
@node Routing overview |
27443ac75474
Add chapter on random numbers to manual
Tom Henderson <tomh@tomh.org>
parents:
3274
diff
changeset
|
2 |
@chapter Routing overview |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
3 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
4 |
This chapter describes the overall design of routing in the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
5 |
@code{src/internet-stack} |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
6 |
module, and some details about the routing approachs currently |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
7 |
implemented. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
8 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
9 |
@node Routing-Overview |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
10 |
@section Overview |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
11 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
12 |
We intend to support traditional routing approaches and protocols, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
13 |
ports of open source routing implementations, and facilitate research |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
14 |
into unorthodox routing techniques. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
15 |
For simulations that are not primarily focused on routing and that |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
16 |
simply want correct routing tables to occur somehow, we have an |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
17 |
global centralized routing capability. A singleton object |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
18 |
(GlobalRouteManager) be instantiated, builds a network map, and |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
19 |
populates a forwarding table on each node at time t=0 in the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
20 |
simulation. Simulation script writers can use the same node |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
21 |
API to manually enter routes as well. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
22 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
23 |
@node Support for multiple routing protocols |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
24 |
@section Support for multiple routing protocols |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
25 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
26 |
Typically, multiple routing protocols are supported in user space and |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
27 |
coordinate to write a single forwarding table in the kernel. Presently |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
28 |
in @command{ns-3}, the implementation instead allows for multiple routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
29 |
protocols to build/keep their own routing state, and the IPv4 implementation |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
30 |
will query each one of these routing protocols (in some order determined |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
31 |
by the simulation author) until a route is found. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
32 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
33 |
We chose this approach because it may better |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
34 |
faciliate the integration of disparate routing approaches that may |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
35 |
be difficult to coordinate the writing to a single table, approaches |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
36 |
where more information than destination IP address (e.g., source |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
37 |
routing) is used to determine the next hop, and on-demand |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
38 |
routing approaches where packets must be cached. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
39 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
40 |
There are presently two routing protocols defined: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
41 |
@itemize @bullet |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
42 |
@item class Ipv4StaticRouting (covering both unicast and multicast) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
43 |
@item Optimized Link State Routing (a MANET protocol defined in |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
44 |
@uref{http://www.ietf.org/rfc/rfc3626.txt,,RFC 3626}) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
45 |
@end itemize |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
46 |
but first we describe how multiple routing protocols are supported. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
47 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
48 |
@subsection class Ipv4RoutingProtocol |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
49 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
50 |
@code{class Ipv4RoutingProtocol} derives from ns-3 Object which means |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
51 |
that it supports interface aggregation and reference counting. Routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
52 |
protocols should inherit from this class, defined in src/node/ipv4.cc. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
53 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
54 |
The main function that must be supported by these protocols is called |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
55 |
@code{RequestRoute}. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
56 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
57 |
* This method is called whenever a node's IPv4 forwarding engine |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
58 |
* needs to lookup a route for a given packet and IP header. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
59 |
* |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
60 |
* The routing protocol implementation may determine immediately it |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
61 |
* should not be handling this particular the route request. For |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
62 |
* instance, a routing protocol may decline to search for routes for |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
63 |
* certain classes of addresses, like link-local. In this case, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
64 |
* RequestRoute() should return false and the routeReply callback |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
65 |
* must not be invoked. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
66 |
* |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
67 |
* If the routing protocol implementations assumes it can provide |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
68 |
* the requested route, then it should return true, and the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
69 |
* routeReply callback must be invoked, either immediately before |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
70 |
* returning true (synchronously), or in the future (asynchronous). |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
71 |
* The routing protocol may use any information available in the IP |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
72 |
* header and packet as routing key, although most routing protocols |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
73 |
* use only the destination address (as given by |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
74 |
* ipHeader.GetDestination ()). The routing protocol is also |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
75 |
* allowed to add a new header to the packet, which will appear |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
76 |
* immediately after the IP header, although most routing do not |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
77 |
* insert any extra header. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
78 |
*/ |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
79 |
virtual bool RequestRoute (uint32_t ifIndex, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
80 |
const Ipv4Header &ipHeader, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
81 |
Ptr<Packet> packet, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
82 |
RouteReplyCallback routeReply) = 0; |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
83 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
84 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
85 |
This class also provides a typedef (used above) for a special Callback |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
86 |
that will pass to the callback function the Ipv4Route that is found (see the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
87 |
Doxygen documentation): |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
88 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
89 |
typedef Callback<void, bool, const Ipv4Route&, Ptr<Packet>, const Ipv4Header&> RouteReplyCallback; |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
90 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
91 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
92 |
@subsection Ipv4::AddRoutingProtocol |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
93 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
94 |
Class Ipv4 provides a pure virtual function declaration for the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
95 |
method that allows one to add a routing protocol: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
96 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
97 |
void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
98 |
int16_t priority); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
99 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
100 |
This method is implemented by class Ipv4L3Protocol in the internet-stack |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
101 |
module. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
102 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
103 |
The priority variable above governs the priority in which the routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
104 |
protocols are inserted. Notice that it is a signed int. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
105 |
When the class Ipv4L3Protocol is instantiated, a single routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
106 |
protocol (Ipv4StaticRouting, introduced below) is added at priority |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
107 |
zero. Internally, a list of Ipv4RoutingProtocols is stored, and |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
108 |
and the routing protocols are each consulted in decreasing order |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
109 |
of priority to see whether a match is found. Therefore, if you |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
110 |
want your Ipv4RoutingProtocol to have priority lower than the static |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
111 |
routing, insert it with priority less than 0; e.g.: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
112 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
113 |
m_ipv4->AddRoutingProtocol (m_routingTable, -10); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
114 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
115 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
116 |
@subsection Ipv4L3Protocol::Lookup |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
117 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
118 |
The main function for obtaining a route is shown below: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
119 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
120 |
Ipv4L3Protocol::Lookup ( |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
121 |
uint32_t ifIndex, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
122 |
Ipv4Header const &ipHeader, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
123 |
Ptr<Packet> packet, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
124 |
Ipv4RoutingProtocol::RouteReplyCallback routeReply) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
125 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
126 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
127 |
This function will search the list of routing protocols, in priority order, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
128 |
until a route is found. It will then invoke the RouteReplyCallback |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
129 |
and no further routing protocols will be searched. If the caller does |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
130 |
not want to constrain the possible interface, it can be wildcarded |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
131 |
as such: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
132 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
133 |
Lookup (Ipv4RoutingProtocol::IF_INDEX_ANY, ipHeader, packet, routeReply); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
134 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
135 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
136 |
@node Roadmap and Future work |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
137 |
@section Roadmap and Future work |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
138 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
139 |
Some goals for future support are: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
140 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
141 |
Users should be able to trace (either debug print, or redirect to a trace |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
142 |
file) the routing table in a format such as used in an |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
143 |
Unix implementation: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
144 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
145 |
# netstat -nr (or # route -n) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
146 |
Kernel IP routing table |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
147 |
Destination Gateway Genmask Flags MSS Window irtt Iface |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
148 |
127.0.0.1 * 255.255.255.255 UH 0 0 0 lo |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
149 |
172.16.1.0 * 255.255.255.0 U 0 0 0 eth0 |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
150 |
172.16.2.0 172.16.1.1 255.255.255.0 UG 0 0 0 eth0 |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
151 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
152 |
# ip route show |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
153 |
192.168.99.0/24 dev eth0 scope link |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
154 |
127.0.0.0/8 dev lo scope link |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
155 |
default via 192.168.99.254 dev eth0 |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
156 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
157 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
158 |
Global computation of multicast routing should be implemented as well. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
159 |
This would ignore group membership and ensure that a copy of every |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
160 |
sourced multicast datagram would be delivered to each node. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
161 |
This might be implemented as an RPF mechanism that functioned on-demand |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
162 |
by querying the forwarding table, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
163 |
and perhaps optimized by a small multicast forwarding cache. It is |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
164 |
a bit trickier to implement over wireless links where the input |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
165 |
interface is the same as the output interface; other aspects of the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
166 |
packet must be considered and the forwarding logic slightly changed |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
167 |
to allow for forwarding out the same interface. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
168 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
169 |
In the future, work on bringing XORP or quagga routing to ns, but it will |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
170 |
take several months to port and enable. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
171 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
172 |
There are presently no roadmap plans for IPv6. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
173 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
174 |
@node Static routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
175 |
@section Static routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
176 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
177 |
The internet-stack module provides one routing protocol (Ipv4StaticRouting) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
178 |
by default. This routing protocol allows one to add unicast or multicast |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
179 |
static routes to a node. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
180 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
181 |
@node Unicast routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
182 |
@section Unicast routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
183 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
184 |
The unicast static routing API may be accessed via the functions |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
185 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
186 |
void Ipv4::AddHostRouteTo () |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
187 |
void Ipv4::AddNetworkRouteTo () |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
188 |
void Ipv4::SetDefaultRoute () |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
189 |
uint32_t Ipv4::GetNRoutes () |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
190 |
Ipv4Route Ipv4::GetRoute () |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
191 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
192 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
193 |
@uref{http://www.nsnam.org/doxygen/index.html,,Doxygen} documentation |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
194 |
provides full documentation of these methods. These methods are forwarding |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
195 |
functions to the actual implementation in Ipv4StaticRouting, when using |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
196 |
the internet-stack module. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
197 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
198 |
@node Multicast routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
199 |
@section Multicast routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
200 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
201 |
The following function is used to add a static multicast route |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
202 |
to a node: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
203 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
204 |
void |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
205 |
Ipv4StaticRouting::AddMulticastRoute (Ipv4Address origin, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
206 |
Ipv4Address group, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
207 |
uint32_t inputInterface, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
208 |
std::vector<uint32_t> outputInterfaces); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
209 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
210 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
211 |
A multicast route must specify an origin IP address, a multicast group and |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
212 |
an input network interface index as conditions and provide a vector of |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
213 |
output network interface indices over which packets matching the conditions |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
214 |
are sent. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
215 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
216 |
Typically there are two main types of multicast routes: routes of the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
217 |
first kind are used during forwarding. All of the conditions must be |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
218 |
exlicitly provided. The second kind of routes are used to get packets off |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
219 |
of a local node. The difference is in the input interface. Routes for |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
220 |
forwarding will always have an explicit input interface specified. Routes |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
221 |
off of a node will always set the input interface to a wildcard specified |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
222 |
by the index Ipv4RoutingProtocol::IF\_INDEX\_ANY. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
223 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
224 |
For routes off of a local node wildcards may be used in the origin and |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
225 |
multicast group addresses. The wildcard used for Ipv4Adresses is that |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
226 |
address returned by Ipv4Address::GetAny () -- typically "0.0.0.0". Usage |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
227 |
of a wildcard allows one to specify default behavior to varying degrees. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
228 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
229 |
For example, making the origin address a wildcard, but leaving the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
230 |
multicast group specific allows one (in the case of a node with multiple |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
231 |
interfaces) to create different routes using different output interfaces |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
232 |
for each multicast group. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
233 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
234 |
If the origin and multicast addresses are made wildcards, you have created |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
235 |
essentially a default multicast address that can forward to multiple |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
236 |
interfaces. Compare this to the actual default multicast address that is |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
237 |
limited to specifying a single output interface for compatibility with |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
238 |
existing functionality in other systems. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
239 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
240 |
Another command sets the default multicast route: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
241 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
242 |
void |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
243 |
Ipv4StaticRouting::SetDefaultMulticastRoute (uint32_t outputInterface); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
244 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
245 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
246 |
This is the multicast equivalent of the unicast version SetDefaultRoute. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
247 |
We tell the routing system what to do in the case where a specific route |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
248 |
to a destination multicast group is not found. The system forwards |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
249 |
packets out the specified interface in the hope that "something out there" |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
250 |
knows better how to route the packet. This method is only used in |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
251 |
initially sending packets off of a host. The default multicast route is |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
252 |
not consulted during forwarding -- exact routes must be specified using |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
253 |
AddMulticastRoute for that case. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
254 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
255 |
Since we're basically sending packets to some entity we think may know |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
256 |
better what to do, we don't pay attention to "subtleties" like origin |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
257 |
address, nor do we worry about forwarding out multiple interfaces. If the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
258 |
default multicast route is set, it is returned as the selected route from |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
259 |
LookupStatic irrespective of origin or multicast group if another specific |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
260 |
route is not found. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
261 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
262 |
Finally, a number of additional functions are provided to fetch and |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
263 |
remove multicast routes: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
264 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
265 |
uint32_t GetNMulticastRoutes (void) const; |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
266 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
267 |
Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
268 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
269 |
Ipv4MulticastRoute *GetDefaultMulticastRoute (void) const; |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
270 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
271 |
bool RemoveMulticastRoute (Ipv4Address origin, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
272 |
Ipv4Address group, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
273 |
uint32_t inputInterface); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
274 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
275 |
void RemoveMulticastRoute (uint32_t index); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
276 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
277 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
278 |
@node Global centralized routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
279 |
@section Global centralized routing |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
280 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
281 |
Presently, global centralized IPv4 @emph{unicast} routing over both |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
282 |
point-to-point and shared (CSMA) links is supported. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
283 |
The global centralized routing will be modified in the future to |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
284 |
reduce computations once profiling finds the performance bottlenecks. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
285 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
286 |
@node Global Unicast Routing API |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
287 |
@section Global Unicast Routing API |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
288 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
289 |
The public API is very minimal. User scripts include the following: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
290 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
291 |
#include "ns3/global-route-manager.h" |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
292 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
293 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
294 |
After IP addresses are configured, the following function call will |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
295 |
cause all of the nodes that have an Ipv4 interface to receive |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
296 |
forwarding tables entered automatically by the GlobalRouteManager: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
297 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
298 |
GlobalRouteManager::PopulateRoutingTables (); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
299 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
300 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
301 |
@emph{Note:} A reminder that the wifi NetDevice is not yet supported |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
302 |
(only CSMA and PointToPoint). |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
303 |
|
4020 | 304 |
It is possible to call this function again in the midst of a simulation |
305 |
using the following additional public function: |
|
306 |
@verbatim |
|
307 |
GlobalRouteManager::RecomputeRoutingTables (); |
|
308 |
@end verbatim |
|
309 |
which flushes the old tables, queries the nodes for new interface information, |
|
310 |
and rebuilds the routes. |
|
311 |
||
312 |
For instance, this scheduling call will cause the tables to be rebuilt |
|
313 |
at time 5 seconds: |
|
314 |
@verbatim |
|
315 |
Simulator::Schedule (Seconds (5),&GlobalRouteManager::RecomputeRoutingTables); |
|
316 |
@end verbatimT |
|
317 |
||
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
318 |
@node Global Routing Implementation |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
319 |
@section Global Routing Implementation |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
320 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
321 |
A singleton object (GlobalRouteManager) is responsible for populating |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
322 |
the static routes on each node, using the public Ipv4 API of that node. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
323 |
It queries each node in the topology for a "globalRouter" interface. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
324 |
If found, it uses the API of that interface to obtain a "link state |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
325 |
advertisement (LSA)" for the router. Link State Advertisements |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
326 |
are used in OSPF routing, and we follow their formatting. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
327 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
328 |
The GlobalRouteManager populates a link state database with LSAs |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
329 |
gathered from the entire topology. Then, for each router in the topology, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
330 |
the GlobalRouteManager executes the OSPF shortest path first (SPF) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
331 |
computation on the database, and populates the routing tables on each |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
332 |
node. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
333 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
334 |
The quagga (http://www.quagga.net) OSPF implementation was used as the |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
335 |
basis for the routing computation logic. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
336 |
One benefit of following an existing OSPF SPF implementation is that |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
337 |
OSPF already has defined link state advertisements for all common |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
338 |
types of network links: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
339 |
@itemize @bullet |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
340 |
@item point-to-point (serial links) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
341 |
@item point-to-multipoint (Frame Relay, ad hoc wireless) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
342 |
@item non-broadcast multiple access (ATM) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
343 |
@item broadcast (Ethernet) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
344 |
@end itemize |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
345 |
Therefore, we think that enabling these other link types will be more |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
346 |
straightforward now that the underlying OSPF SPF framework is in place. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
347 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
348 |
Presently, we can handle IPv4 point-to-point, numbered links, as well |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
349 |
as shared broadcast (CSMA) links, and we do not do equal-cost multipath. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
350 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
351 |
The GlobalRouteManager first walks the list of nodes and aggregates |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
352 |
a GlobalRouter interface to each one as follows: |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
353 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
354 |
typedef std::vector < Ptr<Node> >::iterator Iterator; |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
355 |
for (Iterator i = NodeList::Begin (); i != NodeList::End (); i++) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
356 |
{ |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
357 |
Ptr<Node> node = *i; |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
358 |
Ptr<GlobalRouter> globalRouter = CreateObject<GlobalRouter> (node); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
359 |
node->AggregateObject (globalRouter); |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
360 |
} |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
361 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
362 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
363 |
This interface is later queried and used to generate a Link State |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
364 |
Advertisement for each router, and this link state database is |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
365 |
fed into the OSPF shortest path computation logic. The Ipv4 API |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
366 |
is finally used to populate the routes themselves. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
367 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
368 |
@node Optimized Link State Routing (OLSR) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
369 |
@section Optimized Link State Routing (OLSR) |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
370 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
371 |
This is the first dynamic routing protocol for @command{ns-3}. The implementation |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
372 |
is found in the src/routing/olsr directory, and an example script is in |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
373 |
examples/simple-point-to-point-olsr.cc. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
374 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
375 |
The following commands will enable OLSR in a simulation. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
376 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
377 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
378 |
olsr::EnableAllNodes (); // Start OLSR on all nodes |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
379 |
olsr::EnableNodes(InputIterator begin, InputIterator end); // Start on |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
380 |
// a list of nodes |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
381 |
olsr::EnableNode (Ptr<Node> node); // Start OLSR on "node" only |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
382 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
383 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
384 |
Once instantiated, the agent can be started with the Start() command, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
385 |
and the OLSR "main interface" can be set with the SetMainInterface() |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
386 |
command. A number of protocol constants are defined in olsr-agent-impl.cc. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
387 |