author | Tom Henderson <tomh@tomh.org> |
Mon, 28 Sep 2015 20:27:25 -0700 | |
changeset 11676 | 05ea1489e509 |
parent 11152 | 613c316c7c18 |
permissions | -rw-r--r-- |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
2 |
/* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 Strasbourg University |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
4 |
* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
8 |
* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
13 |
* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
17 |
* |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
18 |
* Author: David Gross <gdavid.devel@gmail.com> |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
19 |
* Sebastien Vincent <vincent@clarinet.u-strasbg.fr> |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
20 |
*/ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
21 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
22 |
// Network topology |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
23 |
// // |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
24 |
// // n0 R n1 |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
25 |
// // | _ | |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
26 |
// // ====|_|==== |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
27 |
// // router |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
28 |
// // - R sends RA to n0's subnet (2001:1::/64 and 2001:ABCD::/64); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
29 |
// // - R interface to n0 has two addresses with following prefixes 2001:1::/64 and 2001:ABCD::/64; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
30 |
// // - R sends RA to n1's subnet (2001:2::/64); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
31 |
// // - n0 ping6 n1. |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
32 |
// // |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
33 |
// // - Tracing of queues and packet receptions to file "radvd-two-prefix.tr" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
34 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
35 |
#include <fstream> |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
36 |
#include "ns3/core-module.h" |
6834
036f9a0b9899
Rename internet-stack to internet, and organize module
Tom Henderson <tomh@tomh.org>
parents:
6821
diff
changeset
|
37 |
#include "ns3/internet-module.h" |
6848
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6847
diff
changeset
|
38 |
#include "ns3/csma-module.h" |
6847
138f00c56381
Move applications to a single module
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
39 |
#include "ns3/applications-module.h" |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
40 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
41 |
#include "ns3/ipv6-routing-table-entry.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
42 |
#include "ns3/radvd.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
43 |
#include "ns3/radvd-interface.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
44 |
#include "ns3/radvd-prefix.h" |
6648
d1785ce489c5
Module layout rework for static-routing, list-routing, global-routing
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6014
diff
changeset
|
45 |
#include "ns3/ipv6-static-routing-helper.h" |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
46 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
47 |
using namespace ns3; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
48 |
|
6892
dc8533a99c63
Bug 1070: csma/ipv6 examples duplicate NS_LOG_COMPONENT_DEFINE
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6865
diff
changeset
|
49 |
NS_LOG_COMPONENT_DEFINE ("RadvdTwoPrefixExample"); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
50 |
|
4768
f05ccb34aabc
Schedule unicast RA in response to RS.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4766
diff
changeset
|
51 |
/** |
10135
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
52 |
* \class IpAddressHelper |
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
53 |
* \brief Helper to print a node's IP addresses. |
4768
f05ccb34aabc
Schedule unicast RA in response to RS.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4766
diff
changeset
|
54 |
*/ |
10135
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
55 |
class IpAddressHelper |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
56 |
{ |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
57 |
public: |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
58 |
/** |
10135
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
59 |
* \brief Print the node's IP addresses. |
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
60 |
* \param n the node |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
61 |
*/ |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
62 |
inline void PrintIpAddresses (Ptr<Node>& n) |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
63 |
{ |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
64 |
Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> (); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
65 |
uint32_t nInterfaces = ipv6->GetNInterfaces(); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
66 |
|
10135
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
67 |
std::cout << "Node: " << ipv6->GetObject<Node> ()->GetId () |
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
68 |
<< " Time: " << Simulator::Now ().GetSeconds () << "s " |
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
69 |
<< "IPv6 addresses" << std::endl; |
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
70 |
std::cout << "(Interface index, Address index)\t" << "IPv6 Address" << std::endl; |
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
71 |
|
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
72 |
for (uint32_t i = 0; i < nInterfaces; i++) |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
73 |
{ |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
74 |
for (uint32_t j = 0; j < ipv6->GetNAddresses(i); j++) |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
75 |
{ |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
76 |
std::cout << "(" << int(i) << "," << int(j) << ")\t" << ipv6->GetAddress(i,j) << std::endl; |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
77 |
} |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
78 |
} |
10135
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
79 |
std::cout << std::endl; |
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
80 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
81 |
}; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
82 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
83 |
int main (int argc, char** argv) |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
84 |
{ |
10136
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
85 |
bool verbose = false; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
86 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
87 |
CommandLine cmd; |
10136
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
88 |
cmd.AddValue ("verbose", "turn on log components", verbose); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
89 |
cmd.Parse (argc, argv); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
90 |
|
10136
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
91 |
if (verbose) |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
92 |
{ |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
93 |
LogComponentEnable ("Ipv6L3Protocol", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
94 |
LogComponentEnable ("Ipv6RawSocketImpl", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
95 |
LogComponentEnable ("Icmpv6L4Protocol", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
96 |
LogComponentEnable ("Ipv6StaticRouting", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
97 |
LogComponentEnable ("Ipv6Interface", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
98 |
LogComponentEnable ("RadvdApplication", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
99 |
LogComponentEnable ("Ping6Application", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
100 |
} |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10135
diff
changeset
|
101 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
102 |
NS_LOG_INFO ("Create nodes."); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
103 |
Ptr<Node> n0 = CreateObject<Node> (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
104 |
Ptr<Node> r = CreateObject<Node> (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
105 |
Ptr<Node> n1 = CreateObject<Node> (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
106 |
|
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
107 |
NodeContainer net1 (n0, r); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
108 |
NodeContainer net2 (r, n1); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
109 |
NodeContainer all (n0, r, n1); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
110 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
111 |
NS_LOG_INFO ("Create IPv6 Internet Stack"); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
112 |
InternetStackHelper internetv6; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
113 |
internetv6.Install (all); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
114 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
115 |
NS_LOG_INFO ("Create channels."); |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
116 |
CsmaHelper csma; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
117 |
csma.SetChannelAttribute ("DataRate", DataRateValue (5000000)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
118 |
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
119 |
NetDeviceContainer d1 = csma.Install (net1); /* n0 - R */ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
120 |
NetDeviceContainer d2 = csma.Install (net2); /* R - n1 */ |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
121 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
122 |
NS_LOG_INFO ("Create networks and assign IPv6 Addresses."); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
123 |
Ipv6AddressHelper ipv6; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
124 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
125 |
/* first subnet */ |
8798
5d8dfd7c6609
bug 1432: Align Ipv6AddressHelper API with Ipv4AddressHelper API
Tom Henderson <tomh@tomh.org>
parents:
7252
diff
changeset
|
126 |
ipv6.SetBase (Ipv6Address ("2001:1::"), Ipv6Prefix (64)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
127 |
NetDeviceContainer tmp; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
128 |
tmp.Add (d1.Get (0)); /* n0 */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
129 |
Ipv6InterfaceContainer iic1 = ipv6.AssignWithoutAddress (tmp); /* n0 interface */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
130 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
131 |
NetDeviceContainer tmp2; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
132 |
tmp2.Add (d1.Get (1)); /* R */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
133 |
Ipv6InterfaceContainer iicr1 = ipv6.Assign (tmp2); /* R interface to the first subnet is just statically assigned */ |
10131
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10129
diff
changeset
|
134 |
iicr1.SetForwarding (0, true); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
135 |
iic1.Add (iicr1); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
136 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
137 |
/* add another IPv6 address for second prefix advertised on first subnet */ |
10135
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
138 |
ipv6.SetBase (Ipv6Address ("2001:ABCD::2"), Ipv6Prefix (64)); |
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
139 |
ipv6.Assign (tmp2); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
140 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
141 |
/* second subnet R - n1 */ |
8798
5d8dfd7c6609
bug 1432: Align Ipv6AddressHelper API with Ipv4AddressHelper API
Tom Henderson <tomh@tomh.org>
parents:
7252
diff
changeset
|
142 |
ipv6.SetBase (Ipv6Address ("2001:2::"), Ipv6Prefix (64)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
143 |
NetDeviceContainer tmp3; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
144 |
tmp3.Add (d2.Get (0)); /* R */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
145 |
Ipv6InterfaceContainer iicr2 = ipv6.Assign (tmp3); /* R interface */ |
10131
0dc090fc749d
Bug 1702 - A router should't aways add itself as the default router
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10129
diff
changeset
|
146 |
iicr2.SetForwarding (0, true); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
147 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
148 |
NetDeviceContainer tmp4; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
149 |
tmp4.Add (d2.Get (1)); /* n1 */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
150 |
Ipv6InterfaceContainer iic2 = ipv6.AssignWithoutAddress (tmp4); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
151 |
iic2.Add (iicr2); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
152 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
153 |
/* radvd configuration */ |
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
154 |
RadvdHelper radvdHelper; |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
155 |
/* R interface (n0 - R) */ |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
156 |
radvdHelper.AddAnnouncedPrefix(iic1.GetInterfaceIndex (1), Ipv6Address("2001:ABCD::0"), 64); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
157 |
radvdHelper.AddAnnouncedPrefix(iic1.GetInterfaceIndex (1), Ipv6Address("2001:1::0"), 64); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
158 |
|
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
159 |
// Set some non-standard timers so the simulation is not taking ages |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
160 |
Ptr<RadvdInterface> routerInterface = radvdHelper.GetRadvdInterface(iic1.GetInterfaceIndex (1)); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
161 |
routerInterface->SetMaxRtrAdvInterval (2000); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
162 |
routerInterface->SetMinRtrAdvInterval (1000); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
163 |
RadvdInterface::RadvdPrefixList prefixList = routerInterface->GetPrefixes (); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
164 |
for (RadvdInterface::RadvdPrefixListI iter = prefixList.begin(); iter != prefixList.end(); iter++) |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
165 |
{ |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
166 |
(*iter)->SetPreferredLifeTime (3); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
167 |
(*iter)->SetValidLifeTime (5); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
168 |
} |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
169 |
|
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
170 |
/* R interface (R - n1) */ |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
171 |
radvdHelper.AddAnnouncedPrefix(iic2.GetInterfaceIndex (1), Ipv6Address("2001:2::0"), 64); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
172 |
|
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
173 |
// Set some non-standard timers so the simulation is not taking ages |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
174 |
routerInterface = radvdHelper.GetRadvdInterface(iic2.GetInterfaceIndex (1)); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
175 |
routerInterface->SetMaxRtrAdvInterval (2000); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
176 |
routerInterface->SetMinRtrAdvInterval (1000); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
177 |
prefixList = routerInterface->GetPrefixes (); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
178 |
for (RadvdInterface::RadvdPrefixListI iter = prefixList.begin(); iter != prefixList.end(); iter++) |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
179 |
{ |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
180 |
(*iter)->SetPreferredLifeTime (3); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
181 |
(*iter)->SetValidLifeTime (5); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
182 |
} |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
183 |
|
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
184 |
ApplicationContainer radvdApps = radvdHelper.Install(r); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
185 |
radvdApps.Start (Seconds (1.0)); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
186 |
radvdApps.Stop (Seconds (2.0)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
187 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
188 |
/* Create a Ping6 application to send ICMPv6 echo request from n0 to n1 via R */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
189 |
uint32_t packetSize = 1024; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
190 |
uint32_t maxPacketCount = 8; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
191 |
Time interPacketInterval = Seconds (1.); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
192 |
Ping6Helper ping6; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
193 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
194 |
/* ping6.SetLocal (iic1.GetAddress (0, 1)); */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
195 |
ping6.SetRemote (Ipv6Address ("2001:2::200:ff:fe00:4")); /* should be n1 address after autoconfiguration */ |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
196 |
ping6.SetIfIndex (iic1.GetInterfaceIndex (0)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
197 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
198 |
ping6.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
199 |
ping6.SetAttribute ("Interval", TimeValue (interPacketInterval)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
200 |
ping6.SetAttribute ("PacketSize", UintegerValue (packetSize)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
201 |
ApplicationContainer apps = ping6.Install (net1.Get (0)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
202 |
apps.Start (Seconds (2.0)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
203 |
apps.Stop (Seconds (9.0)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
204 |
|
10135
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
205 |
Ipv6StaticRoutingHelper routingHelper; |
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
206 |
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> (&std::cout); |
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
207 |
routingHelper.PrintRoutingTableAt (Seconds (2.0), n0, routingStream); |
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
208 |
routingHelper.PrintRoutingTableAt (Seconds (10.0), n0, routingStream); |
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
209 |
|
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
210 |
IpAddressHelper ipAddressHelper; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
211 |
/* RA should be received, two prefixes + routes + default route should be present */ |
10135
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
212 |
Simulator::Schedule (Seconds (2.0), &IpAddressHelper::PrintIpAddresses, &ipAddressHelper, n0); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
213 |
/* at the end, RA addresses and routes should be cleared */ |
10135
21bdad9520b8
Remove obsolete StackHelper from IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
214 |
Simulator::Schedule (Seconds (10.0), &IpAddressHelper::PrintIpAddresses, &ipAddressHelper, n0); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
215 |
|
6014 | 216 |
AsciiTraceHelper ascii; |
217 |
csma.EnableAsciiAll (ascii.CreateFileStream ("radvd-two-prefix.tr")); |
|
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
5891
diff
changeset
|
218 |
csma.EnablePcapAll (std::string ("radvd-two-prefix"), true); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
219 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
220 |
NS_LOG_INFO ("Run Simulation."); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
221 |
Simulator::Run (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
222 |
Simulator::Destroy (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
223 |
NS_LOG_INFO ("Done."); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
224 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
225 |