33 #include "ns3/core-module.h"
34 #include "ns3/applications-module.h"
35 #include "ns3/internet-module.h"
36 #include "ns3/flow-monitor-module.h"
37 #include "ns3/mobility-module.h"
38 #include "ns3/point-to-point-module.h"
39 #include "ns3/gnuplot.h"
41 #include "ns3/qkd-link-helper.h"
42 #include "ns3/qkd-app-helper.h"
43 #include "ns3/qkd-app.h"
45 #include "ns3/olsr-module.h"
46 #include "ns3/dsdv-module.h"
48 #include "ns3/network-module.h"
49 #include "ns3/fd-net-device-module.h"
50 #include "ns3/internet-apps-module.h"
52 #include "ns3/netanim-module.h"
83 <<
"\nSent (Packets):\t" << m_packets_sent
91 int main (
int argc,
char *argv[])
115 positionAlloc ->Add(Vector(0, 200, 0));
116 positionAlloc ->Add(Vector(200, 200, 0));
117 positionAlloc ->Add(Vector(400, 200, 0));
118 mobility.SetPositionAllocator(positionAlloc);
119 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
137 ipv4.SetBase (
"10.1.1.0",
"255.255.255.0");
140 ipv4.SetBase (
"10.1.2.0",
"255.255.255.0");
171 postprocessingApplications.
Add(
189 uint16_t communicationPort = 8081;
202 appAlice->SetStartTime (
Seconds (20.));
203 appAlice->SetStopTime (
Seconds (300.));
205 appAlice->SetAttribute(
"NumberOfKeyToFetchFromKMS",
UintegerValue (3));
232 appBob->SetStartTime (
Seconds (18.));
233 appBob->SetStopTime (
Seconds (300.));
239 std::cout <<
"\t SrcNode: " << n.
Get(0)->
GetId() <<
" Source IP address: " << i0i1.
GetAddress(0) << std::endl;
240 std::cout <<
"\t DstNode: " << n.
Get(2)->
GetId() <<
" Destination IP address: " <<
i1i2.
GetAddress(1) << std::endl;
251 p2p.EnablePcapAll (
"qkd_channel_test");
NodeContainer n1n2
Nodecontainer n1 + n2.
Ipv4InterfaceContainer i1i2
IPv4 interface container i1 + i2.
a polymophic address class
Interface to network animator.
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
Manage ASCII trace files for device models.
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
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.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
static void EnablePrinting()
Enable printing packets metadata.
Build a set of PointToPointNetDevice objects.
A helper to make it easier to instantiate an ns3::QKDAppApplication on a set of nodes.
ApplicationContainer InstallPostProcessing(Ptr< Node > node1, Ptr< Node > node2, Address masterAddress, Address slaveAddress, Address masterKMSAddress, Address slaveKMSAddress, uint32_t keySizeInBits, DataRate keyRate, uint32_t packetSize, DataRate dataRate)
Install an ns3::QKDPostprocessingApplication on the node configured with all the attributes set with ...
Ptr< QKDKeyManagerSystemApplication > InstallKMS(Ptr< Node > node, Ipv4Address kmsAddress) const
Install an ns3::QKDKeyManagmentSystem on the node configured with all the attributes set with SetAttr...
Build a set of QKDNetDevice objects such as QKD buffers QKD encryptors and QKD graphs.
void AddGraph(Ptr< Node > src, Ptr< Node > dst)
Add a graph.
Ptr< QKDControl > InstallQKDControl(Ptr< Node > node)
Install the QKD control on a node.
void PrintGraphs()
Print graphs.
std::string CreateQKDLink(Ptr< QKDControl > control, Ptr< Node > alice, Ptr< Node > bob, Ptr< Node > aliceKMS, Ptr< Node > bobKMS, uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurrent)
Create a QKD link.
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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
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.
uint32_t m_bytes_received
void SentPacket(std::string context, Ptr< const Packet > p)
void Ratio(uint32_t m_bytes_sent, uint32_t m_packets_sent)
uint32_t m_packets_received
void ReceivedPacket(std::string context, Ptr< const Packet > p, const Address &addr)