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/internet-apps-module.h"
32#include "ns3/gnuplot.h"
34#include "ns3/qkd-link-helper.h"
35#include "ns3/qkd-app-helper.h"
36#include "ns3/qkd-app-004.h"
38#include "ns3/network-module.h"
39#include "ns3/internet-apps-module.h"
40#include "ns3/netanim-module.h"
41#include "ns3/mpi-module.h"
155std::vector<std::pair<std::string, std::vector<uint32_t>>>
161 std::vector<std::pair<std::string, std::vector<uint32_t> > > result;
167 if(!
myFile.is_open())
throw std::runtime_error(
"Could not open file");
177 std::getline(
myFile, line);
180 std::stringstream
ss(line);
186 result.push_back({
colname, std::vector<uint32_t> {}});
191 while(std::getline(
myFile, line))
194 std::stringstream
ss(line);
206 if(
ss.peek() ==
',')
ss.ignore();
224 std::string linkId =
it->second->nodes;
227 std::map<std::string, uint32_t>::iterator
it2 =
it->second->m_keyIDGeneratedInBuffers.find (
keyId );
228 if (
it2 ==
it->second->m_keyIDGeneratedInBuffers.end ()){
232 it->second->m_keysGenerated++;
265 if(
it->second->type == 0 &&
it->second->srcKMSNodeId == srcNodeId &&
it->second->dstKMSNodeId == dstNodeId){
267 std::string linkId =
it->second->nodes;
269 it->second->m_keysConsumed++;
305 std::string linkId =
it->second->nodes;
308 std::map<std::string, uint32_t>::iterator
it2 =
it->second->m_keyIDConsumedInBuffers.find (
jointKeyId );
310 if (
it2 ==
it->second->m_keyIDConsumedInBuffers.end ()){
316 it->second->m_keysConsumed++;
351 if(
it->second->type == 0 && ( (
it->second->srcKMSNodeId == srcNodeId &&
it->second->dstKMSNodeId == dstNodeId)
352 || (
it->second->srcKMSNodeId == dstNodeId &&
it->second->dstKMSNodeId == srcNodeId))){
354 std::string linkId =
it->second->nodes;
356 it->second->m_keysRelayed++;
386 std::string linkId =
it->second->nodes;
388 it->second->m_bytes_sent += p->GetSize();
389 it->second->m_appPacketsSent++;
429 it->second->m_missedSendPacketCalls++;
436 it->second->m_bytes_received += p->GetSize();
437 it->second->m_appPacketsReceived++;
444 it->second->m_sig_bytes_sent += p->GetSize();
445 it->second->m_appSigPacketsSent++;
446 std::string linkId =
it->second->nodes;
470 it->second->m_sig_bytes_received += p->GetSize();
471 it->second->m_appSigPacketsReceived++;
478 it->second->m_bytes_sent_to_kms += p->GetSize();
479 it->second->m_kmsPacketsSent++;
480 std::string linkId =
it->second->nodes;
506 it->second->m_bytes_received_from_kms += p->GetSize();
507 it->second->m_kmsPacketsReceived++;
508 std::string linkId =
it->second->nodes;
533 std::vector<std::pair<std::string, std::vector<uint32_t> > >
output;
537 if(
it->second->m_printed)
continue;
539 std::vector<uint32_t>
temp(45,0);
540 temp[0] =
it->second->type;
542 if(
it->second->type == 0){
545 for (std::map<std::string, uint32_t>::iterator
it2 =
it->second->m_keyIDConsumedInBuffers.begin();
546 it2 !=
it->second->m_keyIDConsumedInBuffers.end(); ++
it2) {
553 for (std::map<std::string, uint32_t>::iterator
it2 =
it->second->m_keyIDGeneratedInBuffers.begin();
554 it2 !=
it->second->m_keyIDGeneratedInBuffers.end(); ++
it2) {
560 temp[1] =
it->second->m_linkDistance;
561 temp[2] =
it->second->m_keyRate;
562 temp[3] =
it->second->m_keysGenerated;
563 temp[4] =
it->second->m_keysGeneratedBits;
564 temp[5] =
it->second->m_keysConsumed;
565 temp[6] =
it->second->m_keysConsumedBits;
566 temp[7] =
it->second->m_avgSizeOfGeneratedKeys;
567 temp[8] =
it->second->m_avgSizeOfConsumedKeys;
568 temp[9] =
it->second->m_bufferCapacityBits;
569 temp[23] =
it->second->m_startTime;
570 temp[24] =
it->second->m_stopTime;
572 temp[36] =
it->second->m_keysRelayed;
573 temp[37] =
it->second->m_keysRelayedBits;
580 for (std::map<std::string, uint32_t>::iterator
it2 =
it->second->m_keyIDConsumedInBuffers.begin();
581 it2 !=
it->second->m_keyIDConsumedInBuffers.end(); ++
it2) {
587 temp[10] =
it->second->m_bytes_sent;
588 temp[11] =
it->second->m_bytes_received;
589 temp[12] =
it->second->m_appPacketsSent;
590 temp[13] =
it->second->m_appPacketsReceived;
591 temp[14] =
it->second->m_missedSendPacketCalls;
592 temp[15] =
it->second->m_encryptionType;
593 temp[16] =
it->second->m_authenticationType;
594 temp[17] =
it->second->m_aesLifeTime;
595 temp[18] =
it->second->m_packetSize;
596 temp[19] =
it->second->m_trafficRate;
597 temp[20] =
it->second->m_sizeOfKeyBufferForEncryption;
598 temp[21] =
it->second->m_sizeOfKeyBufferForAuthentication;
599 temp[22] =
it->second->m_numberOfKeysToFetchFromKMS;
600 temp[23] =
it->second->m_startTime;
601 temp[24] =
it->second->m_stopTime;
603 temp[5] =
it->second->m_keysConsumed;
604 temp[6] =
it->second->m_keysConsumedBits;
605 temp[8] =
it->second->m_avgSizeOfConsumedKeys;
607 temp[25] =
it->second->m_sig_bytes_sent;
608 temp[26] =
it->second->m_sig_bytes_received;
609 temp[27] =
it->second->m_appSigPacketsSent;
610 temp[28] =
it->second->m_appSigPacketsReceived;
612 temp[29] =
it->second->m_bytes_sent_to_kms;
613 temp[30] =
it->second->m_bytes_received_from_kms;
614 temp[31] =
it->second->m_kmsPacketsSent;
615 temp[32] =
it->second->m_kmsPacketsReceived;
620 output.push_back( std::make_pair(
it->second->nodes,
temp) );
621 it->second->m_printed = 1;
636 if(
it->second->m_printed)
continue;
637 std::string
nodes =
it->second->nodes;
639 if(
it->second->type == 0){
640 output[
"qkd_links"][
nodes][
"Link distance (meters)"] = 0;
641 output[
"qkd_links"][
nodes][
"Key rate (bit/sec)"] = 0;
642 output[
"qkd_links"][
nodes][
"Key-pairs generated"] = 0;
643 output[
"qkd_links"][
nodes][
"Key-pairs generated (bits)"] = 0;
644 output[
"qkd_links"][
nodes][
"Key-pairs consumed"] = 0;
645 output[
"qkd_links"][
nodes][
"Key-pairs consumed (bits)"] = 0;
646 output[
"qkd_links"][
nodes][
"Key-pairs relayed"] = 0;
647 output[
"qkd_links"][
nodes][
"Key-pairs relayed (bits)"] = 0;
650 output[
"qkd_links"][
nodes][
"Average size of generated key-pairs (bits)"] = 0;
651 output[
"qkd_links"][
nodes][
"Average size of consumed key-pairs (bits)"] = 0;
652 output[
"qkd_links"][
nodes][
"Start Time (sec)"] = 0;
654 output[
"qkd_links"][
nodes][
"QKDBuffer Capacity (bits)"] = 0;
656 std::string type = (
it->second->type == 1) ?
"etsi_004":
"etsi_014";
657 output[type][
nodes][
"QKDApps Statistics"][
"Bytes Sent"] = 0;
658 output[type][
nodes][
"QKDApps Statistics"][
"Bytes Received"] = 0;
659 output[type][
nodes][
"QKDApps Statistics"][
"Packets Sent"] = 0;
660 output[type][
nodes][
"QKDApps Statistics"][
"Packets Received"] = 0;
661 output[type][
nodes][
"QKDApps Statistics"][
"Missed send packet calls"] = 0;
662 output[type][
nodes][
"QKDApps Statistics"][
"Key/Data utilization (%)"] = 0;
664 output[type][
nodes][
"QKDApps Statistics"][
"Encryption"] = 0;
665 output[type][
nodes][
"QKDApps Statistics"][
"Authentication"] = 0;
666 output[type][
nodes][
"QKDApps Statistics"][
"AES Key Lifetime (bytes)"] = 0;
667 output[type][
nodes][
"QKDApps Statistics"][
"Size of Key Buffer for Encryption"] = 0;
668 output[type][
nodes][
"QKDApps Statistics"][
"Size of Key Buffer for Authentication"] = 0;
669 output[type][
nodes][
"QKDApps Statistics"][
"Number of Keys to Fetch From KMS"] = 0;
670 output[type][
nodes][
"QKDApps Statistics"][
"Packet Size (bytes)"] = 0;
671 output[type][
nodes][
"QKDApps Statistics"][
"Traffic Rate (bit/sec)"] = 0;
672 output[type][
nodes][
"QKDApps Statistics"][
"Start Time (sec)"] = 0;
673 output[type][
nodes][
"QKDApps Statistics"][
"Stop Time (sec)"] = 0;
675 output[type][
nodes][
"Signaling Statistics"][
"Bytes Sent"] = 0;
676 output[type][
nodes][
"Signaling Statistics"][
"Bytes Received"] = 0;
677 output[type][
nodes][
"Signaling Statistics"][
"Packets Sent"] = 0;
678 output[type][
nodes][
"Signaling Statistics"][
"Packets Received"] = 0;
680 output[type][
nodes][
"QKDApps-KMS Statistics"][
"Bytes Sent"] = 0;
681 output[type][
nodes][
"QKDApps-KMS Statistics"][
"Bytes Received"] = 0;
682 output[type][
nodes][
"QKDApps-KMS Statistics"][
"Packets Sent"] = 0;
683 output[type][
nodes][
"QKDApps-KMS Statistics"][
"Packets Received"] = 0;
685 output[type][
nodes][
"Key Consumption Statistics"][
"Key-pairs consumed"] = 0;
686 output[type][
nodes][
"Key Consumption Statistics"][
"Key-pairs consumed (bits)"] = 0;
687 output[type][
nodes][
"Key Consumption Statistics"][
"Average size of consumed key-pairs (bits)"] = 0;
692 std::vector<std::vector<std::pair<std::string, std::vector<uint32_t>>>>
cpuValues;
715 std::string type =
"qkd_links";
724 std::cout <<
"********************************** \n\n";
726 if(type ==
"qkd_links"){
737 output[type][
nodes][
"Average size of generated key-pairs (bits)"] =
cpuValues.at(0).at(
j).second.at(7);
738 output[type][
nodes][
"Average size of consumed key-pairs (bits)"] =
cpuValues.at(0).at(
j).second.at(8);
744 std::cout <<
"QKD LINK: " <<
nodes <<
"\n"
745 <<
"\nQKDBuffer Capacity (bits):\t" <<
output[type][
nodes][
"QKDBuffer Capacity (bits)"]
746 <<
"\nLink distance (meters):\t\t" <<
output[type][
nodes][
"Link distance (meters)"]
747 <<
"\nKey rate (bit/sec):\t\t" <<
output[type][
nodes][
"Key rate (bit/sec)"]
748 <<
"\nKey-pairs generated:\t" <<
output[type][
nodes][
"Key-pairs generated"]
749 <<
"\tKey-pairs generated (bits):\t" <<
output[type][
nodes][
"Key-pairs generated (bits)"]
750 <<
"\nKey-pairs consumed:\t" <<
output[type][
nodes][
"Key-pairs consumed"]
751 <<
"\tKey-pairs consumed (bits):\t" <<
output[type][
nodes][
"Key-pairs consumed (bits)"]
752 <<
"\nKey-pairs relayed:\t" <<
output[type][
nodes][
"Key-pairs relayed"]
753 <<
"\tKey-pairs relayed (bits):\t" <<
output[type][
nodes][
"Key-pairs relayed (bits)"]
756 <<
"\nAvg size of generated keys (bits):\t" <<
output[type][
nodes][
"Average size of generated key-pairs (bits)"]
757 <<
"\nAvg size of consumed keys (bits):\t" <<
output[type][
nodes][
"Average size of consumed key-pairs (bits)"]
758 <<
"\nStart Time (sec):\t\t" <<
output[type][
nodes][
"Start Time (sec)"]
759 <<
"\nStop Time (sec):\t\t" <<
output[type][
nodes][
"Stop Time (sec)"]
767 output[type][
nodes][
"QKDApps Statistics"][
"Missed send packet calls"] =
cpuValues.at(0).at(
j).second.at(14);
778 if(
output[type][
nodes][
"QKDApps Statistics"][
"Encryption"] == 0){
779 output[type][
nodes][
"QKDApps Statistics"][
"Encryption"] =
"Unencrypted";
780 }
else if(
output[type][
nodes][
"QKDApps Statistics"][
"Encryption"] == 1){
781 output[type][
nodes][
"QKDApps Statistics"][
"Encryption"] =
"OTP";
782 }
else if(
output[type][
nodes][
"QKDApps Statistics"][
"Encryption"] == 2){
783 output[type][
nodes][
"QKDApps Statistics"][
"Encryption"] =
"AES-256";
784 output[type][
nodes][
"QKDApps Statistics"][
"AES Key Lifetime (bytes)"] =
cpuValues.at(0).at(
j).second.at(17);
788 if(
output[type][
nodes][
"QKDApps Statistics"][
"Authentication"] == 0){
789 output[type][
nodes][
"QKDApps Statistics"][
"Authentication"] =
"Unauthenticated";
790 }
else if(
output[type][
nodes][
"QKDApps Statistics"][
"Authentication"] == 1){
791 output[type][
nodes][
"QKDApps Statistics"][
"Authentication"] =
"VMAC";
793 output[type][
nodes][
"QKDApps Statistics"][
"Authentication"] =
"SHA-1";
796 output[type][
nodes][
"QKDApps Statistics"][
"Packet Size (bytes)"] =
cpuValues.at(0).at(
j).second.at(18);
797 output[type][
nodes][
"QKDApps Statistics"][
"Traffic Rate (bit/sec)"] =
cpuValues.at(0).at(
j).second.at(19);
799 if(type ==
"etsi_004"){
800 output[type][
nodes][
"QKDApps Statistics"][
"Size of Key Buffer for Encryption"] =
cpuValues.at(0).at(
j).second.at(20);
801 output[type][
nodes][
"QKDApps Statistics"][
"Size of Key Buffer for Authentication"] =
cpuValues.at(0).at(
j).second.at(21);
803 output[type][
nodes][
"QKDApps Statistics"][
"Number of Keys to Fetch From KMS"] =
cpuValues.at(0).at(
j).second.at(22);
812 output[type][
nodes][
"Signaling Statistics"][
"Packets Received"] =
cpuValues.at(0).at(
j).second.at(28);
815 output[type][
nodes][
"QKDApps-KMS Statistics"][
"Bytes Received"] =
cpuValues.at(0).at(
j).second.at(30);
817 output[type][
nodes][
"QKDApps-KMS Statistics"][
"Packets Received"] =
cpuValues.at(0).at(
j).second.at(32);
819 output[type][
nodes][
"Key Consumption Statistics"][
"Key-pairs consumed"] =
cpuValues.at(0).at(
j).second.at(5);
820 output[type][
nodes][
"Key Consumption Statistics"][
"Key-pairs consumed (bits)"] =
cpuValues.at(0).at(
j).second.at(6);
821 output[type][
nodes][
"Key Consumption Statistics"][
"Average size of consumed key-pairs (bits)"] =
cpuValues.at(0).at(
j).second.at(8);
823 std::cout <<
"QKDApps " << type <<
": " <<
nodes <<
"\n\n"
824 <<
"Encryption:\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Encryption"];
825 if(
output[type][
nodes][
"QKDApps Statistics"][
"Encryption"] ==
"AES-256"){
826 std::cout <<
"\nAES Key Lifetime (bytes):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"AES Key Lifetime (bytes)"];
829 <<
"\nAuthentication:\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Authentication"]
830 <<
"\nPacket Size (bytes):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Packet Size (bytes)"]
831 <<
"\nTraffic Rate (bit/sec):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Traffic Rate (bit/sec)"];
833 if(type ==
"etsi_004"){
835 <<
"\nSize of Key Buffer for Encryption:\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Size of Key Buffer for Encryption"]
836 <<
"\nSize of Key Buffer for Authentication:\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Size of Key Buffer for Authentication"];
839 <<
"\nNumber of Keys to Fetch From KMS:\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Number of Keys to Fetch From KMS"];
843 <<
"\nMissed send packet calls:\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Missed send packet calls"]
844 <<
"\nSent (bytes):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Bytes Sent"]
845 <<
"\tReceived (bytes):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Bytes Received"]
846 <<
"\nSent (Packets):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Packets Sent"]
847 <<
"\tReceived (Packets):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Packets Received"]
848 <<
"\nKey/Data utilization (%):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Key/Data utilization (%)"]
850 <<
"\nRatio (bytes):\t" << (float)
output[type][
nodes][
"QKDApps Statistics"][
"Bytes Received"]/(
float)
output[type][
nodes][
"QKDApps Statistics"][
"Bytes Sent"]
851 <<
"\tRatio (packets):\t" << (float)
output[type][
nodes][
"QKDApps Statistics"][
"Packets Received"]/(
float)
output[type][
nodes][
"QKDApps Statistics"][
"Packets Sent"]
852 <<
"\nStart Time (sec):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Start Time (sec)"]
853 <<
"\nStop Time (sec):\t" <<
output[type][
nodes][
"QKDApps Statistics"][
"Stop Time (sec)"]
856 <<
"\n- Signaling stats:"
857 <<
"\nSent (bytes):\t" <<
output[type][
nodes][
"Signaling Statistics"][
"Bytes Sent"]
858 <<
"\tReceived (bytes):\t" <<
output[type][
nodes][
"Signaling Statistics"][
"Bytes Received"]
859 <<
"\nSent (Packets):\t" <<
output[type][
nodes][
"Signaling Statistics"][
"Packets Sent"]
860 <<
"\tReceived (Packets):\t" <<
output[type][
nodes][
"Signaling Statistics"][
"Packets Received"]
863 std::cout <<
"\n- QKDApps to KMS stats:"
864 <<
"\nSent (bytes):\t" <<
output[type][
nodes][
"QKDApps-KMS Statistics"][
"Bytes Sent"]
865 <<
"\tReceived (bytes):\t" <<
output[type][
nodes][
"QKDApps-KMS Statistics"][
"Bytes Received"]
866 <<
"\nSent (Packet):\t" <<
output[type][
nodes][
"QKDApps-KMS Statistics"][
"Packets Sent"]
867 <<
"\tReceived (Packet):\t" <<
output[type][
nodes][
"QKDApps-KMS Statistics"][
"Packets Received"]
870 std::cout <<
"\n- Key Consumption Statistics:"
871 <<
"\nKey-pairs consumed:\t" <<
output[type][
nodes][
"Key Consumption Statistics"][
"Key-pairs consumed"]
872 <<
"\nKey-pairs consumed (bits):\t" <<
output[type][
nodes][
"Key Consumption Statistics"][
"Key-pairs consumed (bits)"]
873 <<
"\nAverage size of consumed key-pairs (bits):\t" <<
output[type][
nodes][
"Key Consumption Statistics"][
"Average size of consumed key-pairs (bits)"]
893 distance = distance / 1000;
895 if(distance < 1000) {
897 }
else if(distance > 1000 && distance < 1200) {
924 std::cout <<
"SystemId: " <<
systemId << std::endl;
932 uint16_t simulationTime = 150;
951 std::string srcNodeId;
952 std::string dstNodeId;
961 double startTime = 0;
967 cmd.AddValue (
"showKeyServed",
"Show trace when a key is served from KMS",
showKeyServed);
968 cmd.AddValue (
"showKeyAdded",
"Show trace when a key is generated",
showKeyAdded);
969 cmd.AddValue (
"simTime",
"Simulation time (seconds)", simulationTime);
970 cmd.AddValue (
"useCrypto",
"Perform crypto functions?",
useCrypto);
971 cmd.AddValue (
"trace",
"Enable datapath stats and pcap traces",
trace);
1020 srcNodeId =
inputParams[
"qkd_links"][
a][
"srcNodeId"].dump();
1021 dstNodeId =
inputParams[
"qkd_links"][
a][
"dstNodeId"].dump();
1032 std::cout <<
"Unique size of QKDNodes: " <<
qkdNodesIDs.size() <<
"\n";
1038 srcNodeId =
inputParams[
"etsi_004"][
a][
"srcNodeId"].dump();
1039 dstNodeId =
inputParams[
"etsi_004"][
a][
"dstNodeId"].dump();
1042 NS_FATAL_ERROR (
"Independent application nodes are not supported! " << srcNodeId);
1044 NS_FATAL_ERROR (
"Idependent application nodes are not supported! " << dstNodeId);
1051 srcNodeId =
inputParams[
"etsi_004"][
a][
"srcNodeId"].dump();
1052 dstNodeId =
inputParams[
"etsi_004"][
a][
"dstNodeId"].dump();
1055 NS_FATAL_ERROR (
"Independent application nodes are not supported! " << srcNodeId);
1057 NS_FATAL_ERROR (
"Independent application nodes are not supported! " << dstNodeId);
1094 std::cout <<
"Number of CPUs:\t" <<
systemCount <<
"\n";
1099 std::cout <<
"Number of Nodes:\t" <<
numberOfNodes <<
"\n\n";
1110 std::cout <<
"Install QKDNControl on node: " <<
QControlNodes.Get(
i)->GetId() <<
"\n";
1135 mobility.SetPositionAllocator (
"ns3::RandomRectanglePositionAllocator",
1136 "X",
StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=1000.0]"),
1137 "Y",
StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=1000.0]"));
1138 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1154 ipv4.SetBase (
"10.1.0.0",
"255.255.255.0");
1157 std::cout <<
"\n*********\n*** KMS Configuration\n*********\n";
1215 std::cout <<
"\n*********\n*** Post-Processing Configuration\n*********\n";
1219 std::cout <<
"KMSNode: " <<
KMSNodes.Get(
i)->GetId() <<
"\n";
1226 std::vector<uint32_t>
keySizes = {1024, 2048, 4096, 8192};
1227 std::vector<uint32_t>
keyRates = {5000, 10000, 15000};
1228 std::vector<uint32_t>
ppPacketSizes = {100,150,200,250,300,350};
1229 std::vector<uint32_t>
ppRates = {1000, 1500, 2000, 2500, 3000};
1233 srcNodeId =
inputParams[
"qkd_links"][
a][
"srcNodeId"].dump();
1234 dstNodeId =
inputParams[
"qkd_links"][
a][
"dstNodeId"].dump();
1236 int i=std::stoi(srcNodeId);
1237 int j=std::stoi(dstNodeId);
1260 <<
"Create link QKDNode-QKDNode: " << n.
Get(
i)->
GetId() <<
"(" <<
interfaces.GetAddress(0) <<
")"
1300 linkD->m_avgSizeOfGeneratedKeys = 0;
1301 linkD->m_avgSizeOfConsumedKeys = 0;
1304 linkD->m_startTime = startTime;
1307 linkD->srcNodeId = std::stoi(srcNodeId);
1308 linkD->dstNodeId = std::stoi(dstNodeId);
1313 std::cout <<
linkD->title << std::endl;
1314 std::cout <<
"SrcNode: " << n.
Get(
i)->
GetId() <<
" Source IP address: " <<
interfaces.GetAddress(0) << std::endl;
1315 std::cout <<
"DstNode: " << n.
Get(
j)->
GetId() <<
" Destination IP address: " <<
interfaces.GetAddress(1) << std::endl;
1318 std::cout <<
"ppKeySize: " <<
ppKeySize << std::endl;
1319 std::cout <<
"ppKeyRate: " <<
ppKeyRate << std::endl;
1320 std::cout <<
"ppPacketSize: " <<
ppPacketSize << std::endl;
1321 std::cout <<
"ppRate: " <<
ppRate << std::endl;
1355 std::cout <<
"startTime: " << startTime << std::endl;
1356 std::cout <<
"stopTime: " <<
stopTime << std::endl;
1370 std::cout <<
"\n*********\n*** ETSI 004 Configuration\n*********\n";
1380 std::vector<uint32_t>
AESLifetimes = {10000, 20000, 100000,200000,300000,400000,500000};
1383 std::vector<uint32_t>
appRates = {20000, 30000, 50000, 100000, 150000};
1433 srcNodeId =
inputParams[
"etsi_004"][
a][
"srcNodeId"].dump();
1434 dstNodeId =
inputParams[
"etsi_004"][
a][
"dstNodeId"].dump();
1436 int i=std::stoi(srcNodeId);
1437 int j=std::stoi(dstNodeId);
1447 std::cout <<
"Create link node-node: " << n.
Get(
i)->
GetId() <<
"\t" << n.
Get(
j)->
GetId() <<
"\n";
1462 std::cout <<
"Create link node-KMSA: " << n.
Get(
i)->
GetId() <<
"\t" <<
KMSNodes.Get(
i)->GetId() <<
"\n";
1477 std::cout <<
"Create link node-KMSB: " << n.
Get(
j)->
GetId() <<
"\t" <<
KMSNodes.Get(
j)->GetId() <<
"\n";
1490 linkD->title =
"ETSI 004 Connection: " +
linkD->nodes;
1499 linkD->m_startTime = startTime;
1503 std::cout <<
linkD->title <<
"\n";
1504 std::cout <<
"Alice NodeId: " << n.
Get(
i)->
GetId() <<
" Alice App IP: " <<
interfacesToApp.GetAddress(0) << std::endl;
1509 std::cout <<
"AESLifetime: " <<
aesLifetime << std::endl;
1511 std::cout <<
"AppRate: " <<
appRate << std::endl;
1512 std::cout <<
"AppPacketSize: " <<
appPacketSize << std::endl;
1516 std::cout <<
"startTime: " << startTime << std::endl;
1517 std::cout <<
"stopTime: " <<
stopTime << std::endl;
1566 std::cout <<
"\n*********\n*** ETSI 014 Configuration\n*********\n";
1620 srcNodeId =
inputParams[
"etsi_014"][
a][
"srcNodeId"].dump();
1621 dstNodeId =
inputParams[
"etsi_014"][
a][
"dstNodeId"].dump();
1623 int i=std::stoi(srcNodeId);
1624 int j=std::stoi(dstNodeId);
1634 std::cout <<
"Create link node-node: " << n.
Get(
i)->
GetId() <<
"\t" << n.
Get(
j)->
GetId() <<
"\n";
1649 std::cout <<
"Create link node-KMSA: " << n.
Get(
i)->
GetId() <<
"\t" <<
KMSNodes.Get(
i)->GetId() <<
"\n";
1664 std::cout <<
"Create link node-KMSB: " << n.
Get(
j)->
GetId() <<
"\t" <<
KMSNodes.Get(
j)->GetId() <<
"\n";
1676 linkD->title =
"ETSI 014 Connection: " +
linkD->nodes;
1684 linkD->m_startTime = startTime;
1688 std::cout <<
linkD->title <<
"\n";
1689 std::cout <<
"Alice NodeId: " << n.
Get(
i)->
GetId() <<
" Alice App IP: " <<
interfacesToApp.GetAddress(0) << std::endl;
1694 std::cout <<
"AESLifetime: " <<
aesLifetime << std::endl;
1696 std::cout <<
"AppRate: " <<
appRate << std::endl;
1697 std::cout <<
"AppPacketSize: " <<
appPacketSize << std::endl;
1699 std::cout <<
"AppHoldTime: " <<
appHoldTime << std::endl;
1700 std::cout <<
"startTime: " << startTime << std::endl;
1701 std::cout <<
"stopTime: " <<
stopTime << std::endl;
1781 p2p.EnableAsciiAll (
ascii.CreateFileStream (
"qkd_etis004.tr"));
1782 p2p.EnablePcapAll (
"qkd_etis004");
1793 std::cout <<
"simTime:\t" << simulationTime <<
"\n";
1794 std::cout <<
"useCrypto:\t" <<
useCrypto <<
"\n";
1795 std::cout <<
"trace:\t" <<
trace <<
"\n";
1820 printf(
"elapsed process CPU time = %llu nanoseconds\n", (
long long unsigned int)
execTime);
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.
static void Bind(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
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.
Helper class used to assign positions and mobility models to nodes.
static uint32_t GetSystemId()
Get the id number of this rank.
static uint32_t GetSize()
Get the number of ranks used by ns-3.
static void Disable()
Clean up the ns-3 parallel communications interface.
static void Enable(int *pargc, char ***pargv)
Setup the parallel communication interface.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
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.
QKDNetSim implements Key Management System(KMS) as an application that listens on TCP port 80.
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 Time Now()
Return the current simulation virtual time.
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.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
Hold an unsigned integer type.
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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...
uint32_t m_kmsPacketsSent
uint32_t m_keysRelayedBits
uint32_t m_sizeOfKeyBufferForAuthentication
uint32_t m_bytes_received
uint32_t m_authenticationType
uint32_t m_appPacketsReceived
uint32_t m_bytes_sent_to_kms
uint32_t m_appSigPacketsReceived
uint32_t m_appPacketsSent
uint32_t m_bytes_received_from_kms
uint32_t m_bufferCapacityBits
uint32_t m_appSigPacketsSent
std::map< std::string, uint32_t > m_keyIDGeneratedInBuffers
double m_avgSizeOfGeneratedKeys
uint32_t m_missedSendPacketCalls
double m_avgSizeOfConsumedKeys
uint32_t m_kmsPacketsReceived
uint32_t m_encryptionType
uint32_t m_numberOfKeysToFetchFromKMS
std::map< std::string, uint32_t > m_keyIDConsumedInBuffers
uint32_t m_sizeOfKeyBufferForEncryption
uint32_t m_keysWastedBits
uint32_t m_sig_bytes_sent
std::map< std::string, uint32_t > m_keyIDConsumedByKMS
uint32_t m_keysConsumedBits
uint32_t m_keysGeneratedBits
uint32_t m_sig_bytes_received