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

Sbuffer is a working buffer from which keys are served. More...

#include "s-buffer.h"

+ Inheritance diagram for ns3::SBuffer:
+ Collaboration diagram for ns3::SBuffer:

Public Types

enum  Type {
  LOCAL_SBUFFER , RELAY_SBUFFER , STREAM_SBUFFER , E2E_SESSION ,
  LOCAL_SESSION
}
 S-Buffer Type. More...
 

Public Member Functions

 SBuffer ()
 QBuffer constructor.
 
 SBuffer (SBuffer::Type type, uint32_t size)
 SBuffer constructor.
 
 ~SBuffer () override
 QBuffer destructor.
 
virtual void DoInitialize () override
 Initialize() implementation.
 
uint32_t GetBitCount () const override
 get amount of stored key material in bits
 
uint32_t GetDefaultKeyCount (uint32_t number=0)
 Get number of keys that are in default size.
 
Ptr< QKDKeyGetHalfKey (std::string keyId, uint32_t size)
 Get portion of key.
 
Ptr< QKDKeyGetKey (std::string keyID="", bool fireTraces=true) override
 get key from QBuffer
 
Ptr< QKDKeyGetKey (uint32_t size)
 Get key with given size.
 
uint32_t GetNextIndex ()
 
uint32_t GetSBitCount ()
 Get servable bit count.
 
uint32_t GetSKeyCount ()
 Get servable key count.
 
uint32_t GetStreamIndex ()
 
Ptr< QKDKeyGetStreamKey ()
 Returns key chunk with lowest index.
 
uint32_t GetStreamKeyCount ()
 
Ptr< QKDKeyGetSupplyKey (std::string keyId)
 Get supply key.
 
Ptr< QKDKeyGetTransformCandidate (uint32_t size)
 Get key candidate.
 
Type GetType ()
 Get s-buffer type.
 
void InsertKeyToStreamSession (Ptr< QKDKey > key)
 Insert key to key stream session.
 
bool IsRelayActive ()
 
void LogUpdate (uint32_t diffValue, bool positive) override
 Log key consumption.
 
void MarkKey (std::string keyId, QKDKey::QKDKeyState_e state)
 Mark key.
 
void SetKeyLifetime (std::string keyId)
 Assign a lifetime to a key.
 
void SetRelayState (bool relayActive)
 
void SetType (Type type)
 Set s-buffer type.
 
bool StoreKey (Ptr< QKDKey > key)
 store key in SBuffer
 
bool StoreKey (Ptr< QKDKey > key, bool fireTraces) override
 store key in QBuffer
 
void StoreSupplyKey (Ptr< QKDKey > key)
 Store supply key.
 
- Public Member Functions inherited from ns3::QBuffer
 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.
 
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.
 
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.
 
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)
 
- 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::QBuffer
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.
 

Private Attributes

uint32_t m_currentStreamIndex
 The last index when the S-Buffer is used for key stream sessions.
 
uint32_t m_defaultKeySizeSBufferDefault
 
uint32_t m_maxKeyBitSBufferDefault
 
uint32_t m_minKeyBitSBufferDefault
 
uint32_t m_notReadyBitCount
 Amount of key material stored that are not in READY state.
 
uint32_t m_notReadyKeyCount
 Number of keys stored which are not in READY state.
 
bool m_relayActive
 The state of S-Buffer will not trigger relay if relay is active.
 
std::map< uint32_t, Ptr< QKDKey > > m_stream_keys
 Key stream session.
 
std::map< std::string, Ptr< QKDKey > > m_supply_keys
 Created keys which are ready for supply to crypto applications.
 
uint32_t m_thresholdKeyBitSBufferDefault
 
SBuffer::Type m_type
 S-Buffer type.
 

Additional Inherited Members

- Static Public Attributes inherited from ns3::QBuffer
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 inherited from ns3::QBuffer
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 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 inherited from ns3::QBuffer
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 inherited from ns3::QBuffer
static uint32_t nBuffers = 0
 number of created buffers - static value
 

Detailed Description

Sbuffer is a working buffer from which keys are served.

Introspection did not find any typical Config paths.

Note
Each QBuffer has a pair of SBuffers, one dedicated for the outbound(enc) and other for the inbound(dec) connection.

The SBuffer is filled with certain amount of key material from QBuffer, and is accessed to serve cryptographic application request.


