Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 1 | ndnSIM helpers |
| 2 | ============== |
| 3 | |
| 4 | Helpers are very important components of ndnSIM, especially for writing simulation scenarios. |
| 5 | The following summarizes helpers and their basic usage. |
| 6 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 7 | StackHelper |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 8 | --------------- |
| 9 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 10 | :ndnsim:`StackHelper` is used to install ndnSIM network stack on requested nodes, as well to provide a simple way configure several important parameters of NDN simulation. |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 11 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 12 | Example: |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 13 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 14 | .. code-block:: c++ |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 15 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 16 | ndn::StackHelper ndnHelper; |
| 17 | NodeContainer nodes; |
| 18 | ... |
| 19 | ndnHelper.Install (nodes); |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 20 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 21 | Routing |
| 22 | +++++++ |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 23 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 24 | All forwarding strategies require knowledge of where Interests can be forwarded (Forwarding Information Base). |
| 25 | Unlike IP routing, this knowledge may be imprecise, but without such knowledge forwarding strategies will not be able to make any decision and will drop any Interests. |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 26 | |
| 27 | .. note:: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 28 | By default, all nodes have empty FIB. You need either to manually configure routes, use global routing controller, or (not recommended) enable default routes. |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 29 | |
| 30 | Manually routes |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 31 | ^^^^^^^^^^^^^^^ |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 32 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 33 | Routes can be configured manually using :ndnsim:`StackHelper::AddRoute` static methods of :ndnsim:`StackHelper`. |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 34 | |
| 35 | These routes **should** be created **after** installing NDN stack on a node: |
| 36 | |
| 37 | .. code-block:: c++ |
| 38 | |
Alexander Afanasyev | b8d14ad | 2012-08-09 13:19:37 -0700 | [diff] [blame] | 39 | ndnHelper.Install (nodes); |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 40 | ... |
| 41 | Ptr<Node> node = ... // FIB entry will be added to FIB on this node |
| 42 | std::string prefix = ... // some prefix |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 43 | Ptr<ndn::Face> face = ... // NDN face that belongs to the node and through which prefix is accessible |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 44 | int32_t metric = ... // some routing metric |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 45 | ndn::StackHelper::AddRoute (node, prefix, face, metric); |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 46 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 47 | Global routing controller |
| 48 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 49 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 50 | To simplify FIB management in large topologies, ndnSIM contains a global routing controller (:ndnsim:`helper <GlobalRoutingHelper>` and :ndnsim:`special interface <GlobalRouter>`), similar in spirit to ``Ipv4GlobalRoutingHelper``. |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 51 | |
| 52 | There are several necessary steps, in order to take advantage of the global routing controller: |
| 53 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 54 | * install :ndnsim:`special interfaces <GlobalRouter>` on nodes |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 55 | |
| 56 | .. code-block:: c++ |
| 57 | |
| 58 | NodeContainer nodes; |
| 59 | ... |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 60 | ndn::GlobalRoutingHelper ndnGlobalRoutingHelper; |
Alexander Afanasyev | b8d14ad | 2012-08-09 13:19:37 -0700 | [diff] [blame] | 61 | ndnGlobalRoutingHelper.Install (nodes); |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 62 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 63 | * specify which node exports which prefix using :ndnsim:`GlobalRoutingHelper::AddOrigins` |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 64 | |
| 65 | .. code-block:: c++ |
| 66 | |
| 67 | Ptr<Node> producer; // producer node that exports prefix |
| 68 | std::string prefix; // exported prefix |
| 69 | ... |
Alexander Afanasyev | b8d14ad | 2012-08-09 13:19:37 -0700 | [diff] [blame] | 70 | ndnGlobalRoutingHelper.AddOrigins (prefix, producer); |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 71 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 72 | * calculate and install FIBs on every node using :ndnsim:`GlobalRoutingHelper::CalculateRoutes` |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 73 | |
| 74 | .. code-block:: c++ |
| 75 | |
Alexander Afanasyev | b8d14ad | 2012-08-09 13:19:37 -0700 | [diff] [blame] | 76 | cdnGlobalRoutingHelper.CalculateRoutes (); |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 77 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 78 | Default routes |
| 79 | ^^^^^^^^^^^^^^ |
| 80 | |
| 81 | In simple topologies, like in :doc:`examples <examples>`, or when |
| 82 | simulating broadcast environment, it is possible to set up *default* |
| 83 | FIB entries using :ndnsim:`StackHelper::SetDefaultRoutes` call. |
| 84 | More specifically, every installed NDN stack will have a FIB entry to ``/`` prefix, containing all available faces. |
| 85 | |
| 86 | The following should be done before installing stack on a node: |
| 87 | |
| 88 | .. code-block:: c++ |
| 89 | |
| 90 | ndnHelper.SetDefaultRoutes (true); |
| 91 | ... |
| 92 | ndnHelper.Install (nodes); |
| 93 | |
| 94 | |
| 95 | Content Store |
| 96 | +++++++++++++ |
| 97 | |
| 98 | ndnSIM comes with several different in-memory :ndnsim:`content store <ndn::ContentStore>` implementations, featuring different cache replacement policies. |
| 99 | |
| 100 | .. note: |
| 101 | |
| 102 | The default content store uses LRU replacement policity and constrained with 100 cached ContentObjects. |
| 103 | |
| 104 | To select a particular content store and configure its capacity, use :ndnsim:`SetContentStore <ndn::StackHelper::SetContentStore>` helper method: |
| 105 | |
| 106 | - :ndnsim:`Least Recently Used (LRU) <ndn::cs::Lru>` (default): |
| 107 | |
| 108 | .. code-block:: c++ |
| 109 | |
| 110 | ndnHelper.SetContentStore ("ns3::ndn::cs::Lru", |
| 111 | "MaxSize", "10000"); |
| 112 | ... |
| 113 | ndnHelper.Install (nodes); |
| 114 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 115 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 116 | - :ndnsim:`First-In-First-Out (FIFO) <ndn::cs::Fifo>`: |
| 117 | |
| 118 | .. code-block:: c++ |
| 119 | |
| 120 | ndnHelper.SetContentStore ("ns3::ndn::cs::Fifo", |
| 121 | "MaxSize", "10000"); |
| 122 | ... |
| 123 | ndnHelper.Install (nodes); |
| 124 | |
| 125 | - :ndnsim:`Random <ndn::cs::Random>`: |
| 126 | |
| 127 | .. code-block:: c++ |
| 128 | |
| 129 | ndnHelper.SetContentStore ("ns3::ndn::cs::Random", |
| 130 | "MaxSize", "10000"); |
| 131 | ... |
| 132 | ndnHelper.Install (nodes); |
| 133 | |
| 134 | .. note:: |
| 135 | |
| 136 | If ``MaxSize`` parameter is omitted, then will be used a default value (100). |
| 137 | |
| 138 | .. note:: |
| 139 | |
| 140 | If ``MaxSize`` is set to 0, then no limit on ContentStore will be enforced |
| 141 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 142 | |
Alexander Afanasyev | 71278d4 | 2012-12-12 19:16:54 -0800 | [diff] [blame] | 143 | Content Store with entry lifetime tracking |
| 144 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 145 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 146 | In order to evaluate lifetime of the content store entries, the special versions of the content store need to be used: |
| 147 | |
| 148 | - :ndnsim:`Least Recently Used (LRU) with cache entry lifetime tracking <ndn::cs::Stats::Lru>`: |
| 149 | |
| 150 | .. code-block:: c++ |
| 151 | |
| 152 | void |
| 153 | CacheEntryRemoved (std::string context, Ptr<const ndn::cs::Entry> entry, Time lifetime) |
| 154 | { |
| 155 | std::cout << entry->GetName () << " " << lifetime.ToDouble (Time::S) << "s" << std::endl; |
| 156 | } |
| 157 | |
| 158 | ... |
| 159 | |
| 160 | ndnHelper.SetContentStore ("ns3::ndn::cs::Stats::Lru", |
| 161 | "MaxSize", "10000"); |
| 162 | ... |
| 163 | ndnHelper.Install (nodes); |
| 164 | |
| 165 | // connect to lifetime trace |
| 166 | Config::Connect ("/NodeList/*/$ns3::ndn::cs::Stats::Lru/WillRemoveEntry", MakeCallback (CacheEntryRemoved)); |
| 167 | |
| 168 | |
| 169 | - :ndnsim:`First-In-First-Out (FIFO) with cache entry lifetime tracking <ndn::cs::Stats::Fifo>`: |
| 170 | |
| 171 | .. code-block:: c++ |
| 172 | |
| 173 | void |
| 174 | CacheEntryRemoved (std::string context, Ptr<const ndn::cs::Entry> entry, Time lifetime) |
| 175 | { |
| 176 | std::cout << entry->GetName () << " " << lifetime.ToDouble (Time::S) << "s" << std::endl; |
| 177 | } |
| 178 | |
| 179 | ... |
| 180 | |
| 181 | ndnHelper.SetContentStore ("ns3::ndn::cs::Stats::Fifo", |
| 182 | "MaxSize", "10000"); |
| 183 | ... |
| 184 | ndnHelper.Install (nodes); |
| 185 | |
| 186 | // connect to lifetime trace |
| 187 | Config::Connect ("/NodeList/*/$ns3::ndn::cs::Stats::Fifo/WillRemoveEntry", MakeCallback (CacheEntryRemoved)); |
| 188 | |
| 189 | - :ndnsim:`Random with cache entry lifetime tracking <ndn::cs::Stats::Random>`: |
| 190 | |
| 191 | .. code-block:: c++ |
| 192 | |
| 193 | void |
| 194 | CacheEntryRemoved (std::string context, Ptr<const ndn::cs::Entry> entry, Time lifetime) |
| 195 | { |
| 196 | std::cout << entry->GetName () << " " << lifetime.ToDouble (Time::S) << "s" << std::endl; |
| 197 | } |
| 198 | |
| 199 | ... |
| 200 | |
| 201 | ndnHelper.SetContentStore ("ns3::ndn::cs::Stats::Random", |
| 202 | "MaxSize", "10000"); |
| 203 | ... |
| 204 | ndnHelper.Install (nodes); |
| 205 | |
| 206 | // connect to lifetime trace |
| 207 | Config::Connect ("/NodeList/*/$ns3::ndn::cs::Stats::Random/WillRemoveEntry", MakeCallback (CacheEntryRemoved)); |
| 208 | |
Alexander Afanasyev | 71278d4 | 2012-12-12 19:16:54 -0800 | [diff] [blame] | 209 | .. _Content Store respecting freshness field of ContentObjects: |
| 210 | |
| 211 | Content Store respecting freshness field of ContentObjects |
| 212 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 213 | |
| 214 | If simulations need Content Store which respects freshness of ContentObjects, the following versions of content store should be used: |
| 215 | |
| 216 | .. note: |
| 217 | |
| 218 | Please note that currently, Freshness granularity is 1 second and maximum value is 65535 second. Value means infinity. |
| 219 | |
| 220 | - :ndnsim:`Least Recently Used (LRU) respecting ContentObject freshness <ndn::cs::Freshness::Lru>`: |
| 221 | |
| 222 | .. code-block:: c++ |
| 223 | |
| 224 | ... |
| 225 | |
| 226 | ndnHelper.SetContentStore ("ns3::ndn::cs::Freshness::Lru", |
| 227 | "MaxSize", "10000"); |
| 228 | ... |
| 229 | |
| 230 | |
| 231 | - :ndnsim:`First-In-First-Out (FIFO) respecting ContentObject freshness <ndn::cs::Freshness::Fifo>`: |
| 232 | |
| 233 | .. code-block:: c++ |
| 234 | |
| 235 | ... |
| 236 | |
| 237 | ndnHelper.SetContentStore ("ns3::ndn::cs::Freshness::Fifo", |
| 238 | "MaxSize", "10000"); |
| 239 | ... |
| 240 | |
| 241 | - :ndnsim:`Random respecting ContentObject freshness <ndn::cs::Freshness::Random>`: |
| 242 | |
| 243 | .. code-block:: c++ |
| 244 | |
| 245 | ... |
| 246 | |
| 247 | ndnHelper.SetContentStore ("ns3::ndn::cs::Freshness::Random", |
| 248 | "MaxSize", "10000"); |
| 249 | ... |
| 250 | |
| 251 | The following example demonstrates a basic usage of a customized content store (``ndn-simple-with-content-freshness.cc``). |
| 252 | In this scenario two simple consumers (both installed on a consumer node) continually request the same data packet. |
| 253 | When Data producer specify unlimited freshness, Content keeps getting satisfied from local caches, while if freshness is specified, Interests periodically are getting through to the Data producer. |
| 254 | |
| 255 | .. aafig:: |
| 256 | :aspect: 60 |
| 257 | :scale: 120 |
| 258 | |
| 259 | +----------+ +--------+ +----------+ |
| 260 | | | 1Mbps | | 1Mbps | | |
| 261 | | Consumer |<-------------->| Router |<-------------->| Producer | |
| 262 | | | 10ms | | 10ms | | |
| 263 | +----------+ +--------+ +----------+ |
| 264 | |
| 265 | |
| 266 | .. literalinclude:: ../../examples/ndn-simple-with-content-freshness.cc |
| 267 | :language: c++ |
| 268 | :linenos: |
| 269 | :lines: 20-27,43- |
| 270 | |
| 271 | To run this scenario, use the following command:: |
| 272 | |
| 273 | NS_LOG=DumbRequester:ndn.cs.Freshness.Lru ./waf --run=ndn-simple-with-content-freshness |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 274 | |
| 275 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 276 | Pending Interest Table |
| 277 | ++++++++++++++++++++++ |
| 278 | |
| 279 | The current version of ndnSIM provides :ndnsim:`templated realizations <ndn::pit::PitImpl>` of :ndnsim:`PIT abstraction <ndn::Pit>`, allowing optional bounding the number of PIT entries and different replacement policies (i.e., perform different actions when limit on number of PIT entries is reached). |
| 280 | |
| 281 | To select a particular PIT implementation and configure its policies, use :ndnsim:`SetPit <ndn::StackHelper::SetPit>` helper method: |
| 282 | |
| 283 | - :ndnsim:`persistent <ndn::pit::Persistent>` (default): |
| 284 | |
| 285 | New entries will be rejected if PIT size reached its limit |
| 286 | |
| 287 | .. code-block:: c++ |
| 288 | |
| 289 | ndnHelper.SetPit ("ns3::ndn::pit::Persistent", |
| 290 | "MaxSize", "0"); |
| 291 | ... |
| 292 | ndnHelper.Install (nodes); |
| 293 | |
| 294 | - :ndnsim:`random <ndn::pit::Random>`: |
| 295 | |
| 296 | when PIT reaches its limit, random entry (could be the newly created one) will be removed from PIT; |
| 297 | |
| 298 | .. code-block:: c++ |
| 299 | |
| 300 | ndnHelper.SetPit ("ns3::ndn::pit::Random", |
| 301 | "MaxSize", "0"); |
| 302 | ... |
| 303 | ndnHelper.Install (nodes); |
| 304 | |
| 305 | - :ndnsim:`least-recently-used <ndn::pit::Lru>`: |
| 306 | |
| 307 | the least recently used entry (the oldest entry with minimum number of incoming faces) will be removed when PIT size reached its limit. |
| 308 | |
| 309 | .. code-block:: c++ |
| 310 | |
| 311 | ndnHelper.SetPit ("ns3::ndn::pit::Lru", |
| 312 | "MaxSize", "0"); |
| 313 | ... |
| 314 | ndnHelper.Install (nodes); |
| 315 | |
| 316 | Forwarding strategy |
| 317 | +++++++++++++++++++ |
| 318 | |
| 319 | A desired :ndnsim:`forwarding strategy <ForwardingStrategy>` parameter need to be set before installing stack on a node. |
| 320 | |
| 321 | Currently, there are following forwarding strategies that can be used in simulations: |
| 322 | |
| 323 | - :ndnsim:`Flooding` (default) |
| 324 | |
| 325 | Interests will be forwarded to all available faces available for a route (FIB entry). |
| 326 | If there are no available GREEN or YELLOW faces, interests is dropped. |
| 327 | |
| 328 | .. code-block:: c++ |
| 329 | |
| 330 | ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::Flooding"); |
| 331 | ... |
| 332 | ndnHelper.Install (nodes); |
| 333 | |
| 334 | |
| 335 | - :ndnsim:`SmartFlooding` |
| 336 | |
| 337 | If GREEN face is available, Interest will be sent to the highest-ranked GREEN face. |
| 338 | If not, Interest will be forwarded to all available faces available for a route (FIB entry)/ |
| 339 | If there are no available GREEN or YELLOW faces, interests is dropped. |
| 340 | |
| 341 | .. code-block:: c++ |
| 342 | |
| 343 | ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::SmartFlooding"); |
| 344 | ... |
| 345 | ndnHelper.Install (nodes); |
| 346 | |
| 347 | - :ndnsim:`BestRoute` |
| 348 | |
| 349 | If GREEN face is available, Interest will be sent to the highest-ranked GREEN face. |
| 350 | If not, Interest will be forwarded to the highest-ranked YELLOW face. |
| 351 | If there are no available GREEN or YELLOW faces, interests is dropped. |
| 352 | |
| 353 | .. code-block:: c++ |
| 354 | |
| 355 | ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute"); |
| 356 | ... |
| 357 | ndnHelper.Install (nodes); |
| 358 | |
| 359 | |
| 360 | |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 361 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 362 | AppHelper |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 363 | --------------- |
| 364 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 365 | :ndnsim:`AppHelper` simplifies task of creating, configuring, and installing ndnSIM applications. |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 366 | |
| 367 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 368 | The basic usage of the :ndnsim:`AppHelper`: |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 369 | |
| 370 | * Create helper for specific applications class: |
| 371 | |
| 372 | .. code-block:: c++ |
| 373 | |
| 374 | // Create helper for the consumer generating Interests with constant rate |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 375 | ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr"); |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 376 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 377 | * Assign prefix on which application operates (either generating Interests using this name or satisfying Interests for this name) using :ndnsim:`AppHelper::SetPrefix`: |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 378 | |
| 379 | .. code-block:: c++ |
| 380 | |
| 381 | consumerHelper.SetPrefix (prefix); |
| 382 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 383 | * Assign application-specific attributes using :ndnsim:`AppHelper::SetAttribute`: |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 384 | |
| 385 | .. code-block:: c++ |
| 386 | |
| 387 | // Set frequency parameter |
| 388 | consumerHelper.SetAttribute ("Frequency", StringValue ("10")); // 10 interests a second |
| 389 | |
| 390 | * Install application on one or more nodes: |
| 391 | |
| 392 | .. code-block:: c++ |
| 393 | |
| 394 | NodeContainer nodes; |
| 395 | ... |
| 396 | consumerHelper.Install (nodes) |