author | Tommaso Pecorella <tommaso.pecorella@unifi.it> |
Wed, 20 Nov 2013 20:15:02 +0100 | |
changeset 10440 | 1e48ff9185f1 |
parent 8977 | 2bd04c7f5010 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Mileti? <rivanvx@gmail.com>
parents:
7176
diff
changeset
|
1 |
// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- |
3962 | 2 |
// |
3 |
// Copyright (c) 2008 University of Washington |
|
4 |
// |
|
5 |
// This program is free software; you can redistribute it and/or modify |
|
6 |
// it under the terms of the GNU General Public License version 2 as |
|
7 |
// published by the Free Software Foundation; |
|
8 |
// |
|
9 |
// This program is distributed in the hope that it will be useful, |
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
// GNU General Public License for more details. |
|
13 |
// |
|
14 |
// You should have received a copy of the GNU General Public License |
|
15 |
// along with this program; if not, write to the Free Software |
|
16 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
// |
|
18 |
// |
|
19 |
||
20 |
#ifndef IPV4_GLOBAL_ROUTING_H |
|
21 |
#define IPV4_GLOBAL_ROUTING_H |
|
22 |
||
23 |
#include <list> |
|
24 |
#include <stdint.h> |
|
25 |
#include "ns3/ipv4-address.h" |
|
26 |
#include "ns3/ipv4-header.h" |
|
27 |
#include "ns3/ptr.h" |
|
28 |
#include "ns3/ipv4.h" |
|
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
29 |
#include "ns3/ipv4-routing-protocol.h" |
8977
2bd04c7f5010
Replace src/internet usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
30 |
#include "ns3/random-variable-stream.h" |
3962 | 31 |
|
32 |
namespace ns3 { |
|
33 |
||
34 |
class Packet; |
|
35 |
class NetDevice; |
|
36 |
class Ipv4Interface; |
|
37 |
class Ipv4Address; |
|
38 |
class Ipv4Header; |
|
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
39 |
class Ipv4RoutingTableEntry; |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
40 |
class Ipv4MulticastRoutingTableEntry; |
3962 | 41 |
class Node; |
42 |
||
43 |
||
44 |
/** |
|
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
45 |
* \brief Global routing protocol for IP version 4 stacks. |
3962 | 46 |
* |
47 |
* In ns-3 we have the concept of a pluggable routing protocol. Routing |
|
48 |
* protocols are added to a list maintained by the Ipv4L3Protocol. Every |
|
49 |
* stack gets one routing protocol for free -- the Ipv4StaticRouting routing |
|
50 |
* protocol is added in the constructor of the Ipv4L3Protocol (this is the |
|
51 |
* piece of code that implements the functionality of the IP layer). |
|
52 |
* |
|
53 |
* As an option to running a dynamic routing protocol, a GlobalRouteManager |
|
54 |
* object has been created to allow users to build routes for all participating |
|
55 |
* nodes. One can think of this object as a "routing oracle"; it has |
|
56 |
* an omniscient view of the topology, and can construct shortest path |
|
57 |
* routes between all pairs of nodes. These routes must be stored |
|
58 |
* somewhere in the node, so therefore this class Ipv4GlobalRouting |
|
59 |
* is used as one of the pluggable routing protocols. It is kept distinct |
|
60 |
* from Ipv4StaticRouting because these routes may be dynamically cleared |
|
61 |
* and rebuilt in the middle of the simulation, while manually entered |
|
62 |
* routes into the Ipv4StaticRouting may need to be kept distinct. |
|
63 |
* |
|
64 |
* This class deals with Ipv4 unicast routes only. |
|
65 |
* |
|
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
66 |
* \see Ipv4RoutingProtocol |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
67 |
* \see GlobalRouteManager |
3962 | 68 |
*/ |
69 |
class Ipv4GlobalRouting : public Ipv4RoutingProtocol |
|
70 |
{ |
|
71 |
public: |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
72 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
73 |
* \brief Get the type ID. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
74 |
* \return the object TypeId |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
75 |
*/ |
3962 | 76 |
static TypeId GetTypeId (void); |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
77 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
78 |
* \brief Construct an empty Ipv4GlobalRouting routing protocol, |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
79 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
80 |
* The Ipv4GlobalRouting class supports host and network unicast routes. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
81 |
* This method initializes the lists containing these routes to empty. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
82 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
83 |
* \see Ipv4GlobalRouting |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
84 |
*/ |
3962 | 85 |
Ipv4GlobalRouting (); |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
86 |
virtual ~Ipv4GlobalRouting (); |
3962 | 87 |
|
6317
e4a750adf12c
bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents:
6273
diff
changeset
|
88 |
// These methods inherited from base class |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
4745
diff
changeset
|
89 |
virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr); |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
90 |
|
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
91 |
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev, |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
92 |
UnicastForwardCallback ucb, MulticastForwardCallback mcb, |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
93 |
LocalDeliverCallback lcb, ErrorCallback ecb); |
4560
2f106fd728ab
Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4527
diff
changeset
|
94 |
virtual void NotifyInterfaceUp (uint32_t interface); |
2f106fd728ab
Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4527
diff
changeset
|
95 |
virtual void NotifyInterfaceDown (uint32_t interface); |
2f106fd728ab
Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4527
diff
changeset
|
96 |
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address); |
2f106fd728ab
Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4527
diff
changeset
|
97 |
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address); |
2f106fd728ab
Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4527
diff
changeset
|
98 |
virtual void SetIpv4 (Ptr<Ipv4> ipv4); |
6701
a590022a1536
[bug 947] Pretty-print IPv4 routing tables (patch originated by Hemanth Narra)
Tom Henderson <tomh@tomh.org>
parents:
6648
diff
changeset
|
99 |
virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const; |
3962 | 100 |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
101 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
102 |
* \brief Add a host route to the global routing table. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
103 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
104 |
* \param dest The Ipv4Address destination for this route. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
105 |
* \param nextHop The Ipv4Address of the next hop in the route. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
106 |
* \param interface The network interface index used to send packets to the |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
107 |
* destination. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
108 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
109 |
* \see Ipv4Address |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
110 |
*/ |
3962 | 111 |
void AddHostRouteTo (Ipv4Address dest, |
112 |
Ipv4Address nextHop, |
|
113 |
uint32_t interface); |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
114 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
115 |
* \brief Add a host route to the global routing table. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
116 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
117 |
* \param dest The Ipv4Address destination for this route. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
118 |
* \param interface The network interface index used to send packets to the |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
119 |
* destination. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
120 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
121 |
* \see Ipv4Address |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
122 |
*/ |
3962 | 123 |
void AddHostRouteTo (Ipv4Address dest, |
124 |
uint32_t interface); |
|
125 |
||
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
126 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
127 |
* \brief Add a network route to the global routing table. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
128 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
129 |
* \param network The Ipv4Address network for this route. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
130 |
* \param networkMask The Ipv4Mask to extract the network. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
131 |
* \param nextHop The next hop in the route to the destination network. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
132 |
* \param interface The network interface index used to send packets to the |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
133 |
* destination. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
134 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
135 |
* \see Ipv4Address |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
136 |
*/ |
3962 | 137 |
void AddNetworkRouteTo (Ipv4Address network, |
138 |
Ipv4Mask networkMask, |
|
139 |
Ipv4Address nextHop, |
|
140 |
uint32_t interface); |
|
141 |
||
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
142 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
143 |
* \brief Add a network route to the global routing table. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
144 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
145 |
* \param network The Ipv4Address network for this route. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
146 |
* \param networkMask The Ipv4Mask to extract the network. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
147 |
* \param interface The network interface index used to send packets to the |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
148 |
* destination. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
149 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
150 |
* \see Ipv4Address |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
151 |
*/ |
3962 | 152 |
void AddNetworkRouteTo (Ipv4Address network, |
153 |
Ipv4Mask networkMask, |
|
154 |
uint32_t interface); |
|
155 |
||
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
156 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
157 |
* \brief Add an external route to the global routing table. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
158 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
159 |
* \param network The Ipv4Address network for this route. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
160 |
* \param networkMask The Ipv4Mask to extract the network. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
161 |
* \param nextHop The next hop Ipv4Address |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
162 |
* \param interface The network interface index used to send packets to the |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
163 |
* destination. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
164 |
*/ |
4745
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4603
diff
changeset
|
165 |
void AddASExternalRouteTo (Ipv4Address network, |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4603
diff
changeset
|
166 |
Ipv4Mask networkMask, |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4603
diff
changeset
|
167 |
Ipv4Address nextHop, |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4603
diff
changeset
|
168 |
uint32_t interface); |
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4603
diff
changeset
|
169 |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
170 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
171 |
* \brief Get the number of individual unicast routes that have been added |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
172 |
* to the routing table. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
173 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
174 |
* \warning The default route counts as one of the routes. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
175 |
* \returns the number of routes |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
176 |
*/ |
6701
a590022a1536
[bug 947] Pretty-print IPv4 routing tables (patch originated by Hemanth Narra)
Tom Henderson <tomh@tomh.org>
parents:
6648
diff
changeset
|
177 |
uint32_t GetNRoutes (void) const; |
3962 | 178 |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
179 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
180 |
* \brief Get a route from the global unicast routing table. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
181 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
182 |
* Externally, the unicast global routing table appears simply as a table with |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
183 |
* n entries. The one subtlety of note is that if a default route has been set |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
184 |
* it will appear as the zeroth entry in the table. This means that if you |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
185 |
* add only a default route, the table will have one entry that can be accessed |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
186 |
* either by explicitly calling GetDefaultRoute () or by calling GetRoute (0). |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
187 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
188 |
* Similarly, if the default route has been set, calling RemoveRoute (0) will |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
189 |
* remove the default route. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
190 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
191 |
* \param i The index (into the routing table) of the route to retrieve. If |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
192 |
* the default route has been set, it will occupy index zero. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
193 |
* \return If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
194 |
* a zero pointer is returned. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
195 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
196 |
* \see Ipv4RoutingTableEntry |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
197 |
* \see Ipv4GlobalRouting::RemoveRoute |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
198 |
*/ |
6701
a590022a1536
[bug 947] Pretty-print IPv4 routing tables (patch originated by Hemanth Narra)
Tom Henderson <tomh@tomh.org>
parents:
6648
diff
changeset
|
199 |
Ipv4RoutingTableEntry *GetRoute (uint32_t i) const; |
3962 | 200 |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
201 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
202 |
* \brief Remove a route from the global unicast routing table. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
203 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
204 |
* Externally, the unicast global routing table appears simply as a table with |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
205 |
* n entries. The one subtlety of note is that if a default route has been set |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
206 |
* it will appear as the zeroth entry in the table. This means that if the |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
207 |
* default route has been set, calling RemoveRoute (0) will remove the |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
208 |
* default route. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
209 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
210 |
* \param i The index (into the routing table) of the route to remove. If |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
211 |
* the default route has been set, it will occupy index zero. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
212 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
213 |
* \see Ipv4RoutingTableEntry |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
214 |
* \see Ipv4GlobalRouting::GetRoute |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
215 |
* \see Ipv4GlobalRouting::AddRoute |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
216 |
*/ |
3962 | 217 |
void RemoveRoute (uint32_t i); |
218 |
||
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
219 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
220 |
* Assign a fixed random variable stream number to the random variables |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
221 |
* used by this model. Return the number of streams (possibly zero) that |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
222 |
* have been assigned. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
223 |
* |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
224 |
* \param stream first stream index to use |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
225 |
* \return the number of stream indices assigned by this model |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
226 |
*/ |
8977
2bd04c7f5010
Replace src/internet usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
227 |
int64_t AssignStreams (int64_t stream); |
2bd04c7f5010
Replace src/internet usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
228 |
|
3962 | 229 |
protected: |
230 |
void DoDispose (void); |
|
231 |
||
232 |
private: |
|
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
5856
diff
changeset
|
233 |
/// Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently |
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
5856
diff
changeset
|
234 |
bool m_randomEcmpRouting; |
6317
e4a750adf12c
bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents:
6273
diff
changeset
|
235 |
/// Set to true if this interface should respond to interface events by globallly recomputing routes |
e4a750adf12c
bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents:
6273
diff
changeset
|
236 |
bool m_respondToInterfaceEvents; |
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
5856
diff
changeset
|
237 |
/// A uniform random number generator for randomly routing packets among ECMP |
8977
2bd04c7f5010
Replace src/internet usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
238 |
Ptr<UniformRandomVariable> m_rand; |
5858
afb51c7f34c2
bug 667: Add equal-cost multipath routing (ECMP) to IPv4 global routing
Wilson Thong <wilsonwk@ee.cityu.edu.hk>
parents:
5856
diff
changeset
|
239 |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
240 |
/// container of Ipv4RoutingTableEntry (routes to hosts) |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
241 |
typedef std::list<Ipv4RoutingTableEntry *> HostRoutes; |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
242 |
/// const iterator of container of Ipv4RoutingTableEntry (routes to hosts) |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
243 |
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator HostRoutesCI; |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
244 |
/// iterator of container of Ipv4RoutingTableEntry (routes to hosts) |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
245 |
typedef std::list<Ipv4RoutingTableEntry *>::iterator HostRoutesI; |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
246 |
|
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
247 |
/// container of Ipv4RoutingTableEntry (routes to networks) |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
248 |
typedef std::list<Ipv4RoutingTableEntry *> NetworkRoutes; |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
249 |
/// const iterator of container of Ipv4RoutingTableEntry (routes to networks) |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
250 |
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator NetworkRoutesCI; |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
251 |
/// iterator of container of Ipv4RoutingTableEntry (routes to networks) |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4372
diff
changeset
|
252 |
typedef std::list<Ipv4RoutingTableEntry *>::iterator NetworkRoutesI; |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
253 |
|
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
254 |
/// container of Ipv4RoutingTableEntry (routes to external AS) |
4745
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4603
diff
changeset
|
255 |
typedef std::list<Ipv4RoutingTableEntry *> ASExternalRoutes; |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
256 |
/// const iterator of container of Ipv4RoutingTableEntry (routes to external AS) |
4745
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4603
diff
changeset
|
257 |
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator ASExternalRoutesCI; |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
258 |
/// iterator of container of Ipv4RoutingTableEntry (routes to external AS) |
4745
a0e27af57c8d
Allow injection of routes to Ipv4GlobalRouting
Antti Makela <zarhan@cc.hut.fi>
parents:
4603
diff
changeset
|
259 |
typedef std::list<Ipv4RoutingTableEntry *>::iterator ASExternalRoutesI; |
3962 | 260 |
|
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
4745
diff
changeset
|
261 |
Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif = 0); |
3962 | 262 |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
263 |
HostRoutes m_hostRoutes; //!< Routes to hosts |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
264 |
NetworkRoutes m_networkRoutes; //!< Routes to networks |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
265 |
ASExternalRoutes m_ASexternalRoutes; //!< External routes imported |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
266 |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8977
diff
changeset
|
267 |
Ptr<Ipv4> m_ipv4; //!< associated IPv4 instance |
3962 | 268 |
}; |
269 |
||
270 |
} // Namespace ns3 |
|
271 |
||
272 |
#endif /* IPV4_GLOBAL_ROUTING_H */ |