A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::QBuffer Class Reference

Qbuffer is a secure storage for QKD keys. More...

#include "q-buffer.h"

+ Inheritance diagram for ns3::QBuffer:
+ Collaboration diagram for ns3::QBuffer:

Classes

struct  data
 

Public Member Functions

 QBuffer ()
 QBuffer constructor.
 
 ~QBuffer () override
 QBuffer destructor.
 
void CheckState ()
 Update the state after some changes on the QBuffer.
 
virtual void Configure (uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurrent, uint32_t defaultKeySize)
 create QKD buffer configuration
 
void Dispose ()
 destroy a QBuffer
 
double GetAverageKeyChargingTimePeriod ()
 Return average duration of key charging process in the long run.
 
virtual uint32_t GetBitCount () const
 get amount of stored key material in bits
 
int64_t GetDeltaTime ()
 
std::string GetDescription () const
 
uint32_t GetId () const
 Get the QKD Storage/Buffer ID.
 
uint32_t GetIndex ()
 Get the index of the buffer per local node.
 
virtual Ptr< QKDKeyGetKey (std::string keyID="", bool fireTraces=true)
 get key from QBuffer
 
uint32_t GetKeyCount () const
 get number of stored keys
 
uint32_t GetKeySize () const
 Get default size of keys stored in QBuffer.
 
int64_t GetLastKeyChargingTimeDuration ()
 Return time value about the time duration of last key charging process.
 
uint64_t GetMaxKeySizeBit () const
 
uint32_t GetMaxNumberOfRecordedKeyChargingTimePeriods () const
 Return the maximal number of values which are used for calculation of average key charging time period.
 
uint32_t GetMCurrentPrevious () const
 Help function used for ploting graphs; Previous - before latest change.
 
uint64_t GetMinKeySizeBit () const
 
uint32_t GetMmax () const
 
uint32_t GetMmin () const
 
uint32_t GetMthr () 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 QKD buffer where it holds that Mthr(t) ≤ Mmax .
 
uint32_t GetPreviousState ()
 Fetch the previous state of the QBuffer.
 
uint32_t GetRemoteNodeId () const
 Get the index of the remote node id.
 
uint32_t GetSrcKMSApplicationIndex () const
 
uint32_t GetState ()
 Fetch the current state of the QBuffer.
 
void Init (uint32_t dstKmNodeId, uint32_t Mmin, uint32_t Mthr, uint32_t Mmax, uint32_t Mcurrent, uint32_t defaultKeySize)
 initialize QBuffer
 
void InitTotalGraph () const
 Help function for total graph ploting.
 
void KeyCalculation ()
 Help function used for ploting graphs.
 
virtual void LogUpdate (uint32_t diffValue, bool positive)
 Log key consumption.
 
bool operator== (QBuffer const &o) const
 Assign operator.
 
void SetDescription (std::string val)
 
void SetIndex (uint32_t)
 Set the index of the buffer per local node.
 
void SetKeySize (uint32_t size)
 Set default key size.
 
void SetMthr (uint32_t thr)
 Set the threshold value of QKD storage.
 
void SetRemoteNodeId (uint32_t value)
 Set the index of the remote node id.
 
void SetSrcKMSApplicationIndex (uint32_t &value)
 
virtual bool StoreKey (Ptr< QKDKey > key=nullptr, bool fireTraces=true)
 store key in QBuffer
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the TypeId.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Static Public Attributes

static const uint32_t QSTATUS_CHARGING = 2
 QStatus CHARGING.
 
static const uint32_t QSTATUS_EMPTY = 3
 QStatus EMPTY.
 
static const uint32_t QSTATUS_READY = 0
 QStatus READY.
 
static const uint32_t QSTATUS_WARNING = 1
 QStatus WARNING.
 

Protected Member Functions

bool DestroyKey (std::string keyId)
 destroy key from the QBuffer
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Protected Attributes

double m_averageKeyChargingTimePeriod
 The average duration of key charging time period.
 
TracedCallback< doublem_averageKeyChargingTimePeriodTrace
 
uint32_t m_bitsChargedInTimePeriod
 Help value used for graph ploting and calculation of average post-processing duration.
 
uint32_t m_bitsUsedInTimePeriod
 Help value used for detection of average key usage.
 
uint32_t m_bufferID
 unique buffer ID
 
