13#include "ns3/simulator.h"
15#include "ns3/config.h"
16#include "ns3/packet.h"
17#include "ns3/object.h"
19#include "ns3/internet-module.h"
20#include "ns3/random-variable-stream.h"
21#include "ns3/trace-helper.h"
22#include "ns3/traffic-control-module.h"
45 std::cout <<
"ADD GRAPHS! " << std::endl;
52 for(
uint32_t i = 0;
i < node->GetNApplications(); ++
i)
63 std::vector<Ptr<QBuffer> >
Qbuffers =
kms->GetQBuffersVector();
67 NS_LOG_FUNCTION(
this << buffer << buffer->GetState() << buffer->GetIndex() );
69 uint32_t dstNodeId = buffer->GetRemoteNodeId();
74 buffer->GetInstanceTypeId().GetName() ==
"ns3::SBuffer"
81 std::ostringstream
temp1;
82 temp1 <<
"SBUFFER (LOCAL) between " << node->GetId() <<
" and " <<
dstKmsNode->GetId();
87 std::ostringstream
temp1;
88 temp1 <<
"SBUFFER (RELAY) between " << node->GetId() <<
" and " <<
dstKmsNode->GetId();
92 std::ostringstream
temp1;
93 temp1 <<
"SBUFFER (STREAM) between " << node->GetId() <<
" and " <<
dstKmsNode->GetId();
107 buffer->GetSrcKMSApplicationIndex(),
176 NS_LOG_FUNCTION(
this << buffer << buffer->GetState() << buffer->GetIndex() );
204 controller->SetNode(n);
205 n->AggregateObject(controller);
220 controller->SetNode(node);
221 node->AggregateObject(controller);
289 node->AggregateObject(protocol);
298 if(
el.first == nodeId)
325 std::vector<std::pair<uint32_t, uint32_t> >
row;
363std::vector< std::pair<uint32_t, uint32_t> >
365 std::vector< std::vector<std::pair<uint32_t, uint32_t> > >
adjList,
368 std::vector<std::pair<uint32_t, uint32_t> >
dist;
372 for(
int i = 0;
i < n;
i++)
378 std::priority_queue<std::pair<int, int>, std::vector< std::pair<int, int> >, std::greater<std::pair<int, int> > >
pq;
381 pq.push(std::make_pair(
int(start), 0));
385 while(
pq.empty() ==
false)
388 int u =
pq.top().first;
423 std::vector<std::pair<uint32_t, uint32_t> >
dist;
431 std::vector<uint32_t> path;
Ipv4 addresses are stored in host order in this class.
static uint32_t GetNNodes()
static Ptr< Node > GetNode(uint32_t n)
Instantiate subclasses of ns3::Object.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
QCenController is a centralized controller used for re-routing.
As described in OPENQKD deliverable D6.1(section 5), the QKD control is a network component with the ...
static QKDGraphManager * getInstance()
Signelton getInstance function.
void PrintGraphs()
Print graphs.
void CreateGraphForBuffer(Ptr< Node > srcKMSNode, Ptr< Node > dstKMSNode, uint32_t bufferID, uint32_t srcKMSApplicationIndex, std::string graphName, std::string graphType, Ptr< QBuffer > buff)
Connect new QBuffer/Sbuffer to QKDTotalGraph.
QKDNetSim implements Key Management System(KMS) as an application that listens on TCP port 80.
void ConfigureRSBuffers(std::vector< Ptr< QKDControl > > controllers, uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurr, uint32_t defaultKeySize)
uint32_t GetColumn(uint32_t nodeId)
void AddGraph(Ptr< Node > src, Ptr< Node > dst)
ADD QKDGraph.
Ptr< QCenController > m_cen_controller
Centralized control for rerouting.
std::map< uint32_t, Ptr< QKDControl > > m_controllers
void PrintGraphs()
Print QKDGraphs.
std::vector< std::vector< std::pair< uint32_t, uint32_t > > > m_adjList
void AddGraphs()
ADD QKDGraph.
uint32_t ReverseColumn(uint32_t position)
Ptr< QKDControl > InstallQKDNController(Ptr< Node > node)
Install QKDN controller on node.
std::vector< std::pair< uint32_t, uint32_t > > DijkstraSP(std::vector< std::vector< std::pair< uint32_t, uint32_t > > > adjList, uint32_t start)
void CreateTopologyGraph(std::vector< Ptr< QKDControl > > controllers, uint32_t reroute=0)
static void CreateAndAggregateObjectFromTypeId(Ptr< Node > node, const std::string typeId)
create an object from its TypeId and aggregates it to the node
void PopulateRoutingTables()
QKDLinkHelper()
Create a QKDLinkHelper to make life easier when creating point to point networks.
Ptr< QCenController > InstallQCenController(Ptr< Node > node)
void ConfigureQBuffers(std::vector< Ptr< QKDControl > > controllers, uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurr, uint32_t defaultKeySize)
Configure all Q buffers(default conf).
Introspection did not find any typical Config paths.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#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 ",...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.