Attributes

  • SDefaultKeySize: The default key size of Sbuffer
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 512
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • SMaximal: The maximal amount of key material in Sbuffer (bits)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 128000
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • SMinimal: The minimal amount of key material in Sbuffer (bits)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 10
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • SThreshold: The threshold amount of key material in Sbuffer (bits)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 32000
    • Flags: constructwriteread
    • Support level: SUPPORTED

Attributes defined in parent class ns3::QBuffer

  • 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

No TraceSources are defined for this type.

TraceSources defined in parent class ns3::QBuffer

  • 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 704 bytes (on a 64-bit architecture).

Definition at line 50 of file s-buffer.h.

Member Enumeration Documentation

◆ Type

S-Buffer Type.

Enumerator
LOCAL_SBUFFER 
RELAY_SBUFFER 
STREAM_SBUFFER 
E2E_SESSION 
LOCAL_SESSION 

Definition at line 56 of file s-buffer.h.

Constructor & Destructor Documentation

◆ SBuffer() [1/2]

ns3::SBuffer::SBuffer ( )

QBuffer constructor.

Definition at line 62 of file s-buffer.cc.

References m_currentStreamIndex, m_notReadyBitCount, m_notReadyKeyCount, m_relayActive, and NS_LOG_FUNCTION.

◆ SBuffer() [2/2]

ns3::SBuffer::SBuffer ( SBuffer::Type  type,
uint32_t  size 
)

SBuffer constructor.

Parameters
typeSBuffer type
sizeSBuffer default key size

Definition at line 99 of file s-buffer.cc.

References ns3::QBuffer::Configure(), m_currentStreamIndex, m_notReadyBitCount, m_notReadyKeyCount, m_relayActive, NS_LOG_FUNCTION, ns3::QBuffer::SetKeySize(), SetType(), and STREAM_SBUFFER.

+ Here is the call graph for this function:

◆ ~SBuffer()

ns3::SBuffer::~SBuffer ( )
override

QBuffer destructor.

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

References ns3::QBuffer::m_keys, m_stream_keys, m_supply_keys, and NS_LOG_FUNCTION.

Member Function Documentation

◆ DoInitialize()

void ns3::SBuffer::DoInitialize ( )
overridevirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 72 of file s-buffer.cc.

References ns3::Object::DoInitialize(), ns3::QBuffer::Init(), m_currentStreamIndex, ns3::QBuffer::m_defaultKeySize, m_defaultKeySizeSBufferDefault, ns3::QBuffer::m_dstKmNodeId, ns3::QBuffer::m_maxKeyBit, m_maxKeyBitSBufferDefault, ns3::QBuffer::m_minKeyBit, m_minKeyBitSBufferDefault, m_notReadyBitCount, m_notReadyKeyCount, m_relayActive, ns3::QBuffer::m_thresholdKeyBit, m_thresholdKeyBitSBufferDefault, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetBitCount()

uint32_t ns3::SBuffer::GetBitCount ( ) const
inlineoverridevirtual

get amount of stored key material in bits

Returns
int32_t amount of stored key material in bits

Reimplemented from ns3::QBuffer.

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

References ns3::QBuffer::m_currentKeyBit.

Referenced by GetSBitCount(), InsertKeyToStreamSession(), and StoreKey().

+ Here is the caller graph for this function:

◆ GetDefaultKeyCount()

uint32_t ns3::SBuffer::GetDefaultKeyCount ( uint32_t  number = 0)

Get number of keys that are in default size.

Parameters
uint32_ta target number of required keys
Returns
uint32_t number of key in default size

This function is important when cosidereing the RELAY operation. The RELAY procedure can not make desicion based on available key count, because it does not include the transform operation in parallel.

Definition at line 143 of file s-buffer.cc.

References ns3::Create(), ns3::QBuffer::GetKeySize(), ns3::QBuffer::m_keys, NS_LOG_FUNCTION, and ns3::QKDKey::READY.

+ Here is the call graph for this function:

◆ GetHalfKey()

Ptr< QKDKey > ns3::SBuffer::GetHalfKey ( std::string  keyId,
uint32_t  size 
)

Get portion of key.

Parameters
keyIdkey identifier
sizeportion size
Returns
Ptr on QKD key

This function is called on s-buffer("dec"), as a counterpart to conditioned GetTransformCandidate function. It returns a portion of key, identified with keyId. In this case, the remaining portion is s-buffer remains in READY state.

Definition at line 420 of file s-buffer.cc.

References ns3::Create(), GetKey(), LogUpdate(), ns3::QBuffer::m_keys, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::value().

+ Here is the call graph for this function:

◆ GetKey() [1/2]

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

get key from QBuffer

Parameters
keyIDkey identifier
Returns
Ptr to the key

Reimplemented from ns3::QBuffer.

Definition at line 476 of file s-buffer.cc.

References ns3::QBuffer::CheckState(), ns3::Create(), ns3::QBuffer::GetKey(), LogUpdate(), and ns3::QKDKey::READY.

+ Here is the call graph for this function:

◆ GetKey() [2/2]

Ptr< QKDKey > ns3::SBuffer::GetKey ( uint32_t  size)

Get key with given size.

Parameters
sizesize of the key
Returns
Ptr on QKD key

For relay purposes. We want to relay keys in default sizes! However, the LOCAL_SBUFFER contains keys in vaious sizes! Therefore, it is important to assure that we are getting the key which is in given size!

Definition at line 459 of file s-buffer.cc.

References ns3::Create(), GetKey(), ns3::QBuffer::m_keys, NS_LOG_FUNCTION, and ns3::QKDKey::READY.

Referenced by GetHalfKey(), GetKey(), GetTransformCandidate(), and MarkKey().

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

◆ GetNextIndex()

uint32_t ns3::SBuffer::GetNextIndex ( )

Definition at line 658 of file s-buffer.cc.

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

+ Here is the call graph for this function:

◆ GetSBitCount()

uint32_t ns3::SBuffer::GetSBitCount ( )

Get servable bit count.

Returns
uint32_t servable bit count

Get amount of key material that is in READY state

Definition at line 181 of file s-buffer.cc.

References GetBitCount(), m_notReadyBitCount, and NS_LOG_FUNCTION.

Referenced by GetTransformCandidate(), and LogUpdate().

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

◆ GetSKeyCount()

uint32_t ns3::SBuffer::GetSKeyCount ( )

Get servable key count.

Returns
uint32_t servable key count

Get number of keys from s-buffer that are in READY state

Definition at line 171 of file s-buffer.cc.

References ns3::QBuffer::GetKeyCount(), m_notReadyKeyCount, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetStreamIndex()

uint32_t ns3::SBuffer::GetStreamIndex ( )

Definition at line 651 of file s-buffer.cc.

References m_currentStreamIndex, and NS_LOG_FUNCTION.

◆ GetStreamKey()

Ptr< QKDKey > ns3::SBuffer::GetStreamKey ( )

Returns key chunk with lowest index.

Returns
QKDKey secret key chunk

Definition at line 524 of file s-buffer.cc.

References ns3::QBuffer::CheckState(), ns3::Create(), LogUpdate(), m_stream_keys, NS_LOG_ERROR, NS_LOG_FUNCTION, and ns3::QKDKey::READY.

+ Here is the call graph for this function:

◆ GetStreamKeyCount()

uint32_t ns3::SBuffer::GetStreamKeyCount ( )

Definition at line 637 of file s-buffer.cc.

References ns3::Create(), ns3::QBuffer::GetKeySize(), m_stream_keys, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetSupplyKey()

Ptr< QKDKey > ns3::SBuffer::GetSupplyKey ( std::string  keyId)

Get supply key.

Parameters
keyIdkey identifier

Definition at line 505 of file s-buffer.cc.

References ns3::QBuffer::CheckState(), ns3::Create(), LogUpdate(), m_supply_keys, NS_LOG_ERROR, NS_LOG_FUNCTION, and ns3::QKDKey::READY.

+ Here is the call graph for this function:

◆ GetTransformCandidate()

Ptr< QKDKey > ns3::SBuffer::GetTransformCandidate ( uint32_t  size)

Get key candidate.

Parameters
sizetarget key size
Returns
Ptr on QKD key

If the input size is equal to zero the function returns a random key from s-buffer. Otherwise, the funtion returns a key of the requested size. If such key is not available, larger key is modified and a portion of it is returned from the function, while remaining portion remains in s-buffer. Remaining key is marked as INIT, and is not servable until it gets in sync. This function is always called on s-buffers("enc").

