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); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
29 |
// // - 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
|
30 |
// // - n0 ping6 n1. |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
31 |
// // |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
32 |
// // - Tracing of queues and packet receptions to file "radvd.tr" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
33 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
34 |
#include <fstream> |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
35 |
#include "ns3/core-module.h" |
6834
036f9a0b9899
Rename internet-stack to internet, and organize module
Tom Henderson <tomh@tomh.org>
parents:
6821
diff
changeset
|
36 |
#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
|
37 |
#include "ns3/csma-module.h" |
6847
138f00c56381
Move applications to a single module
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
38 |
#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
|
39 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
40 |
#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
|
41 |
#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
|
42 |
#include "ns3/radvd-prefix.h" |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
43 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
44 |
using namespace ns3; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
45 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
46 |
NS_LOG_COMPONENT_DEFINE ("RadvdExample"); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
47 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
48 |
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
|
49 |
{ |
10136
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
50 |
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
|
51 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
52 |
CommandLine cmd; |
10136
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
53 |
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
|
54 |
cmd.Parse (argc, argv); |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
55 |
|
10136
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
56 |
if (verbose) |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
57 |
{ |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
58 |
LogComponentEnable ("Ipv6L3Protocol", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
59 |
LogComponentEnable ("Ipv6RawSocketImpl", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
60 |
LogComponentEnable ("Icmpv6L4Protocol", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
61 |
LogComponentEnable ("Ipv6StaticRouting", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
62 |
LogComponentEnable ("Ipv6Interface", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
63 |
LogComponentEnable ("RadvdApplication", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
64 |
LogComponentEnable ("Ping6Application", LOG_LEVEL_ALL); |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
65 |
} |
71b625bfe8c7
Add "verbose" command line to IPv6 examples
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10131
diff
changeset
|
66 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
67 |
NS_LOG_INFO ("Create nodes."); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
68 |
Ptr<Node> n0 = CreateObject<Node> (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
69 |
Ptr<Node> r = CreateObject<Node> (); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
70 |
Ptr<Node> n1 = CreateObject<Node> (); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
71 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
72 |
NodeContainer net1 (n0, r); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
73 |
NodeContainer net2 (r, n1); |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
74 |
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
|
75 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
76 |
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
|
77 |
InternetStackHelper internetv6; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
78 |
internetv6.Install (all); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
79 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
80 |
NS_LOG_INFO ("Create channels."); |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
81 |
CsmaHelper csma; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
82 |
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
|
83 |
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); |
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
84 |
NetDeviceContainer d1 = csma.Install (net1); /* n0 - R */ |
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
85 |
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
|
86 |
|
5891
09a575cdf8db
Indent correctly IPv6 code.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
5524
diff
changeset
|
87 |
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
|
88 |
Ipv6AddressHelper ipv6; |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
89 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
90 |
/* first subnet */ |
8798
5d8dfd7c6609
bug 1432: Align Ipv6AddressHelper API with Ipv4AddressHelper API
Tom Henderson <tomh@tomh.org>
parents:
6865
diff
changeset
|
91 |
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
|
92 |
NetDeviceContainer tmp; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
93 |
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
|
94 |
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
|
95 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
96 |
NetDeviceContainer tmp2; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
97 |
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
|
98 |
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
|
99 |
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
|
100 |
iic1.Add (iicr1); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
101 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
102 |
/* second subnet R - n1 */ |
8798
5d8dfd7c6609
bug 1432: Align Ipv6AddressHelper API with Ipv4AddressHelper API
Tom Henderson <tomh@tomh.org>
parents:
6865
diff
changeset
|
103 |
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
|
104 |
NetDeviceContainer tmp3; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
105 |
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
|
106 |
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
|
107 |
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
|
108 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
109 |
NetDeviceContainer tmp4; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
110 |
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
|
111 |
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
|
112 |
iic2.Add (iicr2); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
113 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
114 |
/* radvd configuration */ |
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
115 |
RadvdHelper radvdHelper; |
11062
91a7bee99048
Bug 2016 - Radvd do not consider the SendAdvert option and don't reply to RS
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10136
diff
changeset
|
116 |
|
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
117 |
/* R interface (n0 - R) */ |
11062
91a7bee99048
Bug 2016 - Radvd do not consider the SendAdvert option and don't reply to RS
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10136
diff
changeset
|
118 |
/* n0 will receive unsolicited (periodic) RA */ |
91a7bee99048
Bug 2016 - Radvd do not consider the SendAdvert option and don't reply to RS
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10136
diff
changeset
|
119 |
radvdHelper.AddAnnouncedPrefix (iic1.GetInterfaceIndex (1), Ipv6Address("2001:1::0"), 64); |
91a7bee99048
Bug 2016 - Radvd do not consider the SendAdvert option and don't reply to RS
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10136
diff
changeset
|
120 |
|
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
121 |
/* R interface (R - n1) */ |
11062
91a7bee99048
Bug 2016 - Radvd do not consider the SendAdvert option and don't reply to RS
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10136
diff
changeset
|
122 |
/* n1 will have to use RS, as RA are not sent automatically */ |
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
123 |
radvdHelper.AddAnnouncedPrefix(iic2.GetInterfaceIndex (1), Ipv6Address("2001:2::0"), 64); |
11062
91a7bee99048
Bug 2016 - Radvd do not consider the SendAdvert option and don't reply to RS
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10136
diff
changeset
|
124 |
radvdHelper.GetRadvdInterface (iic2.GetInterfaceIndex (1))->SetSendAdvert (false); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
125 |
|
10129
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
126 |
ApplicationContainer radvdApps = radvdHelper.Install (r); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
127 |
radvdApps.Start (Seconds (1.0)); |
5d1521685ad9
Bug 1728 - Radvd application is missing an Helper
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
8798
diff
changeset
|
128 |
radvdApps.Stop (Seconds (10.0)); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
129 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
130 |
/* 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
|
131 |
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
|
132 |
uint32_t maxPacketCount = 5; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
133 |
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
|
134 |
Ping6Helper ping6; |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
135 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
136 |
/* 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
|
137 |
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
|
138 |
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
|
139 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
140 |
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
|
141 |
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
|
142 |
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
|
143 |
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
|
144 |
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
|
145 |
apps.Stop (Seconds (7.0)); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
146 |
|
6014 | 147 |
AsciiTraceHelper ascii; |
148 |
csma.EnableAsciiAll (ascii.CreateFileStream ("radvd.tr")); |
|
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
5891
diff
changeset
|
149 |
csma.EnablePcapAll (std::string ("radvd"), true); |
4731
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
150 |
|
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
151 |
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
|
152 |
Simulator::Run (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
153 |
Simulator::Destroy (); |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
154 |
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
|
155 |
} |
510db8599bfb
second phase of IPv6 checkins from Univ. of Strasbourg team
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
diff
changeset
|
156 |