double m_c
 average amount of key in the buffer during the recalculate time period
 
EventId m_calculateRoutingMetric
 
std::vector< int64_t > m_chargingTimePeriods
 Vector of durations of several last charging time periods.
 
TracedCallback< doublem_CMetricChangeTrace
 
uint32_t m_currentKeyBit
 The current amount of key material in QKD key storage.
 
TracedCallback< uint32_tm_currentKeyBitChangeTrace
 
TracedCallback< uint32_tm_currentKeyBitDecreaseTrace
 
TracedCallback< uint32_tm_currentKeyBitIncreaseTrace
 
uint32_t m_currentKeyBitPrevious
 The previous value of current amount of key material in QKD key storage.
 
uint32_t m_defaultKeySize
 
std::string m_description
 
uint32_t m_dstKmNodeId
 
bool m_isRisingCurve
 whether curve on graph is rising or not
 
std::unordered_map< std::string, Ptr< QKDKey > > m_keys
 key database
 
TracedCallback< Ptr< QKDKey > > m_keyServedTrace
 
int64_t m_lastKeyChargingTimeDuration
 The timestamp of last key usage.
 
int64_t m_lastKeyChargingTimeStamp
 The timestamp of last key charging(when the new key material was added)
 
uint32_t m_maxKeyBit
 
uint32_t m_maxNumberOfRecordedKeyChargingTimePeriods
 The maximal number of values which are used for stored for calculation of average key charging time period.
 
uint32_t m_maxValueGraph
 
uint32_t m_minKeyBit
 
TracedCallback< Ptr< QKDKey > > m_newKeyAddedTrace
 
uint32_t m_nextKeyID
 ID of the next key to be generated.
 
uint32_t m_noAddNewValue
 Help value used for graph ploting.
 
uint32_t m_noEntry
 Help value used for graph ploting.
 
uint32_t m_period
 Help value used for graph ploting.
 
uint32_t m_previousStatus
 
std::vector< struct QBuffer::datam_previousValues
 Help vector used for graph ploting.
 
uint32_t m_recalculateTimePeriod
 The period of time(in seconds) to calculate average amount of the key in the buffer Default value 5 - used in routing protocols for detection of information freshness.
 
uint32_t m_srcKMSApplicationIndex
 
uint32_t m_srcNodeBufferListIndex
 
uint32_t m_status
 The state of the Net Device transmit state machine.
 
TracedCallback< uint32_tm_StatusChangeTrace
 
uint32_t m_thresholdKeyBit
 
TracedCallback< uint32_tm_thresholdKeyBitChangeTrace
 

Static Protected Attributes

static uint32_t nBuffers = 0
 number of created buffers - static value
 

Additional Inherited Members

Detailed Description

Qbuffer is a secure storage for QKD keys.

Introspection did not find any typical Config paths.

QBuffer is assigned for each connection using QKDControl on each peer.

Note
The two QKD nodes that establish one or more logical QKD connections will implement QBuffer on each side which will be assigned by QKDControl entity. The purpose of the QBuffer is to collect enough key material for its subsequent use for cryptographic purposes. Due to the limited charging key rate of QKD protocols, QKD post-processing applications strive to save keys in QBuffers to generate as many keys in advance. However, warehouses have a limited capacity that is defined with a maximum value. They also have a minimum capacity that describes the minimum amount of key required to establish initial post-processing operations. Also, the buffer implements a threshold value that may indicate that the necessary actions are being taken before the buffer is completely emptied.

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 QBuffer 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 QBuffer 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.


Attributes

  • CalculationTimePeriod: The period of time(in seconds) to calculate average amount of the key in the buffer
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 5
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • DefaultKeySize: The default key size
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 512
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • MaxNumberOfRecordedKeyCharingTimePeriods: The maximal number of values which are stored for calculation of average key charging time period
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 5
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • Maximal: The maximal amount of key material in QKD storage(bits)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1000000000
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • Minimal: The minimal amount of key material in QKD storage(bits)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1000000
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • Threshold: The threshold amount of key material in QKD(bits)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 2000000
    • Flags: constructwriteread
    • Support level: SUPPORTED

