author | Tom Henderson <tomh@tomh.org> |
Mon, 28 Sep 2015 20:27:25 -0700 | |
changeset 11676 | 05ea1489e509 |
parent 11156 | be4bb6ee65d9 |
permissions | -rw-r--r-- |
9696 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
3 |
* Copyright (c) 2013 ResiliNets, ITTC, University of Kansas |
9696 | 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 |
* Authors: Justin P. Rohrer, Truc Anh N. Nguyen <annguyen@ittc.ku.edu>, Siddharth Gangadhar <siddharth@ittc.ku.edu> |
|
19 |
* |
|
20 |
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director |
|
21 |
* ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets |
|
22 |
* Information and Telecommunication Technology Center (ITTC) |
|
23 |
* and Department of Electrical Engineering and Computer Science |
|
24 |
* The University of Kansas Lawrence, KS USA. |
|
25 |
* |
|
26 |
* Work supported in part by NSF FIND (Future Internet Design) Program |
|
27 |
* under grant CNS-0626918 (Postmodern Internet Architecture), |
|
28 |
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI), |
|
29 |
* US Department of Defense (DoD), and ITTC at The University of Kansas. |
|
30 |
* |
|
31 |
* “TCP Westwood(+) Protocol Implementation in ns-3” |
|
32 |
* Siddharth Gangadhar, Trúc Anh Ngọc Nguyễn , Greeshma Umapathi, and James P.G. Sterbenz, |
|
33 |
* ICST SIMUTools Workshop on ns-3 (WNS3), Cannes, France, March 2013 |
|
34 |
*/ |
|
35 |
||
36 |
#include <iostream> |
|
37 |
#include <fstream> |
|
38 |
#include <string> |
|
39 |
||
40 |
#include "ns3/core-module.h" |
|
41 |
#include "ns3/network-module.h" |
|
42 |
#include "ns3/internet-module.h" |
|
43 |
#include "ns3/point-to-point-module.h" |
|
44 |
#include "ns3/applications-module.h" |
|
45 |
#include "ns3/error-model.h" |
|
46 |
#include "ns3/tcp-header.h" |
|
47 |
#include "ns3/udp-header.h" |
|
48 |
#include "ns3/enum.h" |
|
49 |
#include "ns3/event-id.h" |
|
50 |
#include "ns3/flow-monitor-helper.h" |
|
51 |
#include "ns3/ipv4-global-routing-helper.h" |
|
52 |
||
53 |
using namespace ns3; |
|
54 |
||
55 |
NS_LOG_COMPONENT_DEFINE ("TcpVariantsComparison"); |
|
56 |
||
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
57 |
bool firstCwnd = true; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
58 |
bool firstSshThr = true; |
11156
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
59 |
bool firstRtt = true; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
60 |
bool firstRto = true; |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
61 |
Ptr<OutputStreamWrapper> cWndStream; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
62 |
Ptr<OutputStreamWrapper> ssThreshStream; |
11156
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
63 |
Ptr<OutputStreamWrapper> rttStream; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
64 |
Ptr<OutputStreamWrapper> rtoStream; |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
65 |
uint32_t cWndValue; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
66 |
uint32_t ssThreshValue; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
67 |
|
9696 | 68 |
|
69 |
static void |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
70 |
CwndTracer (uint32_t oldval, uint32_t newval) |
9696 | 71 |
{ |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
72 |
if (firstCwnd) |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
73 |
{ |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
74 |
*cWndStream->GetStream () << "0.0 " << oldval << std::endl; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
75 |
firstCwnd = false; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
76 |
} |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
77 |
*cWndStream->GetStream () << Simulator::Now ().GetSeconds () << " " << newval << std::endl; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
78 |
cWndValue = newval; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
79 |
|
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
80 |
if (!firstSshThr) |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
81 |
{ |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
82 |
*ssThreshStream->GetStream () << Simulator::Now ().GetSeconds () << " " << ssThreshValue << std::endl; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
83 |
} |
9696 | 84 |
} |
85 |
||
86 |
static void |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
87 |
SsThreshTracer (uint32_t oldval, uint32_t newval) |
9696 | 88 |
{ |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
89 |
if (firstSshThr) |
9696 | 90 |
{ |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
91 |
*ssThreshStream->GetStream () << "0.0 " << oldval << std::endl; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
92 |
firstSshThr = false; |
9696 | 93 |
} |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
94 |
*ssThreshStream->GetStream () << Simulator::Now ().GetSeconds () << " " << newval << std::endl; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
95 |
ssThreshValue = newval; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
96 |
|
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
97 |
if (!firstCwnd) |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
98 |
{ |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
99 |
*cWndStream->GetStream () << Simulator::Now ().GetSeconds () << " " << cWndValue << std::endl; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
100 |
} |
9696 | 101 |
} |
102 |
||
11156
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
103 |
static void |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
104 |
RttTracer (Time oldval, Time newval) |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
105 |
{ |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
106 |
if (firstRtt) |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
107 |
{ |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
108 |
*rttStream->GetStream () << "0.0 " << oldval.GetSeconds () << std::endl; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
109 |
firstRtt = false; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
110 |
} |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
111 |
*rttStream->GetStream () << Simulator::Now ().GetSeconds () << " " << newval.GetSeconds () << std::endl; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
112 |
} |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
113 |
|
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
114 |
static void |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
115 |
RtoTracer (Time oldval, Time newval) |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
116 |
{ |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
117 |
if (firstRto) |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
118 |
{ |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
119 |
*rtoStream->GetStream () << "0.0 " << oldval.GetSeconds () << std::endl; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
120 |
firstRto = false; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
121 |
} |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
122 |
*rtoStream->GetStream () << Simulator::Now ().GetSeconds () << " " << newval.GetSeconds () << std::endl; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
123 |
} |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
124 |
|
9696 | 125 |
|
126 |
static void |
|
127 |
TraceCwnd (std::string cwnd_tr_file_name) |
|
128 |
{ |
|
129 |
AsciiTraceHelper ascii; |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
130 |
cWndStream = ascii.CreateFileStream (cwnd_tr_file_name.c_str ()); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
131 |
Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeCallback (&CwndTracer)); |
9696 | 132 |
} |
133 |
||
134 |
static void |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
135 |
TraceSsThresh (std::string ssthresh_tr_file_name) |
9696 | 136 |
{ |
137 |
AsciiTraceHelper ascii; |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
138 |
ssThreshStream = ascii.CreateFileStream (ssthresh_tr_file_name.c_str ()); |
11156
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
139 |
Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/SlowStartThreshold", MakeCallback (&SsThreshTracer)); |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
140 |
} |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
141 |
|
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
142 |
static void |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
143 |
TraceRtt (std::string rtt_tr_file_name) |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
144 |
{ |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
145 |
AsciiTraceHelper ascii; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
146 |
rttStream = ascii.CreateFileStream (rtt_tr_file_name.c_str ()); |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
147 |
Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/RTT", MakeCallback (&RttTracer)); |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
148 |
} |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
149 |
|
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
150 |
static void |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
151 |
TraceRto (std::string rto_tr_file_name) |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
152 |
{ |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
153 |
AsciiTraceHelper ascii; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
154 |
rtoStream = ascii.CreateFileStream (rto_tr_file_name.c_str ()); |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
155 |
Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/RTO", MakeCallback (&RtoTracer)); |
9696 | 156 |
} |
157 |
||
158 |
int main (int argc, char *argv[]) |
|
159 |
{ |
|
160 |
std::string transport_prot = "TcpWestwood"; |
|
161 |
double error_p = 0.0; |
|
162 |
std::string bandwidth = "2Mbps"; |
|
163 |
std::string access_bandwidth = "10Mbps"; |
|
164 |
std::string access_delay = "45ms"; |
|
165 |
bool tracing = false; |
|
166 |
std::string tr_file_name = ""; |
|
167 |
std::string cwnd_tr_file_name = ""; |
|
168 |
std::string ssthresh_tr_file_name = ""; |
|
11156
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
169 |
std::string rtt_tr_file_name = ""; |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
170 |
std::string rto_tr_file_name = ""; |
9696 | 171 |
double data_mbytes = 0; |
172 |
uint32_t mtu_bytes = 400; |
|
173 |
uint16_t num_flows = 1; |
|
174 |
float duration = 100; |
|
175 |
uint32_t run = 0; |
|
176 |
bool flow_monitor = true; |
|
177 |
||
178 |
||
179 |
CommandLine cmd; |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
180 |
cmd.AddValue ("transport_prot", "Transport protocol to use: TcpTahoe, TcpReno, TcpNewReno, TcpWestwood, TcpWestwoodPlus ", transport_prot); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
181 |
cmd.AddValue ("error_p", "Packet error rate", error_p); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
182 |
cmd.AddValue ("bandwidth", "Bottleneck bandwidth", bandwidth); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
183 |
cmd.AddValue ("access_bandwidth", "Access link bandwidth", access_bandwidth); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
184 |
cmd.AddValue ("delay", "Access link delay", access_delay); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
185 |
cmd.AddValue ("tracing", "Flag to enable/disable tracing", tracing); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
186 |
cmd.AddValue ("tr_name", "Name of output trace file", tr_file_name); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
187 |
cmd.AddValue ("cwnd_tr_name", "Name of output trace file", cwnd_tr_file_name); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
188 |
cmd.AddValue ("ssthresh_tr_name", "Name of output trace file", ssthresh_tr_file_name); |
11156
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
189 |
cmd.AddValue ("rtt_tr_name", "Name of output trace file", rtt_tr_file_name); |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
190 |
cmd.AddValue ("rto_tr_name", "Name of output trace file", rto_tr_file_name); |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
191 |
cmd.AddValue ("data", "Number of Megabytes of data to transmit", data_mbytes); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
192 |
cmd.AddValue ("mtu", "Size of IP packets to send in bytes", mtu_bytes); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
193 |
cmd.AddValue ("num_flows", "Number of flows", num_flows); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
194 |
cmd.AddValue ("duration", "Time to allow flows to run in seconds", duration); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
195 |
cmd.AddValue ("run", "Run index (for setting repeatable seeds)", run); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
196 |
cmd.AddValue ("flow_monitor", "Enable flow monitor", flow_monitor); |
9696 | 197 |
cmd.Parse (argc, argv); |
198 |
||
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
199 |
SeedManager::SetSeed (1); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
200 |
SeedManager::SetRun (run); |
9696 | 201 |
|
202 |
// User may find it convenient to enable logging |
|
203 |
//LogComponentEnable("TcpVariantsComparison", LOG_LEVEL_ALL); |
|
204 |
//LogComponentEnable("BulkSendApplication", LOG_LEVEL_INFO); |
|
205 |
//LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); |
|
206 |
||
207 |
// Calculate the ADU size |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
208 |
Header* temp_header = new Ipv4Header (); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
209 |
uint32_t ip_header = temp_header->GetSerializedSize (); |
9696 | 210 |
NS_LOG_LOGIC ("IP Header size is: " << ip_header); |
211 |
delete temp_header; |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
212 |
temp_header = new TcpHeader (); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
213 |
uint32_t tcp_header = temp_header->GetSerializedSize (); |
9696 | 214 |
NS_LOG_LOGIC ("TCP Header size is: " << tcp_header); |
215 |
delete temp_header; |
|
216 |
uint32_t tcp_adu_size = mtu_bytes - (ip_header + tcp_header); |
|
217 |
NS_LOG_LOGIC ("TCP ADU size is: " << tcp_adu_size); |
|
218 |
||
219 |
// Set the simulation start and stop time |
|
220 |
float start_time = 0.1; |
|
221 |
float stop_time = start_time + duration; |
|
222 |
||
223 |
// Select TCP variant |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
224 |
if (transport_prot.compare ("TcpTahoe") == 0) |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
225 |
{ |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
226 |
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpTahoe::GetTypeId ())); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
227 |
} |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
228 |
else if (transport_prot.compare ("TcpReno") == 0) |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
229 |
{ |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
230 |
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpReno::GetTypeId ())); |
9696 | 231 |
} |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
232 |
else if (transport_prot.compare ("TcpNewReno") == 0) |
9696 | 233 |
{ |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
234 |
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpNewReno::GetTypeId ())); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
235 |
} |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
236 |
else if (transport_prot.compare ("TcpWestwood") == 0) |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
237 |
{ // the default protocol type in ns3::TcpWestwood is WESTWOOD |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
238 |
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId ())); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
239 |
Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood::TUSTIN)); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
240 |
} |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
241 |
else if (transport_prot.compare ("TcpWestwoodPlus") == 0) |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
242 |
{ |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
243 |
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", TypeIdValue (TcpWestwood::GetTypeId ())); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
244 |
Config::SetDefault ("ns3::TcpWestwood::ProtocolType", EnumValue (TcpWestwood::WESTWOODPLUS)); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
245 |
Config::SetDefault ("ns3::TcpWestwood::FilterType", EnumValue (TcpWestwood::TUSTIN)); |
9696 | 246 |
} |
247 |
else |
|
248 |
{ |
|
249 |
NS_LOG_DEBUG ("Invalid TCP version"); |
|
250 |
exit (1); |
|
251 |
} |
|
252 |
||
253 |
// Create gateways, sources, and sinks |
|
254 |
NodeContainer gateways; |
|
255 |
gateways.Create (1); |
|
256 |
NodeContainer sources; |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
257 |
sources.Create (num_flows); |
9696 | 258 |
NodeContainer sinks; |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
259 |
sinks.Create (num_flows); |
9696 | 260 |
|
261 |
// Configure the error model |
|
262 |
// Here we use RateErrorModel with packet error rate |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
263 |
Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable> (); |
9696 | 264 |
uv->SetStream (50); |
265 |
RateErrorModel error_model; |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
266 |
error_model.SetRandomVariable (uv); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
267 |
error_model.SetUnit (RateErrorModel::ERROR_UNIT_PACKET); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
268 |
error_model.SetRate (error_p); |
9696 | 269 |
|
270 |
PointToPointHelper UnReLink; |
|
271 |
UnReLink.SetDeviceAttribute ("DataRate", StringValue (bandwidth)); |
|
272 |
UnReLink.SetChannelAttribute ("Delay", StringValue ("0.01ms")); |
|
273 |
UnReLink.SetDeviceAttribute ("ReceiveErrorModel", PointerValue (&error_model)); |
|
274 |
||
275 |
||
276 |
InternetStackHelper stack; |
|
277 |
stack.InstallAll (); |
|
278 |
||
279 |
Ipv4AddressHelper address; |
|
280 |
address.SetBase ("10.0.0.0", "255.255.255.0"); |
|
281 |
||
282 |
// Configure the sources and sinks net devices |
|
283 |
// and the channels between the sources/sinks and the gateways |
|
284 |
PointToPointHelper LocalLink; |
|
285 |
LocalLink.SetDeviceAttribute ("DataRate", StringValue (access_bandwidth)); |
|
286 |
LocalLink.SetChannelAttribute ("Delay", StringValue (access_delay)); |
|
287 |
Ipv4InterfaceContainer sink_interfaces; |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
288 |
for (int i = 0; i < num_flows; i++) |
9696 | 289 |
{ |
290 |
NetDeviceContainer devices; |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
291 |
devices = LocalLink.Install (sources.Get (i), gateways.Get (0)); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
292 |
address.NewNetwork (); |
9696 | 293 |
Ipv4InterfaceContainer interfaces = address.Assign (devices); |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
294 |
devices = UnReLink.Install (gateways.Get (0), sinks.Get (i)); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
295 |
address.NewNetwork (); |
9696 | 296 |
interfaces = address.Assign (devices); |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
297 |
sink_interfaces.Add (interfaces.Get (1)); |
9696 | 298 |
} |
299 |
||
300 |
NS_LOG_INFO ("Initialize Global Routing."); |
|
301 |
Ipv4GlobalRoutingHelper::PopulateRoutingTables (); |
|
302 |
||
303 |
uint16_t port = 50000; |
|
304 |
Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port)); |
|
305 |
PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress); |
|
306 |
||
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
307 |
for (uint16_t i = 0; i < sources.GetN (); i++) |
9696 | 308 |
{ |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
309 |
AddressValue remoteAddress (InetSocketAddress (sink_interfaces.GetAddress (i, 0), port)); |
9696 | 310 |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
311 |
if (transport_prot.compare ("TcpTahoe") == 0 |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
312 |
|| transport_prot.compare ("TcpReno") == 0 |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
313 |
|| transport_prot.compare ("TcpNewReno") == 0 |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
314 |
|| transport_prot.compare ("TcpWestwood") == 0 |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
315 |
|| transport_prot.compare ("TcpWestwoodPlus") == 0) |
9696 | 316 |
{ |
317 |
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (tcp_adu_size)); |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
318 |
BulkSendHelper ftp ("ns3::TcpSocketFactory", Address ()); |
9696 | 319 |
ftp.SetAttribute ("Remote", remoteAddress); |
320 |
ftp.SetAttribute ("SendSize", UintegerValue (tcp_adu_size)); |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
321 |
ftp.SetAttribute ("MaxBytes", UintegerValue (int(data_mbytes * 1000000))); |
9696 | 322 |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
323 |
ApplicationContainer sourceApp = ftp.Install (sources.Get (i)); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
324 |
sourceApp.Start (Seconds (start_time * i)); |
9696 | 325 |
sourceApp.Stop (Seconds (stop_time - 3)); |
326 |
||
327 |
sinkHelper.SetAttribute ("Protocol", TypeIdValue (TcpSocketFactory::GetTypeId ())); |
|
328 |
ApplicationContainer sinkApp = sinkHelper.Install (sinks); |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
329 |
sinkApp.Start (Seconds (start_time * i)); |
9696 | 330 |
sinkApp.Stop (Seconds (stop_time)); |
331 |
} |
|
332 |
else |
|
333 |
{ |
|
334 |
NS_LOG_DEBUG ("Invalid transport protocol " << transport_prot << " specified"); |
|
335 |
exit (1); |
|
336 |
} |
|
337 |
} |
|
338 |
||
339 |
// Set up tracing if enabled |
|
340 |
if (tracing) |
|
341 |
{ |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
342 |
if (tr_file_name.compare ("") != 0) |
9696 | 343 |
{ |
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
344 |
std::ofstream ascii; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
345 |
Ptr<OutputStreamWrapper> ascii_wrap; |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
346 |
ascii.open (tr_file_name.c_str ()); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
347 |
ascii_wrap = new OutputStreamWrapper (tr_file_name.c_str (), std::ios::out); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
348 |
stack.EnableAsciiIpv4All (ascii_wrap); |
9696 | 349 |
} |
350 |
||
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
351 |
if (cwnd_tr_file_name.compare ("") != 0) |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
352 |
{ |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
353 |
Simulator::Schedule (Seconds (0.00001), &TraceCwnd, cwnd_tr_file_name); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
354 |
} |
9696 | 355 |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
356 |
if (ssthresh_tr_file_name.compare ("") != 0) |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
357 |
{ |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
358 |
Simulator::Schedule (Seconds (0.00001), &TraceSsThresh, ssthresh_tr_file_name); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
359 |
} |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
360 |
|
11156
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
361 |
if (rtt_tr_file_name.compare ("") != 0) |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
362 |
{ |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
363 |
Simulator::Schedule (Seconds (0.00001), &TraceRtt, rtt_tr_file_name); |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
364 |
} |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
365 |
|
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
366 |
if (rto_tr_file_name.compare ("") != 0) |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
367 |
{ |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
368 |
Simulator::Schedule (Seconds (0.00001), &TraceRto, rto_tr_file_name); |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
369 |
} |
be4bb6ee65d9
TCP comparison example enhancements
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10856
diff
changeset
|
370 |
|
9696 | 371 |
} |
372 |
||
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
373 |
UnReLink.EnablePcapAll ("TcpVariantsComparison", true); |
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
374 |
LocalLink.EnablePcapAll ("TcpVariantsComparison", true); |
9696 | 375 |
|
376 |
// Flow monitor |
|
9727
cb763839fc18
bug 1644: dispose of flow monitor objects from FlowMonitorHelper
Tom Henderson <tomh@tomh.org>
parents:
9696
diff
changeset
|
377 |
FlowMonitorHelper flowHelper; |
9696 | 378 |
if (flow_monitor) |
379 |
{ |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
380 |
flowHelper.InstallAll (); |
9696 | 381 |
} |
382 |
||
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
383 |
Simulator::Stop (Seconds (stop_time)); |
9696 | 384 |
Simulator::Run (); |
385 |
||
386 |
if (flow_monitor) |
|
387 |
{ |
|
10856
d45187afb01a
Improvements to tcp-variants-comparison example
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10668
diff
changeset
|
388 |
flowHelper.SerializeToXmlFile ("TcpVariantsComparison.flowmonitor", true, true); |
9696 | 389 |
} |
390 |
||
391 |
Simulator::Destroy (); |
|
392 |
return 0; |
|
393 |
} |