A Discrete-Event Network Simulator
API
ns3::QKDApp014 Class Reference

Establish secure communication on application lavel to use the key and test LKSM. More...

#include "qkd-app-014.h"

+ Inheritance diagram for ns3::QKDApp014:
+ Collaboration diagram for ns3::QKDApp014:

Classes

struct  AddressHash
 Hashing for the Address class. More...
 
struct  QKDApp014Key
 The cryptographic key at the application layer. More...
 
struct  QKDApp014KeyBuffer
 The key buffer at the application layer. More...
 

Public Types

enum  QKDApp014State {
  NOT_STARTED , INITIALIZED , READY , WAIT ,
  SEND_DATA , DECRYPT_DATA , STOPPED
}
 The application states. More...
 
- Public Types inherited from ns3::Application
typedef void(* DelayAddressCallback) (const Time &delay, const Address &from)
 Common callback signature for packet delay and address. More...
 
typedef void(* StateTransitionCallback) (const std::string &oldState, const std::string &newState)
 Common signature used by callbacks to application's state transition trace source. More...
 

Public Member Functions

 QKDApp014 ()
 Constructor. More...
 
virtual ~QKDApp014 ()
 Destructor. More...
 
void AddAuthKeyInKeyStore (QKDApp014::QKDApp014Key &key)
 Add a new key to the authentication key store. More...
 
void AddEncKeyInKeyStore (QKDApp014::QKDApp014Key &key)
 Add a new key to the encryption key store. More...
 
void AddKeyInInboundKeyStore (QKDApp014::QKDApp014Key &key)
 Add a new key to the inbound key store. More...
 
void CancelScheduledAction (uint32_t eventId)
 Cancel the scheduled event/action. More...
 
void CheckAppBufferState ()
 Check the state of the application key buffer. More...
 
void CheckAppState ()
 Check the conditions to change the application state. More...
 
bool ConnectionRequestedFromKMS (Ptr< Socket > socket, const Address &address)
 Callback function after the connection response from the KMS has been received. More...
 
void ConnectionSignalingToAppFailed (Ptr< Socket > socket)
 Callback function after the signaling connection to the APP has failed. More...
 
void ConnectionSignalingToAppSucceeded (Ptr< Socket > socket)
 Callback function after the signaling connection to the APP is complete. More...
 
void ConnectionToAppFailed (Ptr< Socket > socket)
 Callback function after the connection to the APP has failed. More...
 
void ConnectionToAppSucceeded (Ptr< Socket > socket)
 Callback function after the connection to the APP is complete. More...
 
void ConnectionToKMSFailed (Ptr< Socket > socket)
 Callback function after the connection to the KMS has failed. More...
 
void ConnectionToKMSSucceeded (Ptr< Socket > socket)
 Callback function after the connection to the KMS is complete. More...
 
