22 #include "ns3/address.h"
24 #include "ns3/nstime.h"
25 #include "ns3/simulator.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/trace-source-accessor.h"
32 #include "ns3/qkd-connection-register.h"
43 static TypeId tid =
TypeId (
"ns3::QKDConnectionRegister")
45 .SetGroupName (
"QKDConnectionRegister")
65 std::make_pair (rt.
GetId (), rt)
74 << i3->second.GetSrcSaeId()
75 << i3->second.GetDestinationSaeId()
76 << i3->second.GetType()
115 std::map<UUID, QKDApplicationEntry>::const_iterator i =
m_applications.find (
id);
124 i3->second.GetSrcSaeId() ==
id || i3->second.GetDestinationSaeId() ==
id
132 << i3->second.GetId()
133 << i3->second.GetSrcSaeId()
134 << i3->second.GetDestinationSaeId()
135 << i3->second.GetType()
157 (i3->second.GetSrcSaeId() == srcSaeId && i3->second.GetDestinationSaeId() == dstSaeId) ||
158 (i3->second.GetSrcSaeId() == dstSaeId && i3->second.GetDestinationSaeId() == srcSaeId)
159 ) && i3->second.GetType() == type
167 << i3->second.GetId()
168 << i3->second.GetSrcSaeId()
169 << i3->second.GetDestinationSaeId()
170 << i3->second.GetType()
181 UUID keyAssociationId,
189 if(i->second.GetId() == keyAssociationId){
210 (i->second.GetSourceNodeId() == srcNodeId && i->second.GetDestinationNodeId() == dstNodeId) ||
211 (i->second.GetSourceNodeId() == dstNodeId && i->second.GetDestinationNodeId() == srcNodeId)
229 std::map<double, QKDKeyAssociationLinkEntry> connectedLinks;
232 if( i->second.CheckSAEApplicationExists(appId) ) {
233 connectedLinks.insert(
234 std::make_pair(i->second.GetEffectiveSKR(), i->second)
241 if(connectedLinks.size()){
242 uint32_t counter = 1;
243 uint32_t random = rand() % connectedLinks.size();
244 for (std::map<double, QKDKeyAssociationLinkEntry>::iterator i = connectedLinks.begin (); i != connectedLinks.end (); ++i)
246 if(counter == random){
268 std::map<double, QKDKeyAssociationLinkEntry> connectedLinks;
271 NS_LOG_FUNCTION(
this <<
"Assigned keyAssociationId:" << i->second.GetId().string());
288 if(i->second.GetId() == rt.
GetId()){
303 i->second.PrintSAEApplications();
312 bool keyAssociationFound =
false;
315 if(i->second.GetId() == keyAssociationId){
316 i->second.UpdateQKDApplications(appId);
317 i->second.PrintRegistryInfo();
318 i->second.PrintSAEApplications();
319 keyAssociationFound =
true;
322 if(!keyAssociationFound){
323 NS_LOG_FUNCTION(
this <<
"No key association found with id " << keyAssociationId);
A base class which provides memory management and object aggregation.
Introspection did not find any typical Config paths.
ConnectionType
The connection types.
UUID GetId()
Get the application identifier.
QKDConnectionRegister is a class used to keep details about distant QKD links and applications.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID for the instance.
static TypeId GetTypeId(void)
Get the type ID.
bool LookupKeyAssociationByApplicationId(UUID saeId, QKDKeyAssociationLinkEntry &rt)
Lookup the key association entry with the application identifier (UUID).
QKDConnectionRegister()
Constructor.
void PrintListOfAllKeyAssociations()
Print the key association list.
bool AddApplicationEntry(QKDApplicationEntry &r)
Add the QKD application entry if it doesn't yet exist in the table.
bool LookupKeyAssociationByDestinationNodeId(uint32_t srcNodeId, uint32_t dstNodeId, QKDKeyAssociationLinkEntry &rt)
Lookup the key association entry with the source and destination identifiers.
std::map< UUID, QKDApplicationEntry > m_applications
The list of applications.
bool SaveKeyAssociation(QKDKeyAssociationLinkEntry &rt)
Store the key association entry.
bool LookupKeyAssociationById(UUID keyAssociationId, QKDKeyAssociationLinkEntry &rt)
Lookup the key association entry with destination node identifier.
bool LookupApplication(UUID dstSaeId, QKDApplicationEntry &rt)
Lookup the application entry with the destination (receiver) application identifier (UUID).
std::map< uint32_t, QKDKeyAssociationLinkEntry > m_keyAssociations
The list of key associations.
bool DeleteKeyAssociationLinkEntry(uint32_t dst)
Delete the key association table entry with a given destination, if it exists.
bool AssignKeyAssociation(UUID srcSaeId, UUID dstSaeId, std::string type, uint32_t priority, QKDKeyAssociationLinkEntry &rt)
Assign the key association.
bool DeleteApplicationEntry(UUID dst)
Delete the application entry, if it exists.
void UpdateQKDApplications(UUID keyAssociationId, UUID saeId)
Update the key association list of QKD applications.
bool LookupApplicationBySaeIDsAndType(UUID srcSaeId, UUID dstSaeId, QKDApplicationEntry::ConnectionType type, QKDApplicationEntry &rt)
Lookup the application entry with the application identifiers and the connection type.
bool AddKeyAssociationEntry(QKDKeyAssociationLinkEntry &r)
Add the key association entry if it doesn't yet exist in the table.
Introspection did not find any typical Config paths.
uint32_t GetDestinationNodeId()
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Universally unique identifier (UUID)
std::string string() const
Get string from the current UUID in format "00000000-0000-0000-0000-000000000000".
#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 ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.