Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 UCLA |
| 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 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
| 20 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 21 | #include "ndn-global-routing-helper.h" |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 22 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 23 | #include "ns3/ndn-l3-protocol.h" |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 24 | #include "../model/ndn-net-device-face.h" |
| 25 | #include "../model/ndn-global-router.h" |
| 26 | #include "ns3/ndn-name-components.h" |
| 27 | #include "ns3/ndn-fib.h" |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 28 | |
| 29 | #include "ns3/node.h" |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 30 | #include "ns3/node-container.h" |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 31 | #include "ns3/net-device.h" |
| 32 | #include "ns3/channel.h" |
| 33 | #include "ns3/log.h" |
| 34 | #include "ns3/assert.h" |
| 35 | #include "ns3/names.h" |
| 36 | #include "ns3/node-list.h" |
| 37 | #include "ns3/channel-list.h" |
Alexander Afanasyev | f5c0774 | 2012-10-31 13:13:05 -0700 | [diff] [blame] | 38 | #include "ns3/object-factory.h" |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 39 | |
| 40 | #include <boost/lexical_cast.hpp> |
Alexander Afanasyev | 8e2f112 | 2012-04-17 15:01:11 -0700 | [diff] [blame] | 41 | #include <boost/foreach.hpp> |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 42 | #include <boost/concept/assert.hpp> |
| 43 | // #include <boost/graph/graph_concepts.hpp> |
| 44 | // #include <boost/graph/adjacency_list.hpp> |
| 45 | #include <boost/graph/dijkstra_shortest_paths.hpp> |
| 46 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 47 | #include "boost-graph-ndn-global-routing-helper.h" |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 48 | |
Alexander Afanasyev | 7353251 | 2012-11-27 00:42:35 -0800 | [diff] [blame] | 49 | #include <math.h> |
| 50 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 51 | NS_LOG_COMPONENT_DEFINE ("ndn.GlobalRoutingHelper"); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 52 | |
| 53 | using namespace std; |
| 54 | using namespace boost; |
| 55 | |
| 56 | namespace ns3 { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 57 | namespace ndn { |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 58 | |
| 59 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 60 | GlobalRoutingHelper::Install (Ptr<Node> node) |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 61 | { |
| 62 | NS_LOG_LOGIC ("Node: " << node->GetId ()); |
| 63 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 64 | Ptr<L3Protocol> ndn = node->GetObject<L3Protocol> (); |
| 65 | NS_ASSERT_MSG (ndn != 0, "Cannot install GlobalRoutingHelper before Ndn is installed on a node"); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 66 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 67 | Ptr<GlobalRouter> gr = node->GetObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 68 | if (gr != 0) |
| 69 | { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 70 | NS_LOG_DEBUG ("GlobalRouter is already installed: " << gr); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 71 | return; // already installed |
| 72 | } |
| 73 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 74 | gr = CreateObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 75 | node->AggregateObject (gr); |
| 76 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 77 | for (uint32_t faceId = 0; faceId < ndn->GetNFaces (); faceId++) |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 78 | { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 79 | Ptr<NetDeviceFace> face = DynamicCast<NetDeviceFace> (ndn->GetFace (faceId)); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 80 | if (face == 0) |
| 81 | { |
| 82 | NS_LOG_DEBUG ("Skipping non-netdevice face"); |
| 83 | continue; |
| 84 | } |
| 85 | |
| 86 | Ptr<NetDevice> nd = face->GetNetDevice (); |
| 87 | if (nd == 0) |
| 88 | { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 89 | NS_LOG_DEBUG ("Not a NetDevice associated with NetDeviceFace"); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 90 | continue; |
| 91 | } |
| 92 | |
| 93 | Ptr<Channel> ch = nd->GetChannel (); |
| 94 | |
| 95 | if (ch == 0) |
| 96 | { |
| 97 | NS_LOG_DEBUG ("Channel is not associated with NetDevice"); |
| 98 | continue; |
| 99 | } |
| 100 | |
| 101 | if (ch->GetNDevices () == 2) // e.g., point-to-point channel |
| 102 | { |
| 103 | for (uint32_t deviceId = 0; deviceId < ch->GetNDevices (); deviceId ++) |
| 104 | { |
| 105 | Ptr<NetDevice> otherSide = ch->GetDevice (deviceId); |
| 106 | if (nd == otherSide) continue; |
| 107 | |
| 108 | Ptr<Node> otherNode = otherSide->GetNode (); |
| 109 | NS_ASSERT (otherNode != 0); |
| 110 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 111 | Ptr<GlobalRouter> otherGr = otherNode->GetObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 112 | if (otherGr == 0) |
| 113 | { |
| 114 | Install (otherNode); |
| 115 | } |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 116 | otherGr = otherNode->GetObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 117 | NS_ASSERT (otherGr != 0); |
| 118 | gr->AddIncidency (face, otherGr); |
| 119 | } |
| 120 | } |
| 121 | else |
| 122 | { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 123 | Ptr<GlobalRouter> grChannel = ch->GetObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 124 | if (grChannel == 0) |
| 125 | { |
| 126 | Install (ch); |
| 127 | } |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 128 | grChannel = ch->GetObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 129 | |
| 130 | gr->AddIncidency (0, grChannel); |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 136 | GlobalRoutingHelper::Install (Ptr<Channel> channel) |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 137 | { |
| 138 | NS_LOG_LOGIC ("Channel: " << channel->GetId ()); |
| 139 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 140 | Ptr<GlobalRouter> gr = channel->GetObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 141 | if (gr != 0) |
| 142 | return; |
| 143 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 144 | gr = CreateObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 145 | channel->AggregateObject (gr); |
| 146 | |
| 147 | for (uint32_t deviceId = 0; deviceId < channel->GetNDevices (); deviceId ++) |
| 148 | { |
| 149 | Ptr<NetDevice> dev = channel->GetDevice (deviceId); |
| 150 | |
| 151 | Ptr<Node> node = dev->GetNode (); |
| 152 | NS_ASSERT (node != 0); |
| 153 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 154 | Ptr<GlobalRouter> grOther = node->GetObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 155 | if (grOther == 0) |
| 156 | { |
| 157 | Install (node); |
| 158 | } |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 159 | grOther = node->GetObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 160 | NS_ASSERT (grOther != 0); |
| 161 | |
| 162 | gr->AddIncidency (0, grOther); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 167 | GlobalRoutingHelper::Install (const NodeContainer &nodes) |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 168 | { |
| 169 | for (NodeContainer::Iterator node = nodes.Begin (); |
| 170 | node != nodes.End (); |
| 171 | node ++) |
| 172 | { |
| 173 | Install (*node); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 178 | GlobalRoutingHelper::InstallAll () |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 179 | { |
| 180 | Install (NodeContainer::GetGlobal ()); |
| 181 | } |
| 182 | |
| 183 | |
| 184 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 185 | GlobalRoutingHelper::AddOrigin (const std::string &prefix, Ptr<Node> node) |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 186 | { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 187 | Ptr<GlobalRouter> gr = node->GetObject<GlobalRouter> (); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 188 | NS_ASSERT_MSG (gr != 0, |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 189 | "GlobalRouter is not installed on the node"); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 190 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 191 | Ptr<NameComponents> name = Create<NameComponents> (boost::lexical_cast<NameComponents> (prefix)); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 192 | gr->AddLocalPrefix (name); |
| 193 | } |
| 194 | |
| 195 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 196 | GlobalRoutingHelper::AddOrigins (const std::string &prefix, const NodeContainer &nodes) |
Alexander Afanasyev | 06d3a61 | 2012-04-17 22:25:40 -0700 | [diff] [blame] | 197 | { |
| 198 | for (NodeContainer::Iterator node = nodes.Begin (); |
| 199 | node != nodes.End (); |
| 200 | node++) |
| 201 | { |
| 202 | AddOrigin (prefix, *node); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 207 | GlobalRoutingHelper::AddOrigin (const std::string &prefix, const std::string &nodeName) |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 208 | { |
| 209 | Ptr<Node> node = Names::Find<Node> (nodeName); |
| 210 | NS_ASSERT_MSG (node != 0, nodeName << "is not a Node"); |
| 211 | |
| 212 | AddOrigin (prefix, node); |
| 213 | } |
| 214 | |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 215 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 216 | GlobalRoutingHelper::CalculateRoutes () |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 217 | { |
Alexander Afanasyev | 8e2f112 | 2012-04-17 15:01:11 -0700 | [diff] [blame] | 218 | /** |
| 219 | * Implementation of route calculation is heavily based on Boost Graph Library |
| 220 | * See http://www.boost.org/doc/libs/1_49_0/libs/graph/doc/table_of_contents.html for more details |
| 221 | */ |
| 222 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 223 | BOOST_CONCEPT_ASSERT(( VertexListGraphConcept< NdnGlobalRouterGraph > )); |
| 224 | BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept< NdnGlobalRouterGraph > )); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 225 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 226 | NdnGlobalRouterGraph graph; |
| 227 | typedef graph_traits < NdnGlobalRouterGraph >::vertex_descriptor vertex_descriptor; |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 228 | |
Alexander Afanasyev | 8e2f112 | 2012-04-17 15:01:11 -0700 | [diff] [blame] | 229 | // For now we doing Dijkstra for every node. Can be replaced with Bellman-Ford or Floyd-Warshall. |
| 230 | // Other algorithms should be faster, but they need additional EdgeListGraph concept provided by the graph, which |
| 231 | // is not obviously how implement in an efficient manner |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 232 | for (NodeList::Iterator node = NodeList::Begin (); node != NodeList::End (); node++) |
| 233 | { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 234 | Ptr<GlobalRouter> source = (*node)->GetObject<GlobalRouter> (); |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 235 | if (source == 0) |
| 236 | { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 237 | NS_LOG_DEBUG ("Node " << (*node)->GetId () << " does not export GlobalRouter interface"); |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 238 | continue; |
| 239 | } |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 240 | |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 241 | DistancesMap distances; |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 242 | |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 243 | dijkstra_shortest_paths (graph, source, |
| 244 | // predecessor_map (boost::ref(predecessors)) |
| 245 | // . |
| 246 | distance_map (boost::ref(distances)) |
| 247 | . |
| 248 | distance_inf (WeightInf) |
| 249 | . |
| 250 | distance_zero (WeightZero) |
| 251 | . |
| 252 | distance_compare (boost::WeightCompare ()) |
| 253 | . |
| 254 | distance_combine (boost::WeightCombine ()) |
| 255 | ); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 256 | |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 257 | // NS_LOG_DEBUG (predecessors.size () << ", " << distances.size ()); |
Alexander Afanasyev | 8e2f112 | 2012-04-17 15:01:11 -0700 | [diff] [blame] | 258 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 259 | Ptr<Fib> fib = source->GetObject<Fib> (); |
Alexander Afanasyev | 8e2f112 | 2012-04-17 15:01:11 -0700 | [diff] [blame] | 260 | fib->InvalidateAll (); |
| 261 | NS_ASSERT (fib != 0); |
| 262 | |
Alexander Afanasyev | 5bcdc99 | 2012-11-19 22:25:55 -0800 | [diff] [blame] | 263 | NS_LOG_DEBUG ("Reachability from Node: " << source->GetObject<Node> ()->GetId ()); |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 264 | for (DistancesMap::iterator i = distances.begin (); |
| 265 | i != distances.end (); |
| 266 | i++) |
| 267 | { |
| 268 | if (i->first == source) |
| 269 | continue; |
| 270 | else |
| 271 | { |
Alexander Afanasyev | 8e2f112 | 2012-04-17 15:01:11 -0700 | [diff] [blame] | 272 | // cout << " Node " << i->first->GetObject<Node> ()->GetId (); |
| 273 | if (i->second.get<0> () == 0) |
| 274 | { |
| 275 | // cout << " is unreachable" << endl; |
| 276 | } |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 277 | else |
Alexander Afanasyev | 8e2f112 | 2012-04-17 15:01:11 -0700 | [diff] [blame] | 278 | { |
Alexander Afanasyev | a8f5d88 | 2012-11-09 14:22:48 -0800 | [diff] [blame] | 279 | BOOST_FOREACH (const Ptr<const NameComponents> &prefix, i->first->GetLocalPrefixes ()) |
| 280 | { |
Alexander Afanasyev | 5bcdc99 | 2012-11-19 22:25:55 -0800 | [diff] [blame] | 281 | NS_LOG_DEBUG (" prefix " << prefix << " reachable via face " << *i->second.get<0> () |
| 282 | << " with distance " << i->second.get<1> () |
| 283 | << " with delay " << i->second.get<2> ()); |
Alexander Afanasyev | f5c0774 | 2012-10-31 13:13:05 -0700 | [diff] [blame] | 284 | |
Alexander Afanasyev | a8f5d88 | 2012-11-09 14:22:48 -0800 | [diff] [blame] | 285 | Ptr<fib::Entry> entry = fib->Add (prefix, i->second.get<0> (), i->second.get<1> ()); |
Alexander Afanasyev | 6b0c88f | 2012-12-01 12:24:27 -0800 | [diff] [blame^] | 286 | entry->SetRealDelayToProducer (i->second.get<0> (), Seconds (i->second.get<2> ())); |
| 287 | |
Alexander Afanasyev | adcccf4 | 2012-11-26 23:55:34 -0800 | [diff] [blame] | 288 | Ptr<Limits> faceLimits = i->second.get<0> ()->GetObject<Limits> (); |
| 289 | |
| 290 | Ptr<Limits> fibLimits = entry->GetObject<Limits> (); |
| 291 | if (fibLimits != 0) |
Alexander Afanasyev | a8f5d88 | 2012-11-09 14:22:48 -0800 | [diff] [blame] | 292 | { |
Alexander Afanasyev | adcccf4 | 2012-11-26 23:55:34 -0800 | [diff] [blame] | 293 | // if it was created by the forwarding strategy via DidAddFibEntry event |
Alexander Afanasyev | 7353251 | 2012-11-27 00:42:35 -0800 | [diff] [blame] | 294 | fibLimits->SetLimits (faceLimits->GetMaxRate (), 2 * i->second.get<2> () /*exact RTT*/); |
| 295 | NS_LOG_DEBUG ("Set limit for prefix " << *prefix << " " << faceLimits->GetMaxRate () << " / " << |
| 296 | 2*i->second.get<2> () << "s (" << faceLimits->GetMaxRate () * 2 * i->second.get<2> () << ")"); |
Alexander Afanasyev | a8f5d88 | 2012-11-09 14:22:48 -0800 | [diff] [blame] | 297 | } |
| 298 | } |
Alexander Afanasyev | 8e2f112 | 2012-04-17 15:01:11 -0700 | [diff] [blame] | 299 | } |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 300 | } |
| 301 | } |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 302 | } |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 306 | } // namespace ndn |
| 307 | } // namespace ns3 |