TraceSources

  • AverageKeyChargingTimePeriod: The change trace for current status of QKD storage
    • Callback signature: ns3::QBuffer::AverageKeyChargingTimePeriod
    • Support level: SUPPORTED
  • CMetricChange: The change trace for current status of QKD storage
    • Callback signature: ns3::QBuffer::CMetricChange
    • Support level: SUPPORTED
  • CurrentChange: The change trace for current amount of key material in QKD storage
    • Callback signature: ns3::QBuffer::CurrentChange
    • Support level: SUPPORTED
  • CurrentDecrease: The decrease trace for current amount of key material in QKD storage - TOTAL GRAPH
    • Callback signature: ns3::QBuffer::CurrentDecrease
    • Support level: SUPPORTED
  • CurrentIncrease: The increase trace for current amount of key material in QKD storage - TOTAL GRAPH
    • Callback signature: ns3::QBuffer::CurrentIncrease
    • Support level: SUPPORTED
  • KeyServed: The threce to monitor key usage
    • Callback signature: ns3::QBuffer::AverageKeyChargingTimePeriod
    • Support level: SUPPORTED
  • NewKeyAdded: The trace to monitor adding new key material to the buffer
    • Callback signature: ns3::QBuffer::AverageKeyChargingTimePeriod
    • Support level: SUPPORTED
  • StatusChange: The change trace for current status of QKD storage
    • Callback signature: ns3::QBuffer::StatusChange
    • Support level: SUPPORTED
  • ThresholdChange: The change trace for threshold amount of key material in QKD storage
    • Callback signature: ns3::QBuffer::ThresholdChange
    • Support level: SUPPORTED

Size of this type is 576 bytes (on a 64-bit architecture).

Definition at line 71 of file q-buffer.h.

Constructor & Destructor Documentation

◆ QBuffer()

ns3::QBuffer::QBuffer ( )

QBuffer constructor.

Definition at line 113 of file q-buffer.cc.

References NS_LOG_FUNCTION.

◆ ~QBuffer()

ns3::QBuffer::~QBuffer ( )
override

QBuffer destructor.

Definition at line 176 of file q-buffer.cc.

References m_keys, and NS_LOG_FUNCTION.

Member Function Documentation

◆ CheckState()

void ns3::QBuffer::CheckState ( )

◆ Configure()

void ns3::QBuffer::Configure ( uint32_t  Mmin,
uint32_t  Mthr,
uint32_t  Mmax,
uint32_t  Mcurrent,
uint32_t  defaultKeySize 
)
virtual

create QKD buffer configuration

Parameters
Mminminimum amount(bits) of key material QKD buffer should maintain
Mmaxmaximum amount(bits) of key material QKD buffer can store
Mthrthresold amount(bits) of key material
Mcurrcurrent amount(bits) of key material QKD buffer maintain
defaultKeySizedefault size of stored keys

Definition at line 119 of file q-buffer.cc.

References ns3::Create(), m_currentKeyBit, m_defaultKeySize, m_maxKeyBit, m_minKeyBit, m_thresholdKeyBit, and NS_LOG_FUNCTION.

Referenced by ns3::SBuffer::SBuffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DestroyKey()

bool ns3::QBuffer::DestroyKey ( std::string  keyId)
protected

destroy key from the QBuffer

Parameters
keyIdkey identifier
Returns
bool function status

Definition at line 409 of file q-buffer.cc.

References ns3::Create(), m_keys, and NS_LOG_FUNCTION.

Referenced by GetKey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Dispose()

void ns3::QBuffer::Dispose ( )

destroy a QBuffer

This is the pre-destructor function of the QBuffer.

Definition at line 183 of file q-buffer.cc.

References ns3::Simulator::Cancel(), m_calculateRoutingMetric, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetAverageKeyChargingTimePeriod()

double ns3::QBuffer::GetAverageKeyChargingTimePeriod ( )

Return average duration of key charging process in the long run.

Returns
double average duration of key charging period

Definition at line 509 of file q-buffer.cc.

References m_averageKeyChargingTimePeriod, and NS_LOG_FUNCTION.

◆ GetBitCount()

virtual uint32_t ns3::QBuffer::GetBitCount ( ) const
inlinevirtual

get amount of stored key material in bits

Returns
int32_t amount of stored key material in bits

Reimplemented in ns3::SBuffer.

Definition at line 167 of file q-buffer.h.

References m_currentKeyBit.

Referenced by StoreKey().

+ Here is the caller graph for this function:

◆ GetDeltaTime()

int64_t ns3::QBuffer::GetDeltaTime ( )

Definition at line 501 of file q-buffer.cc.

References ns3::Create(), ns3::Time::GetMilliSeconds(), m_lastKeyChargingTimeStamp, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetDescription()

std::string ns3::QBuffer::GetDescription ( ) const
inline

Definition at line 187 of file q-buffer.h.

References m_description.

◆ GetId()

uint32_t ns3::QBuffer::GetId ( ) const

Get the QKD Storage/Buffer ID.

Returns
int32_t buffer unique ID

Definition at line 474 of file q-buffer.cc.

References m_bufferID, and NS_LOG_FUNCTION.

◆ GetIndex()

uint32_t ns3::QBuffer::GetIndex ( )

Get the index of the buffer per local node.

Returns
int32_t index

Definition at line 562 of file q-buffer.cc.

References m_srcNodeBufferListIndex, and NS_LOG_FUNCTION.

◆ GetKey()

Ptr< QKDKey > ns3::QBuffer::GetKey ( std::string  keyID = "",
bool  fireTraces = true 
)
virtual

get key from QBuffer

Parameters
keyIDkey identifier
Returns
Ptr to the key

Reimplemented in ns3::SBuffer.

Definition at line 360 of file q-buffer.cc.

References ns3::Create(), DestroyKey(), GetKeyCount(), LogUpdate(), m_currentKeyBitDecreaseTrace, m_keys, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::SBuffer::GetKey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetKeyCount()

uint32_t ns3::QBuffer::GetKeyCount ( ) const

get number of stored keys

Returns
int32_t key count

Definition at line 279 of file q-buffer.cc.

References m_keys.

Referenced by GetKey(), ns3::SBuffer::GetSKeyCount(), ns3::SBuffer::GetTransformCandidate(), and ns3::SBuffer::LogUpdate().

+ Here is the caller graph for this function:

◆ GetKeySize()

uint32_t ns3::QBuffer::GetKeySize ( ) const

Get default size of keys stored in QBuffer.

Returns
int32_t default key size

Definition at line 190 of file q-buffer.cc.

References m_defaultKeySize.

Referenced by ns3::SBuffer::GetDefaultKeyCount(), ns3::SBuffer::GetStreamKeyCount(), ns3::SBuffer::InsertKeyToStreamSession(), and ns3::SBuffer::LogUpdate().

+ Here is the caller graph for this function:

◆ GetLastKeyChargingTimeDuration()

int64_t ns3::QBuffer::GetLastKeyChargingTimeDuration ( )

Return time value about the time duration of last key charging process.

Returns
int64_t lastKeyChargingTimeDuration

Definition at line 490 of file q-buffer.cc.

References m_lastKeyChargingTimeDuration, and NS_LOG_FUNCTION.

◆ GetMaxKeySizeBit()

uint64_t ns3::QBuffer::GetMaxKeySizeBit ( ) const
inline

Definition at line 177 of file q-buffer.h.

References m_maxKeyBit.

◆ GetMaxNumberOfRecordedKeyChargingTimePeriods()

uint32_t ns3::QBuffer::GetMaxNumberOfRecordedKeyChargingTimePeriods ( ) const

Return the maximal number of values which are used for calculation of average key charging time period.

Returns
int32_t maximal number of recorded key charging time periods; default value 5

Definition at line 423 of file q-buffer.cc.

References m_maxNumberOfRecordedKeyChargingTimePeriods.

◆ GetMCurrentPrevious()

uint32_t ns3::QBuffer::GetMCurrentPrevious ( ) const

Help function used for ploting graphs; Previous - before latest change.

Returns
int32_t integer representation of the previous QKD storage key material;

Definition at line 530 of file q-buffer.cc.

References m_currentKeyBitPrevious, and NS_LOG_FUNCTION.

◆ GetMinKeySizeBit()

uint64_t ns3::QBuffer::GetMinKeySizeBit ( ) const
inline

Definition at line 172 of file q-buffer.h.

References m_minKeyBit.

◆ GetMmax()

uint32_t ns3::QBuffer::GetMmax ( ) const

Definition at line 274 of file q-buffer.cc.

References m_maxKeyBit.

Referenced by StoreKey().

+ Here is the caller graph for this function:

◆ GetMmin()

uint32_t ns3::QBuffer::GetMmin ( ) const