Definition at line 288 of file s-buffer.cc.

References ns3::Create(), GetKey(), ns3::QBuffer::GetKeyCount(), GetSBitCount(), ns3::QKDKey::INIT, LogUpdate(), ns3::QBuffer::m_currentKeyBit, ns3::QBuffer::m_keys, MarkKey(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::QKDKey::READY, and ns3::value().

+ Here is the call graph for this function:

◆ GetType()

SBuffer::Type ns3::SBuffer::GetType ( )

Get s-buffer type.

Returns
SBufferType s-buffer type

Definition at line 135 of file s-buffer.cc.

References m_type, and NS_LOG_FUNCTION.

Referenced by StoreSupplyKey().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::SBuffer::GetTypeId ( )
static

Get the TypeId.

Returns
The TypeId for this class

Definition at line 32 of file s-buffer.cc.

References ns3::Create(), m_defaultKeySizeSBufferDefault, m_maxKeyBitSBufferDefault, m_minKeyBitSBufferDefault, m_thresholdKeyBitSBufferDefault, ns3::MakeUintegerAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ InsertKeyToStreamSession()

void ns3::SBuffer::InsertKeyToStreamSession ( Ptr< QKDKey key)

Insert key to key stream session.

Parameters
keysecret key

An input key may be reformated to create multiple key_chunks based on QoS criteria.

Definition at line 546 of file s-buffer.cc.

References ns3::Create(), GetBitCount(), ns3::QBuffer::GetKeySize(), ns3::GetSize(), LogUpdate(), m_currentStreamIndex, m_stream_keys, NS_LOG_FUNCTION, ns3::QKDKey::READY, and StoreSupplyKey().

+ Here is the call graph for this function:

◆ IsRelayActive()

bool ns3::SBuffer::IsRelayActive ( )

Definition at line 724 of file s-buffer.cc.

References m_relayActive, and NS_LOG_FUNCTION.

◆ LogUpdate()

void ns3::SBuffer::LogUpdate ( uint32_t  diffValue,
bool  positive 
)
overridevirtual

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 from ns3::QBuffer.

Definition at line 212 of file s-buffer.cc.

References ns3::QBuffer::CheckState(), ns3::Create(), ns3::QBuffer::GetKeyCount(), ns3::QBuffer::GetKeySize(), GetSBitCount(), ns3::QBuffer::m_bitsUsedInTimePeriod, ns3::QBuffer::m_currentKeyBit, ns3::QBuffer::m_currentKeyBitChangeTrace, ns3::QBuffer::m_keys, m_stream_keys, m_supply_keys, NS_ASSERT, NS_LOG_FUNCTION, and ns3::QKDKey::READY.

Referenced by GetHalfKey(), GetKey(), GetStreamKey(), GetSupplyKey(), GetTransformCandidate(), InsertKeyToStreamSession(), MarkKey(), StoreKey(), and StoreSupplyKey().

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

◆ MarkKey()

void ns3::SBuffer::MarkKey ( std::string  keyId,
QKDKey::QKDKeyState_e  state 
)

Mark key.

Parameters
keyIdkey identifier
statenew state

Definition at line 669 of file s-buffer.cc.

References ns3::Create(), GetKey(), LogUpdate(), ns3::QBuffer::m_keys, m_notReadyBitCount, m_notReadyKeyCount, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::QKDKey::OBSOLETE, and ns3::QKDKey::READY.

Referenced by GetTransformCandidate().

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

◆ SetKeyLifetime()

void ns3::SBuffer::SetKeyLifetime ( std::string  keyId)

Assign a lifetime to a key.

Parameters
keyIdkey identifier

Definition at line 711 of file s-buffer.cc.

References NS_LOG_FUNCTION.

◆ SetRelayState()

void ns3::SBuffer::SetRelayState ( bool  relayActive)

Definition at line 717 of file s-buffer.cc.

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

+ Here is the call graph for this function:

◆ SetType()

void ns3::SBuffer::SetType ( SBuffer::Type  type)

Set s-buffer type.

Parameters
typethe s-buffer type

Definition at line 128 of file s-buffer.cc.

References m_type, and NS_LOG_FUNCTION.

Referenced by SBuffer().

+ Here is the caller graph for this function:

◆ StoreKey() [1/2]

bool ns3::SBuffer::StoreKey ( Ptr< QKDKey key)
inline

store key in SBuffer

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

Definition at line 159 of file s-buffer.h.

References StoreKey().

Referenced by StoreKey().

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

◆ StoreKey() [2/2]

bool ns3::SBuffer::StoreKey ( Ptr< QKDKey key,
bool  fireTraces 
)
overridevirtual

store key in QBuffer

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

Reimplemented from ns3::QBuffer.

Definition at line 192 of file s-buffer.cc.

References ns3::Create(), GetBitCount(), LogUpdate(), NS_LOG_FUNCTION, ns3::QKDKey::READY, and ns3::QBuffer::StoreKey().

+ Here is the call graph for this function:

◆ StoreSupplyKey()

void ns3::SBuffer::StoreSupplyKey ( Ptr< QKDKey key)

Store supply key.

Parameters
keykey

Definition at line 487 of file s-buffer.cc.

References GetType(), LogUpdate(), m_stream_keys, m_supply_keys, NS_LOG_FUNCTION, ns3::QKDKey::READY, and STREAM_SBUFFER.

Referenced by InsertKeyToStreamSession().

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

Member Data Documentation

◆ m_currentStreamIndex

uint32_t ns3::SBuffer::m_currentStreamIndex
private

The last index when the S-Buffer is used for key stream sessions.

Definition at line 268 of file s-buffer.h.

Referenced by SBuffer(), SBuffer(), DoInitialize(), GetStreamIndex(), and InsertKeyToStreamSession().

◆ m_defaultKeySizeSBufferDefault

uint32_t ns3::SBuffer::m_defaultKeySizeSBufferDefault
private

Definition at line 286 of file s-buffer.h.

Referenced by DoInitialize(), and GetTypeId().

◆ m_maxKeyBitSBufferDefault

uint32_t ns3::SBuffer::m_maxKeyBitSBufferDefault
private

Definition at line 282 of file s-buffer.h.

Referenced by DoInitialize(), and GetTypeId().

◆ m_minKeyBitSBufferDefault

uint32_t ns3::SBuffer::m_minKeyBitSBufferDefault
private

Definition at line 280 of file s-buffer.h.

Referenced by DoInitialize(), and GetTypeId().

◆ m_notReadyBitCount

uint32_t ns3::SBuffer::m_notReadyBitCount
private

Amount of key material stored that are not in READY state.

Definition at line 272 of file s-buffer.h.

Referenced by SBuffer(), SBuffer(), DoInitialize(), GetSBitCount(), and MarkKey().

◆ m_notReadyKeyCount

uint32_t ns3::SBuffer::m_notReadyKeyCount
private

Number of keys stored which are not in READY state.

Definition at line 270 of file s-buffer.h.

Referenced by SBuffer(), SBuffer(), DoInitialize(), GetSKeyCount(), and MarkKey().

◆ m_relayActive

bool ns3::SBuffer::m_relayActive
private

The state of S-Buffer will not trigger relay if relay is active.

Definition at line 274 of file s-buffer.h.

Referenced by SBuffer(), SBuffer(), DoInitialize(), IsRelayActive(), and SetRelayState().

◆ m_stream_keys

std::map<uint32_t, Ptr<QKDKey> > ns3::SBuffer::m_stream_keys
private

Key stream session.

Definition at line 276 of file s-buffer.h.

Referenced by ~SBuffer(), GetNextIndex(), GetStreamKey(), GetStreamKeyCount(), InsertKeyToStreamSession(), LogUpdate(), and StoreSupplyKey().

◆ m_supply_keys

std::map<std::string, Ptr<QKDKey> > ns3::SBuffer::m_supply_keys
private

Created keys which are ready for supply to crypto applications.

Definition at line 278 of file s-buffer.h.

Referenced by ~SBuffer(), GetSupplyKey(), LogUpdate(), and StoreSupplyKey().

◆ m_thresholdKeyBitSBufferDefault

uint32_t ns3::SBuffer::m_thresholdKeyBitSBufferDefault
private

Definition at line 284 of file s-buffer.h.

Referenced by DoInitialize(), and GetTypeId().

◆ m_type

SBuffer::Type ns3::SBuffer::m_type
private

S-Buffer type.

Definition at line 266 of file s-buffer.h.

Referenced by GetType(), and SetType().


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