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;
Ipv4InterfaceContainer i1i2
a polymophic address class
Interface to network animator.
holds a vector of ns3::Application pointers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
void EnableAsciiAll(std::string prefix)
Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes c...
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.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
static void PopulateRoutingTables(void)
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(void) const
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
static void EnablePrinting(void)
Enable printing packets metadata.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void EnablePcapAll(std::string prefix, bool promiscuous=false)
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created ...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
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 Stop(void)
Tell the Simulator the calling event should be the last one executed.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
static void Run(void)
Run the simulation.
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.
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)