void DataPacketReceivedFromApp (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for the TCP segmentation of the data packets received from the peer QKD application. More...
 
void DataToKMSSend (Ptr< Socket >, uint32_t)
 Callback function to notify that data to KMS has been sent. More...
 
QKDApp014State GetAppState () const
 Get the current state of the application. More...
 
std::string GetAppStateString () const
 Get the current state of the application in the string format. More...
 
uint32_t GetAuthenticationKeySize ()
 Get required key size for the choosen authentication algorithm. More...
 
uint32_t GetEncryptionKeySize ()
 Get required key size for the choosen encryption algorithm. More...
 
UUID GetId (void)
 Get the application identifier. More...
 
QKDApp014::QKDApp014Key GetKeyFromAppKeyBuffer (std::string keyId, std::string keyType)
 Get the key from the application key buffer. More...
 
QKDApp014::QKDApp014Key GetKeyFromAppKeyBuffer (uint32_t keyType)
 Get the key from the application key buffer. More...
 
void GetKeysFromKMS (uint32_t keyType)
 Request keys from the KMS (ETSI QKD 014 - Get key method). More...
 
void GetKeyWithKeyIDs ()
 Requests keys with given identifiers from the KMS (ETSI QKD 014 - Get key with key IDs method). More...
 
std::string GetPacketContent (uint32_t msgLength=0)
 Generate a random packet (message) of a given size. More...
 
void GetStatusFromKMS (uint32_t keyType)
 Request status information from the KMS (ETSI QKD 014 - Get status method). More...
 
void HandleAcceptFromApp (Ptr< Socket > s, const Address &from)
 Handle an incoming connection from the peer QKD application. More...
 
void HandleAcceptFromKMS (Ptr< Socket > s, const Address &from)
 Handle an incoming connection from the KMS. More...
 
void HandleAcceptSignalingFromApp (Ptr< Socket > s, const Address &from)
 Handle a signaling incoming connection from the peer QKD application. More...
 
void HandlePeerCloseFromApp (Ptr< Socket > socket)
 Handle a connection close from the peer QKD application. More...
 
void HandlePeerCloseFromKMS (Ptr< Socket > socket)
 Handle a connection close from the KMS. More...
 
void HandlePeerCloseSignalingFromApp (Ptr< Socket > socket)
 Handle a signaling connection close from the peer QKD application. More...
 
void HandlePeerErrorFromApp (Ptr< Socket > socket)
 Handle a connection error from the peer QKD application. More...
 
void HandlePeerErrorFromKMS (Ptr< Socket > socket)
 Handle a connection error from the KMS. More...
 
void HandlePeerErrorSignalingFromApp (Ptr< Socket > socket)
 Handle a signaling connection error from the peer QKD application. More...
 
void HandleReadFromApp (Ptr< Socket > socket)
 Handle a packet received from the peer QKD application. More...
 
void HandleReadFromKMS (Ptr< Socket > socket)
 Handle a packet received from the KMS application. More...
 
void HandleReadSignalingFromApp (Ptr< Socket > socket)
 Handle a signaling packet received from the peer QKD application. More...
 
void InitializeAppKeyBuffer ()
 Initialize the application key buffer. More...
 
void PacketReceivedFromKMS (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for the TCP segmentation of the packets received from the KMS. More...
 
void PrepareSendSocketToApp ()
 Prepare the send socket to communicate with the peer QKD Application. More...
 
void PrepareSendSocketToKMS ()
 Prepare the send socket to communicate with the KMS Application. More...
 
void PrepareSinkSocketFromApp ()
 Prepare the sink socket to listen from the peer QKD Application. More...
 
void PrepareSinkSocketFromKMS ()
 Prepare the sink socket to listen from the KMS Application. More...
 
void PrintAppBufferStatusInformation ()
 Print the status information on the application key buffer. More...
 
void PrintTemporaryKeyStoreContent ()
 Print the content of the temporary key store. More...
 
void ProcessDataPacketFromApp (QKDAppHeader header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process the data packets from the peer QKD application. More...
 
void ProcessGetKeyResponse (HTTPMessage &header, nlohmann::json jGetKeyResponse)
 Process the GET_KEY response from the KMS. More...
 
void ProcessGetKeyWithKeyIDsResponse (HTTPMessage &header, nlohmann::json jGetKeyWithKeyIDsResponse)
 Process the Get Key with Key IDs response from the KMS. More...
 
void ProcessResponseFromKMS (HTTPMessage &header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process the response from the KMS application. More...
 
void ProcessSignalingPacketFromApp (HTTPMessage &header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process the signaling packets received from the peer QKD application. More...
 
void ProcessStatusResponse (HTTPMessage &header, nlohmann::json jstatusResponse)
 Process the status response from the KMS. More...
 
void RemoveKeysFromTemporaryKeyStore (std::vector< std::string > keyIds)
 Remove keys from the temporary key store. More...
 
uint32_t ScheduleAction (Time t, std::string action)
 Schedule the action. More...
 
void SetEncryptionAndAuthenticationSettings (uint32_t encryptionType, uint32_t authenticationType, uint32_t authenticationTagLengthInBits)
 Set the encryption and the authentication algorithms. More...
 
void SetKsidAuthentication (UUID val)
 Set the authentication identifier. More...
 
void SetKsidEncryption (UUID val)
 Set the encryption identifier. More...
 
void Setup (std::string socketType, Address src, Address dst, Address kms, UUID dstSaeId, std::string type)
 Configure the application. More...
 
void Setup (std::string socketType, Address src, Address dst, Address kms, UUID dstSaeId, uint32_t packetSize, uint32_t nPackets, DataRate dataRate, std::string type)
 Configure the application. More...
 
void SignalingPacketReceivedFromApp (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for the TCP segmentation of the signaling packets received from the peer QKD application. More...
 
void SwitchAppState (QKDApp014State state)
 Change the state of the application. More...
 
- Public Member Functions inherited from ns3::Application
 Application ()
 
virtual ~Application ()
 
Ptr< NodeGetNode () const
 
void SetNode (Ptr< Node > node)
 
void SetStartTime (Time start)
 Specify application start time. More...
 
void SetStopTime (Time stop)
 Specify application stop time. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<>
Ptr< ObjectGetObject () 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< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) 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 (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= ([[maybe_unused]] const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) 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 erros. 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 std::string GetAppStateString (QKDApp014State state)
 Convert application state to the string format. More...
 
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Application
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Public Attributes

TracedCallback< Ptr< const Packet >, std::string > m_mxTrace
 A trace for the missed time slots to send data packets. More...
 
TracedCallback< Ptr< const Packet > > m_rxKmsTrace
 A trace for received packets from the KMS. More...
 
TracedCallback< Ptr< const Packet > > m_rxSigTrace
 A trace for received signaling packets. More...
 
TracedCallback< Ptr< const Packet >, std::string > m_rxTrace
 A trace for received data packets. More...
 
ns3::TracedCallback< const std::string &, const std::string & > m_stateTransitionTrace
 The posible application state transitions. More...
 
TracedCallback< Ptr< const Packet > > m_txKmsTrace
 A trace for transmitted packets to the KMS. More...
 
TracedCallback< Ptr< const Packet > > m_txSigTrace
 A trace for transmitted signaling packets. More...
 
TracedCallback< Ptr< const Packet >, std::string > m_txTrace
 A trace for transmitted data packets. More...
 

Private Member Functions

void AppTransitionTree (void)
 Transition through a tree of the application states and trigger actions. More...
 
std::string CreateKeyIdField (std::string keyId)
 Adjust the encryption key identifier for the QKDApp header. More...
 
void ExchangeInfoMessages (std::string ksid, std::vector< std::string > keyIds, HTTPMessage::HttpStatus statusCode=HTTPMessage::Ok)
 Exchange key identifiers between sending and receiving application. More...
 
uint32_t GetETSIMethod (void)
 Map the HTTP response and obtrain the request method. More...
 
uint32_t GetKeyType (void)
 Map the HTTP response and obtain the key type. More...
 
void MemoriesRequestApp (std::vector< std::string > keyIds)
 Memories the HTTP request made to the peer QKD application. More...
 
void MemoriesRequestKMS (uint32_t methodType, uint32_t keyType=0)
 Memories the HTTP request made to the local KMS. More...
 
std::string ReadKeyIdField (std::string keyId)
 Rebuild the key identifier for the QKDApp header. More...
 
void RequestProcessedApp (void)
 Remove request from the HTTP requests store (once the response from the peer application has been processed). More...
 
void RequestProcessedKMS (void)
 Remove the request from the HTTP requests store (once the response from the KMS has been processed). More...
 
void ScheduleTx (void)
 Schedule the time slot to send the data packets. More...
 
void SendPacket (void)
 Send the application packet (includes the generation of a random message and optional encryption or/and authentication on the message). More...
 
virtual void StartApplication (void)
 
virtual void StopApplication (void)
 Application specific shutdown code. More...
 

Private Attributes

uint64_t m_aesLifetime
 The AES key lifetime. More...
 
QKDApp014KeyBuffer m_appKeyBuffer
 The application key buffer. More...
 
QKDApp014State m_appState
 The application state. More...
 
uint32_t m_authenticationTagLengthInBits
 The size of the authentication tag in bits (32 by default). More...
 
TracedCallback< Ptr< Packet >, std::string > m_authenticationTrace
 A trace callback for the authentication event. More...
 
QKDEncryptor::AuthenticationType m_authenticationType
 The authentication algorithm. More...
 
uint32_t m_authenticationTypeInt
 The authentication algorithm. More...
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_buffer_kms
 The buffer for the received packets from the KMS (fragmentation). More...
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_buffer_QKDApp014
 The buffer for received data packets (fragmentation). More...
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_buffer_sig
 The buffer for the received signaling packets (fragmentation). More...
 
DataRate m_dataRate
 The application data rate. More...
 
uint32_t m_dataSent
 The amount of the sent data. More...
 
TracedCallback< Ptr< Packet >, std::string > m_deauthenticationTrace
 A trace callback for the authentication check event. More...
 
TracedCallback< Ptr< Packet > > m_decryptionTrace
 A trace callback for the decryption event. More...
 
UUID m_dstSaeId
 The peer application identifier. More...
 
TracedCallback< Ptr< Packet > > m_encryptionTrace
 A trace callback for the encryption event. More...
 
QKDEncryptor::EncryptionType m_encryptionType
 The encryption algorithm. More...
 
uint32_t m_encryptionTypeInt
 The encryption algorithm. More...
 
Ptr< QKDEncryptorm_encryptor
 The QKD encryptor. More...
 
std::vector< std::vector< std::string > > m_httpRequestsApp
 A vector of HTTP requests sent to the peer application. More...
 
std::vector< std::pair< uint32_t, uint32_t > > m_httpRequestsKMS
 A vector of HTTP requests set to the KMS. More...
 
UUID m_id
 The application identifier. More...
 
bool m_internalAppWait
 The indicator for the longer wait (used after the GetKey error!). More...
 
nlohmann::json m_keyIDs
 The latest received key identifiers from the sender application. More...
 
Address m_kms
 The local KMS address. More...
 
UUID m_ksid_auth
 The authentication key stream identifier. More...
 
UUID m_ksid_enc
 The encryption key stream identifier. More...
 
Address m_local
 The local address for the data transmission. More...
 
Address m_localSignaling
 The local address for the signaling data transmission. More...
 
uint32_t m_master
 Is a master (sender/primary) application? More...
 
uint32_t m_numberOfKeysKMS
 The number of keys to fetch per request. More...
 
TracedCallback< const uint32_t & > m_obtainedKeyMaterialTrace
 A trace callback for the obtained key material. More...
 
uint32_t m_packetSize
 The data packet size. More...
 
uint32_t m_packetsSent
 The number of sent data packets. More...
 
Address m_peer
 The address of the peer for the data transmission. More...
 
Address m_peerSignaling
 The address of the peer for the signaling data transmission. More...
 
Ptr< UniformRandomVariablem_random
 The uniform random variable. More...
 
std::map< uint32_t, EventIdm_scheduledEvents
 The map of scheduled events. More...
 
Ptr< Socketm_sendDataSocketApp
 The sending socket for the data. More...
 
EventId m_sendEvent
 The data transmission event. More...
 
Ptr< Socketm_sendSignalingSocketApp
 The sending socket for the signaling messages. More...
 
Ptr< Socketm_sendSocketToKMS
 The sending socket to the KMS. More...
 
Ptr< Socketm_sinkDataSocketApp
 The receiving socket for the data. More...
 
Ptr< Socketm_sinkSignalingSocketApp
 The receiving socket for the signaling messages. More...
 
Ptr< Socketm_sinkSocketFromKMS
 The receiving socket from the KMS. More...
 
std::string m_socketType
 The sockets type. More...
 
TypeId m_tid
 The type identifier. More...
 
std::multimap< std::string, std::string > m_transitionMatrix
 The map of the possible state transitions. More...
 
uint32_t m_useCrypto
 Execute actual cryptographic algorithms? More...
 
Time m_waitInsufficient
 The amount of time spent waiting before issuing a new GET_KEY request when the previous one resulted in an error "inssuficient amount of keys". More...
 
Time m_waitTransform
 The amount of time spent waiting before issuing a new GET_KEY request when the previous one resulted in an error "keys are being transformed". More...
 

Static Private Attributes

static uint32_t m_applicationCounts = 0
 The number of running applications. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Application
virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void NotifyNewAggregate (void)
 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 (void)
 Notifier called once the ObjectBase is fully constructed. More...
 
- Protected Attributes inherited from ns3::Application
Ptr< Nodem_node
 The node that this application is installed on. More...
 
EventId m_startEvent
 The event that will fire at m_startTime to start the application. More...
 
Time m_startTime
 The simulation time that the application will start. More...
 
EventId m_stopEvent
 The event that will fire at m_stopTime to end the application. More...
 
Time m_stopTime
 The simulation time that the application will end. More...
 

Detailed Description

Establish secure communication on application lavel to use the key and test LKSM.

This application was written to complement simple application to consume keys so a generic QKDApp014 name was selected. The application (Alice) implements sockets for connection with counter-party application (Bob) and implements sockets for communication with local key management system. At the moment, application follows ETSI QKD 014 standardization exchanging HTTP requests/responses to obtain details about the key from its local key management system. Obtained keys from Get key response are stored in temporary memory on master QKDApp014 (Alice) in JSON data structure, from where they are moved to an application key buffer when confirmation of keys from peer application (Bob) is recieved. Keys obtained from Get key with key IDs are directly stored to the application key buffer and confirmation message for keys is sent to its peer application (Alice). Application (Alice) use keys from the application key buffer to apply security services on its data. QKD application header is then added to the protected data and sent to peer application. Slave QKD application (Bob) will process recieved protected packet based on information in QKD header and keys from the application key buffer. Communication between peers needed to negotiate keys was not included in ETSI014, and this application use HTTP messages for this purpose.

Config Paths

ns3::QKDApp014 is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/ApplicationList/[i]/$ns3::QKDApp014"

Attributes

  • Protocol: The type of protocol to use.
  • NumberOfKeyToFetchFromKMS: The total number of keys per request to LKMS (ESTI QKD 014)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 3
    • Flags: construct write read
  • LengthOfAuthenticationTag: The default length of the authentication tag
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 256
    • Flags: construct write read
  • EncryptionType: The type of encryption to be used (0-unencrypted, 1-OTP, 2-AES)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1
    • Flags: construct write read
  • AuthenticationType: The type of authentication to be used (0-unauthenticated, 1-VMAC, 2-MD5, 3-SHA1)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 2
    • Flags: construct write read
  • AESLifetime: Lifetime of AES key expressed in bytes
    • Set with class: ns3::UintegerValue
    • Underlying type: uint64_t 0:18446744073709551615
    • Initial value: 1
    • Flags: construct write read
  • UseCrypto: Should crypto functions be performed (0-No, 1-Yes)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 0
    • Flags: construct write read
  • WaitInsufficient: Penalty time (in seconds) when there is insufficient amount of key
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+08ns
    • Flags: construct write read
  • WaitTransform: Penalty time (in seconds) when keys are being transformed
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+07ns
    • Flags: construct write read

Attributes defined in parent class ns3::Application

  • StartTime: Time at which the application will start
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +0ns
    • Flags: construct write read
  • StopTime: Time at which the application will stop
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +0ns
    • Flags: construct write read

TraceSources

  • Tx: A new packet is created and is sent
    Callback signature: ns3::Packet::TracedCallback
  • TxSig: A new signaling packet is created and is sent
    Callback signature: ns3::Packet::TracedCallback
  • TxKMS: A new packet is created and is sent to local KMS
    Callback signature: ns3::Packet::TracedCallback
  • Rx: A new packet is received
    Callback signature: ns3::Packet::TracedCallback
  • RxSig: A new signaling packet is received
    Callback signature: ns3::Packet::TracedCallback
  • RxKMS: A new packet is received from local KMS
    Callback signature: ns3::Packet::TracedCallback
  • StateTransition: Trace fired upon every QKDApp014 state transition.
    Callback signature: ns3::Application::StateTransitionCallback
  • PacketEncrypted: The change trance for currenly ecrypted packet
    Callback signature: ns3::QKDCrypto::PacketEncrypted
  • PacketDecrypted: The change trance for currenly decrypted packet
    Callback signature: ns3::QKDCrypto::PacketDecrypted
  • PacketAuthenticated: The change trance for currenly authenticated packet
    Callback signature: ns3::QKDCrypto::PacketAuthenticated
  • PacketDeAuthenticated: The change trance for currenly deauthenticated packet
    Callback signature: ns3::QKDCrypto::PacketDeAuthenticated
  • Mx: Missed send packet call
    Callback signature: ns3::Packet::TracedCallback
  • KeyObtained: Trace amount of obtained key material
    Callback signature: ns3::QKDApp014::KeyObtained

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

Definition at line 81 of file qkd-app-014.h.

Member Enumeration Documentation

◆ QKDApp014State

The application states.

Enumerator
NOT_STARTED 
INITIALIZED 
READY 
WAIT 
SEND_DATA 
DECRYPT_DATA 
STOPPED 

Definition at line 143 of file qkd-app-014.h.

Constructor & Destructor Documentation

◆ QKDApp014()

ns3::QKDApp014::QKDApp014 ( )

Constructor.


   SETUP

Definition at line 153 of file qkd-app-014.cc.

References m_applicationCounts, m_id, m_random, m_transitionMatrix, and ns3::UUID::Random().

+ Here is the call graph for this function:

◆ ~QKDApp014()

ns3::QKDApp014::~QKDApp014 ( )
virtual

Member Function Documentation

◆ AddAuthKeyInKeyStore()

void ns3::QKDApp014::AddAuthKeyInKeyStore ( QKDApp014::QKDApp014Key key)

Add a new key to the authentication key store.

Parameters
keyThe application authentication key.

Definition at line 777 of file qkd-app-014.cc.

References m_appKeyBuffer, NS_LOG_FUNCTION, and ns3::QKDApp014::QKDApp014KeyBuffer::outboundAuthKeyStore.

Referenced by ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ AddEncKeyInKeyStore()

void ns3::QKDApp014::AddEncKeyInKeyStore ( QKDApp014::QKDApp014Key key)

Add a new key to the encryption key store.

Parameters
keyThe application encryption key.

Definition at line 770 of file qkd-app-014.cc.

References m_appKeyBuffer, NS_LOG_FUNCTION, and ns3::QKDApp014::QKDApp014KeyBuffer::outboundEncKeyStore.

Referenced by ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ AddKeyInInboundKeyStore()

void ns3::QKDApp014::AddKeyInInboundKeyStore ( QKDApp014::QKDApp014Key key)

Add a new key to the inbound key store.

Parameters
keyThe application key.

Definition at line 763 of file qkd-app-014.cc.

References ns3::QKDApp014::QKDApp014KeyBuffer::inboundKeyStore, m_appKeyBuffer, and NS_LOG_FUNCTION.

Referenced by ProcessGetKeyWithKeyIDsResponse().

+ Here is the caller graph for this function:

◆ AppTransitionTree()

void ns3::QKDApp014::AppTransitionTree ( void  )
private

Transition through a tree of the application states and trigger actions.


   STATE functions

Definition at line 1974 of file qkd-app-014.cc.

References GetAuthenticationKeySize(), GetEncryptionKeySize(), GetStatusFromKMS(), INITIALIZED, m_appState, m_master, NS_FATAL_ERROR, NS_LOG_FUNCTION, PrepareSendSocketToApp(), PrepareSendSocketToKMS(), READY, SendPacket(), SwitchAppState(), and WAIT.

Referenced by StartApplication().

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

◆ CancelScheduledAction()

void ns3::QKDApp014::CancelScheduledAction ( uint32_t  eventId)

Cancel the scheduled event/action.

Parameters
eventIdThe identifier of the scheduled action.

Definition at line 318 of file qkd-app-014.cc.

References ns3::Simulator::Cancel(), m_scheduledEvents, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ CheckAppBufferState()

void ns3::QKDApp014::CheckAppBufferState ( )

Check the state of the application key buffer.

This function checks the state of the application key buffer and submits a new GET_KEY request if neccessary.

Definition at line 802 of file qkd-app-014.cc.

References CheckAppState(), GetAuthenticationKeySize(), GetEncryptionKeySize(), GetKeysFromKMS(), m_appKeyBuffer, m_internalAppWait, m_master, NS_LOG_FUNCTION, ns3::QKDApp014::QKDApp014KeyBuffer::outboundAuthKeyStore, and ns3::QKDApp014::QKDApp014KeyBuffer::outboundEncKeyStore.

Referenced by ProcessStatusResponse(), ScheduleAction(), and SendPacket().

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

◆ CheckAppState()

void ns3::QKDApp014::CheckAppState ( )

Check the conditions to change the application state.

Based on the state of the application key buffer, the application changes the state between READY and WAIT.

Definition at line 817 of file qkd-app-014.cc.

References GetAuthenticationKeySize(), GetEncryptionKeySize(), m_appKeyBuffer, m_appState, NS_LOG_FUNCTION, ns3::QKDApp014::QKDApp014KeyBuffer::outboundAuthKeyStore, ns3::QKDApp014::QKDApp014KeyBuffer::outboundEncKeyStore, READY, SwitchAppState(), and WAIT.

Referenced by CheckAppBufferState(), and ProcessSignalingPacketFromApp().

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

◆ ConnectionRequestedFromKMS()

bool ns3::QKDApp014::ConnectionRequestedFromKMS ( Ptr< Socket socket,
const Address address 
)

Callback function after the connection response from the KMS has been received.

Parameters
socketThe connected socket.
addressThe address of the KMS.

Definition at line 506 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), and NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromKMS().

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

◆ ConnectionSignalingToAppFailed()

void ns3::QKDApp014::ConnectionSignalingToAppFailed ( Ptr< Socket socket)

Callback function after the signaling connection to the APP has failed.

Parameters
socketThe connected socket.

Definition at line 584 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionSignalingToAppSucceeded()

void ns3::QKDApp014::ConnectionSignalingToAppSucceeded ( Ptr< Socket socket)

Callback function after the signaling connection to the APP is complete.

Parameters
socketThe connected socket.

Definition at line 578 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToAppFailed()

void ns3::QKDApp014::ConnectionToAppFailed ( Ptr< Socket socket)

Callback function after the connection to the APP has failed.

Parameters
socketThe connected socket.

Definition at line 572 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToAppSucceeded()

void ns3::QKDApp014::ConnectionToAppSucceeded ( Ptr< Socket socket)

Callback function after the connection to the APP is complete.

Parameters
socketThe connected socket.

Definition at line 566 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToKMSFailed()

void ns3::QKDApp014::ConnectionToKMSFailed ( Ptr< Socket socket)

Callback function after the connection to the KMS has failed.

Parameters
socketThe connected socket.

Definition at line 560 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToKMS().

+ Here is the caller graph for this function:

◆ ConnectionToKMSSucceeded()

void ns3::QKDApp014::ConnectionToKMSSucceeded ( Ptr< Socket socket)

Callback function after the connection to the KMS is complete.

Parameters
socketThe connected socket.

Definition at line 554 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToKMS().

+ Here is the caller graph for this function:

◆ CreateKeyIdField()

std::string ns3::QKDApp014::CreateKeyIdField ( std::string  keyId)
private

Adjust the encryption key identifier for the QKDApp header.

Parameters
keyIdThe key identifier.
Returns
The adjusted key identifier.

This function only removes '-' symbols from the key identifier which is in UUID format.

Definition at line 2175 of file qkd-app-014.cc.

Referenced by SendPacket().

+ Here is the caller graph for this function:

◆ DataPacketReceivedFromApp()

void ns3::QKDApp014::DataPacketReceivedFromApp ( const Ptr< Packet > &  p,
const Address from,
Ptr< Socket socket 
)

Check for the TCP segmentation of the data packets received from the peer QKD application.

Parameters
pThe received data packet.
fromThe address of the peer application.
socketThe connected socket.

Definition at line 1118 of file qkd-app-014.cc.

References ns3::Packet::AddAtEnd(), ns3::Packet::CreateFragment(), GetAppStateString(), ns3::QKDAppHeader::GetLength(), ns3::QKDAppHeader::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_appState, m_buffer_QKDApp014, m_dstSaeId, m_master, m_rxTrace, NS_ABORT_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Packet::PeekHeader(), ProcessDataPacketFromApp(), READY, ns3::Packet::RemoveAtStart(), ns3::Packet::RemoveHeader(), and ns3::UUID::string().

Referenced by HandleReadFromApp().

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

◆ DataToKMSSend()

void ns3::QKDApp014::DataToKMSSend ( Ptr< Socket socket,
uint32_t   
)

Callback function to notify that data to KMS has been sent.

Parameters
Theconnected socket.
Theamount of data.

Definition at line 722 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToKMS().

+ Here is the caller graph for this function:

◆ ExchangeInfoMessages()

void ns3::QKDApp014::ExchangeInfoMessages ( std::string  ksid,
std::vector< std::string >  keyIds,
HTTPMessage::HttpStatus  statusCode = HTTPMessage::Ok 
)
private

Exchange key identifiers between sending and receiving application.

Parameters
ksidThe key stream identifier.
keyIdsThe vector cointaning key identifiers to negotiate.
statusCodeThe HTTP status code of the response (the default status is 200:Ok).

Primary (sender) application sends vector of key identifiers previously obtained from the KMS. Replica (receiver) application obtains the keys from the KMS using received identifiers. The success of this operation is reported to the primary application.

Definition at line 1904 of file qkd-app-014.cc.

References ns3::HTTPMessage::CreateRequest(), ns3::HTTPMessage::CreateResponse(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_dataSent, m_master, m_packetsSent, m_sendSignalingSocketApp, m_sinkSignalingSocketApp, m_txSigTrace, MemoriesRequestApp(), NS_ASSERT, NS_LOG_FUNCTION, PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), ns3::Socket::Send(), and ns3::HTTPMessage::ToString().

Referenced by ProcessGetKeyResponse(), and ProcessGetKeyWithKeyIDsResponse().

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

◆ GetAppState()

QKDApp014::QKDApp014State ns3::QKDApp014::GetAppState ( ) const

Get the current state of the application.

Returns
The current state of the application.

Definition at line 2016 of file qkd-app-014.cc.

References m_appState.

◆ GetAppStateString() [1/2]

std::string ns3::QKDApp014::GetAppStateString ( ) const

Get the current state of the application in the string format.

Returns
The current state of the application in the string format.

Definition at line 2056 of file qkd-app-014.cc.

References m_appState.

Referenced by DataPacketReceivedFromApp(), ScheduleTx(), SendPacket(), StartApplication(), and SwitchAppState().

+ Here is the caller graph for this function:

◆ GetAppStateString() [2/2]

std::string ns3::QKDApp014::GetAppStateString ( QKDApp014::QKDApp014State  state)
static

Convert application state to the string format.

Parameters
stateThe state.
Returns
The state in the string format.

Definition at line 2022 of file qkd-app-014.cc.

References DECRYPT_DATA, INITIALIZED, NOT_STARTED, NS_FATAL_ERROR, READY, SEND_DATA, STOPPED, and WAIT.

◆ GetAuthenticationKeySize()

uint32_t ns3::QKDApp014::GetAuthenticationKeySize ( )

Get required key size for the choosen authentication algorithm.

Returns
The key size.

Definition at line 2217 of file qkd-app-014.cc.

References m_authenticationType, ns3::QKDEncryptor::QKDCRYPTO_AUTH_MD5, ns3::QKDEncryptor::QKDCRYPTO_AUTH_SHA1, ns3::QKDEncryptor::QKDCRYPTO_AUTH_VMAC, and ns3::QKDEncryptor::UNAUTHENTICATED.

Referenced by AppTransitionTree(), CheckAppBufferState(), CheckAppState(), GetKeysFromKMS(), ProcessDataPacketFromApp(), and SendPacket().

+ Here is the caller graph for this function:

◆ GetEncryptionKeySize()

uint32_t ns3::QKDApp014::GetEncryptionKeySize ( )

Get required key size for the choosen encryption algorithm.

Returns
The key size.

Definition at line 2194 of file qkd-app-014.cc.

References m_encryptionType, m_packetSize, NS_LOG_FUNCTION, ns3::QKDEncryptor::QKDCRYPTO_AES, ns3::QKDEncryptor::QKDCRYPTO_OTP, and ns3::QKDEncryptor::UNENCRYPTED.

Referenced by AppTransitionTree(), CheckAppBufferState(), CheckAppState(), and GetKeysFromKMS().

+ Here is the caller graph for this function:

◆ GetETSIMethod()

uint32_t ns3::QKDApp014::GetETSIMethod ( void  )
private

Map the HTTP response and obtrain the request method.

Returns
The request method.

Definition at line 933 of file qkd-app-014.cc.

References m_httpRequestsKMS.

Referenced by ProcessResponseFromKMS().

+ Here is the caller graph for this function:

◆ GetId()

UUID ns3::QKDApp014::GetId ( void  )
inline

Get the application identifier.

Returns
The application identifier.

Definition at line 561 of file qkd-app-014.h.

References m_id.

Referenced by PrepareSinkSocketFromApp().

+ Here is the caller graph for this function:

◆ GetKeyFromAppKeyBuffer() [1/2]

QKDApp014::QKDApp014Key ns3::QKDApp014::GetKeyFromAppKeyBuffer ( std::string  keyId,
std::string  keyType 
)

Get the key from the application key buffer.

Parameters
keyIdThe key identifier.
keyTypeThe key type.
Returns
The application key.

Definition at line 870 of file qkd-app-014.cc.

References ns3::QKDApp014::QKDApp014KeyBuffer::inboundKeyStore, m_appKeyBuffer, m_encryptionTypeInt, m_packetSize, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

◆ GetKeyFromAppKeyBuffer() [2/2]

QKDApp014::QKDApp014Key ns3::QKDApp014::GetKeyFromAppKeyBuffer ( uint32_t  keyType)

Get the key from the application key buffer.

Parameters
keyTypeThe type of the key to obtain: 0-encryption key, 1-authentication key.
Returns
The application key.

Definition at line 833 of file qkd-app-014.cc.

References m_appKeyBuffer, m_packetSize, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::QKDApp014::QKDApp014KeyBuffer::outboundAuthKeyStore, and ns3::QKDApp014::QKDApp014KeyBuffer::outboundEncKeyStore.

Referenced by ProcessDataPacketFromApp(), and SendPacket().

+ Here is the caller graph for this function:

◆ GetKeysFromKMS()

◆ GetKeyType()

uint32_t ns3::QKDApp014::GetKeyType ( void  )
private

Map the HTTP response and obtain the key type.

Returns
The key type.

Definition at line 939 of file qkd-app-014.cc.

References m_httpRequestsKMS.

Referenced by ProcessGetKeyResponse().

+ Here is the caller graph for this function:

◆ GetKeyWithKeyIDs()

void ns3::QKDApp014::GetKeyWithKeyIDs ( )

Requests keys with given identifiers from the KMS (ETSI QKD 014 - Get key with key IDs method).

The key identifiers are locally stored at the application, and that's why the input to this function is void.

Definition at line 1472 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), ns3::InetSocketAddress::GetIpv4(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_keyIDs, m_kms, m_master, m_sendSocketToKMS, m_sinkSocketFromKMS, m_txKmsTrace, MemoriesRequestKMS(), NS_ASSERT, NS_LOG_FUNCTION, PrepareSendSocketToKMS(), PrepareSinkSocketFromKMS(), ns3::Ipv4Address::Print(), ns3::Socket::Send(), and ns3::HTTPMessage::ToString().

Referenced by ProcessSignalingPacketFromApp().

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

◆ GetPacketContent()

std::string ns3::QKDApp014::GetPacketContent ( uint32_t  msgLength = 0)

Generate a random packet (message) of a given size.

Parameters
msgLengthThe message size.
Returns
The random message.

Definition at line 2150 of file qkd-app-014.cc.

References ns3::UniformRandomVariable::GetValue(), m_packetSize, m_random, and NS_LOG_FUNCTION.

Referenced by SendPacket().

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

◆ GetStatusFromKMS()

void ns3::QKDApp014::GetStatusFromKMS ( uint32_t  keyType)

Request status information from the KMS (ETSI QKD 014 - Get status method).

Parameters
keyTypeThe key type (encryption or authentication).

   KEY MANAGEMENT functions

Definition at line 1280 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), ns3::InetSocketAddress::GetIpv4(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_kms, m_ksid_auth, m_ksid_enc, m_sendSocketToKMS, m_sinkSocketFromKMS, m_txKmsTrace, MemoriesRequestKMS(), NS_ASSERT, NS_LOG_FUNCTION, PrepareSendSocketToKMS(), PrepareSinkSocketFromKMS(), ns3::Ipv4Address::Print(), ns3::Socket::Send(), ns3::UUID::string(), and ns3::HTTPMessage::ToString().

Referenced by AppTransitionTree().

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

◆ GetTypeId()

◆ HandleAcceptFromApp()

void ns3::QKDApp014::HandleAcceptFromApp ( Ptr< Socket s,
const Address from 
)

Handle an incoming connection from the peer QKD application.

Parameters
sThe incoming connection socket.
fromThe address the connection is from.

Definition at line 530 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), HandleReadFromApp(), ns3::MakeCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().

Referenced by PrepareSinkSocketFromApp().

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

◆ HandleAcceptFromKMS()

void ns3::QKDApp014::HandleAcceptFromKMS ( Ptr< Socket s,
const Address from 
)

Handle an incoming connection from the KMS.

Parameters
sThe incoming connection socket.
fromThe address the connection is from.

Definition at line 518 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), HandleReadFromKMS(), ns3::MakeCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().

Referenced by PrepareSinkSocketFromKMS().

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

◆ HandleAcceptSignalingFromApp()

void ns3::QKDApp014::HandleAcceptSignalingFromApp ( Ptr< Socket s,
const Address from 
)

Handle a signaling incoming connection from the peer QKD application.

Parameters
sThe incoming connection socket.
fromThe address the connection is from.

Definition at line 542 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), HandleReadSignalingFromApp(), ns3::MakeCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().

Referenced by PrepareSinkSocketFromApp().

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

◆ HandlePeerCloseFromApp()

void ns3::QKDApp014::HandlePeerCloseFromApp ( Ptr< Socket socket)

Handle a connection close from the peer QKD application.

Parameters
socketThe connected socket.

Definition at line 602 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromApp().

+ Here is the caller graph for this function:

◆ HandlePeerCloseFromKMS()

void ns3::QKDApp014::HandlePeerCloseFromKMS ( Ptr< Socket socket)

Handle a connection close from the KMS.

Parameters
socketThe connected socket.

Definition at line 590 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromKMS().

+ Here is the caller graph for this function:

◆ HandlePeerCloseSignalingFromApp()

void ns3::QKDApp014::HandlePeerCloseSignalingFromApp ( Ptr< Socket socket)

Handle a signaling connection close from the peer QKD application.

Parameters
socketThe connected socket.

Definition at line 613 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromApp().

+ Here is the caller graph for this function:

◆ HandlePeerErrorFromApp()

void ns3::QKDApp014::HandlePeerErrorFromApp ( Ptr< Socket socket)

Handle a connection error from the peer QKD application.

Parameters
socketThe connected socket.

Definition at line 607 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromApp().

+ Here is the caller graph for this function:

◆ HandlePeerErrorFromKMS()

void ns3::QKDApp014::HandlePeerErrorFromKMS ( Ptr< Socket socket)

Handle a connection error from the KMS.

Parameters
socketThe connected socket.

Definition at line 596 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromKMS().

+ Here is the caller graph for this function:

◆ HandlePeerErrorSignalingFromApp()

void ns3::QKDApp014::HandlePeerErrorSignalingFromApp ( Ptr< Socket socket)

Handle a signaling connection error from the peer QKD application.

Parameters
socketthe connected socket.

Definition at line 619 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromApp().

+ Here is the caller graph for this function:

◆ HandleReadFromApp()

void ns3::QKDApp014::HandleReadFromApp ( Ptr< Socket socket)

Handle a packet received from the peer QKD application.

Parameters
socketThe receiving socket.

Definition at line 658 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), DataPacketReceivedFromApp(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::InetSocketAddress::IsMatchingType(), ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::Socket::RecvFrom().

Referenced by HandleAcceptFromApp(), and PrepareSinkSocketFromApp().

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

◆ HandleReadFromKMS()

void ns3::QKDApp014::HandleReadFromKMS ( Ptr< Socket socket)

Handle a packet received from the KMS application.

Parameters
socketThe receiving socket.

Definition at line 625 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::InetSocketAddress::IsMatchingType(), ns3::Simulator::Now(), NS_LOG_FUNCTION, PacketReceivedFromKMS(), and ns3::Socket::RecvFrom().

Referenced by HandleAcceptFromKMS(), and PrepareSinkSocketFromKMS().

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

◆ HandleReadSignalingFromApp()

void ns3::QKDApp014::HandleReadSignalingFromApp ( Ptr< Socket socket)

Handle a signaling packet received from the peer QKD application.

Parameters
socketThe receiving socket.

Definition at line 690 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::InetSocketAddress::IsMatchingType(), ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::Socket::RecvFrom(), and SignalingPacketReceivedFromApp().

Referenced by HandleAcceptSignalingFromApp(), and PrepareSinkSocketFromApp().

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

◆ InitializeAppKeyBuffer()

void ns3::QKDApp014::InitializeAppKeyBuffer ( )

◆ MemoriesRequestApp()

void ns3::QKDApp014::MemoriesRequestApp ( std::vector< std::string >  keyIds)
private

Memories the HTTP request made to the peer QKD application.

Parameters
keyIdsThe vector of key identifiers.

Definition at line 915 of file qkd-app-014.cc.

References m_httpRequestsApp.

Referenced by ExchangeInfoMessages().

+ Here is the caller graph for this function:

◆ MemoriesRequestKMS()

void ns3::QKDApp014::MemoriesRequestKMS ( uint32_t  methodType,
uint32_t  keyType = 0 
)
private

Memories the HTTP request made to the local KMS.

Parameters
methodTypeThe request method.
keyTypeThe key type.

HTTP requests are memorised in a vector in order to map the responses.


   HTTP mapping

Definition at line 909 of file qkd-app-014.cc.

References m_httpRequestsKMS.

Referenced by GetKeysFromKMS(), GetKeyWithKeyIDs(), and GetStatusFromKMS().

+ Here is the caller graph for this function:

◆ PacketReceivedFromKMS()

void ns3::QKDApp014::PacketReceivedFromKMS ( const Ptr< Packet > &  p,
const Address from,
Ptr< Socket socket 
)

Check for the TCP segmentation of the packets received from the KMS.

Parameters
pThe received packet.
fromThe address of the KMS.
socketThe connected socket.

Definition at line 1519 of file qkd-app-014.cc.

References ns3::Packet::AddAtEnd(), ns3::Packet::CopyData(), ns3::Packet::CreateFragment(), ns3::HTTPMessage::GetSize(), ns3::Packet::GetSize(), ns3::HTTPMessage::GetStatusMessage(), ns3::Packet::GetUid(), ns3::HTTPMessage::IsFragmented(), m_buffer_kms, m_rxKmsTrace, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::HTTPMessageParser::Parse(), ProcessResponseFromKMS(), ns3::Packet::RemoveAtStart(), ns3::HTTPMessage::ToString(), and ns3::Packet::ToString().

Referenced by HandleReadFromKMS().

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

◆ PrepareSendSocketToApp()

◆ PrepareSendSocketToKMS()

◆ PrepareSinkSocketFromApp()

◆ PrepareSinkSocketFromKMS()

◆ PrintAppBufferStatusInformation()

void ns3::QKDApp014::PrintAppBufferStatusInformation ( )

Print the status information on the application key buffer.

Definition at line 794 of file qkd-app-014.cc.

References ns3::QKDApp014::QKDApp014KeyBuffer::inboundKeyStore, m_appKeyBuffer, NS_LOG_FUNCTION, ns3::QKDApp014::QKDApp014KeyBuffer::outboundAuthKeyStore, and ns3::QKDApp014::QKDApp014KeyBuffer::outboundEncKeyStore.

Referenced by ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ PrintTemporaryKeyStoreContent()

void ns3::QKDApp014::PrintTemporaryKeyStoreContent ( )

Print the content of the temporary key store.

Definition at line 784 of file qkd-app-014.cc.

References m_appKeyBuffer, NS_LOG_FUNCTION, and ns3::QKDApp014::QKDApp014KeyBuffer::temporaryKeyStoreMaster.

Referenced by ProcessGetKeyResponse(), and ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ ProcessDataPacketFromApp()

void ns3::QKDApp014::ProcessDataPacketFromApp ( QKDAppHeader  header,
Ptr< Packet packet,
Ptr< Socket socket 
)

◆ ProcessGetKeyResponse()

void ns3::QKDApp014::ProcessGetKeyResponse ( HTTPMessage header,
nlohmann::json  jGetKeyResponse 
)

Process the GET_KEY response from the KMS.

Parameters
headerThe received HTTP message.
jGetKeyResponseThe JSON response payload.

Definition at line 1645 of file qkd-app-014.cc.

References ExchangeInfoMessages(), GetKeyType(), ns3::HTTPMessage::GetStatus(), m_aesLifetime, m_appKeyBuffer, m_encryptionType, m_encryptor, m_obtainedKeyMaterialTrace, m_packetSize, m_waitInsufficient, m_waitTransform, NS_FATAL_ERROR, NS_LOG_FUNCTION, PrintTemporaryKeyStoreContent(), RequestProcessedKMS(), ScheduleAction(), and ns3::QKDApp014::QKDApp014KeyBuffer::temporaryKeyStoreMaster.

Referenced by ProcessResponseFromKMS().

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

◆ ProcessGetKeyWithKeyIDsResponse()

void ns3::QKDApp014::ProcessGetKeyWithKeyIDsResponse ( HTTPMessage header,
nlohmann::json  jGetKeyWithKeyIDsResponse 
)

Process the Get Key with Key IDs response from the KMS.

Parameters
headerThe received HTTP message.
jGetKeyWithKeyIDsResponseThe JSON response payload.

Definition at line 1711 of file qkd-app-014.cc.

References AddKeyInInboundKeyStore(), ExchangeInfoMessages(), ns3::HTTPMessage::GetStatus(), m_aesLifetime, m_encryptor, m_obtainedKeyMaterialTrace, NS_FATAL_ERROR, NS_LOG_FUNCTION, and RequestProcessedKMS().

Referenced by ProcessResponseFromKMS().

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

◆ ProcessResponseFromKMS()

void ns3::QKDApp014::ProcessResponseFromKMS ( HTTPMessage header,
Ptr< Packet packet,
Ptr< Socket socket 
)

Process the response from the KMS application.

Parameters
headerThe received HTTP message.
packetThe received packet.
socketThe receiving socket.

Definition at line 1583 of file qkd-app-014.cc.

References GetETSIMethod(), ns3::HTTPMessage::GetMessageBodyString(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), NS_FATAL_ERROR, NS_LOG_FUNCTION, ProcessGetKeyResponse(), ProcessGetKeyWithKeyIDsResponse(), and ProcessStatusResponse().

Referenced by PacketReceivedFromKMS().

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

◆ ProcessSignalingPacketFromApp()

void ns3::QKDApp014::ProcessSignalingPacketFromApp ( HTTPMessage header,
Ptr< Packet packet,
Ptr< Socket socket 
)

Process the signaling packets received from the peer QKD application.

Parameters
headerThe received HTTP message.
packetThe received packet.
socketThe receiving socket.

Definition at line 1823 of file qkd-app-014.cc.

References AddAuthKeyInKeyStore(), AddEncKeyInKeyStore(), CheckAppState(), GetKeysFromKMS(), GetKeyWithKeyIDs(), ns3::HTTPMessage::GetMessageBodyString(), ns3::Packet::GetSize(), ns3::HTTPMessage::GetStatus(), ns3::Packet::GetUid(), m_appKeyBuffer, m_httpRequestsApp, m_internalAppWait, m_keyIDs, m_master, NS_LOG_DEBUG, NS_LOG_FUNCTION, PrintAppBufferStatusInformation(), PrintTemporaryKeyStoreContent(), RemoveKeysFromTemporaryKeyStore(), RequestProcessedApp(), and ns3::QKDApp014::QKDApp014KeyBuffer::temporaryKeyStoreMaster.

Referenced by SignalingPacketReceivedFromApp().

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

◆ ProcessStatusResponse()

void ns3::QKDApp014::ProcessStatusResponse ( HTTPMessage header,
nlohmann::json  jstatusResponse 
)

Process the status response from the KMS.

Parameters
headerThe received HTTP message.
jstatusResponseThe JSON response payload.

Definition at line 1618 of file qkd-app-014.cc.

References CheckAppBufferState(), ns3::HTTPMessage::GetStatus(), NS_FATAL_ERROR, NS_LOG_FUNCTION, and RequestProcessedKMS().

Referenced by ProcessResponseFromKMS().

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

◆ ReadKeyIdField()

std::string ns3::QKDApp014::ReadKeyIdField ( std::string  keyId)
private

Rebuild the key identifier for the QKDApp header.

Parameters
keyIdThe key identifier from the QKDApp header.
Returns
The key identifier in the UUID format.

Definition at line 2182 of file qkd-app-014.cc.

References NS_LOG_FUNCTION.

Referenced by ProcessDataPacketFromApp().

+ Here is the caller graph for this function:

◆ RemoveKeysFromTemporaryKeyStore()

void ns3::QKDApp014::RemoveKeysFromTemporaryKeyStore ( std::vector< std::string >  keyIds)

Remove keys from the temporary key store.

Parameters
keyIdsThe key identifiers.

Definition at line 748 of file qkd-app-014.cc.

References m_appKeyBuffer, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::QKDApp014::QKDApp014KeyBuffer::temporaryKeyStoreMaster.

Referenced by ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ RequestProcessedApp()

void ns3::QKDApp014::RequestProcessedApp ( void  )
private

Remove request from the HTTP requests store (once the response from the peer application has been processed).

Definition at line 927 of file qkd-app-014.cc.

References m_httpRequestsApp.

Referenced by ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ RequestProcessedKMS()

void ns3::QKDApp014::RequestProcessedKMS ( void  )
private

Remove the request from the HTTP requests store (once the response from the KMS has been processed).

Definition at line 921 of file qkd-app-014.cc.

References m_httpRequestsKMS.

Referenced by ProcessGetKeyResponse(), ProcessGetKeyWithKeyIDsResponse(), and ProcessStatusResponse().

+ Here is the caller graph for this function:

◆ ScheduleAction()

uint32_t ns3::QKDApp014::ScheduleAction ( Time  t,
std::string  action 
)

Schedule the action.

Parameters
tThe time slot to perform action.
actionThe action.
Returns
The identifier of the scheduled event/action.

Definition at line 296 of file qkd-app-014.cc.

References CheckAppBufferState(), m_internalAppWait, m_scheduledEvents, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by ProcessGetKeyResponse().

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

◆ ScheduleTx()

void ns3::QKDApp014::ScheduleTx ( void  )
private

Schedule the time slot to send the data packets.


   SCHEDULE functions

Definition at line 279 of file qkd-app-014.cc.

References GetAppStateString(), ns3::DataRate::GetBitRate(), m_appState, m_dataRate, m_packetSize, m_sendEvent, NOT_STARTED, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::Seconds(), SendPacket(), and STOPPED.

Referenced by SendPacket().

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

◆ SendPacket()

◆ SetEncryptionAndAuthenticationSettings()

void ns3::QKDApp014::SetEncryptionAndAuthenticationSettings ( uint32_t  encryptionType,
uint32_t  authenticationType,
uint32_t  authenticationTagLengthInBits 
)

Set the encryption and the authentication algorithms.

Parameters
ecryptionTypeThe encryption algorithm.
authenticationTypeThe authentication algorithm.
authenticationTagLengthInBitsThe size of the authentication tag.

   ADDTIONAL functions

Definition at line 2098 of file qkd-app-014.cc.

References m_authenticationType, m_encryptionType, m_encryptor, NS_LOG_FUNCTION, ns3::QKDEncryptor::QKDCRYPTO_AES, ns3::QKDEncryptor::QKDCRYPTO_AUTH_MD5, ns3::QKDEncryptor::QKDCRYPTO_AUTH_SHA1, ns3::QKDEncryptor::QKDCRYPTO_AUTH_VMAC, ns3::QKDEncryptor::QKDCRYPTO_OTP, ns3::QKDEncryptor::UNAUTHENTICATED, and ns3::QKDEncryptor::UNENCRYPTED.

Referenced by ProcessDataPacketFromApp(), and StartApplication().

+ Here is the caller graph for this function:

◆ SetKsidAuthentication()

void ns3::QKDApp014::SetKsidAuthentication ( UUID  val)
inline

Set the authentication identifier.

Parameters
valThe authentication identifier.

Definition at line 112 of file qkd-app-014.h.

References m_ksid_auth.

◆ SetKsidEncryption()

void ns3::QKDApp014::SetKsidEncryption ( UUID  val)
inline

Set the encryption identifier.

Parameters
valThe encryption identifier.

Definition at line 104 of file qkd-app-014.h.

References m_ksid_enc.

◆ Setup() [1/2]

void ns3::QKDApp014::Setup ( std::string  socketType,
Address  src,
Address  dst,
Address  kms,
UUID  dstSaeId,
std::string  type 
)

Configure the application.

Parameters
socketTypeThe socket type.
srcThe source application address.
dstThe destination application address.
kmsThe local KMS address.
dstSaeIdThe peer application identifier.
typeThe application type, the sender or the receiver.

Definition at line 204 of file qkd-app-014.cc.

◆ Setup() [2/2]

void ns3::QKDApp014::Setup ( std::string  socketType,
Address  src,
Address  dst,
Address  kms,
UUID  dstSaeId,
uint32_t  packetSize,
uint32_t  nPackets,
DataRate  dataRate,
std::string  type 
)

Configure the application.

Parameters
socketTypeThe socket type.
srcThe source application address.
dstThe destination application address.
kmsThe local KMS address.
dstSaeIdThe peer application identifier.
packetSizeThe size of the data packet.
nPacketsThe number of data packets.
dataRateThe data rate.
typeThe application type, the sender or the receiver.

Definition at line 226 of file qkd-app-014.cc.

References ns3::InetSocketAddress::ConvertFrom(), InitializeAppKeyBuffer(), INITIALIZED, m_applicationCounts, m_appState, m_dataRate, m_dstSaeId, m_internalAppWait, m_kms, m_local, m_localSignaling, m_master, m_packetSize, m_peer, m_peerSignaling, m_socketType, NS_LOG_FUNCTION, packetSize, and SwitchAppState().

+ Here is the call graph for this function:

◆ SignalingPacketReceivedFromApp()

void ns3::QKDApp014::SignalingPacketReceivedFromApp ( const Ptr< Packet > &  p,
const Address from,
Ptr< Socket socket 
)

Check for the TCP segmentation of the signaling packets received from the peer QKD application.

Parameters
pThe received signaling packet.
fromThe address of the peer application.
socketThe connected socket.

Definition at line 1758 of file qkd-app-014.cc.

References ns3::Packet::AddAtEnd(), ns3::Packet::CopyData(), ns3::Packet::CreateFragment(), ns3::HTTPMessage::GetSize(), ns3::Packet::GetSize(), ns3::HTTPMessage::GetStatusMessage(), ns3::Packet::GetUid(), ns3::HTTPMessage::IsFragmented(), m_buffer_kms, m_rxSigTrace, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::HTTPMessageParser::Parse(), ProcessSignalingPacketFromApp(), ns3::Packet::RemoveAtStart(), ns3::HTTPMessage::ToString(), and ns3::Packet::ToString().

Referenced by HandleReadSignalingFromApp().

+ Here is the call graph for this function: