16#include "ns3/packet.h"
17#include "ns3/object.h"
18#include "ns3/ipv4-header.h"
19#include "ns3/traced-value.h"
20#include "ns3/trace-source-accessor.h"
21#include "ns3/event-id.h"
26#include <unordered_map>
383 std::unordered_map< std::string, Ptr <QKDKey> >
m_keys;
An identifier for simulation events.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
Qbuffer is a secure storage for QKD keys.
void Dispose()
destroy a QBuffer
virtual void Configure(uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurrent, uint32_t defaultKeySize)
create QKD buffer configuration
static const uint32_t QSTATUS_WARNING
QStatus WARNING.
uint32_t m_thresholdKeyBit
uint32_t GetMaxNumberOfRecordedKeyChargingTimePeriods() const
Return the maximal number of values which are used for calculation of average key charging time perio...
void SetIndex(uint32_t)
Set the index of the buffer per local node.
uint32_t m_recalculateTimePeriod
The period of time(in seconds) to calculate average amount of the key in the buffer Default value 5 -...
void SetDescription(std::string val)
TracedCallback< uint32_t > m_currentKeyBitDecreaseTrace
bool operator==(QBuffer const &o) const
Assign operator.
uint32_t m_noEntry
Help value used for graph ploting.
void SetMthr(uint32_t thr)
Set the threshold value of QKD storage.
uint32_t m_maxNumberOfRecordedKeyChargingTimePeriods
The maximal number of values which are used for stored for calculation of average key charging time p...
TracedCallback< uint32_t > m_currentKeyBitIncreaseTrace
uint32_t m_nextKeyID
ID of the next key to be generated.
uint32_t GetSrcKMSApplicationIndex() const
void Init(uint32_t dstKmNodeId, uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurrent, uint32_t defaultKeySize)
initialize QBuffer
static const uint32_t QSTATUS_CHARGING
QStatus CHARGING.
int64_t GetLastKeyChargingTimeDuration()
Return time value about the time duration of last key charging process.
uint32_t m_period
Help value used for graph ploting.
QBuffer()
QBuffer constructor.
std::unordered_map< std::string, Ptr< QKDKey > > m_keys
key database
static const uint32_t QSTATUS_READY
QStatus READY.
void SetKeySize(uint32_t size)
Set default key size.
bool m_isRisingCurve
whether curve on graph is rising or not
std::string m_description
uint32_t GetKeySize() const
Get default size of keys stored in QBuffer.
uint32_t m_currentKeyBit
The current amount of key material in QKD key storage.
std::vector< struct QBuffer::data > m_previousValues
Help vector used for graph ploting.
std::vector< int64_t > m_chargingTimePeriods
Vector of durations of several last charging time periods.
uint32_t GetMthr() const
Get the threshold value of QKD storage The threshold value Mthr(t) at the time of measurement t is us...
uint32_t m_bitsUsedInTimePeriod
Help value used for detection of average key usage.
static TypeId GetTypeId()
Get the TypeId.
uint32_t m_srcKMSApplicationIndex
int64_t m_lastKeyChargingTimeDuration
The timestamp of last key usage.
uint32_t m_bitsChargedInTimePeriod
Help value used for graph ploting and calculation of average post-processing duration.
TracedCallback< double > m_CMetricChangeTrace
virtual Ptr< QKDKey > GetKey(std::string keyID="", bool fireTraces=true)
get key from QBuffer
virtual uint32_t GetBitCount() const
get amount of stored key material in bits
double GetAverageKeyChargingTimePeriod()
Return average duration of key charging process in the long run.
double m_c
average amount of key in the buffer during the recalculate time period
uint32_t m_status
The state of the Net Device transmit state machine.
void SetSrcKMSApplicationIndex(uint32_t &value)
TracedCallback< Ptr< QKDKey > > m_newKeyAddedTrace
uint32_t GetId() const
Get the QKD Storage/Buffer ID.
uint32_t GetIndex()
Get the index of the buffer per local node.
std::string GetDescription() const
int64_t m_lastKeyChargingTimeStamp
The timestamp of last key charging(when the new key material was added)
void SetRemoteNodeId(uint32_t value)
Set the index of the remote node id.
uint32_t m_bufferID
unique buffer ID
virtual void LogUpdate(uint32_t diffValue, bool positive)
Log key consumption.
uint32_t m_srcNodeBufferListIndex
uint32_t m_currentKeyBitPrevious
The previous value of current amount of key material in QKD key storage.
uint32_t m_defaultKeySize
static uint32_t nBuffers
number of created buffers - static value
void InitTotalGraph() const
Help function for total graph ploting.
double m_averageKeyChargingTimePeriod
The average duration of key charging time period.
TracedCallback< uint32_t > m_currentKeyBitChangeTrace
uint32_t GetKeyCount() const
get number of stored keys
~QBuffer() override
QBuffer destructor.
static const uint32_t QSTATUS_EMPTY
QStatus EMPTY.
uint64_t GetMinKeySizeBit() const
void CheckState()
Update the state after some changes on the QBuffer.
uint32_t GetPreviousState()
Fetch the previous state of the QBuffer.
uint32_t GetState()
Fetch the current state of the QBuffer.
uint32_t GetMCurrentPrevious() const
Help function used for ploting graphs; Previous - before latest change.
uint32_t m_noAddNewValue
Help value used for graph ploting.
uint32_t GetRemoteNodeId() const
Get the index of the remote node id.
EventId m_calculateRoutingMetric
uint64_t GetMaxKeySizeBit() const
TracedCallback< uint32_t > m_StatusChangeTrace
uint32_t m_previousStatus
TracedCallback< Ptr< QKDKey > > m_keyServedTrace
TracedCallback< uint32_t > m_thresholdKeyBitChangeTrace
bool DestroyKey(std::string keyId)
destroy key from the QBuffer
void KeyCalculation()
Help function used for ploting graphs.
virtual bool StoreKey(Ptr< QKDKey > key=nullptr, bool fireTraces=true)
store key in QBuffer
TracedCallback< double > m_averageKeyChargingTimePeriodTrace
a unique identifier for an interface.
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.
static unsigned int value(char c)