Definition at line 269 of file q-buffer.cc.

References m_minKeyBit.

◆ GetMthr()

uint32_t ns3::QBuffer::GetMthr ( ) 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 QKD buffer where it holds that Mthr(t) ≤ Mmax .

Returns
int32_t integer representation of the threshold value of the QKD storage

Definition at line 537 of file q-buffer.cc.

References m_thresholdKeyBit, and NS_LOG_FUNCTION.

◆ GetPreviousState()

uint32_t ns3::QBuffer::GetPreviousState ( )

Fetch the previous state of the QBuffer.

Help function used for ploting graphs

Returns
int32_t integer representation of QKD Storage state

Definition at line 523 of file q-buffer.cc.

References m_previousStatus, and NS_LOG_FUNCTION.

◆ GetRemoteNodeId()

uint32_t ns3::QBuffer::GetRemoteNodeId ( ) const
inline

Get the index of the remote node id.

Returns
int32_t index

Definition at line 340 of file q-buffer.h.

References m_dstKmNodeId.

◆ GetSrcKMSApplicationIndex()

uint32_t ns3::QBuffer::GetSrcKMSApplicationIndex ( ) const
inline

Definition at line 360 of file q-buffer.h.

References m_srcKMSApplicationIndex.

◆ GetState()

uint32_t ns3::QBuffer::GetState ( )

Fetch the current state of the QBuffer.

QBuffer 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 516 of file q-buffer.cc.

References m_status, and NS_LOG_FUNCTION.

◆ GetTypeId()

◆ Init()

void ns3::QBuffer::Init ( uint32_t  dstKmNodeId,
uint32_t  Mmin,
uint32_t  Mthr,
uint32_t  Mmax,
uint32_t  Mcurrent,
uint32_t  defaultKeySize 
)

initialize QBuffer

Parameters
dstKmNodeIdremote key manager node identifier
Mminminimum amount(bits) of key material QBuffer should maintain
Mthrthresold amount(bits) of key material
Mmaxmaximum amount(bits) of key material QBuffer can store
Mcurrcurrent amount(bits) of key material QBuffer maintain
defaultKeySizedefault size of stored keys

Definition at line 136 of file q-buffer.cc.

References CheckState(), ns3::Create(), m_bitsChargedInTimePeriod, m_bitsUsedInTimePeriod, m_bufferID, m_c, m_currentKeyBit, m_currentKeyBitPrevious, m_defaultKeySize, m_dstKmNodeId, m_lastKeyChargingTimeDuration, m_lastKeyChargingTimeStamp, m_maxKeyBit, m_minKeyBit, m_noAddNewValue, m_noEntry, m_period, m_previousStatus, m_thresholdKeyBit, nBuffers, and NS_LOG_FUNCTION.

Referenced by ns3::SBuffer::DoInitialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitTotalGraph()

void ns3::QBuffer::InitTotalGraph ( ) const

Help function for total graph ploting.

Definition at line 480 of file q-buffer.cc.

References m_currentKeyBit, m_currentKeyBitIncreaseTrace, and NS_LOG_FUNCTION.

◆ KeyCalculation()

void ns3::QBuffer::KeyCalculation ( )

Help function used for ploting graphs.

Definition at line 201 of file q-buffer.cc.

References CheckState(), ns3::compareByData(), m_currentKeyBit, m_currentKeyBitPrevious, m_isRisingCurve, m_noEntry, m_period, m_previousValues, NS_LOG_FUNCTION, ns3::QBuffer::data::position, and ns3::QBuffer::data::value.

Referenced by StoreKey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogUpdate()

void ns3::QBuffer::LogUpdate ( uint32_t  diffValue,
bool  positive 
)
virtual

Log key consumption.

Parameters
diffValuekey consumption in bits
positiveincrement or negative

It is utilized from derived class S-Buffer when a portion of key is obtained from m_keys, to account for this key usage.

Reimplemented in ns3::SBuffer.

Definition at line 230 of file q-buffer.cc.

References CheckState(), ns3::Create(), m_bitsUsedInTimePeriod, m_currentKeyBit, m_currentKeyBitChangeTrace, and NS_LOG_FUNCTION.

Referenced by GetKey(), and StoreKey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator==()

bool ns3::QBuffer::operator== ( QBuffer const o) const

Assign operator.

Parameters
oOther QBuffer
Returns
True if buffers are identical; False otherwise

Definition at line 467 of file q-buffer.cc.

References ns3::Create(), and m_bufferID.

+ Here is the call graph for this function:

◆ SetDescription()

void ns3::QBuffer::SetDescription ( std::string  val)
inline

Definition at line 182 of file q-buffer.h.

References ns3::Create(), and m_description.

+ Here is the call graph for this function:

◆ SetIndex()

void ns3::QBuffer::SetIndex ( uint32_t  index)

Set the index of the buffer per local node.

Parameters
int32_tindex

Definition at line 551 of file q-buffer.cc.

References m_srcNodeBufferListIndex, and NS_LOG_FUNCTION.

◆ SetKeySize()

void ns3::QBuffer::SetKeySize ( uint32_t  size)

Set default key size.

Parameters
sizekey size

Definition at line 557 of file q-buffer.cc.

References m_defaultKeySize.

Referenced by ns3::SBuffer::SBuffer().

+ Here is the caller graph for this function:

◆ SetMthr()

void ns3::QBuffer::SetMthr ( uint32_t  thr)

Set the threshold value of QKD storage.

Parameters
int32_tinteger set the threshold value of the QKD storage

Definition at line 543 of file q-buffer.cc.

References ns3::Create(), m_thresholdKeyBit, m_thresholdKeyBitChangeTrace, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SetRemoteNodeId()

void ns3::QBuffer::SetRemoteNodeId ( uint32_t  value)
inline

Set the index of the remote node id.

Parameters
int32_tvalue

Definition at line 350 of file q-buffer.h.

References m_dstKmNodeId, and ns3::value().

+ Here is the call graph for this function:

◆ SetSrcKMSApplicationIndex()

void ns3::QBuffer::SetSrcKMSApplicationIndex ( uint32_t value)
inline

Definition at line 355 of file q-buffer.h.

References m_srcKMSApplicationIndex, and ns3::value().

+ Here is the call graph for this function:

◆ StoreKey()

bool ns3::QBuffer::StoreKey ( Ptr< QKDKey key = nullptr,
bool  fireTraces = true 
)
virtual

store key in QBuffer

Parameters
Ptr<QKey>key
Returns
true if the key is added to the storage; False otherwise

Second, add new value to vector of previous values

Reimplemented in ns3::SBuffer.

Definition at line 285 of file q-buffer.cc.

References ns3::Create(), GetBitCount(), ns3::Time::GetMilliSeconds(), GetMmax(), KeyCalculation(), LogUpdate(), m_averageKeyChargingTimePeriod, m_averageKeyChargingTimePeriodTrace, m_bitsChargedInTimePeriod, m_chargingTimePeriods, m_currentKeyBit, m_currentKeyBitChangeTrace, m_currentKeyBitIncreaseTrace, m_keys, 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 ns3::SBuffer::StoreKey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_averageKeyChargingTimePeriod

double ns3::QBuffer::m_averageKeyChargingTimePeriod
protected

The average duration of key charging time period.

Definition at line 488 of file q-buffer.h.

Referenced by GetAverageKeyChargingTimePeriod(), and StoreKey().

◆ m_averageKeyChargingTimePeriodTrace

TracedCallback< double > ns3::QBuffer::m_averageKeyChargingTimePeriodTrace
protected

Definition at line 500 of file q-buffer.h.

Referenced by GetTypeId(), and StoreKey().

◆ m_bitsChargedInTimePeriod

uint32_t ns3::QBuffer::m_bitsChargedInTimePeriod
protected

Help value used for graph ploting and calculation of average post-processing duration.

Definition at line 413 of file q-buffer.h.

Referenced by Init(), and StoreKey().

◆ m_bitsUsedInTimePeriod

uint32_t ns3::QBuffer::m_bitsUsedInTimePeriod
protected

Help value used for detection of average key usage.

Definition at line 418 of file q-buffer.h.

Referenced by Init(), LogUpdate(), and ns3::SBuffer::LogUpdate().

◆ m_bufferID

uint32_t ns3::QBuffer::m_bufferID
protected

unique buffer ID

Definition at line 379 of file q-buffer.h.

Referenced by GetId(), Init(), and operator==().

◆ m_c

double ns3::QBuffer::m_c
protected

average amount of key in the buffer during the recalculate time period

Definition at line 431 of file q-buffer.h.

