A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
qkd-location-register.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: Emir Dervisevic <emir.dervisevic@etf.unsa.ba>
9 * Miralem Mehic <miralem.mehic@ieee.org>
10 */
11#ifndef QKD_LOCATION_REGISTER_H
12#define QKD_LOCATION_REGISTER_H
13
14#include "ns3/event-id.h"
15#include "ns3/ptr.h"
16#include "ns3/data-rate.h"
17#include "ns3/traced-callback.h"
18#include "ns3/output-stream-wrapper.h"
19#include "ns3/packet.h"
20#include "ns3/object.h"
21#include "ns3/traced-value.h"
22#include "ns3/trace-source-accessor.h"
23#include "ns3/node.h"
24#include "ns3/core-module.h"
25#include "ns3/log.h"
26#include "ns3/socket.h"
27
29#include "qkd-control.h"
30
31#include <map>
32#include <iostream>
33#include <sstream>
34
35namespace ns3 {
36
37class QKDControl;
38class QKDLocationRegisterEntry;
39
40/**
41 * @ingroup applications
42 * @class QKDLocationRegister
43 * @brief QKDLocationRegister is a class used to
44 * keep details about distant QKD nodes and their connectivity.
45 *
46 * @note QKDNetSim KMS implements a location register table that is used
47 * to define paths to distant node. It is a early version of routing table
48 * that will be updated via routing protocol.
49 */
50
52{
53 public:
54
55 /**
56 * @brief Get the type ID.
57 * @return the object TypeId
58 */
59 static TypeId GetTypeId();
60
61 /**
62 * @brief Get the type ID for the instance
63 * @return the instance TypeId
64 */
65 TypeId GetInstanceTypeId() const override;
66
67 /// c-tor
69
71 /**
72 * Add location table entry if it doesn't yet exist in location table
73 * @param r location table entry
74 * @return true in success
75 */
76 bool
78 /**
79 * Delete location table entry with destination address dst, if it exists.
80 * @param dst destination address
81 * @return true on success
82 */
83 bool
85 /**
86 * Lookup location table entry with destination address dst
87 * @param dst destination application ID
88 * @param rt entry with destination address dst, if exists
89 * @return true on success
90 */
91 bool
93 /**
94 * Lookup location table entry with destination address dst KMS Id
95 * @Ipv4Address destination KMS Ipv4Address
96 * @param rt entry with destination address dst, if exists
97 * @return true on success
98 */
99 bool
101 /**
102 * Lookup list of addresses for which nxtHp is the next Hop address
103 * @param nxtHp nexthop's address for which we want the list of destinations
104 * @param dstList is the list that will hold all these destination addresses
105 */
106 void
107 GetListOfDestinationWithNextHop(uint32_t nxtHp, std::map<uint32_t, QKDLocationRegisterEntry> & dstList);
108 /**
109 * Lookup list of all addresses in the location table
110 * @param allRoutes is the list that will hold all these addresses present in the nodes location table
111 */
112 void
113 GetListOfAllEntries(std::map<uint32_t, QKDLocationRegisterEntry> & allRoutes);
114 /**
115 * Print location table
116 * @param stream the output stream
117 */
118 void
120 /**
121 * Provides the number of routes present in that nodes location table.
122 * @returns the number of routes
123 */
124 uint32_t GetSize();
125
127
128 void SetNode(Ptr<Node> n) { m_node = n; m_id = n->GetId(); }
129
131
132 void SetAddress(Ipv4Address addr) { m_address = addr; }
133
134 private:
135
137
138 std::vector< std::pair<uint32_t, uint32_t> > DijkstraSP(
139 uint32_t start
140 );
141
142 std::map<uint32_t, QKDLocationRegisterEntry> m_locationEntites;
143
145
146 std::vector<std::pair<uint32_t, uint32_t> > m_adjList; //<! adjecent List, used for dijkstraSP! It is a topology graph!
147
148 std::map<uint32_t, Ptr<QKDControl> > m_controllers; //<! a pair of KMNodeId and respective QKDControl
149
151
153};
154
155} // namespace ns3
156
157#endif /* QKD_LOCATION_REGISTER_H */
158
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
Introspection did not find any typical Config paths.
QKDLocationRegister is a class used to keep details about distant QKD nodes and their connectivity.
void GetListOfDestinationWithNextHop(uint32_t nxtHp, std::map< uint32_t, QKDLocationRegisterEntry > &dstList)
Lookup list of addresses for which nxtHp is the next Hop address.
void Print(Ptr< OutputStreamWrapper > stream) const
Print location table.
bool Lookup(uint32_t dstSaeId, QKDLocationRegisterEntry &rt)
Lookup location table entry with destination address dst.
std::map< uint32_t, QKDLocationRegisterEntry > m_locationEntites
std::map< uint32_t, Ptr< QKDControl > > m_controllers
void SetAddress(Ipv4Address addr)
bool AddEntry(QKDLocationRegisterEntry &r)
Add location table entry if it doesn't yet exist in location table.
TypeId GetInstanceTypeId() const override
Get the type ID for the instance.
bool DeleteEntry(uint32_t dst)
Delete location table entry with destination address dst, if it exists.
std::vector< std::pair< uint32_t, uint32_t > > DijkstraSP(uint32_t start)
std::vector< std::pair< uint32_t, uint32_t > > m_adjList
bool LookupByKms(Ipv4Address dstKmsId, QKDLocationRegisterEntry &rt)
Lookup location table entry with destination address dst KMS Id @Ipv4Address destination KMS Ipv4Addr...
static TypeId GetTypeId()
Get the type ID.
void GetListOfAllEntries(std::map< uint32_t, QKDLocationRegisterEntry > &allRoutes)
Lookup list of all addresses in the location table.
uint32_t GetSize()
Provides the number of routes present in that nodes location table.
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.