forked from quic-interop/quic-network-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple-p2p.cc
34 lines (26 loc) · 1.18 KB
/
simple-p2p.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "../helper/quic-network-simulator-helper.h"
#include "../helper/quic-point-to-point-helper.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE("ns3 simulator");
int main(int argc, char *argv[]) {
std::string delay, bandwidth, queue;
CommandLine cmd;
cmd.AddValue("delay", "delay of the p2p link", delay);
cmd.AddValue("bandwidth", "bandwidth of the p2p link", bandwidth);
cmd.AddValue("queue", "queue size of the p2p link (in packets)", queue);
cmd.Parse (argc, argv);
NS_ABORT_MSG_IF(delay.length() == 0, "Missing parameter: delay");
NS_ABORT_MSG_IF(bandwidth.length() == 0, "Missing parameter: bandwidth");
NS_ABORT_MSG_IF(queue.length() == 0, "Missing parameter: queue");
QuicNetworkSimulatorHelper sim;
// Stick in the point-to-point line between the sides.
QuicPointToPointHelper p2p;
p2p.SetDeviceAttribute("DataRate", StringValue(bandwidth));
p2p.SetChannelAttribute("Delay", StringValue(delay));
p2p.SetQueueSize(StringValue(queue + "p"));
NetDeviceContainer devices = p2p.Install(sim.GetLeftNode(), sim.GetRightNode());
sim.Run(Seconds(36000));
}