25#include "ns3/core-module.h"
26#include "ns3/applications-module.h"
27#include "ns3/internet-module.h"
28#include "ns3/flow-monitor-module.h"
29#include "ns3/mobility-module.h"
30#include "ns3/point-to-point-module.h"
31#include "ns3/gnuplot.h"
33#include "ns3/qkd-link-helper.h"
34#include "ns3/qkd-app-helper.h"
35#include "ns3/qkd-app-004.h"
37#include "ns3/network-module.h"
38#include "ns3/internet-apps-module.h"
39#include "ns3/netanim-module.h"
51std::map<std::string, std::map<std::string, uint32_t> >
m_servedKeys;
81 it->second.second += p->GetSize();
102 it->second.second += p->GetSize();
114 it->second.second += p->GetSize();
126 it->second.second += p->GetSize();
138 it->second.second += p->GetSize();
150 it->second.second += p->GetSize();
156 std::cout <<
"\n\nAPPLICATION STATS:\n";
157 std::cout <<
"\n\tAPP-APP Data Packets Sent:";
159 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
160 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
161 std::cout <<
"\n\n\tAPP-APP Data Packets Received:";
163 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
164 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
165 std::cout <<
"\n\n\tMissed Send Packet Calls:";
167 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first <<
"\tNumber:\t" <<
el.second;
168 std::cout <<
"\n\n\tAPP-APP Signaling Packets Sent:";
170 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
171 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
172 std::cout <<
"\n\n\tAPP-APP Signaling Packets Received:";
174 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
175 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
176 std::cout <<
"\n\n\tAPP-KM Packets Sent:";
178 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
179 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
180 std::cout <<
"\n\n\tAPP-KM Packets Received:";
182 std::cout <<
"\n\t\tApplication ID:\t" <<
el.first
183 <<
"\tNumber:\t" <<
el.second.first <<
"\t\tBytes:\t" <<
el.second.second;
186 std::cout <<
"\n\nQKD LINK STATS:\n";
188 for(
const auto &
el1 :
el.second)
189 std::cout <<
"\n\t QKDSystem link: " <<
el.first <<
"\t keyId: "<<
el1.first <<
"\t Size: " <<
el1.second / 2 <<
" (bits)";
192 std::cout <<
"\n\nSERVICE STATS:\n";
194 std::cout <<
"\n\tApplication ID:\t" <<
el.first;
195 for(
auto const &
el1:
el.second)
196 std::cout <<
"\n\t\tKey ID:\t" <<
el1.first <<
"\t Size: " <<
el1.second <<
" (bits)";
214 uint16_t simulationTime = 500;
257 cmd.AddValue (
"simTime",
"Simulation time (seconds)", simulationTime);
258 cmd.AddValue (
"appHoldTime",
"How long (seconds) should QKDApp004 wait to close socket to KMS after receiving REST response?",
appHoldTime);
259 cmd.AddValue (
"appStartTime",
"Application start time (seconds)",
appStartTime);
260 cmd.AddValue (
"appStopTime",
"Application stop time (seconds)",
appStopTime);
261 cmd.AddValue (
"qkdStartTime",
"QKD start time (seconds)",
qkdStartTime);
262 cmd.AddValue (
"qkdStopTime",
"QKD stop time (seconds)",
qkdStopTime);
263 cmd.AddValue (
"encryptionType",
"Type of encryption to be used",
encryptionType);
265 cmd.AddValue (
"aesLifetime",
"How many packets to encrypt with the same AES key?",
aesLifetime);
266 cmd.AddValue (
"keyBufferLengthEncryption",
"How many keys to store in local buffer of QKDApp004 for encryption?",
keyBufferLengthEncryption);
268 cmd.AddValue (
"useCrypto",
"Perform crypto functions?",
useCrypto);
269 cmd.AddValue (
"seed",
"Random seed value",
seed);
270 cmd.AddValue (
"trace",
"Enable datapath stats and pcap traces",
trace);
297 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
318 ipv4.SetBase (
"10.1.1.0",
"255.255.255.0");
320 ipv4.SetBase (
"10.1.2.0",
"255.255.255.0");
322 ipv4.SetBase (
"10.1.3.0",
"255.255.255.0");
324 ipv4.SetBase (
"10.1.4.0",
"255.255.255.0");
326 ipv4.SetBase (
"10.1.5.0",
"255.255.255.0");
363 std::cout <<
"SrcNode: " << n.
Get(0)->
GetId() <<
" Source IP address: " <<
i0i1.GetAddress(0) << std::endl;
364 std::cout <<
"DstNode: " << n.
Get(2)->
GetId() <<
" Destination IP address: " <<
i1i2.
GetAddress(1) << std::endl;
365 std::cout <<
"SrcKMSNode: " << n.
Get(3)->
GetId() <<
" Destination KMS IP address: " <<
i3i4.
GetAddress(0) << std::endl;
366 std::cout <<
"DstKMSNode: " << n.
Get(4)->
GetId() <<
" Destination KMS IP address: " <<
i3i4.
GetAddress(1) << std::endl;
443 p2p.EnableAsciiAll (
ascii.CreateFileStream (
"qkd_etis004.tr"));
444 p2p.EnablePcapAll (
"qkd_etis004");
454 std::cout <<
"simTime:\t" << simulationTime <<
"\n";
456 std::cout <<
"appStopTime:\t" <<
appStopTime <<
"\n";
458 std::cout <<
"qkdStopTime:\t" <<
qkdStopTime <<
"\n";
461 std::cout <<
"aesLifetime:\t" <<
aesLifetime <<
"\n";
464 std::cout <<
"useCrypto:\t" <<
useCrypto <<
"\n";
465 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.
AttributeValue implementation for Boolean.
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.
AttributeValue implementation for Time.
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...