A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
qkd-link-helper.h
Go to the documentation of this file.
1/*
2 * Copyright(c) 2020 DOTFEESA www.tk.etf.unsa.ba
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 *
7 *
8 * Author: Miralem Mehic <miralem.mehic@ieee.org>
9 */
10
11#ifndef QKD_HELPER_H
12#define QKD_HELPER_H
13
14#include <string>
15#include <queue>
16
17#include "ns3/object-factory.h"
18#include "ns3/net-device-container.h"
19#include "ns3/node-container.h"
20#include "ns3/trace-helper.h"
21#include "ns3/ipv4-interface-address.h"
22#include "ns3/core-module.h"
23#include "ns3/network-module.h"
24#include "ns3/internet-module.h"
25
26//#include "ns3/qkd-control.h"
27#include "ns3/qcen-control.h"
29#include "ns3/qkd-graph-manager.h"
30
31namespace ns3 {
32
33class NetDevice;
34class Node;
35
36/**
37 * @ingroup qkd
38 * @class QKDLinkHelper
39 * @brief Build a set of QKDNetDevice objects such as QKD buffers
40 * QKD encryptors and QKD graphs.
41 *
42 */
44{
45public:
46
47 /**
48 * Create a QKDLinkHelper to make life easier when creating point to
49 * point networks.
50 */
52 virtual ~QKDLinkHelper() {}
53
54 void AddGraphs();
55
56 void AddGraph(Ptr<Node> src, Ptr<Node> dst);
57
58 void AddGraph(Ptr<Node> src, Ptr<Node> dst, std::string graphName);
59
60 void AddGraph(Ptr<Node> src, Ptr<Node> dst, std::string graphName, std::string graphType);
61
62 void PrintGraphs();
63
64 /**
65 * @brief Install QKDN controller on node
66 * @param node smart pointer on node
67 * @return Ptr<QKDControl> smart pointer on QKDN controller
68 */
70 //QKDControlContainer InstallQKDNController(NodeContainer& n);
71
73
75
77
78 /**
79 * @brief Configure all Q buffers(default conf). Mandatory function!
80 * @param controllers vector of all QKDN controllers
81 * @param Mmin minimum amount(bits) of key material QKD buffer should maintain
82 * @param Mmax maximum amount(bits) of key material QKD buffer can store
83 * @param Mthr thresold amount(bits) of key material
84 * @param Mcurr current amount(bits) of key material QKD buffer maintain
85 * @param defaultKeysize default size of stored keys
86 */
88 std::vector<Ptr<QKDControl> > controllers,
94 );
95
96 /**
97 * @brief Configure all Q buffers(default conf). Mandatory function!
98 * @param controllers vector of all QKDN controllers
99 * @param Mmin minimum amount(bits) of key material QKD buffer should maintain
100 * @param Mthr thresold amount(bits) of key material
101 * @param Mmax maximum amount(bits) of key material QKD buffer can store
102 */
104 std::vector<Ptr<QKDControl> > controllers,
109 );
110
112 std::vector<Ptr<QKDControl> > controllers,
118 );
119
121 std::vector<Ptr<QKDControl> > controllers,
126 );
127
129
130 /**
131 * @brief create an object from its TypeId and aggregates it to the node
132 * @param node the node
133 * @param typeId the object TypeId
134 */
135 static void CreateAndAggregateObjectFromTypeId(Ptr<Node> node, const std::string typeId);
136
137private:
138
139 // map KMNodeId -> internal index (0..N-1)
140 std::unordered_map<uint32_t, uint32_t> m_kmNodeIdToIndex;
141 // vector index -> KMNodeId (reverse mapping)
142 std::vector<uint32_t> m_indexToKmNodeId;
143
145
147
148 std::vector< std::pair<uint32_t, uint32_t> > DijkstraSP(
149 std::vector< std::vector<std::pair<uint32_t, uint32_t> > > adjList,
150 uint32_t start
151 );
152
153 Ptr<QCenController> m_cen_controller; //!< Centralized control for rerouting.
154
155 std::map<uint32_t, Ptr<QKDControl> > m_controllers; //<! a pair of KMNodeId and respective QKDControl
156
157 std::vector< std::vector<std::pair<uint32_t, uint32_t> > > m_adjList; //<! adjecent List, used for dijkstraSP!
158
160
161};
162} // namespace ns3
163
164#endif /* QKD_HELPER_H */
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.