A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
qkd-control.h
Go to the documentation of this file.
1/*
2 * Copyright(c) 2022 DOTFEESA www.tk.etf.unsa.ba
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 *
7 *
8 * Authors: Emir Dervisevic <emir.dervisevic@etf.unsa.ba>
9 * Miralem Mehic <miralem.mehic@ieee.org>
10 */
11
12#ifndef QKDCONTROL_H
13#define QKDCONTROL_H
14
15#include <queue>
16#include <vector>
17#include <map>
18#include <string>
19
20#include "ns3/packet.h"
21#include "ns3/object.h"
22#include "ns3/ipv4-header.h"
23#include "ns3/traced-value.h"
24#include "ns3/trace-source-accessor.h"
25#include "ns3/event-id.h"
26#include "qkd-key.h"
27#include "ns3/node.h"
28#include "ns3/qkd-key-manager-system-application.h"
29
30#include "ns3/tag.h"
31#include "ns3/net-device.h"
32#include "ns3/traffic-control-layer.h"
33
34#include "qkd-encryptor.h"
35#include "q-buffer.h"
36#include "s-buffer.h"
37
38#include "ns3/object-factory.h"
39#include "ns3/core-module.h"
40#include "ns3/network-module.h"
41#include "ns3/internet-module.h"
42#include "ns3/ipv4-interface-address.h"
43
44namespace ns3 {
45
46 class QKDKeyManagerSystemApplication;
47 class QKDLocationRegisterEntry;
48 class QKDLocationRegister;
49 /**
50 * @ingroup qkd
51 * @class QKDControl
52 *
53 * @brief As described in OPENQKD deliverable D6.1(section 5),
54 * the QKD control is a network component with the knowledge of the
55 * network status. It should perform network management through distributed
56 * protocols or centralized entities.
57 *
58 * @note In the current version of QKDNetSim, QKDControl can be installed
59 * on an independent node without a direct QKD connection. It is in charge
60 * of establishing QKD links, and it contains a list of QKD links with
61 * associated QKD buffers implemented in a QKD network.
62 */
63 class QKDControl : public Object
64 {
65 public:
66
67 /**
68 * Describes QKD modules at site
69 */
79
89
90 /**
91 * @brief Get the type ID.
92 * @return the object TypeId
93 */
94 static TypeId GetTypeId();
95
96 /**
97 * @brief Get the type ID for the instance
98 * @return the instance TypeId
99 */
100 TypeId GetInstanceTypeId() const override;
101
102 /**
103 * @brief Constructor
104 */
105 QKDControl();
106
107 /**
108 * @brief Destructor
109 */
110 ~QKDControl() override;
111
112 /**
113 * Destroy a QKDControl
114 *
115 * This is the pre-destructor function of the QKDControl.
116 */
117 void Dispose();
118
119 /**
120 * @brief Return QKDQBuffer for plotting
121 * @param Ptr<Node> src, Ptr<Node> dst
122 * @return Ptr<QBuffer>
123 */
125
126 Ptr<Node> GetNode() const;
127
128 void SetNode(Ptr<Node>);
129
130 /**
131 * @brief Assign key manager
132 * @param n key manager's node
133 */
135
136 /**
137 * @brief Get Key Manager System Application from node
138 * @param n node
139 * @return key manager system application
140 */
142
144
146
147 std::string GetLocalKMId() const;
148
150
151 std::vector<uint32_t> GetRemoteKmNodeIds() const;
152
153 /**
154 * @brief Register QKD Module / PP application pair
155 * @param moduleLocal local QKD module node
156 * @param moduleRemote remote QKD module node
157 * @param idLocal local QKD module ID
158 * @param idRemote remote QKD module ID
159 * @param kmLocal local key manager node
160 * @param kmRemote remote key manager node
161 */
165 std::string idLocal,
166 std::string idRemote,
169 );
170
171 /**
172 * @brief register a pair of QKD applications
173 * @param localAppId ID of local QKD application
174 * @param remoteAppId ID of remote QKD application
175 * @param remoteKmNode remote KM node
176 */
178 std::string localAppId,
179 std::string remoteAppId,
180 Ptr<Node> remoteKmNode
181 );
182
183 /**
184 * @brief Get local application ID based on the remote application ID
185 * @param peerAppId remote application ID
186 * @return string local application ID
187 */
188 std::string GetApplicationId(std::string peerAppId);
189
190 /**
191 * @brief Configure all buffers(default conf). Mandatory function!
192 * @param Mmin minimum amount(bits) of key material QKD buffer should maintain
193 * @param Mmax maximum amount(bits) of key material QKD buffer can store
194 * @param Mthr thresold amount(bits) of key material
195 * @param Mcurr current amount(bits) of key material QKD buffer maintain
196 * @param defaultKeySize default size of stored keys
197 */
204 ); //add intance of same function with input remoteKM -> configure this buffer connection, and one with vector<KMs>
205
212 );
213
215
217
218 void ClearRoutingTable();
219
221
223
225
226
227 protected:
228 /**
229 * The dispose method. Subclasses must override this method
230 * and must chain up to it by calling Node::DoDispose at the
231 * end of their own DoDispose method.
232 */
233 void DoDispose() override;
234
235 /**
236 * @briefInitialization function
237 */
238 void DoInitialize() override;
239
240 private:
241
242
244
245 std::vector<Ptr<Node> > m_remote_km_nodes; //!< Remote Key Manager Node(s)(direct QKD connection!)
246
247 std::vector<QKDModule> m_qkd_modules; //!< Registered QKD modules
248
249 //std::vector<Ptr<QKDControl> > m_conn_qkdn_controllers; //!< Connecting QKDN controllers
250
251 Ptr<QBuffer> m_qbuffer_config; //!< Default QKD buffer configuration
252
254
255 std::map<uint32_t, Ptr<QBuffer> > m_qbuffers_conf; //!< Dedicaded QKD buffer configuration
256
257 std::vector<std::string> m_local_qkdapps; //!< Vector of all the apps(IDs) connecting to local KM node
258
259 std::map<std::string, std::string> m_qkdapp_pairs; //!<QKDapp pair(remoteApp, localApp)
260
261 std::map<std::string, uint32_t > m_remote_qkdapps; //!< All remote apps(IDs) and their KM nodes(must keep nodes to get remote KM address in QKD network)
262
264
265 };
266}
267// namespace ns3
268
269#endif /* QKDCONTROL_H */
Ipv4 addresses are stored in host order in this class.
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
As described in OPENQKD deliverable D6.1(section 5), the QKD control is a network component with the ...
Definition qkd-control.h:64
void AssignKeyManager(Ptr< Node > n)
Assign key manager.
Ptr< Node > m_node
Ptr< QBuffer > GetQBufferConf(uint32_t remoteId)
void AddRouteEntry(QKDLocationRegisterEntry entry)
Ipv4Address GetLocalKMAddress() const
void DoInitialize() override
@briefInitialization function
void RegisterQKDModulePair(Ptr< Node > moduleLocal, Ptr< Node > moduleRemote, std::string idLocal, std::string idRemote, Ptr< Node > kmLocal, Ptr< Node > kmRemote)
Register QKD Module / PP application pair.
TypeId GetInstanceTypeId() const override
Get the type ID for the instance.
void Dispose()
Destroy a QKDControl.
std::vector< uint32_t > GetRemoteKmNodeIds() const
~QKDControl() override
Destructor.
static TypeId GetTypeId()
Get the type ID.
Ptr< QBuffer > m_rsbuffer_config
void ClearRoutingTable()
Ptr< QBuffer > m_qbuffer_config
Default QKD buffer configuration.
std::vector< std::string > m_local_qkdapps
Vector of all the apps(IDs) connecting to local KM node.
Ptr< QBuffer > GetBufferByDestinationNode(Ptr< Node >, Ptr< Node >)
Return QKDQBuffer for plotting.
std::string GetApplicationId(std::string peerAppId)
Get local application ID based on the remote application ID.
std::vector< Ptr< Node > > m_remote_km_nodes
Remote Key Manager Node(s)(direct QKD connection!)
Ptr< QKDLocationRegister > m_routingTable
Routing Table.
std::map< uint32_t, Ptr< QBuffer > > m_qbuffers_conf
Dedicaded QKD buffer configuration.
Ptr< Node > GetLocalKMNode() const
std::map< std::string, uint32_t > m_remote_qkdapps
All remote apps(IDs) and their KM nodes(must keep nodes to get remote KM address in QKD network)
Ptr< Node > GetNode() const
std::vector< QKDModule > m_qkd_modules
Registered QKD modules.
QKDLocationRegisterEntry GetRoute(std::string remoteAppId)
void SetNode(Ptr< Node >)
Ptr< QKDKeyManagerSystemApplication > GetKeyManagerSystemApplication(Ptr< Node > n) const
Get Key Manager System Application from node.
QKDControl()
Constructor.
void DoDispose() override
The dispose method.
void RegisterQKDApplicationPair(std::string localAppId, std::string remoteAppId, Ptr< Node > remoteKmNode)
register a pair of QKD applications
void ConfigureQBuffers(uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurr, uint32_t defaultKeySize)
Configure all buffers(default conf).
uint32_t GetLocalKMNodeId() const
std::string GetLocalKMId() const
Ptr< SBuffer > CreateRSBuffer(uint32_t remoteId)
std::map< std::string, std::string > m_qkdapp_pairs
QKDapp pair(remoteApp, localApp)
void ConfigureRSBuffers(uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurr, uint32_t defaultKeySize)
Introspection did not find any typical Config paths.
a unique identifier for an interface.
Definition type-id.h:49
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.
Describes QKD modules at site.
Definition qkd-control.h:71