QKD buffer is a secure storage for QKD keys. More...
#include "qkd-buffer.h"
Classes | |
struct | data |
Data specific variables. More... | |
struct | KeyStorage |
The key storage description. More... | |
Public Member Functions | |
QKDBuffer () | |
Constructor. More... | |
virtual | ~QKDBuffer () |
Destructor. More... | |
bool | AddNewKey (Ptr< QKDKey > key, uint32_t keyTransformed) |
Add new key to the storage. More... | |
void | CheckState (void) |
Update the state of the buffer. More... | |
void | Dispose (void) |
Destroy a QKD buffer. More... | |
double | FetchAverageKeyChargingTimePeriod () |
Get the average duration of key charging process in the long run. More... | |
int64_t | FetchDeltaTime () |
Ptr< QKDKey > | FetchKeyByID (std::string keyID) |
Get the key of a given identifier. More... | |
Ptr< QKDKey > | FetchKeyByID (std::string keyID, uint32_t fillProcessActive) |
Get the key of a given identifier. More... | |
Ptr< QKDKey > | FetchKeyBySize (const uint32_t &keySize) |
Get the key of a given size. More... | |
int64_t | FetchLastKeyChargingTimeDuration () |
Get the time value about the time duration of last key charging process. More... | |
uint32_t | FetchMaxNumberOfRecordedKeyChargingTimePeriods () |
Get the maximal number of values which are used for calculation of average key charging time period. More... | |
uint32_t | FetchPreviousState (void) |
Get the previous state of the QKD buffer. More... | |
uint32_t | FetchState (void) |
Get the current state of the QKD buffer. More... | |
double | GetAverageKeyConsumptionRate () |
Get average key consumption rate. More... | |
double | GetAverageKeyGenerationRate () |
Get average key generation rate. More... | |
Ptr< Node > | GetDstNode () |
Get the QKD destination node. More... | |
uint32_t | GetId (void) const |
Get the QKD buffer identifier. More... | |
uint32_t | GetIndex () |
Get the index of the buffer per local node. More... | |
uint32_t | GetKeyCount () |
Get the number of stored keys. More... | |
uint32_t | GetKeyCount (uint32_t keySize) |
Get the number of the available keys with a given size. More... | |
uint64_t | GetKeyCountBit () |
Get the amount of stored keys in bits. More... | |
uint32_t | GetKeySize () |
Get default size of the key (ETSI QKD 014). More... | |
uint32_t | GetMaxKeyCount () |
Get the maximum number of stored keys. More... | |
uint64_t | GetMaxKeyCountBit () |
Get the maximum amount of stored keys in bits. More... | |
uint64_t | GetMaxKeySizeBit () |
Get the maximal key size that can be served in bits. More... | |
uint32_t | GetMCurrentPrevious (void) const |
Get previous - before latest change. More... | |
uint32_t | GetMinKeyCount () |
Get the minimum number of stored keys. More... | |
uint32_t | GetMinKeySize () |
Get the minimum key size that can be served. More... | |
uint64_t | GetMinKeySizeBit () |
Get the minimum key size that can be served in bits. More... | |
uint32_t | GetMthr (void) const |
Get the threshold value of QKD storage. More... | |
uint64_t | GetReadyKeyCountBit () |
Get the amount of the key material in bits that is ready to be served. More... | |
Ptr< Node > | GetSrcNode () |
Get the QKD source node. More... | |
uint64_t | GetTargetKeyCountBit () |
Get tge amount of key material in bits that is ready to be served and belongs to a set of targeted keys. More... | |
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. More... | |
void | InitTotalGraph () const |
Initialize total graph. More... | |
void | KeyCalculation () |
Help function used for ploting graphs. More... | |
bool | operator== (QKDBuffer const &o) const |
Define equal operator on the QKD buffer object. More... | |
bool | ProbeKeyStatus (std::string keyId, QKDKey::QKDKeyState_e keyState) |
Check if the state of the key equals to a given state. More... | |
void | RecordTargetSize (uint32_t size) |
Record the key target size. More... | |
void | ReleaseReservation (std::string keyId) |
Release the key reservation. More... | |
void | ReserveKey (std::string keyId) |
Reserve the QKD key. More... | |
Ptr< QKDKey > | SearchOptimalKeyToTransform (uint32_t targetSize) |
Serach for the optimal key to transform. More... | |
void | SetDstNode (Ptr< Node >) |
Set the QKD destination node. More... | |
void | SetIndex (uint32_t) |
Set the index of the buffer per local node. More... | |
void | SetMthr (uint32_t thr) |
Set the threshold value of the QKD storage. More... | |
void | SetSrcNode (Ptr< Node >) |
Set the QKD source node. More... | |
void | UpdateKeyConsumptionStatistics (Ptr< QKDKey > key) |
Update key consumption statistics. More... | |
void | UpdateKeyGenerationStatistics (Ptr< QKDKey > key) |
Update key generation statistics. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the TypeId. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Public Attributes | |
uint32_t | m_bufferID |
The unique buffer identifier. More... | |
Ptr< Node > | m_dstNode |
The destination node. More... | |
Ptr< Node > | m_srcNode |
The source node. More... | |
Static Public Attributes | |
static uint32_t | nBuffers = 0 |
The number of the created buffers - a static value. More... | |
static const uint32_t | QKDSTATUS_CHARGING = 2 |
QKDStatus CHARGING. More... | |
static const uint32_t | QKDSTATUS_EMPTY = 3 |
QKDStatus EMPTY. More... | |
static const uint32_t | QKDSTATUS_READY = 0 |
QKDStatus READY. More... | |
static const uint32_t | QKDSTATUS_WARNING = 1 |
QKDStatus WARNING. More... | |
Private Attributes | |
double | m_averageKeyChargingSize |
The average key charging size. More... | |
double | m_averageKeyChargingTimePeriod |
The average duration of the key charging time period. More... | |
double | m_averageKeyConsumptionRate |
The average key consumption rate. More... | |
TracedCallback< double > | m_averageKeyConsumptionRateTrace |
A trace of the average key consumption rate. More... | |
double | m_averageKeyConsumptionSize |
The average key consumption size. More... | |
double | m_averageKeyConsumptionTimePeriod |
The average duration of the key consumption time period. More... | |
double | m_averageKeyGenerationRate |
The average key generation rate. More... | |
TracedCallback< double > | m_averageKeyGenerationRateTrace |
A trace of the average key generation rate. More... | |
uint32_t | m_bitsUsedInTimePeriod |
Help value used for graph ploting. More... | |
double | m_c |
The average amount of key in the buffer during the recalculate time period. More... | |
EventId | m_calculateRoutingMetric |
The event to calculate routing metric. More... | |
std::vector< int64_t > | m_chargingTimePeriods |
The durations of the serveral last charging time periods. More... | |
TracedCallback< double > | m_CMetricChangeTrace |
A trace of c metric changes. More... | |
std::vector< int64_t > | m_consumptionTimePeriods |
The durations of the serveral last consumption time periods. More... | |
uint32_t | m_currentKeyBit |
The current amount of key material in the QKD key storage. More... | |
TracedCallback< uint32_t > | m_currentKeyBitChangeTrace |
A trace for current bit change. More... | |
TracedCallback< uint32_t > | m_currentKeyBitDecreaseTrace |
A trace of decrease in amount of key bits. More... | |
TracedCallback< uint32_t > | m_currentKeyBitIncreaseTrace |
A trace of increase in amount of key bits. More... | |
uint32_t | m_currentKeyBitPrevious |
The previous value of current amount of key material in the QKD key storage. More... | |
uint32_t | m_currentKeyBitReally |
The current amount of key material used for real tracking of storage (transform!). More... | |
uint64_t | m_currentReadyKeyBit |
The current amount of key material in the QKD buffer that are ready to be served. More... | |
uint64_t | m_currentTargetKeyBit |
The current amount of key material in the QKD buffer that is already targeted. More... | |
uint32_t | m_defaultKeySize |
The default key size as required by the ETSI QKD 014 interface details. More... | |
std::map< uint32_t, QKDBuffer::KeyStorage > | m_destinations |
bool | m_isRisingCurve |
Whether curve on graph is rising or not. More... | |
TracedCallback< Ptr< QKDKey > > | m_keyReservedTrace |
A trace for reserved keys. More... | |
std::map< std::string, Ptr< QKDKey > > | m_keys |
The list of available keys with their identifiers. More... | |
TracedCallback< Ptr< QKDKey > > | m_keyServedTrace |
A trace for served keys. More... | |
std::vector< int64_t > | m_lastChargedKeySizes |
The size of the several last generated keys. More... | |
std::vector< int64_t > | m_lastConsumedKeySizes |
The size of the several last consumed keys. More... | |
int64_t | m_lastKeyChargingTimeDuration |
The timestamp of a last key usage. More... | |
int64_t | m_lastKeyChargingTimeStamp |
The timestamp of a last key charging (when the new key material was added). More... | |
int64_t | m_lastKeyConsumptionTimeDuration |
The timestamp of a last key fetch operation. More... | |
int64_t | m_lastKeyConsumptionTimeStamp |
The timestamp of a last key consumption (when the last key material was fetched). More... | |
uint32_t | m_maximalKeyCount |
The maximal number of stored keys. More... | |
uint32_t | m_maxKeyBit |
The maximal amount of key material in the QKD key storage. More... | |
uint32_t | m_maxNumberOfRecordedKeyChargingTimePeriods |
The maximal number of values which are used for calculation of the average key charging time period. More... | |
uint32_t | m_maxNumberOfRecordedKeyConsumptionTimePeriods |
The maximal number of values which are used for calculation of the average key consumption time period. More... | |
uint32_t | m_minimalKeyCount |
The minimal number of stored keys. More... | |
uint32_t | m_minKeyBit |
The minimal amount of key material in the QKD key storage. More... | |
TracedCallback< Ptr< QKDKey > > | m_newKeyAddedTrace |
A trace of newly added keys. More... | |
uint32_t | m_nextKeyID |
The identifie of the next key to be generated. More... | |
uint32_t | m_noAddNewValue |
Help value used for graph ploting. More... | |
uint32_t | m_noEntry |
Help value used for graph ploting. More... | |
uint32_t | m_period |
Help value used for graph ploting. More... | |
uint32_t | m_previousStatus |
The previous status; important for deciding about further status that can be selected. More... | |
std::vector< struct QKDBuffer::data > | m_previousValues |
Help vector used for graph ploting. More... | |
uint32_t | m_recalculateTimePeriod |
The period of time (in seconds) to calculate average amount of the key in the buffer. More... | |
uint32_t | m_srcNodeBufferListIndex |
The index in the source node buffer list. More... | |
uint32_t | m_status |
The state of the Net Device transmit state machine. More... | |
TracedCallback< uint32_t > | m_StatusChangeTrace |
A trace of status changes. More... | |
std::vector< uint32_t > | m_targetSizeSet |
The list of requested key sizes. More... | |
uint32_t | m_thresholdKeyBit |
The threshold amount of key material in the QKD key storage. More... | |
TracedCallback< uint32_t > | m_thresholdKeyBitChangeTrace |
A traceback for available key bits. More... | |
TracedCallback< uint32_t > | m_thresholdKeyBitDecreaseTrace |
A traceback for consumed key bits. More... | |
TracedCallback< uint32_t > | m_thresholdKeyBitIncreaseTrace |
A traceback for generated key bits. More... | |
TracedCallback< Ptr< QKDKey > > | m_transformedKeyAddedTrace |
A trace for tranformed keys. More... | |
bool | m_useRealStorages |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoDispose () |
Destructor implementation. More... | |
virtual void | DoInitialize () |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
QKD buffer is a secure storage for QKD keys.
QKDBuffer is assigned for each link using QKDControl on each side of the link (each node).
It is important to note that a QKD link has full application only when there are enough keys to apply for cryptographic purposes. Therefore, constant monitoring of the state of the QKD buffer is necessary to identify the statuses in which the QKD buffer can be found: READY - Amount of key is larger than threshold Mthr WARNING - Amount of key is lower then threshold and the amount of keys in the buffer is decreasing CHARGING - Amount of key is lower then threshold and the amount of keys in the buffer is increasing EMPTY - The amount of keys in the buffer is lower than the minimal value
The states of the QKD buffer do not directly affect the communication, but it can be used for easier prioritization of traffic depending on the state of the buffer. For example, in EMPTY state, QKD post-processing applications used to establish a new key material should have the highest priority in traffic processing.
Definition at line 79 of file qkd-buffer.h.
ns3::QKDBuffer::QKDBuffer | ( | ) |
ns3::QKDBuffer::~QKDBuffer | ( | ) |
Destructor.
Definition at line 219 of file qkd-buffer.cc.
References m_destinations, m_keys, m_targetSizeSet, and NS_LOG_FUNCTION.
Add new key to the storage.
Add new content to buffer.
key | The QKD key object. |
keyTransformed | Is the key transformed? |
Ptr<QKDKey> | key |
uint32_t | keyTransformed Used when node receives information that new key material was establieshed |
Definition at line 318 of file qkd-buffer.cc.
References KeyCalculation(), m_currentKeyBit, m_currentKeyBitChangeTrace, m_currentKeyBitIncreaseTrace, m_currentKeyBitReally, m_currentReadyKeyBit, m_currentTargetKeyBit, m_keys, m_maxKeyBit, m_newKeyAddedTrace, m_targetSizeSet, m_transformedKeyAddedTrace, NS_LOG_FUNCTION, and UpdateKeyGenerationStatistics().
void ns3::QKDBuffer::CheckState | ( | void | ) |
Update the state of the buffer.
Definition at line 778 of file qkd-buffer.cc.
References m_currentKeyBit, m_currentKeyBitPrevious, m_isRisingCurve, m_maxKeyBit, m_minKeyBit, m_previousStatus, m_status, m_StatusChangeTrace, m_thresholdKeyBit, NS_LOG_FUNCTION, QKDSTATUS_CHARGING, QKDSTATUS_EMPTY, QKDSTATUS_READY, and QKDSTATUS_WARNING.
Referenced by KeyCalculation().
void ns3::QKDBuffer::Dispose | ( | void | ) |
Destroy a QKD buffer.
This is the pre-destructor function of the QKDBuffer.
Definition at line 228 of file qkd-buffer.cc.
References ns3::Simulator::Cancel(), m_calculateRoutingMetric, and NS_LOG_FUNCTION.
double ns3::QKDBuffer::FetchAverageKeyChargingTimePeriod | ( | ) |
Get the average duration of key charging process in the long run.
Definition at line 861 of file qkd-buffer.cc.
References m_averageKeyChargingTimePeriod, and NS_LOG_FUNCTION.
int64_t ns3::QKDBuffer::FetchDeltaTime | ( | ) |
Definition at line 853 of file qkd-buffer.cc.
References ns3::Time::GetMilliSeconds(), m_lastKeyChargingTimeStamp, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
Get the key of a given identifier.
keyID | The key identifier. |
Definition at line 498 of file qkd-buffer.cc.
Get the key of a given identifier.
keyID | The key identifier. |
fillProcessActive | Is asked by the fill process? |
Definition at line 506 of file qkd-buffer.cc.
References m_currentKeyBit, m_currentKeyBitReally, m_keys, NS_LOG_FUNCTION, and UpdateKeyConsumptionStatistics().
Get the key of a given size.
Fetch key from buffer with given key size! This function is called by master KMS while selection keys to return on ETSI 014 get_key request.
keySize | The key size. |
Therefore, the selected key must be READY and not reserved for other use.
Definition at line 475 of file qkd-buffer.cc.
References KeyCalculation(), m_currentKeyBit, m_currentKeyBitReally, m_keys, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::QKDKey::READY, and UpdateKeyConsumptionStatistics().
int64_t ns3::QKDBuffer::FetchLastKeyChargingTimeDuration | ( | ) |
Get the time value about the time duration of last key charging process.
Return time value about the time duration of last key charging process.
Definition at line 842 of file qkd-buffer.cc.
References m_lastKeyChargingTimeDuration, and NS_LOG_FUNCTION.
uint32_t ns3::QKDBuffer::FetchMaxNumberOfRecordedKeyChargingTimePeriods | ( | ) |
Get the maximal number of values which are used for calculation of average key charging time period.
Definition at line 437 of file qkd-buffer.cc.
References m_maxNumberOfRecordedKeyChargingTimePeriods.
uint32_t ns3::QKDBuffer::FetchPreviousState | ( | void | ) |
Get the previous state of the QKD buffer.
Help function used for ploting graphs.
Definition at line 874 of file qkd-buffer.cc.
References m_previousStatus, and NS_LOG_FUNCTION.
uint32_t ns3::QKDBuffer::FetchState | ( | void | ) |
Get the current state of the QKD buffer.
QKD buffer can be in one of the following states: – READY—when Mcur (t) ≥ Mthr , – WARNING—when Mthr > Mcur (t) > Mmin and the previous state was READY, – CHARGING—when Mthr > Mcur (t) and the previous state was EMPTY, – EMTPY—when Mmin ≥ Mcur (t) and the previous state was WARNING or CHARGING
Definition at line 867 of file qkd-buffer.cc.
References m_status, and NS_LOG_FUNCTION.
double ns3::QKDBuffer::GetAverageKeyConsumptionRate | ( | ) |
Get average key consumption rate.
Definition at line 366 of file qkd-buffer.cc.
References ns3::Time::GetSeconds(), m_averageKeyConsumptionRate, m_averageKeyConsumptionSize, m_averageKeyConsumptionTimePeriod, m_consumptionTimePeriods, m_maxNumberOfRecordedKeyConsumptionTimePeriods, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
double ns3::QKDBuffer::GetAverageKeyGenerationRate | ( | ) |
Get average key generation rate.
Definition at line 431 of file qkd-buffer.cc.
References m_averageKeyGenerationRate, and NS_LOG_FUNCTION.
Get the QKD destination node.
Definition at line 922 of file qkd-buffer.cc.
References m_dstNode.
uint32_t ns3::QKDBuffer::GetId | ( | void | ) | const |
Get the QKD buffer identifier.
Definition at line 823 of file qkd-buffer.cc.
References m_bufferID, and NS_LOG_FUNCTION.
uint32_t ns3::QKDBuffer::GetIndex | ( | ) |
Get the index of the buffer per local node.
Definition at line 931 of file qkd-buffer.cc.
References m_srcNodeBufferListIndex.
uint32_t ns3::QKDBuffer::GetKeyCount | ( | ) |
Get the number of stored keys.
(ETSI QKD 014)
Definition at line 275 of file qkd-buffer.cc.
References m_keys.
uint32_t ns3::QKDBuffer::GetKeyCount | ( | uint32_t | keySize | ) |
Get the number of the available keys with a given size.
keySize | The key size. |
Definition at line 442 of file qkd-buffer.cc.
References m_keys, NS_LOG_FUNCTION, and ns3::QKDKey::READY.
uint64_t ns3::QKDBuffer::GetKeyCountBit | ( | ) |
Get the amount of stored keys in bits.
Definition at line 288 of file qkd-buffer.cc.
References m_currentKeyBit.
uint32_t ns3::QKDBuffer::GetKeySize | ( | ) |
Get default size of the key (ETSI QKD 014).
Definition at line 235 of file qkd-buffer.cc.
References m_defaultKeySize.
uint32_t ns3::QKDBuffer::GetMaxKeyCount | ( | ) |
Get the maximum number of stored keys.
(ETSI QKD 014)
Definition at line 283 of file qkd-buffer.cc.
References m_maximalKeyCount.
uint64_t ns3::QKDBuffer::GetMaxKeyCountBit | ( | ) |
Get the maximum amount of stored keys in bits.
(ETSI QKD 014)
uint64_t ns3::QKDBuffer::GetMaxKeySizeBit | ( | ) |
Get the maximal key size that can be served in bits.
(ETSI QKD 014)
Definition at line 307 of file qkd-buffer.cc.
References m_maxKeyBit.
uint32_t ns3::QKDBuffer::GetMCurrentPrevious | ( | void | ) | const |
Get previous - before latest change.
Help function used for ploting graphs.
Definition at line 881 of file qkd-buffer.cc.
References m_currentKeyBitPrevious, and NS_LOG_FUNCTION.
uint32_t ns3::QKDBuffer::GetMinKeyCount | ( | ) |
Get the minimum number of stored keys.
(ETSI QKD 014)
Definition at line 279 of file qkd-buffer.cc.
References m_minimalKeyCount.
uint32_t ns3::QKDBuffer::GetMinKeySize | ( | ) |
Get the minimum key size that can be served.
(ETSI QKD 014)
uint64_t ns3::QKDBuffer::GetMinKeySizeBit | ( | ) |
Get the minimum key size that can be served in bits.
(ETSI QKD 014)
Definition at line 303 of file qkd-buffer.cc.
References m_minKeyBit.
uint32_t ns3::QKDBuffer::GetMthr | ( | void | ) | const |
Get the threshold value of QKD storage.
The threshold value Mthr (t) at the time of measurement t is used to indicate the state of the QKD buffer where it holds that Mthr (t) ≤ Mmax.
Definition at line 888 of file qkd-buffer.cc.
References m_thresholdKeyBit, and NS_LOG_FUNCTION.
uint64_t ns3::QKDBuffer::GetReadyKeyCountBit | ( | ) |
Get the amount of the key material in bits that is ready to be served.
This function provides the information on the amount of key material that is ready to be served, and is not reserved for the other purposes.
Definition at line 293 of file qkd-buffer.cc.
References m_currentReadyKeyBit.
Get the QKD source node.
Definition at line 913 of file qkd-buffer.cc.
References m_srcNode.
uint64_t ns3::QKDBuffer::GetTargetKeyCountBit | ( | ) |
Get tge amount of key material in bits that is ready to be served and belongs to a set of targeted keys.
Definition at line 298 of file qkd-buffer.cc.
References m_currentTargetKeyBit.
|
static |
Get the TypeId.
Definition at line 40 of file qkd-buffer.cc.
References m_averageKeyConsumptionRateTrace, m_averageKeyGenerationRateTrace, m_CMetricChangeTrace, m_currentKeyBit, m_currentKeyBitChangeTrace, m_currentKeyBitDecreaseTrace, m_currentKeyBitIncreaseTrace, m_defaultKeySize, m_keyReservedTrace, m_keyServedTrace, m_maximalKeyCount, m_maxKeyBit, m_maxNumberOfRecordedKeyChargingTimePeriods, m_maxNumberOfRecordedKeyConsumptionTimePeriods, m_minimalKeyCount, m_minKeyBit, m_newKeyAddedTrace, m_recalculateTimePeriod, m_StatusChangeTrace, m_thresholdKeyBit, m_thresholdKeyBitChangeTrace, m_thresholdKeyBitDecreaseTrace, m_thresholdKeyBitIncreaseTrace, m_transformedKeyAddedTrace, ns3::MakeTraceSourceAccessor(), ns3::MakeUintegerAccessor(), and ns3::TypeId::SetParent().
void ns3::QKDBuffer::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.
srcNode | The source node. |
dstNode | The destination node. |
Mmin | The lower threshold value. |
Mthr | The threshold value. |
Mmax | The buffer's capacity. |
Mcurrent | The current amout of key material in the buffer. |
useRealStorages | Should the program use external file key storage? |
Definition at line 172 of file qkd-buffer.cc.
References m_averageKeyConsumptionRate, m_averageKeyGenerationRate, m_bitsUsedInTimePeriod, m_bufferID, m_currentKeyBit, m_currentKeyBitPrevious, m_currentKeyBitReally, m_currentReadyKeyBit, m_currentTargetKeyBit, m_dstNode, m_lastKeyChargingTimeDuration, m_lastKeyChargingTimeStamp, m_lastKeyConsumptionTimeDuration, m_lastKeyConsumptionTimeStamp, m_maxKeyBit, m_minKeyBit, m_nextKeyID, m_noAddNewValue, m_noEntry, m_period, m_previousStatus, m_srcNode, m_thresholdKeyBit, m_useRealStorages, nBuffers, and NS_LOG_FUNCTION.
void ns3::QKDBuffer::InitTotalGraph | ( | ) | const |
Initialize total graph.
Help function for total graph ploting.
Definition at line 829 of file qkd-buffer.cc.
References m_currentKeyBit, m_currentKeyBitIncreaseTrace, m_thresholdKeyBit, m_thresholdKeyBitIncreaseTrace, and NS_LOG_FUNCTION.
void ns3::QKDBuffer::KeyCalculation | ( | ) |
Help function used for ploting graphs.
Definition at line 245 of file qkd-buffer.cc.
References CheckState(), ns3::compareByData(), m_currentKeyBit, m_currentKeyBitPrevious, m_isRisingCurve, m_noEntry, m_period, m_previousValues, NS_LOG_FUNCTION, ns3::QKDBuffer::data::position, and ns3::QKDBuffer::data::value.
Referenced by AddNewKey(), and FetchKeyBySize().
bool ns3::QKDBuffer::operator== | ( | QKDBuffer const & | o | ) | const |
Define equal operator on the QKD buffer object.
o | The other QKD buffer. |
Definition at line 816 of file qkd-buffer.cc.
References m_bufferID.
bool ns3::QKDBuffer::ProbeKeyStatus | ( | std::string | keyId, |
QKDKey::QKDKeyState_e | keyState | ||
) |
Check if the state of the key equals to a given state.
keyId | The key identifier. |
keyState | The key state to compare with. |
Definition at line 455 of file qkd-buffer.cc.
References m_keys, and NS_LOG_FUNCTION.
void ns3::QKDBuffer::RecordTargetSize | ( | uint32_t | size | ) |
Record the key target size.
size | The key size in bits. |
Must keep a record on the requested key sizes to avoid their usage in the key transformation functions!
Definition at line 769 of file qkd-buffer.cc.
References m_targetSizeSet, and NS_LOG_FUNCTION.
void ns3::QKDBuffer::ReleaseReservation | ( | std::string | keyId | ) |
Release the key reservation.
keyId | The key identifier. |
Definition at line 697 of file qkd-buffer.cc.
References m_currentReadyKeyBit, m_keys, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::QKDKey::RESERVED.
void ns3::QKDBuffer::ReserveKey | ( | std::string | keyId | ) |
Reserve the QKD key.
keyId | The key identifier. |
Definition at line 665 of file qkd-buffer.cc.
References m_currentReadyKeyBit, m_currentTargetKeyBit, m_keyReservedTrace, m_keys, m_targetSizeSet, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::QKDKey::READY.
Serach for the optimal key to transform.
targetSize | The target size. |
The search algorithm will prefer keys whose size is larger then the target size.
Definition at line 716 of file qkd-buffer.cc.
References m_keys, m_targetSizeSet, NS_ASSERT, NS_LOG_FUNCTION, and ns3::QKDKey::READY.
Set the QKD destination node.
The | destination node. |
Definition at line 918 of file qkd-buffer.cc.
References m_dstNode.
void ns3::QKDBuffer::SetIndex | ( | uint32_t | index | ) |
Set the index of the buffer per local node.
The | index. |
Definition at line 927 of file qkd-buffer.cc.
References m_srcNodeBufferListIndex.
void ns3::QKDBuffer::SetMthr | ( | uint32_t | thr | ) |
Set the threshold value of the QKD storage.
The | threshold value. |
Definition at line 894 of file qkd-buffer.cc.
References m_thresholdKeyBit, m_thresholdKeyBitChangeTrace, m_thresholdKeyBitDecreaseTrace, m_thresholdKeyBitIncreaseTrace, and NS_LOG_FUNCTION.
Set the QKD source node.
The | source node. |
Definition at line 909 of file qkd-buffer.cc.
References m_srcNode.
Update key consumption statistics.
key | The key that is consumed. |
Definition at line 532 of file qkd-buffer.cc.
References ns3::Time::GetSeconds(), m_averageKeyConsumptionRate, m_averageKeyConsumptionRateTrace, m_averageKeyConsumptionSize, m_averageKeyConsumptionTimePeriod, m_bitsUsedInTimePeriod, m_chargingTimePeriods, m_consumptionTimePeriods, m_currentKeyBit, m_currentKeyBitChangeTrace, m_currentKeyBitDecreaseTrace, m_currentReadyKeyBit, m_currentTargetKeyBit, m_keyServedTrace, m_lastConsumedKeySizes, m_lastKeyConsumptionTimeDuration, m_lastKeyConsumptionTimeStamp, m_maxNumberOfRecordedKeyConsumptionTimePeriods, m_targetSizeSet, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::QKDKey::RESERVED.
Referenced by FetchKeyByID(), and FetchKeyBySize().
Update key generation statistics.
key | The key that is generated. |
Definition at line 604 of file qkd-buffer.cc.
References ns3::Time::GetSeconds(), m_averageKeyChargingSize, m_averageKeyChargingTimePeriod, m_averageKeyGenerationRate, m_averageKeyGenerationRateTrace, m_chargingTimePeriods, m_lastChargedKeySizes, m_lastKeyChargingTimeDuration, m_lastKeyChargingTimeStamp, m_maxNumberOfRecordedKeyChargingTimePeriods, m_noAddNewValue, m_noEntry, m_period, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by AddNewKey().
|
private |
The average key charging size.
Definition at line 513 of file qkd-buffer.h.
Referenced by UpdateKeyGenerationStatistics().
|
private |
The average duration of the key charging time period.
Definition at line 511 of file qkd-buffer.h.
Referenced by FetchAverageKeyChargingTimePeriod(), and UpdateKeyGenerationStatistics().
|
private |
The average key consumption rate.
Definition at line 516 of file qkd-buffer.h.
Referenced by GetAverageKeyConsumptionRate(), Init(), and UpdateKeyConsumptionStatistics().
|
private |
A trace of the average key consumption rate.
Definition at line 529 of file qkd-buffer.h.
Referenced by GetTypeId(), and UpdateKeyConsumptionStatistics().
|
private |
The average key consumption size.
Definition at line 514 of file qkd-buffer.h.
Referenced by GetAverageKeyConsumptionRate(), and UpdateKeyConsumptionStatistics().
|
private |
The average duration of the key consumption time period.
Definition at line 512 of file qkd-buffer.h.
Referenced by GetAverageKeyConsumptionRate(), and UpdateKeyConsumptionStatistics().
|
private |
The average key generation rate.
Definition at line 515 of file qkd-buffer.h.
Referenced by GetAverageKeyGenerationRate(), Init(), and UpdateKeyGenerationStatistics().
|
private |
A trace of the average key generation rate.
Definition at line 528 of file qkd-buffer.h.
Referenced by GetTypeId(), and UpdateKeyGenerationStatistics().
|
private |
Help value used for graph ploting.
Definition at line 477 of file qkd-buffer.h.
Referenced by Init(), and UpdateKeyConsumptionStatistics().
uint32_t ns3::QKDBuffer::m_bufferID |
The unique buffer identifier.
Definition at line 302 of file qkd-buffer.h.
Referenced by GetId(), Init(), and operator==().
|
private |
The average amount of key in the buffer during the recalculate time period.
Definition at line 482 of file qkd-buffer.h.
|
private |
The event to calculate routing metric.
Definition at line 517 of file qkd-buffer.h.
Referenced by Dispose().
|
private |
The durations of the serveral last charging time periods.
Definition at line 508 of file qkd-buffer.h.
Referenced by UpdateKeyConsumptionStatistics(), and UpdateKeyGenerationStatistics().
|
private |
A trace of c metric changes.
Definition at line 526 of file qkd-buffer.h.
Referenced by GetTypeId().
|
private |
The durations of the serveral last consumption time periods.
Definition at line 509 of file qkd-buffer.h.
Referenced by GetAverageKeyConsumptionRate(), and UpdateKeyConsumptionStatistics().
|
private |
The current amount of key material in the QKD key storage.
Definition at line 495 of file qkd-buffer.h.
Referenced by AddNewKey(), CheckState(), FetchKeyByID(), FetchKeyBySize(), GetKeyCountBit(), GetTypeId(), Init(), InitTotalGraph(), KeyCalculation(), and UpdateKeyConsumptionStatistics().
|
private |
A trace for current bit change.
Definition at line 522 of file qkd-buffer.h.
Referenced by AddNewKey(), GetTypeId(), and UpdateKeyConsumptionStatistics().
|
private |
A trace of decrease in amount of key bits.
Definition at line 524 of file qkd-buffer.h.
Referenced by GetTypeId(), and UpdateKeyConsumptionStatistics().
|
private |
A trace of increase in amount of key bits.
Definition at line 523 of file qkd-buffer.h.
Referenced by AddNewKey(), GetTypeId(), and InitTotalGraph().
|
private |
The previous value of current amount of key material in the QKD key storage.
Definition at line 499 of file qkd-buffer.h.
Referenced by CheckState(), GetMCurrentPrevious(), Init(), and KeyCalculation().
|
private |
The current amount of key material used for real tracking of storage (transform!).
Definition at line 496 of file qkd-buffer.h.
Referenced by AddNewKey(), FetchKeyByID(), FetchKeyBySize(), and Init().
|
private |
The current amount of key material in the QKD buffer that are ready to be served.
Definition at line 497 of file qkd-buffer.h.
Referenced by AddNewKey(), GetReadyKeyCountBit(), Init(), ReleaseReservation(), ReserveKey(), and UpdateKeyConsumptionStatistics().
|
private |
The current amount of key material in the QKD buffer that is already targeted.
Should not be used to transform keys!
Definition at line 498 of file qkd-buffer.h.
Referenced by AddNewKey(), GetTargetKeyCountBit(), Init(), ReserveKey(), and UpdateKeyConsumptionStatistics().
|
private |
The default key size as required by the ETSI QKD 014 interface details.
Definition at line 469 of file qkd-buffer.h.
Referenced by GetKeySize(), and GetTypeId().
|
private |
Definition at line 533 of file qkd-buffer.h.
Referenced by ~QKDBuffer().
The destination node.
Definition at line 301 of file qkd-buffer.h.
Referenced by GetDstNode(), Init(), and SetDstNode().
|
private |
Whether curve on graph is rising or not.
Definition at line 483 of file qkd-buffer.h.
Referenced by CheckState(), and KeyCalculation().
|
private |
A trace for reserved keys.
Definition at line 521 of file qkd-buffer.h.
Referenced by GetTypeId(), and ReserveKey().
The list of available keys with their identifiers.
Definition at line 472 of file qkd-buffer.h.
Referenced by ~QKDBuffer(), AddNewKey(), FetchKeyByID(), FetchKeyBySize(), GetKeyCount(), ProbeKeyStatus(), ReleaseReservation(), ReserveKey(), and SearchOptimalKeyToTransform().
|
private |
A trace for served keys.
Definition at line 520 of file qkd-buffer.h.
Referenced by GetTypeId(), and UpdateKeyConsumptionStatistics().
|
private |
The size of the several last generated keys.
Definition at line 506 of file qkd-buffer.h.
Referenced by UpdateKeyGenerationStatistics().
|
private |
The size of the several last consumed keys.
Definition at line 507 of file qkd-buffer.h.
Referenced by UpdateKeyConsumptionStatistics().
|
private |
The timestamp of a last key usage.
Definition at line 502 of file qkd-buffer.h.
Referenced by FetchLastKeyChargingTimeDuration(), Init(), and UpdateKeyGenerationStatistics().
|
private |
The timestamp of a last key charging (when the new key material was added).
Definition at line 500 of file qkd-buffer.h.
Referenced by FetchDeltaTime(), Init(), and UpdateKeyGenerationStatistics().
|
private |
The timestamp of a last key fetch operation.
Definition at line 503 of file qkd-buffer.h.
Referenced by Init(), and UpdateKeyConsumptionStatistics().
|
private |
The timestamp of a last key consumption (when the last key material was fetched).
Definition at line 501 of file qkd-buffer.h.
Referenced by Init(), and UpdateKeyConsumptionStatistics().
|
private |
The maximal number of stored keys.
Definition at line 489 of file qkd-buffer.h.
Referenced by GetMaxKeyCount(), and GetTypeId().
|
private |
The maximal amount of key material in the QKD key storage.
Definition at line 486 of file qkd-buffer.h.
Referenced by AddNewKey(), CheckState(), GetMaxKeySizeBit(), GetTypeId(), and Init().
|
private |
The maximal number of values which are used for calculation of the average key charging time period.
Definition at line 504 of file qkd-buffer.h.
Referenced by FetchMaxNumberOfRecordedKeyChargingTimePeriods(), GetTypeId(), and UpdateKeyGenerationStatistics().
|
private |
The maximal number of values which are used for calculation of the average key consumption time period.
Definition at line 505 of file qkd-buffer.h.
Referenced by GetAverageKeyConsumptionRate(), GetTypeId(), and UpdateKeyConsumptionStatistics().
|
private |
The minimal number of stored keys.
Definition at line 488 of file qkd-buffer.h.
Referenced by GetMinKeyCount(), and GetTypeId().
|
private |
The minimal amount of key material in the QKD key storage.
Definition at line 485 of file qkd-buffer.h.
Referenced by CheckState(), GetMinKeySizeBit(), GetTypeId(), and Init().
|
private |
A trace of newly added keys.
Definition at line 518 of file qkd-buffer.h.
Referenced by AddNewKey(), and GetTypeId().
|
private |
The identifie of the next key to be generated.
Definition at line 471 of file qkd-buffer.h.
Referenced by Init().
|
private |
Help value used for graph ploting.
Definition at line 476 of file qkd-buffer.h.
Referenced by Init(), and UpdateKeyGenerationStatistics().
|
private |
Help value used for graph ploting.
Definition at line 474 of file qkd-buffer.h.
Referenced by Init(), KeyCalculation(), and UpdateKeyGenerationStatistics().
|
private |
Help value used for graph ploting.
Definition at line 475 of file qkd-buffer.h.
Referenced by Init(), KeyCalculation(), and UpdateKeyGenerationStatistics().
|
private |
The previous status; important for deciding about further status that can be selected.
Definition at line 484 of file qkd-buffer.h.
Referenced by CheckState(), FetchPreviousState(), and Init().
|
private |
Help vector used for graph ploting.
Definition at line 480 of file qkd-buffer.h.
Referenced by KeyCalculation().
|
private |
The period of time (in seconds) to calculate average amount of the key in the buffer.
The default value is 5.
Definition at line 479 of file qkd-buffer.h.
Referenced by GetTypeId().
The source node.
Definition at line 300 of file qkd-buffer.h.
Referenced by GetSrcNode(), Init(), and SetSrcNode().
|
private |
The index in the source node buffer list.
Definition at line 531 of file qkd-buffer.h.
Referenced by GetIndex(), and SetIndex().
|
private |
The state of the Net Device transmit state machine.
Definition at line 510 of file qkd-buffer.h.
Referenced by CheckState(), and FetchState().
|
private |
A trace of status changes.
Definition at line 525 of file qkd-buffer.h.
Referenced by CheckState(), and GetTypeId().
|
private |
The list of requested key sizes.
Definition at line 468 of file qkd-buffer.h.
Referenced by ~QKDBuffer(), AddNewKey(), RecordTargetSize(), ReserveKey(), SearchOptimalKeyToTransform(), and UpdateKeyConsumptionStatistics().
|
private |
The threshold amount of key material in the QKD key storage.
Definition at line 487 of file qkd-buffer.h.
Referenced by CheckState(), GetMthr(), GetTypeId(), Init(), InitTotalGraph(), and SetMthr().
|
private |
A traceback for available key bits.
Definition at line 491 of file qkd-buffer.h.
Referenced by GetTypeId(), and SetMthr().
|
private |
A traceback for consumed key bits.
Definition at line 493 of file qkd-buffer.h.
Referenced by GetTypeId(), and SetMthr().
|
private |
A traceback for generated key bits.
Definition at line 492 of file qkd-buffer.h.
Referenced by GetTypeId(), InitTotalGraph(), and SetMthr().
|
private |
A trace for tranformed keys.
Definition at line 519 of file qkd-buffer.h.
Referenced by AddNewKey(), and GetTypeId().
|
private |
Definition at line 470 of file qkd-buffer.h.
Referenced by Init().
|
static |
The number of the created buffers - a static value.
Definition at line 303 of file qkd-buffer.h.
Referenced by Init().
|
static |
|
static |
|
static |
|
static |