A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
examples_secoqc.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 www.tk.etf.unsa.ba
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Emir Dervisevic <emir.dervisevic@etf.unsa.ba>
7 * Miralem Mehic <miralem.mehic@ieee.org>
8 */
9
10#include <fstream>
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"
18
19#include "ns3/qkd-link-helper.h"
20#include "ns3/qkd-app-helper.h"
21#include "ns3/qkd-app-004.h"
22
23#include "ns3/network-module.h"
24#include "ns3/internet-apps-module.h"
25#include "ns3/netanim-module.h"
26
27
28using namespace ns3;
29
30NS_LOG_COMPONENT_DEFINE ("QKD_ETSI004");
31
34
35
36std::map<std::string, std::map<std::string, uint32_t> > m_generatedKeys;
37std::map<std::string, std::map<std::string, uint32_t> > m_servedKeys;
38
39std::map<std::string, std::pair<uint32_t, uint32_t> > m_dataAppSent;
40std::map<std::string, std::pair<uint32_t, uint32_t> > m_dataAppReveived;
41std::map<std::string, std::pair<uint32_t, uint32_t> > m_dataSigSent;
42std::map<std::string, std::pair<uint32_t, uint32_t> > m_dataSigReceived;
43std::map<std::string, std::pair<uint32_t, uint32_t> > m_dataKmSent;
44std::map<std::string, std::pair<uint32_t, uint32_t> > m_dataKmReceived;
45std::map<std::string, uint32_t> m_missedSendPacketCalls;
46
47void
48KeyGenerated(std::string context, const std::string& appId, const std::string& keyId, const uint32_t& amountInBits)
49{
51}
52
53void
54KeyServed (std::string context, const std::string& appId, const std::string& keyId, const uint32_t& amountInBits)
55{
57}
58
59void
60SentPacket(std::string context, const std::string& appId, Ptr<const Packet> p){
61
62 auto it = m_dataAppSent.find(appId);
63 if(it == m_dataAppSent.end())
64 m_dataAppSent.insert(std::make_pair(appId, std::make_pair(1, p->GetSize() )) );
65 else{
66 it->second.first++;
67 it->second.second += p->GetSize();
68 }
69}
70
71void MissedSendPacketCall (std::string context, const std::string& appId, Ptr<const Packet> p){
72
73 auto it = m_missedSendPacketCalls.find(appId);
74 if(it == m_missedSendPacketCalls.end())
75 m_missedSendPacketCalls.insert(std::make_pair(appId, 1));
76 else
77 it->second++;
78}
79
80void
81ReceivedPacket(std::string context, const std::string& appId, Ptr<const Packet> p){
82
83 auto it = m_dataAppReveived.find(appId);
84 if(it == m_dataAppReveived.end())
85 m_dataAppReveived.insert(std::make_pair(appId, std::make_pair(1, p->GetSize())) );
86 else{
87 it->second.first++;
88 it->second.second += p->GetSize();
89 }
90}
91
92void
93SentPacketSig(std::string context, const std::string& appId, Ptr<const Packet> p){
94
95 auto it = m_dataSigSent.find(appId);
96 if(it == m_dataSigSent.end())
97 m_dataSigSent.insert(std::make_pair(appId, std::make_pair(1, p->GetSize())) );
98 else{
99 it->second.first++;
100 it->second.second += p->GetSize();
101 }
102}
103
104void
105ReceivedPacketSig(std::string context, const std::string& appId, Ptr<const Packet> p){
106
107 auto it = m_dataSigReceived.find(appId);
108 if(it == m_dataSigReceived.end())
109 m_dataSigReceived.insert(std::make_pair(appId, std::make_pair(1, p->GetSize())) );
110 else{
111 it->second.first++;
112 it->second.second += p->GetSize();
113 }
114}
115
116void
117SentPacketToKMS(std::string context, const std::string& appId, Ptr<const Packet> p){
118
119 auto it = m_dataKmSent.find(appId);
120 if(it == m_dataKmSent.end())
121 m_dataKmSent.insert(std::make_pair(appId, std::make_pair(1, p->GetSize())) );
122 else{
123 it->second.first++;
124 it->second.second += p->GetSize();
125 }
126}
127
128void
129ReceivedPacketFromKMS(std::string context, const std::string& appId, Ptr<const Packet> p){
130
131 auto it = m_dataKmReceived.find(appId);
132 if(it == m_dataKmReceived.end())
133 m_dataKmReceived.insert(std::make_pair(appId, std::make_pair(1, p->GetSize())) );
134 else{
135 it->second.first++;
136 it->second.second += p->GetSize();
137 }
138}
139
140void
142 std::cout << "\n\nAPPLICATION STATS:\n";
143 std::cout << "\n\tAPP-APP Data Packets Sent:";
144 for(const auto &el: m_dataAppSent)
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:";
148 for(const auto &el: m_dataAppReveived)
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:";
152 for(const auto &el: m_missedSendPacketCalls)
153 std::cout << "\n\t\tApplication ID:\t" << el.first << "\tNumber:\t" << el.second;
154 std::cout << "\n\n\tAPP-APP Signaling Packets Sent:";
155 for(const auto &el: m_dataSigSent)
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:";
159 for(const auto &el: m_dataSigReceived)
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:";
163 for(const auto &el: m_dataKmSent)
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:";
167 for(const auto &el: m_dataKmReceived)
168 std::cout << "\n\t\tApplication ID:\t" << el.first
169 << "\tNumber:\t" << el.second.first << "\t\tBytes:\t" << el.second.second;
170
171
172 std::cout << "\n\nQKD LINK STATS:\n";
173 for (const auto &el: m_generatedKeys){
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)";
176 }
177
178 std::cout << "\n\nSERVICE STATS:\n";
179 for(auto const &el: m_servedKeys){
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)";
183 std::cout << "\n";
184 }
185}
186
187int main (int argc, char *argv[])
188{
191 //
192 // Explicitly create the nodes required by the topology (shown above).
193 //
194 NS_LOG_INFO ("Create nodes.");
196
197 double appHoldTime = 0.5;
198 uint16_t simulationTime = 500;
199 uint16_t appStartTime = 50;
200 uint16_t appStopTime = 500;
201 uint16_t qkdStartTime = 0;
202 uint16_t qkdStopTime = 500;
203 uint32_t authenticationType = 1; //0-unauthenticated, 1-VMAC, 2,3-MD5,SHA1
204 uint32_t encryptionType = 1; //0-unencrypted, 1-OTP, 2-AES256
206 uint32_t aesLifetime = 10000; //In bytes! 64GB = 68719476736B
211 NS_LOG_DEBUG(simulationTime);
219
220 uint32_t appRate = 100000; //In bps
221 uint32_t appPacketSize = 800; //In bytes
222 uint32_t ppKeyRate = 10000; //In bps
223 uint32_t ppKeySize = 8192; //In bytes
224 uint32_t ppPacketSize = 100; //In bytes
225 uint32_t ppRate = 1000;
232
233 bool trace = false;
234 n.Create (18);
235
236 uint32_t stream = 15;
237 uint32_t seed = 100;
238
239 // Configure command line parameters
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);
248 cmd.AddValue ("authenticationType", "Type of authentication to be used", authenticationType);
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);
251 cmd.AddValue ("keyBufferLengthAuthentication", "How many keys to store in local buffer of QKDApp004 for authentication?", keyBufferLengthAuthentication);
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);
255 cmd.Parse (argc, argv);
256
258 RngSeedManager::SetRun (stream);
259 srand( stream ); //seeding for the first time only!
260
261 NodeContainer n0n2 = NodeContainer (n.Get(0), n.Get (2));
262 NodeContainer n0n1 = NodeContainer (n.Get(0), n.Get (1));
263 NodeContainer n1n3 = NodeContainer (n.Get(1), n.Get (3));
264 NodeContainer n2n3 = NodeContainer (n.Get(2), n.Get (3));
265
266 NodeContainer n2n4 = NodeContainer (n.Get(2), n.Get (4));
267 NodeContainer n2n6 = NodeContainer (n.Get(2), n.Get (6));
268 NodeContainer n3n5 = NodeContainer (n.Get(3), n.Get (5));
269 NodeContainer n3n7 = NodeContainer (n.Get(3), n.Get (7));
270
271 NodeContainer n4n5 = NodeContainer (n.Get(4), n.Get (5));
272 NodeContainer n4n8 = NodeContainer (n.Get(4), n.Get (8));
273 NodeContainer n5n9 = NodeContainer (n.Get(5), n.Get (9));
274 NodeContainer n6n7 = NodeContainer (n.Get(6), n.Get (7));
275 NodeContainer n6n8 = NodeContainer (n.Get(6), n.Get (8));
276 NodeContainer n7n9 = NodeContainer (n.Get(7), n.Get (9));
277
278 NodeContainer n8n10 = NodeContainer (n.Get(8), n.Get (10));
279 NodeContainer n8n9 = NodeContainer (n.Get(8), n.Get (9));
280 NodeContainer n9n11 = NodeContainer (n.Get(9), n.Get (11));
281 NodeContainer n10n11 = NodeContainer (n.Get(10), n.Get (11));
282
284 internet.Install (n);
285
286 // Set Mobility for all nodes
288 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
289 mobility.Install(n);
290
291 // We create the channels first without any IP addressing information
292 NS_LOG_INFO ("Create channels.");
294 p2p.SetDeviceAttribute ("DataRate", StringValue ("50Mbps"));
295 p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
296
297 NetDeviceContainer d0d2 = p2p.Install (n0n2);
298 NetDeviceContainer d0d1 = p2p.Install (n0n1);
299 NetDeviceContainer d1d3 = p2p.Install (n1n3);
300 NetDeviceContainer d2d3 = p2p.Install (n2n3);
301
302 NetDeviceContainer d2d4 = p2p.Install (n2n4);
303 NetDeviceContainer d2d6 = p2p.Install (n2n6);
304 NetDeviceContainer d3d5 = p2p.Install (n3n5);
305 NetDeviceContainer d3d7 = p2p.Install (n3n7);
306
307 NetDeviceContainer d4d5 = p2p.Install (n4n5);
308 NetDeviceContainer d4d8 = p2p.Install (n4n8);
309 NetDeviceContainer d5d9 = p2p.Install (n5n9);
310 NetDeviceContainer d6d7 = p2p.Install (n6n7);
311 NetDeviceContainer d6d8 = p2p.Install (n6n8);
312 NetDeviceContainer d7d9 = p2p.Install (n7n9);
313
314 NetDeviceContainer d8d10 = p2p.Install (n8n10);
315 NetDeviceContainer d8d9 = p2p.Install (n8n9);
316 NetDeviceContainer d9d11 = p2p.Install (n9n11);
318
319 //
320 // We've got the "hardware" in place. Now we need to add IP addresses.
321 //
322 NS_LOG_INFO ("Assign IP Addresses.");
324
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");
333
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");
342
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");
355
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");
364
367
368 // install QKD Control the node 5 and 6
369 Ptr<QKDControl> controlSiteA = QLinkHelper.InstallQKDNController ( n.Get(12) );
370 Ptr<QKDControl> controlSiteB = QLinkHelper.InstallQKDNController ( n.Get(13) );
371 Ptr<QKDControl> controlSiteC = QLinkHelper.InstallQKDNController ( n.Get(14) );
372 Ptr<QKDControl> controlSiteD = QLinkHelper.InstallQKDNController ( n.Get(15) );
373 Ptr<QKDControl> controlSiteE = QLinkHelper.InstallQKDNController ( n.Get(16) );
374 Ptr<QKDControl> controlSiteF = QLinkHelper.InstallQKDNController ( n.Get(17) );
375 QLinkHelper.ConfigureQBuffers ( //Configure Q-Buffers
377 1024, //min_bits
378 1800, //thr_bits
379 500000000, //max_bits
380 512 //default key size in bits
381 );
382 QLinkHelper.ConfigureRSBuffers ( //Configure S-Buffers for relay (RBuffers)!
384 0, //min_bits
385 16000, //thr_bits
386 64000, //max_bits
387 512 //default key size in bits
388 );
389
390 // install KMs on nodes 3 and 4
391 QAHelper.InstallKeyManager(//Install key manager for site A
392 n.Get(1), //Node KM-A
393 i1i3.GetAddress(0), //IP address KM-A
394 80, //Port
395 controlSiteA //Assigned controller A
396 );
397 QAHelper.InstallKeyManager( //Install key manager for site B
398 n.Get(3), //Node KM-B
399 i1i3.GetAddress(1), //IP address KM-B
400 80, //Port
401 controlSiteB //Assigned controller B
402 );
403 QAHelper.InstallKeyManager(
404 n.Get(5),
405 i3i5.GetAddress(1),
406 80,
408 );
409 QAHelper.InstallKeyManager(
410 n.Get(7),
411 i3i7.GetAddress(1),
412 80,
414 );
415 QAHelper.InstallKeyManager(
416 n.Get(9),
417 i9i11.GetAddress(0),
418 80,
420 );
421 QAHelper.InstallKeyManager(
422 n.Get(11),
423 i9i11.GetAddress(1),
424 80,
426 );
427
428 NS_LOG_INFO ("Create Applications.");
429
430 std::cout << "QKDsiteA: " << n.Get(0)->GetId() << " IP address: " << i0i2.GetAddress(0) << std::endl;
431 std::cout << "QKDsiteB: " << n.Get(2)->GetId() << " IP address: " << i0i2.GetAddress(1) << std::endl;
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;
435 std::cout << "KMsiteC: " << n.Get(5)->GetId() << " IP address: " << i3i5.GetAddress(1) << std::endl;
436
439 QAHelper.InstallPostProcessing(
440 n.Get(0), //QKD module A
441 n.Get(2), //QKD module B
442 InetSocketAddress (i0i2.GetAddress(0), 102), //Address A
443 InetSocketAddress (i0i2.GetAddress(1), 102), //Address B
444 n.Get(12), //Controller-A
445 n.Get(13), //Controller-B
446 ppKeySize, //size of key to be added to QKD buffer
447 DataRate (ppKeyRate), //average QKD key rate
448 ppPacketSize, //average data packet size
449 DataRate (ppRate) //average data traffic rate
450 )
451 );
453 QAHelper.InstallPostProcessing(
454 n.Get(2),
455 n.Get(4),
456 InetSocketAddress (i2i4.GetAddress(0), 104),
457 InetSocketAddress (i2i4.GetAddress(1), 104),
458 n.Get(13),
459 n.Get(14),
460 ppKeySize,
464 )
465 );
467 QAHelper.InstallPostProcessing(
468 n.Get(2),
469 n.Get(6),
470 InetSocketAddress (i2i6.GetAddress(0), 106),
471 InetSocketAddress (i2i6.GetAddress(1), 106),
472 n.Get(13),
473 n.Get(15),
474 ppKeySize,
478 )
479 );
481 QAHelper.InstallPostProcessing(
482 n.Get(4),
483 n.Get(8),
484 InetSocketAddress (i4i8.GetAddress(0), 108),
485 InetSocketAddress (i4i8.GetAddress(1), 108),
486 n.Get(14),
487 n.Get(16),
488 ppKeySize,
489 DataRate (7000), //@testing relay errors, use different ppKeyRate: e.g., 7000
492 )
493 );
495 QAHelper.InstallPostProcessing(
496 n.Get(6),
497 n.Get(8),
498 InetSocketAddress (i6i8.GetAddress(0), 110),
499 InetSocketAddress (i6i8.GetAddress(1), 110),
500 n.Get(15),
501 n.Get(16),
502 ppKeySize,
506 )
507 );
509 QAHelper.InstallPostProcessing(
510 n.Get(8),
511 n.Get(10),
512 InetSocketAddress (i8i10.GetAddress(0), 112),
513 InetSocketAddress (i8i10.GetAddress(1), 112),
514 n.Get(16),
515 n.Get(17),
516 ppKeySize,
520 )
521 );
524
525
526 //Set default values for applications created below
527 Config::SetDefault ("ns3::QKDApp014::NumberOfKeyToFetchFromKMS", UintegerValue (numberOfKeyToFetchFromKMS));//Number of keys to obtain per request!
528 Config::SetDefault ("ns3::QKDApp014::AuthenticationType", UintegerValue (authenticationType)); //(0-unauthenticated, 1-VMAC, 2-MD5, 3-SHA1)
529 Config::SetDefault ("ns3::QKDApp014::EncryptionType", UintegerValue (encryptionType)); //(0-unencrypted, 1-OTP, 2-AES)
530 Config::SetDefault ("ns3::QKDApp014::AESLifetime", UintegerValue (aesLifetime));
531 Config::SetDefault ("ns3::QKDApp014::UseCrypto", UintegerValue (useCrypto));
532
533 uint16_t communicationPort = 8081;
536 QAHelper.InstallQKDApplication(
537 n.Get(0), //Source Node
538 n.Get(10), //Destination Node
539 InetSocketAddress (i0i2.GetAddress(0), communicationPort), //Source address
540 InetSocketAddress (i8i10.GetAddress(1), communicationPort), //Destination address
541 n.Get(12), //Controller 1
542 n.Get(17), //Controller 2
543 "tcp", //Connection type
544 appPacketSize, //Payload size
545 DataRate (appRate), //Data rate
546 "etsi014" //Application type
547 )
548 );
551
554 QLinkHelper.PopulateRoutingTables();
555 QLinkHelper.AddGraphs();
556
557 //////////////////////////////////////
558 //// STATISTICS
559 //////////////////////////////////////
560
561 //Connect Traces for QKD Cryptographic Applications
562 Config::Connect("/NodeList/*/ApplicationList/*/$ns3::QKDApp014/Tx", MakeCallback(&SentPacket));
563 Config::Connect("/NodeList/*/ApplicationList/*/$ns3::QKDApp014/Rx", MakeCallback(&ReceivedPacket));
564 Config::Connect("/NodeList/*/ApplicationList/*/$ns3::QKDApp014/Mx", MakeCallback(&MissedSendPacketCall));
565 Config::Connect("/NodeList/*/ApplicationList/*/$ns3::QKDApp014/TxSig", MakeCallback(&SentPacketSig));
566 Config::Connect("/NodeList/*/ApplicationList/*/$ns3::QKDApp014/RxSig", MakeCallback(&ReceivedPacketSig));
567 Config::Connect("/NodeList/*/ApplicationList/*/$ns3::QKDApp014/TxKMS", MakeCallback(&SentPacketToKMS));
568 Config::Connect("/NodeList/*/ApplicationList/*/$ns3::QKDApp014/RxKMS", MakeCallback(&ReceivedPacketFromKMS));
569
570 //Connect Traces for KM key statistics
571 Config::Connect("/NodeList/*/ApplicationList/*/$ns3::QKDKeyManagerSystemApplication/KeyServed", MakeCallback(&KeyServed));
572 Config::Connect("/NodeList/*/ApplicationList/*/$ns3::QKDKeyManagerSystemApplication/QKDKeyGenerated", MakeCallback(&KeyGenerated));
573
574 if(trace){
575 //if we need we can create pcap files
577 p2p.EnableAsciiAll (ascii.CreateFileStream ("qkd_secoqc.tr"));
578 p2p.EnablePcapAll ("qkd_secoqc");
579 AnimationInterface anim ("qkd_secoqc.xml"); // where "animation.xml" is any arbitrary filename
580 }
581
582 Simulator::Stop (Seconds (simulationTime));
584
585 //Finally print the graphs
586 QLinkHelper.PrintGraphs();
587
588 std::cout << "simTime:\t" << simulationTime << "\n";
589 std::cout << "appStartTime:\t" << appStartTime << "\n";
590 std::cout << "appStopTime:\t" << appStopTime << "\n";
591 std::cout << "qkdStartTime:\t" << qkdStartTime << "\n";
592 std::cout << "qkdStopTime:\t" << qkdStopTime << "\n";
593 std::cout << "encryptionType:\t" << encryptionType << "\n";
594 std::cout << "authenticationType:\t" << authenticationType << "\n";
595 std::cout << "aesLifetime:\t" << aesLifetime << "\n";
596 std::cout << "useCrypto:\t" << useCrypto << "\n";
597 std::cout << "trace:\t" << trace << "\n";
598
599 Ratio();
601}
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.
Definition data-rate.h:78
an Inet address class
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.
uint32_t GetId() const
Definition node.cc:106
static void EnablePrinting()
Enable printing packets metadata.
Definition packet.cc:585
static void Enable()
Enable the packet metadata.
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
A helper to make it easier to instantiate an ns3::QKDAppApplication on a set of nodes.
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().
Definition simulator.cc:131
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
Hold variables of type string.
Definition string.h:45
Hold an unsigned integer type.
Definition uinteger.h:34
void SentPacket(std::string context, const std::string &appId, Ptr< const Packet > p)
uint32_t showKeyAdded
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 Ratio()
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
uint32_t showKeyServed
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)
Definition config.cc:883
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:967
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1344
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...
Definition callback.h:684
mobility
Definition third.py:92