Referenced by Init().

◆ m_calculateRoutingMetric

EventId ns3::QBuffer::m_calculateRoutingMetric
protected

Definition at line 490 of file q-buffer.h.

Referenced by Dispose().

◆ m_chargingTimePeriods

std::vector< int64_t > ns3::QBuffer::m_chargingTimePeriods
protected

Vector of durations of several last charging time periods.

Definition at line 478 of file q-buffer.h.

Referenced by StoreKey().

◆ m_CMetricChangeTrace

TracedCallback< double > ns3::QBuffer::m_CMetricChangeTrace
protected

Definition at line 499 of file q-buffer.h.

Referenced by GetTypeId().

◆ m_currentKeyBit

uint32_t ns3::QBuffer::m_currentKeyBit
protected

◆ m_currentKeyBitChangeTrace

TracedCallback< uint32_t > ns3::QBuffer::m_currentKeyBitChangeTrace
protected

Definition at line 495 of file q-buffer.h.

Referenced by GetTypeId(), LogUpdate(), ns3::SBuffer::LogUpdate(), and StoreKey().

◆ m_currentKeyBitDecreaseTrace

TracedCallback< uint32_t > ns3::QBuffer::m_currentKeyBitDecreaseTrace
protected

Definition at line 497 of file q-buffer.h.

Referenced by GetKey(), and GetTypeId().

◆ m_currentKeyBitIncreaseTrace

TracedCallback< uint32_t > ns3::QBuffer::m_currentKeyBitIncreaseTrace
protected

Definition at line 496 of file q-buffer.h.

Referenced by GetTypeId(), InitTotalGraph(), and StoreKey().

◆ m_currentKeyBitPrevious

uint32_t ns3::QBuffer::m_currentKeyBitPrevious
protected

The previous value of current amount of key material in QKD key storage.

Definition at line 457 of file q-buffer.h.

Referenced by CheckState(), GetMCurrentPrevious(), Init(), and KeyCalculation().

◆ m_defaultKeySize

uint32_t ns3::QBuffer::m_defaultKeySize
protected

◆ m_description

std::string ns3::QBuffer::m_description
protected

Definition at line 387 of file q-buffer.h.

Referenced by GetDescription(), and SetDescription().

◆ m_dstKmNodeId

uint32_t ns3::QBuffer::m_dstKmNodeId
protected

Definition at line 375 of file q-buffer.h.

Referenced by ns3::SBuffer::DoInitialize(), GetRemoteNodeId(), Init(), and SetRemoteNodeId().

◆ m_isRisingCurve

bool ns3::QBuffer::m_isRisingCurve
protected

whether curve on graph is rising or not

Definition at line 433 of file q-buffer.h.

Referenced by CheckState(), and KeyCalculation().

◆ m_keys

◆ m_keyServedTrace

TracedCallback< Ptr<QKDKey> > ns3::QBuffer::m_keyServedTrace
protected

Definition at line 493 of file q-buffer.h.

Referenced by GetTypeId().

◆ m_lastKeyChargingTimeDuration

int64_t ns3::QBuffer::m_lastKeyChargingTimeDuration
protected

The timestamp of last key usage.

Definition at line 467 of file q-buffer.h.

Referenced by GetLastKeyChargingTimeDuration(), Init(), and StoreKey().

◆ m_lastKeyChargingTimeStamp

int64_t ns3::QBuffer::m_lastKeyChargingTimeStamp
protected

The timestamp of last key charging(when the new key material was added)

Definition at line 462 of file q-buffer.h.

Referenced by GetDeltaTime(), Init(), and StoreKey().

◆ m_maxKeyBit

uint32_t ns3::QBuffer::m_maxKeyBit
protected

◆ m_maxNumberOfRecordedKeyChargingTimePeriods

uint32_t ns3::QBuffer::m_maxNumberOfRecordedKeyChargingTimePeriods
protected

The maximal number of values which are used for stored for calculation of average key charging time period.

Definition at line 473 of file q-buffer.h.

Referenced by GetMaxNumberOfRecordedKeyChargingTimePeriods(), GetTypeId(), and StoreKey().

◆ m_maxValueGraph

uint32_t ns3::QBuffer::m_maxValueGraph
protected

Definition at line 441 of file q-buffer.h.

◆ m_minKeyBit

