29#include "ns3/core-module.h"
30#include "ns3/applications-module.h"
31#include "ns3/internet-module.h"
32#include "ns3/flow-monitor-module.h"
33#include "ns3/mobility-module.h"
34#include "ns3/point-to-point-module.h"
35#include "ns3/gnuplot.h"
37#include "ns3/qkd-link-helper.h"
38#include "ns3/qkd-app-helper.h"
39#include "ns3/qkd-app-014.h"
41#include "ns3/network-module.h"
42#include "ns3/internet-apps-module.h"
43#include "ns3/netanim-module.h"
53std::map<std::string, std::map<std::string, uint32_t> >
m_servedKeys;
83 it->second.second += p->GetSize();
104 it->second.second += p->GetSize();
116 it->second.second += p->GetSize();
128 it->second.second += p->GetSize();
140 it->second.second += p->GetSize();
152 it->second.second += p->GetSize();
158 std::cout <<
"\n\nAPPLICATION STATS:\n";
159 std::cout <<
"\n\tAPP-APP Data Packets Sent:";
161 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
162 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
163 std::cout <<
"\n\n\tAPP-APP Data Packets Received:";
165 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
166 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
167 std::cout <<
"\n\n\tMissed Send Packet Calls:";
169 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first <<
"\tNumber:\t" <<
el.second;
170 std::cout <<
"\n\n\tAPP-APP Signaling Packets Sent:";
172 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
173 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
174 std::cout <<
"\n\n\tAPP-APP Signaling Packets Received:";
176 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
177 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
178 std::cout <<
"\n\n\tAPP-KM Packets Sent:";
180 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
181 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
182 std::cout <<
"\n\n\tAPP-KM Packets Received:";
184 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
185 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
187 std::cout <<
"\n\nQKD LINK STATS:\n";
189 for(
const auto &
el1 :
el.second)
190 std::cout <<
"\n\tLink (" <<
el.first <<
"-"<<
el1.first <<
")\tGenerated (bits):" <<
el1.second;
193 std::cout <<
"\n\nSERVICE STATS:\n";
195 std::cout <<
"\n\tApplication ID:\t" <<
el.first;
196 for(
auto const &
el1:
el.second)
197 std::cout <<
"\n\t\tKey ID:\t" <<
el1.first <<
"\t\tServed (bits):\t" <<
el1.second;
215 uint16_t simulationTime = 500;
262 cmd.AddValue (
"simTime",
"Simulation time (seconds)", simulationTime);
263 cmd.AddValue (
"appHoldTime",
"How long (seconds) should QKDApp004 wait to close socket to KMS after receiving REST response?",
appHoldTime);
264 cmd.AddValue (
"appStartTime",
"Application start time (seconds)",
appStartTime);
265 cmd.AddValue (
"appStopTime",
"Application stop time (seconds)",
appStopTime);
266 cmd.AddValue (
"qkdStartTime",
"QKD start time (seconds)",
qkdStartTime);
267 cmd.AddValue (
"qkdStopTime",
"QKD stop time (seconds)",
qkdStopTime);
268 cmd.AddValue (
"encryptionType",
"Type of encryption to be used",
encryptionType);
270 cmd.AddValue (
"aesLifetime",
"How many packets to encrypt with the same AES key?",
aesLifetime);
272 cmd.AddValue (
"keyBufferLengthEncryption",
"How many keys to store in local buffer of QKDApp004 for encryption?",
keyBufferLengthEncryption);
274 cmd.AddValue (
"useCrypto",
"Perform crypto functions?",
useCrypto);
275 cmd.AddValue (
"seed",
"Random seed value",
seed);
276 cmd.AddValue (
"trace",
"Enable datapath stats and pcap traces",
trace);
303 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
326 ipv4.SetBase (
"10.1.1.0",
"255.255.255.0");
328 ipv4.SetBase (
"10.1.2.0",
"255.255.255.0");
330 ipv4.SetBase (
"10.1.3.0",
"255.255.255.0");
332 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");
373 std::cout <<
"SrcNode: " << n.
Get(0)->
GetId() <<
" Source IP address: " <<
i0i1.GetAddress(0) << std::endl;
374 std::cout <<
"DstNode: " << n.
Get(2)->
GetId() <<
" Destination IP address: " <<
i1i2.
GetAddress(1) << std::endl;
375 std::cout <<
"SrcKMSNode: " << n.
Get(3)->
GetId() <<
" Destination KMS IP address: " <<
i3i4.
GetAddress(0) << std::endl;
376 std::cout <<
"DstKMSNode: " << n.
Get(4)->
GetId() <<
" Destination KMS IP address: " <<
i3i4.
GetAddress(1) << std::endl;
464 p2p.EnableAsciiAll (
ascii.CreateFileStream (
"qkd_etis014.tr"));
465 p2p.EnablePcapAll (
"qkd_etis014");
475 std::cout <<
"simTime:\t" << simulationTime <<
"\n";
477 std::cout <<
"appStopTime:\t" <<
appStopTime <<
"\n";
479 std::cout <<
"qkdStopTime:\t" <<
qkdStopTime <<
"\n";
482 std::cout <<
"aesLifetime:\t" <<
aesLifetime <<
"\n";
483 std::cout <<
"useCrypto:\t" <<
useCrypto <<
"\n";
484 std::cout <<
"trace:\t" <<
trace <<
"\n";
NodeContainer n1n2
Nodecontainer n1 + n2.
NodeContainer n3n4
Nodecontainer n3 + n4.
Ipv4InterfaceContainer i1i2
IPv4 interface container i1 + i2.
Ipv4InterfaceContainer i3i4
IPv4 interface container i3 + i4.
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...