16#include "ns3/packet.h"
17#include "ns3/object.h"
18#include "ns3/ipv4-header.h"
19#include "ns3/traced-value.h"
20#include "ns3/trace-source-accessor.h"
21#include "ns3/event-id.h"
26#include <unordered_map>
Smart pointer class similar to boost::intrusive_ptr.
Qbuffer is a secure storage for QKD keys.
uint32_t m_currentKeyBit
The current amount of key material in QKD key storage.
QKDKeyState_e
QKD Key States.
Sbuffer is a working buffer from which keys are served.
uint32_t m_currentStreamIndex
The last index when the S-Buffer is used for key stream sessions.
virtual void DoInitialize() override
Initialize() implementation.
void SetKeyLifetime(std::string keyId)
Assign a lifetime to a key.
uint32_t GetStreamIndex()
Ptr< QKDKey > GetHalfKey(std::string keyId, uint32_t size)
Get portion of key.
uint32_t m_minKeyBitSBufferDefault
Ptr< QKDKey > GetKey(uint32_t size)
Get key with given size.
void MarkKey(std::string keyId, QKDKey::QKDKeyState_e state)
Mark key.
std::map< std::string, Ptr< QKDKey > > m_supply_keys
Created keys which are ready for supply to crypto applications.
std::map< uint32_t, Ptr< QKDKey > > m_stream_keys
Key stream session.
void LogUpdate(uint32_t diffValue, bool positive) override
Log key consumption.
uint32_t GetSBitCount()
Get servable bit count.
uint32_t GetBitCount() const override
get amount of stored key material in bits
void StoreSupplyKey(Ptr< QKDKey > key)
Store supply key.
SBuffer()
QBuffer constructor.
Ptr< QKDKey > GetStreamKey()
Returns key chunk with lowest index.
Ptr< QKDKey > GetTransformCandidate(uint32_t size)
Get key candidate.
void SetType(Type type)
Set s-buffer type.
uint32_t GetStreamKeyCount()
uint32_t m_thresholdKeyBitSBufferDefault
Ptr< QKDKey > GetSupplyKey(std::string keyId)
Get supply key.
uint32_t m_notReadyBitCount
Amount of key material stored that are not in READY state.
uint32_t m_maxKeyBitSBufferDefault
Type GetType()
Get s-buffer type.
bool m_relayActive
The state of S-Buffer will not trigger relay if relay is active.
void SetRelayState(bool relayActive)
uint32_t m_notReadyKeyCount
Number of keys stored which are not in READY state.
SBuffer::Type m_type
S-Buffer type.
uint32_t m_defaultKeySizeSBufferDefault
uint32_t GetSKeyCount()
Get servable key count.
~SBuffer() override
QBuffer destructor.
void InsertKeyToStreamSession(Ptr< QKDKey > key)
Insert key to key stream session.
static TypeId GetTypeId()
Get the TypeId.
uint32_t GetDefaultKeyCount(uint32_t number=0)
Get number of keys that are in default size.
bool StoreKey(Ptr< QKDKey > key)
store key in SBuffer
a unique identifier for an interface.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.