uint32_t ns3::QBuffer::m_minKeyBit
protected

◆ m_newKeyAddedTrace

TracedCallback< Ptr<QKDKey> > ns3::QBuffer::m_newKeyAddedTrace
protected

Definition at line 492 of file q-buffer.h.

Referenced by GetTypeId().

◆ m_nextKeyID

uint32_t ns3::QBuffer::m_nextKeyID
protected

ID of the next key to be generated.

Definition at line 392 of file q-buffer.h.

◆ m_noAddNewValue

uint32_t ns3::QBuffer::m_noAddNewValue
protected

Help value used for graph ploting.

Definition at line 407 of file q-buffer.h.

Referenced by Init(), and StoreKey().

◆ m_noEntry

uint32_t ns3::QBuffer::m_noEntry
protected

Help value used for graph ploting.

Definition at line 397 of file q-buffer.h.

Referenced by Init(), KeyCalculation(), and StoreKey().

◆ m_period

uint32_t ns3::QBuffer::m_period
protected

Help value used for graph ploting.

Definition at line 402 of file q-buffer.h.

Referenced by Init(), KeyCalculation(), and StoreKey().

◆ m_previousStatus

uint32_t ns3::QBuffer::m_previousStatus
protected

Definition at line 435 of file q-buffer.h.

Referenced by CheckState(), GetPreviousState(), and Init().

◆ m_previousValues

std::vector< struct QBuffer::data > ns3::QBuffer::m_previousValues
protected

Help vector used for graph ploting.

Definition at line 429 of file q-buffer.h.

Referenced by KeyCalculation().

◆ m_recalculateTimePeriod

uint32_t ns3::QBuffer::m_recalculateTimePeriod
protected

The period of time(in seconds) to calculate average amount of the key in the buffer Default value 5 - used in routing protocols for detection of information freshness.

Definition at line 424 of file q-buffer.h.

Referenced by GetTypeId().

◆ m_srcKMSApplicationIndex

uint32_t ns3::QBuffer::m_srcKMSApplicationIndex
protected

Definition at line 385 of file q-buffer.h.

Referenced by GetSrcKMSApplicationIndex(), and SetSrcKMSApplicationIndex().

◆ m_srcNodeBufferListIndex

uint32_t ns3::QBuffer::m_srcNodeBufferListIndex
protected

Definition at line 502 of file q-buffer.h.

Referenced by GetIndex(), and SetIndex().

◆ m_status

uint32_t ns3::QBuffer::m_status
protected

The state of the Net Device transmit state machine.

Definition at line 483 of file q-buffer.h.

Referenced by CheckState(), and GetState().

◆ m_StatusChangeTrace

TracedCallback< uint32_t > ns3::QBuffer::m_StatusChangeTrace
protected

Definition at line 498 of file q-buffer.h.

Referenced by CheckState(), and GetTypeId().

◆ m_thresholdKeyBit

uint32_t ns3::QBuffer::m_thresholdKeyBit
protected

◆ m_thresholdKeyBitChangeTrace

TracedCallback< uint32_t > ns3::QBuffer::m_thresholdKeyBitChangeTrace
protected

Definition at line 447 of file q-buffer.h.

Referenced by GetTypeId(), and SetMthr().

◆ nBuffers

uint32_t ns3::QBuffer::nBuffers = 0
staticprotected

number of created buffers - static value

Definition at line 381 of file q-buffer.h.

Referenced by Init().

◆ QSTATUS_CHARGING

const uint32_t ns3::QBuffer::QSTATUS_CHARGING = 2
static

QStatus CHARGING.

Definition at line 76 of file q-buffer.h.

Referenced by CheckState().

◆ QSTATUS_EMPTY

const uint32_t ns3::QBuffer::QSTATUS_EMPTY = 3
static

QStatus EMPTY.

Definition at line 77 of file q-buffer.h.

Referenced by CheckState().

◆ QSTATUS_READY

const uint32_t ns3::QBuffer::QSTATUS_READY = 0
static

QStatus READY.

Definition at line 74 of file q-buffer.h.

Referenced by CheckState().

◆ QSTATUS_WARNING

const uint32_t ns3::QBuffer::QSTATUS_WARNING = 1
static

QStatus WARNING.

Definition at line 75 of file q-buffer.h.

Referenced by CheckState().


The documentation for this class was generated from the following files: