25 #include "ns3/packet.h"
26 #include "ns3/object.h"
27 #include "ns3/ipv4-header.h"
28 #include "ns3/traced-value.h"
29 #include "ns3/trace-source-accessor.h"
30 #include "ns3/event-id.h"
31 #include "ns3/qkd-key.h"
105 std::map < uint32_t, QKDKey >
keys;
255 uint32_t
GetId(
void)
const;
472 std::map < std::string, Ptr <QKDKey> >
m_keys;
An identifier for simulation events.
A base class which provides memory management and object aggregation.
QKD buffer is a secure storage for QKD keys.
uint32_t m_srcNodeBufferListIndex
The index in the source node buffer list.
double m_averageKeyChargingTimePeriod
The average duration of the key charging time period.
double m_averageKeyConsumptionSize
The average key consumption size.
int64_t m_lastKeyChargingTimeStamp
The timestamp of a last key charging (when the new key material was added).
uint32_t m_noEntry
Help value used for graph ploting.
double m_averageKeyConsumptionRate
The average key consumption rate.
double m_averageKeyGenerationRate
The average key generation rate.
TracedCallback< Ptr< QKDKey > > m_keyReservedTrace
A trace for reserved keys.
static const uint32_t QKDSTATUS_WARNING
QKDStatus WARNING.
std::vector< int64_t > m_lastChargedKeySizes
The size of the several last generated keys.
void UpdateKeyConsumptionStatistics(Ptr< QKDKey > key)
Update key consumption statistics.
uint32_t m_bufferID
The unique buffer identifier.
bool operator==(QKDBuffer const &o) const
Define equal operator on the QKD buffer object.
void UpdateKeyGenerationStatistics(Ptr< QKDKey > key)
Update key generation statistics.
uint64_t GetMinKeySizeBit()
Get the minimum key size that can be served in bits.
TracedCallback< double > m_CMetricChangeTrace
A trace of c metric changes.
TracedCallback< uint32_t > m_currentKeyBitDecreaseTrace
A trace of decrease in amount of key bits.
uint32_t GetMinKeySize()
Get the minimum key size that can be served.
std::map< std::string, Ptr< QKDKey > > m_keys
The list of available keys with their identifiers.
uint32_t GetMaxKeyCount()
Get the maximum number of stored keys.
uint32_t GetKeyCount()
Get the number of stored keys.
uint32_t m_thresholdKeyBit
The threshold amount of key material in the QKD key storage.
Ptr< QKDKey > SearchOptimalKeyToTransform(uint32_t targetSize)
Serach for the optimal key to transform.
uint32_t m_maxKeyBit
The maximal amount of key material in the QKD key storage.
double FetchAverageKeyChargingTimePeriod()
Get the average duration of key charging process in the long run.
uint32_t m_maxNumberOfRecordedKeyChargingTimePeriods
The maximal number of values which are used for calculation of the average key charging time period.
uint32_t m_period
Help value used for graph ploting.
uint32_t m_minimalKeyCount
The minimal number of stored keys.
uint32_t m_status
The state of the Net Device transmit state machine.
Ptr< QKDKey > FetchKeyBySize(const uint32_t &keySize)
Get the key of a given size.
uint32_t m_currentKeyBitReally
The current amount of key material used for real tracking of storage (transform!).
int64_t m_lastKeyChargingTimeDuration
The timestamp of a last key usage.
TracedCallback< uint32_t > m_thresholdKeyBitChangeTrace
A traceback for available key bits.
static const uint32_t QKDSTATUS_CHARGING
QKDStatus CHARGING.
std::vector< int64_t > m_lastConsumedKeySizes
The size of the several last consumed keys.
uint64_t GetMaxKeySizeBit()
Get the maximal key size that can be served in bits.
virtual ~QKDBuffer()
Destructor.
uint32_t GetIndex()
Get the index of the buffer per local node.
Ptr< Node > GetSrcNode()
Get the QKD source node.
double m_averageKeyConsumptionTimePeriod
The average duration of the key consumption time period.
Ptr< Node > GetDstNode()
Get the QKD destination node.
TracedCallback< uint32_t > m_thresholdKeyBitDecreaseTrace
A traceback for consumed key bits.
double m_averageKeyChargingSize
The average key charging size.
uint32_t m_bitsUsedInTimePeriod
Help value used for graph ploting.
TracedCallback< uint32_t > m_currentKeyBitChangeTrace
A trace for current bit change.
int64_t m_lastKeyConsumptionTimeStamp
The timestamp of a last key consumption (when the last key material was fetched).
void Dispose(void)
Destroy a QKD buffer.
bool AddNewKey(Ptr< QKDKey > key, uint32_t keyTransformed)
Add new key to the storage.
uint32_t m_maximalKeyCount
The maximal number of stored keys.
std::vector< struct QKDBuffer::data > m_previousValues
Help vector used for graph ploting.
uint32_t m_maxNumberOfRecordedKeyConsumptionTimePeriods
The maximal number of values which are used for calculation of the average key consumption time perio...
uint32_t FetchPreviousState(void)
Get the previous state of the QKD buffer.
bool ProbeKeyStatus(std::string keyId, QKDKey::QKDKeyState_e keyState)
Check if the state of the key equals to a given state.
std::vector< int64_t > m_chargingTimePeriods
The durations of the serveral last charging time periods.
uint32_t m_defaultKeySize
The default key size as required by the ETSI QKD 014 interface details.
TracedCallback< Ptr< QKDKey > > m_newKeyAddedTrace
A trace of newly added keys.
void SetIndex(uint32_t)
Set the index of the buffer per local node.
uint64_t GetTargetKeyCountBit()
Get tge amount of key material in bits that is ready to be served and belongs to a set of targeted ke...
void KeyCalculation()
Help function used for ploting graphs.
uint32_t m_currentKeyBit
The current amount of key material in the QKD key storage.
std::map< uint32_t, QKDBuffer::KeyStorage > m_destinations
uint32_t GetId(void) const
Get the QKD buffer identifier.
uint64_t GetMaxKeyCountBit()
Get the maximum amount of stored keys in bits.
double m_c
The average amount of key in the buffer during the recalculate time period.
void ReserveKey(std::string keyId)
Reserve the QKD key.
TracedCallback< double > m_averageKeyConsumptionRateTrace
A trace of the average key consumption rate.
TracedCallback< uint32_t > m_currentKeyBitIncreaseTrace
A trace of increase in amount of key bits.
static const uint32_t QKDSTATUS_READY
QKDStatus READY.
void SetSrcNode(Ptr< Node >)
Set the QKD source node.
TracedCallback< double > m_averageKeyGenerationRateTrace
A trace of the average key generation rate.
void SetMthr(uint32_t thr)
Set the threshold value of the QKD storage.
uint32_t GetMinKeyCount()
Get the minimum number of stored keys.
double GetAverageKeyGenerationRate()
Get average key generation rate.
uint32_t FetchMaxNumberOfRecordedKeyChargingTimePeriods()
Get the maximal number of values which are used for calculation of average key charging time period.
TracedCallback< Ptr< QKDKey > > m_transformedKeyAddedTrace
A trace for tranformed keys.
static uint32_t nBuffers
The number of the created buffers - a static value.
Ptr< QKDKey > FetchKeyByID(std::string keyID)
Get the key of a given identifier.
std::vector< int64_t > m_consumptionTimePeriods
The durations of the serveral last consumption time periods.
uint32_t GetKeySize()
Get default size of the key (ETSI QKD 014).
int64_t FetchLastKeyChargingTimeDuration()
Get the time value about the time duration of last key charging process.
std::vector< uint32_t > m_targetSizeSet
The list of requested key sizes.
static const uint32_t QKDSTATUS_EMPTY
QKDStatus EMPTY.
void ReleaseReservation(std::string keyId)
Release the key reservation.
int64_t m_lastKeyConsumptionTimeDuration
The timestamp of a last key fetch operation.
Ptr< Node > m_srcNode
The source node.
uint32_t m_previousStatus
The previous status; important for deciding about further status that can be selected.
uint32_t GetMthr(void) const
Get the threshold value of QKD storage.
uint32_t m_recalculateTimePeriod
The period of time (in seconds) to calculate average amount of the key in the buffer.
TracedCallback< uint32_t > m_StatusChangeTrace
A trace of status changes.
bool m_isRisingCurve
Whether curve on graph is rising or not.
uint64_t m_currentReadyKeyBit
The current amount of key material in the QKD buffer that are ready to be served.
Ptr< Node > m_dstNode
The destination node.
void SetDstNode(Ptr< Node >)
Set the QKD destination node.
TracedCallback< Ptr< QKDKey > > m_keyServedTrace
A trace for served keys.
double GetAverageKeyConsumptionRate()
Get average key consumption rate.
uint32_t GetMCurrentPrevious(void) const
Get previous - before latest change.
static TypeId GetTypeId(void)
Get the TypeId.
TracedCallback< uint32_t > m_thresholdKeyBitIncreaseTrace
A traceback for generated key bits.
EventId m_calculateRoutingMetric
The event to calculate routing metric.
void InitTotalGraph() const
Initialize total graph.
uint32_t m_minKeyBit
The minimal amount of key material in the QKD key storage.
void CheckState(void)
Update the state of the buffer.
uint32_t m_nextKeyID
The identifie of the next key to be generated.
uint32_t m_noAddNewValue
Help value used for graph ploting.
uint32_t FetchState(void)
Get the current state of the QKD buffer.
void RecordTargetSize(uint32_t size)
Record the key target size.
uint64_t m_currentTargetKeyBit
The current amount of key material in the QKD buffer that is already targeted.
void Init(Ptr< Node > srcNode, Ptr< Node > dstNode, uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurrent, bool useRealStorages)
Initialize a QKD buffer.
uint32_t m_currentKeyBitPrevious
The previous value of current amount of key material in the QKD key storage.
uint64_t GetReadyKeyCountBit()
Get the amount of the key material in bits that is ready to be served.
uint64_t GetKeyCountBit()
Get the amount of stored keys in bits.
QKDKeyState_e
The QKD key states.
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The key storage description.
double publicChannelMetric
std::map< uint32_t, QKDKey > keys
double quantumChannelMetric