author | Tom Henderson <tomh@tomh.org> |
Fri, 04 Sep 2009 17:23:34 -0700 | |
changeset 4755 | 04a9a7e9a624 |
parent 4646 | c25ca2e38845 |
child 5352 | 54b51a1105d6 |
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 |
|
4415 | 4 |
@menu |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
5 |
* Routing architecture:: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
6 |
* Global centralized routing:: |
4415 | 7 |
* Unicast routing:: |
8 |
* Multicast routing:: |
|
9 |
@end menu |
|
10 |
||
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
11 |
ns-3 is intended to support traditional routing approaches and protocols, |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
12 |
support ports of open source routing implementations, and facilitate research |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
13 |
into unorthodox routing techniques. The overall routing architecture |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
14 |
is described below in @ref{Routing architecture}. Users who wish to |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
15 |
just read about how to configure global routing for wired topologies |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
16 |
can read @ref{Global centralized routing}. Unicast routing protocols |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
17 |
are described in @ref{Unicast routing}. Multicast routing is documented in |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
18 |
@ref{Multicast routing}. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
19 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
20 |
@node Routing architecture |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
21 |
@section Routing architecture |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
22 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
23 |
@float Figure,fig:routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
24 |
@caption{Overview of routing} |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
25 |
@image{figures/routing, 6in} |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
26 |
@end float |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
27 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
28 |
Figure 11-1 shows the overall routing architecture for Ipv4. The key objects |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
29 |
are Ipv4L3Protocol, Ipv4RoutingProtocol(s) (a class to which all |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
30 |
routing/forwarding has been delegated from Ipv4L3Protocol), and Ipv4Route(s). |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
31 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
32 |
Ipv4L3Protocol must have at least one Ipv4RoutingProtocol added to |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
33 |
it at simulation setup time. This is done explicitly by calling |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
34 |
Ipv4::SetRoutingProtocol (). |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
35 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
36 |
The abstract base class Ipv4RoutingProtocol () declares a minimal interface, |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
37 |
consisting of two methods: RouteOutput () and RouteInput (). |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
38 |
For packets traveling outbound from a host, the transport protocol will query |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
39 |
Ipv4 for the Ipv4RoutingProtocol object interface, and will request |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
40 |
a route via Ipv4RoutingProtocol::RouteOutput (). |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
41 |
A Ptr to Ipv4Route object is returned. This is analagous to a |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
42 |
dst_cache entry in Linux. The Ipv4Route is carried down to the |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
43 |
Ipv4L3Protocol to avoid a second lookup there. However, some |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
44 |
cases (e.g. Ipv4 raw sockets) will require a call to RouteOutput() |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
45 |
directly from Ipv4L3Protocol. |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
46 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
47 |
For packets received inbound for forwarding or delivery, |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
48 |
the following steps occur. Ipv4L3Protocol::Receive() calls |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
49 |
Ipv4RoutingProtocol::RouteInput(). |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
50 |
This passes the packet ownership to the Ipv4RoutingProtocol object. There |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
51 |
are four callbacks associated with this call: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
52 |
@itemize @bullet |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
53 |
@item LocalDeliver |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
54 |
@item UnicastForward |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
55 |
@item MulticastForward |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
56 |
@item Error |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
57 |
@end itemize |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
58 |
The Ipv4RoutingProtocol must eventually call one of these callbacks for each |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
59 |
packet that it takes responsibility for. This is basically |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
60 |
how the input routing process works in Linux. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
61 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
62 |
@float Figure,fig:routing-specialization |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
63 |
@caption{Ipv4Routing specialization} |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
64 |
@image{figures/routing-specialization, 5in} |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
65 |
@end float |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
66 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
67 |
This overall architecture is designed to support different routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
68 |
approaches, including (in the future) a Linux-like policy-based routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
69 |
implementation, proactive and on-demand routing protocols, and simple |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
70 |
routing protocols for when the simulation user does not really care |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
71 |
about routing. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
72 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
73 |
@ref{fig:routing-specialization} illustrates how multiple routing protocols |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
74 |
derive from this base class. A class Ipv4ListRouting |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
75 |
(implementation class Ipv4ListRoutingImpl) provides the existing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
76 |
list routing approach in ns-3. Its API is the same as base class |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
77 |
Ipv4Routing except for the ability to add multiple prioritized routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
78 |
protocols |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
79 |
(Ipv4ListRouting::AddRoutingProtocol(), Ipv4ListRouting::GetRoutingProtocol()). |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
80 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
81 |
The details of these routing protocols are described below in |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
82 |
@ref{Unicast routing}. For now, we will first start with a basic |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
83 |
unicast routing capability that is intended to globally build routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
84 |
tables at simulation time t=0 for simulation users who do not care |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
85 |
about dynamic routing. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
86 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
87 |
@node Global centralized routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
88 |
@section Global centralized routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
89 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
90 |
Global centralized routing is sometimes called ''God'' routing; it |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
91 |
is a special implementation that walks the simulation topology and |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
92 |
runs a shortest path algorithm, and populates each node's routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
93 |
tables. No actual protocol overhead (on the simulated links) is incurred |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
94 |
with this approach. It does have a few constraints: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
95 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
96 |
@itemize @bullet |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
97 |
@item @strong{Wired only:} It is not intended for use in wireless networks. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
98 |
@item @strong{Unicast only:} It does not do multicast. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
99 |
@item @strong{Scalability:} Some users of this on large topologies |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
100 |
(e.g. 1000 nodes) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
101 |
have noticed that the current implementation is not very scalable. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
102 |
The global centralized routing will be modified in the future to |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
103 |
reduce computations and runtime performance. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
104 |
@end itemize |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
105 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
106 |
Presently, global centralized IPv4 unicast routing over both |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
107 |
point-to-point and shared (CSMA) links is supported. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
108 |
|
4646
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
109 |
By default, when using the ns-3 helper API and the default InternetStackHelper, |
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
110 |
global routing capability will be added to the node, and global routing |
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
111 |
will be inserted as a routing protocol with lower priority than the |
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
112 |
static routes (i.e., users can insert routes via Ipv4StaticRouting API |
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
113 |
and they will take precedence over routes found by global routing). |
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
114 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
115 |
@subsection Global Unicast Routing API |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
116 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
117 |
The public API is very minimal. User scripts include the following: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
118 |
@verbatim |
4646
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
119 |
#include "ns3/helper-module.h" |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
120 |
@end verbatim |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
121 |
|
4646
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
122 |
If the default InternetStackHelper is used, then an instance of |
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
123 |
global routing will be aggregated to each node. |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
124 |
After IP addresses are configured, the following function call will |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
125 |
cause all of the nodes that have an Ipv4 interface to receive |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
126 |
forwarding tables entered automatically by the GlobalRouteManager: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
127 |
@verbatim |
4646
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
128 |
Ipv4GlobalRoutingHelper::PopulateRoutingTables (); |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
129 |
@end verbatim |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
130 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
131 |
@emph{Note:} A reminder that the wifi NetDevice will work but does not |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
132 |
take any wireless effects into account. For wireless, we recommend |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
133 |
OLSR dynamic routing described below. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
134 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
135 |
It is possible to call this function again in the midst of a simulation |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
136 |
using the following additional public function: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
137 |
@verbatim |
4646
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
138 |
Ipv4GlobalRoutingHelper::RecomputeRoutingTables (); |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
139 |
@end verbatim |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
140 |
which flushes the old tables, queries the nodes for new interface information, |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
141 |
and rebuilds the routes. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
142 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
143 |
For instance, this scheduling call will cause the tables to be rebuilt |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
144 |
at time 5 seconds: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
145 |
@verbatim |
4646
c25ca2e38845
some fixes to the manual for IPv4 refactoring
Tom Henderson <tomh@tomh.org>
parents:
4480
diff
changeset
|
146 |
Simulator::Schedule (Seconds (5),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables); |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
147 |
@end verbatim |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
148 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
149 |
@subsection Global Routing Implementation |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
150 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
151 |
This section is for those readers who care about how this is implemented. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
152 |
A singleton object (GlobalRouteManager) is responsible for populating |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
153 |
the static routes on each node, using the public Ipv4 API of that node. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
154 |
It queries each node in the topology for a "globalRouter" interface. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
155 |
If found, it uses the API of that interface to obtain a "link state |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
156 |
advertisement (LSA)" for the router. Link State Advertisements |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
157 |
are used in OSPF routing, and we follow their formatting. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
158 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
159 |
The GlobalRouteManager populates a link state database with LSAs |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
160 |
gathered from the entire topology. Then, for each router in the topology, |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
161 |
the GlobalRouteManager executes the OSPF shortest path first (SPF) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
162 |
computation on the database, and populates the routing tables on each |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
163 |
node. |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
164 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
165 |
The quagga (http://www.quagga.net) OSPF implementation was used as the |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
166 |
basis for the routing computation logic. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
167 |
One benefit of following an existing OSPF SPF implementation is that |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
168 |
OSPF already has defined link state advertisements for all common |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
169 |
types of network links: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
170 |
@itemize @bullet |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
171 |
@item point-to-point (serial links) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
172 |
@item point-to-multipoint (Frame Relay, ad hoc wireless) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
173 |
@item non-broadcast multiple access (ATM) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
174 |
@item broadcast (Ethernet) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
175 |
@end itemize |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
176 |
Therefore, we think that enabling these other link types will be more |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
177 |
straightforward now that the underlying OSPF SPF framework is in place. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
178 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
179 |
Presently, we can handle IPv4 point-to-point, numbered links, as well |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
180 |
as shared broadcast (CSMA) links, and we do not do equal-cost multipath. |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
181 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
182 |
The GlobalRouteManager first walks the list of nodes and aggregates |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
183 |
a GlobalRouter interface to each one as follows: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
184 |
@verbatim |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
185 |
typedef std::vector < Ptr<Node> >::iterator Iterator; |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
186 |
for (Iterator i = NodeList::Begin (); i != NodeList::End (); i++) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
187 |
{ |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
188 |
Ptr<Node> node = *i; |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
189 |
Ptr<GlobalRouter> globalRouter = CreateObject<GlobalRouter> (node); |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
190 |
node->AggregateObject (globalRouter); |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
191 |
} |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
192 |
@end verbatim |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
193 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
194 |
This interface is later queried and used to generate a Link State |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
195 |
Advertisement for each router, and this link state database is |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
196 |
fed into the OSPF shortest path computation logic. The Ipv4 API |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
197 |
is finally used to populate the routes themselves. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
198 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
199 |
@node Unicast routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
200 |
@section Unicast routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
201 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
202 |
There are presently four routing protocols defined: |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
203 |
@itemize @bullet |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
204 |
@item class Ipv4StaticRouting (covering both unicast and multicast) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
205 |
@item Optimized Link State Routing (a MANET protocol defined in |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
206 |
@uref{http://www.ietf.org/rfc/rfc3626.txt,,RFC 3626}) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
207 |
@item class Ipv4ListRouting (used to store a prioritized list of routing |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
208 |
protocols) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
209 |
@item class Ipv4GlobalRouting (used to store routes computed by the global |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
210 |
route manager, if that is used) |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
211 |
@end itemize |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
212 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
213 |
In the future, this architecture should also allow someone to implement |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
214 |
a Linux-like implementation with routing cache, or a Click modular |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
215 |
router, but those are out of scope for now. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
216 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
217 |
@subsection Ipv4ListRouting |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
218 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
219 |
This section describes the current default ns-3 Ipv4RoutingProtocol. |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
220 |
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
|
221 |
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
|
222 |
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
|
223 |
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
|
224 |
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
|
225 |
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
|
226 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
227 |
We chose this approach because it may better |
4755
04a9a7e9a624
Manual spelling fixes from Johannes Buchner
Tom Henderson <tomh@tomh.org>
parents:
4646
diff
changeset
|
228 |
facilitate the integration of disparate routing approaches that may |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
229 |
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
|
230 |
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
|
231 |
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
|
232 |
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
|
233 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
234 |
@subsubsection Ipv4ListRouting::AddRoutingProtocol |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
235 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
236 |
Class Ipv4ListRouting provides a pure virtual function declaration for the |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
237 |
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
|
238 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
239 |
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
|
240 |
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
|
241 |
@end verbatim |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
242 |
This method is implemented by class Ipv4ListRoutingImpl in the internet-stack |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
243 |
module. |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
244 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
245 |
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
|
246 |
protocols are inserted. Notice that it is a signed int. |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
247 |
By default in ns-3, the helper classes will instantiate a Ipv4ListRoutingImpl |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
248 |
object, and add to it an Ipv4StaticRoutingImpl object at priority zero. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
249 |
Internally, a list of Ipv4RoutingProtocols is stored, and |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
250 |
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
|
251 |
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
|
252 |
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
|
253 |
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
|
254 |
@verbatim |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
255 |
Ptr<MyRoutingProtocol> myRoutingProto = CreateObject<MyRoutingProtocol> (); |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
256 |
listRoutingPtr->AddRoutingProtocol (myRoutingProto, -10); |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
257 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
258 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
259 |
Upon calls to RouteOutput() or RouteInput(), the list routing object will |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
260 |
search the list of routing protocols, in priority order, until a route |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
261 |
is found. Such routing protocol will invoke the appropriate callback |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
262 |
and no further routing protocols will be searched. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
263 |
|
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
264 |
@subsection Optimized Link State Routing (OLSR) |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
265 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
266 |
This is the first dynamic routing protocol for @command{ns-3}. The implementation |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
267 |
is found in the src/routing/olsr directory, and an example script is in |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
268 |
examples/simple-point-to-point-olsr.cc. |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
269 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
270 |
The following commands will enable OLSR in a simulation. |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
271 |
|
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
272 |
@verbatim |
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
273 |
olsr::EnableAllNodes (); // Start OLSR on all nodes |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
274 |
olsr::EnableNodes(InputIterator begin, InputIterator end); // Start on |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
275 |
// a list of nodes |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
276 |
olsr::EnableNode (Ptr<Node> node); // Start OLSR on "node" only |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
277 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
278 |
|
4480
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
279 |
Once instantiated, the agent can be started with the Start() command, |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
280 |
and the OLSR "main interface" can be set with the SetMainInterface() |
565c460ffd5a
some revisions to the routing section of the manual
Tom Henderson <tomh@tomh.org>
parents:
4415
diff
changeset
|
281 |
command. A number of protocol constants are defined in olsr-agent-impl.cc. |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
282 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
283 |
@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
|
284 |
@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
|
285 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
286 |
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
|
287 |
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
|
288 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
289 |
void |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
290 |
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
|
291 |
Ipv4Address group, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
292 |
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
|
293 |
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
|
294 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
295 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
296 |
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
|
297 |
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
|
298 |
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
|
299 |
are sent. |
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 |
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
|
302 |
first kind are used during forwarding. All of the conditions must be |
4755
04a9a7e9a624
Manual spelling fixes from Johannes Buchner
Tom Henderson <tomh@tomh.org>
parents:
4646
diff
changeset
|
303 |
explicitly provided. The second kind of routes are used to get packets off |
3274
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
304 |
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
|
305 |
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
|
306 |
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
|
307 |
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
|
308 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
309 |
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
|
310 |
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
|
311 |
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
|
312 |
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
|
313 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
314 |
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
|
315 |
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
|
316 |
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
|
317 |
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
|
318 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
319 |
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
|
320 |
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
|
321 |
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
|
322 |
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
|
323 |
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
|
324 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
325 |
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
|
326 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
327 |
void |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
328 |
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
|
329 |
@end verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
330 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
331 |
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
|
332 |
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
|
333 |
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
|
334 |
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
|
335 |
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
|
336 |
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
|
337 |
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
|
338 |
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
|
339 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
340 |
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
|
341 |
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
|
342 |
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
|
343 |
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
|
344 |
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
|
345 |
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
|
346 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
347 |
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
|
348 |
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
|
349 |
@verbatim |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
350 |
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
|
351 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
352 |
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
|
353 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
354 |
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
|
355 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
356 |
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
|
357 |
Ipv4Address group, |
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
358 |
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
|
359 |
|
eaa3a345b05e
Split out non-tutorial sections from tutorial; place into a doc/manual directory
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
360 |
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
|
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 |