11#include "ns3/core-module.h"
12#include "ns3/applications-module.h"
13#include "ns3/internet-module.h"
14#include "ns3/flow-monitor-module.h"
15#include "ns3/mobility-module.h"
16#include "ns3/point-to-point-module.h"
17#include "ns3/gnuplot.h"
19#include "ns3/qkd-link-helper.h"
20#include "ns3/qkd-app-helper.h"
21#include "ns3/qkd-app-004.h"
23#include "ns3/network-module.h"
24#include "ns3/internet-apps-module.h"
25#include "ns3/netanim-module.h"
37std::map<std::string, std::map<std::string, uint32_t> >
m_servedKeys;
67 it->second.second += p->GetSize();
88 it->second.second += p->GetSize();
100 it->second.second += p->GetSize();
112 it->second.second += p->GetSize();
124 it->second.second += p->GetSize();
136 it->second.second += p->GetSize();
142 std::cout <<
"\n\nAPPLICATION STATS:\n";
143 std::cout <<
"\n\tAPP-APP Data Packets Sent:";
145 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
146 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
147 std::cout <<
"\n\n\tAPP-APP Data Packets Received:";
149 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
150 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
151 std::cout <<
"\n\n\tMissed Send Packet Calls:";
153 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first <<
"\tNumber:\t" <<
el.second;
154 std::cout <<
"\n\n\tAPP-APP Signaling Packets Sent:";
156 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
157 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
158 std::cout <<
"\n\n\tAPP-APP Signaling Packets Received:";
160 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
161 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
162 std::cout <<
"\n\n\tAPP-KM Packets Sent:";
164 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
165 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
166 std::cout <<
"\n\n\tAPP-KM Packets Received:";
168 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
169 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
172 std::cout <<
"\n\nQKD LINK STATS:\n";
174 for(
const auto &
el1 :
el.second)
175 std::cout <<
"\n\t QKDSystem link: " <<
el.first <<
"\t keyId: "<<
el1.first <<
"\t Size: " <<
el1.second / 2 <<
" (bits)";
178 std::cout <<
"\n\nSERVICE STATS:\n";
180 std::cout <<
"\n\tApplication ID:\t" <<
el.first;
181 for(
auto const &
el1:
el.second)
182 std::cout <<
"\n\t\tKey ID:\t" <<
el1.first <<
"\t Size: " <<
el1.second <<
" (bits)";
198 uint16_t simulationTime = 500;
241 cmd.AddValue (
"simTime",
"Simulation time (seconds)", simulationTime);
242 cmd.AddValue (
"appHoldTime",
"How long (seconds) should QKDApp004 wait to close socket to KMS after receiving REST response?",
appHoldTime);
243 cmd.AddValue (
"appStartTime",
"Application start time (seconds)",
appStartTime);
244 cmd.AddValue (
"appStopTime",
"Application stop time (seconds)",
appStopTime);
245 cmd.AddValue (
"qkdStartTime",
"QKD start time (seconds)",
qkdStartTime);
246 cmd.AddValue (
"qkdStopTime",
"QKD stop time (seconds)",
qkdStopTime);
247 cmd.AddValue (
"encryptionType",
"Type of encryption to be used",
encryptionType);
249 cmd.AddValue (
"aesLifetime",
"How many packets to encrypt with the same AES key?",
aesLifetime);
250 cmd.AddValue (
"keyBufferLengthEncryption",
"How many keys to store in local buffer of QKDApp004 for encryption?",
keyBufferLengthEncryption);
252 cmd.AddValue (
"useCrypto",
"Perform crypto functions?",
useCrypto);
253 cmd.AddValue (
"seed",
"Random seed value",
seed);
254 cmd.AddValue (
"trace",
"Enable datapath stats and pcap traces",
trace);
288 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
325 ipv4.SetBase (
"10.1.1.0",
"255.255.255.0");
327 ipv4.SetBase (
"10.1.2.0",
"255.255.255.0");
329 ipv4.SetBase (
"10.1.3.0",
"255.255.255.0");
331 ipv4.SetBase (
"10.1.4.0",
"255.255.255.0");
334 ipv4.SetBase (
"10.1.5.0",
"255.255.255.0");
336 ipv4.SetBase (
"10.1.6.0",
"255.255.255.0");
338 ipv4.SetBase (
"10.1.7.0",
"255.255.255.0");
340 ipv4.SetBase (
"10.1.8.0",
"255.255.255.0");
343 ipv4.SetBase (
"10.1.9.0",
"255.255.255.0");
345 ipv4.SetBase (
"10.1.10.0",
"255.255.255.0");
347 ipv4.SetBase (
"10.1.11.0",
"255.255.255.0");
349 ipv4.SetBase (
"10.1.12.0",
"255.255.255.0");
351 ipv4.SetBase (
"10.1.13.0",
"255.255.255.0");
353 ipv4.SetBase (
"10.1.14.0",
"255.255.255.0");
356 ipv4.SetBase (
"10.1.15.0",
"255.255.255.0");
358 ipv4.SetBase (
"10.1.16.0",
"255.255.255.0");
360 ipv4.SetBase (
"10.1.17.0",
"255.255.255.0");
362 ipv4.SetBase (
"10.1.18.0",
"255.255.255.0");
432 std::cout <<
"QKDsiteC: " << n.
Get(4)->
GetId() <<
" IP address: " <<
i2i4.GetAddress(1) << std::endl;
433 std::cout <<
"KMsiteA: " << n.
Get(1)->
GetId() <<
" IP address: " <<
i1i3.GetAddress(0) << std::endl;
434 std::cout <<
"KMsiteB: " << n.
Get(3)->
GetId() <<
" IP address: " <<
i1i3.GetAddress(1) << std::endl;
577 p2p.EnableAsciiAll (
ascii.CreateFileStream (
"qkd_secoqc.tr"));
578 p2p.EnablePcapAll (
"qkd_secoqc");
588 std::cout <<
"simTime:\t" << simulationTime <<
"\n";
590 std::cout <<
"appStopTime:\t" <<
appStopTime <<
"\n";
592 std::cout <<
"qkdStopTime:\t" <<
qkdStopTime <<
"\n";
595 std::cout <<
"aesLifetime:\t" <<
aesLifetime <<
"\n";
596 std::cout <<
"useCrypto:\t" <<
useCrypto <<
"\n";
597 std::cout <<
"trace:\t" <<
trace <<
"\n";
Ipv4InterfaceContainer i0i2
IPv4 interface container i0 + i2.
NodeContainer n2n3
Nodecontainer n2 + n3.
NodeContainer n0n2
Nodecontainer n0 + n2.
NodeContainer n3n5
Nodecontainer n3 + n5.
Ipv4InterfaceContainer i3i5
IPv4 interface container i3 + i5.
Ipv4InterfaceContainer i2i3
IPv4 interface container i2 + i3.
Interface to network animator.
holds a vector of ns3::Application pointers.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
Manage ASCII trace files for device models.
Parse command-line arguments.
Class for representing data rates.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
static void EnablePrinting()
Enable printing packets metadata.
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
A helper to make it easier to instantiate an ns3::QKDAppApplication on a set of nodes.
Build a set of QKDNetDevice objects such as QKD buffers QKD encryptors and QKD graphs.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
Hold an unsigned integer type.
void SentPacket(std::string context, const std::string &appId, Ptr< const Packet > p)
void MissedSendPacketCall(std::string context, const std::string &appId, Ptr< const Packet > p)
std::map< std::string, std::pair< uint32_t, uint32_t > > m_dataKmReceived
void SentPacketToKMS(std::string context, const std::string &appId, Ptr< const Packet > p)
void KeyGenerated(std::string context, const std::string &appId, const std::string &keyId, const uint32_t &amountInBits)
std::map< std::string, std::pair< uint32_t, uint32_t > > m_dataAppReveived
std::map< std::string, uint32_t > m_missedSendPacketCalls
std::map< std::string, std::pair< uint32_t, uint32_t > > m_dataSigSent
void SentPacketSig(std::string context, const std::string &appId, Ptr< const Packet > p)
std::map< std::string, std::pair< uint32_t, uint32_t > > m_dataSigReceived
void ReceivedPacketFromKMS(std::string context, const std::string &appId, Ptr< const Packet > p)
void KeyServed(std::string context, const std::string &appId, const std::string &keyId, const uint32_t &amountInBits)
std::map< std::string, std::pair< uint32_t, uint32_t > > m_dataKmSent
void ReceivedPacketSig(std::string context, const std::string &appId, Ptr< const Packet > p)
void ReceivedPacket(std::string context, const std::string &appId, Ptr< const Packet > p)
std::map< std::string, std::map< std::string, uint32_t > > m_generatedKeys
std::map< std::string, std::map< std::string, uint32_t > > m_servedKeys
std::map< std::string, std::pair< uint32_t, uint32_t > > m_dataAppSent
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
AnimationInterface * anim
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...