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

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

#include "qkd-app-004.h"

+ Inheritance diagram for ns3::QKDApp004:
+ Collaboration diagram for ns3::QKDApp004:

Classes

struct  AddressHash
 Hashing for the Address class. More...
 
struct  Association004
 The key stream session details. More...
 
struct  KMSPacket
 The KMS packet. More...
 
struct  QKDAppKey
 A cryptographic key at the application layer. More...
 

Public Types

enum  QKDAppState {
  NOT_STARTED , INITIALIZED , ESTABLISHING_ASSOCIATIONS , ASSOCIATIONS_ESTABLISHED ,
  ESTABLISHING_KEY_QUEUES , KEY_QUEUES_ESTABLISHED , READY , WAIT ,
  SEND_DATA , DECRYPT_DATA , STOPPED
}
 The QKD 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

 QKDApp004 ()
 Constructor. More...
 
virtual ~QKDApp004 ()
 Destructor. More...
 
void CancelScheduledAction (uint32_t eventId)
 Cancel the scheduled event. More...
 
void Close (std::string ksid)
 Close the keys stream session (the association). More...
 
bool ConnectionRequestedFromKMS (Ptr< Socket > socket, const Address &address)
 Callback function after the connection for 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 CreateKeyStreamAssociations ()
 
void DataPacketReceivedFromApp (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for the tcp segmentation of the signaling packets received from the KMS. More...
 
void DataToKMSSend (Ptr< Socket >, uint32_t)
 Callback function to notify that data to KMS has been sent. More...
 
QKDAppState GetAppState () const
 Get the current state of the application. More...
 
std::string GetAppStateString () const
 Get the current state of the application in a string notation. More...
 
uint32_t GetAuthenticationKeySize ()
 Get the required key size for the choosen authentication algorithm. More...
 
uint32_t GetEncryptionKeySize ()
 Get the required key size for the choosen encryption algorithm. More...
 
UUID GetId (void)
 Get the application identifier. More...
 
void GetKeyFromKMS (std::string ksid, uint32_t index=0)
 Get key for the key stream. More...
 
uint64_t GetMaxAuthenticationKeyRate ()
 Get the maximum key rate required for the authentication (QoS settings). More...
 
uint64_t GetMaxEncryptionKeyRate ()
 Get the maximum key rate required for the encryption (QoS settings). More...
 
std::string GetPacketContent (uint32_t msgLength=0)
 Generate a random packet payload (the message). More...
 
Ptr< SocketGetSendSocketToKMS ()
 Get the sending socket to the KMS. More...
 
Ptr< SocketGetSinkSocketFromKMS ()
 Get the receiving socket from the KMS. 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 HandlePeerCloseToKMS (Ptr< Socket > socket)
 Handle a connection close to the KMS. 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 HandlePeerErrorToKMS (Ptr< Socket > socket)
 Handle a connection error to the KMS. 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 by the QKD application from the KMS application. More...
 
void HandleReadSignalingFromApp (Ptr< Socket > socket)
 Handle a signaling packet received from the peer QKD application. More...
 
void OpenConnect (std::string ksid, uint32_t keyType=0)
 Request a key stream session (an association) from the local KMS. More...
 
void PacketReceivedFromKMS (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for the tcp segmentation of 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 ProcessCloseResponse (HTTPMessage &header)
 Process the CLOSE response. More...
 
void ProcessDataPacketFromApp (QKDAppHeader header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process data packets from the peer QKD application. More...
 
void ProcessGetKeyResponse (HTTPMessage &header)
 Process the GET_KEY response. More...
 
void ProcessOpenConnectResponse (HTTPMessage &header)
 Process the OPEN_CONNECT response. More...
 
void ProcessResponseFromKMS (HTTPMessage &header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process a response from the KMS application. More...
 
void ProcessSendKsidResponse (HTTPMessage &header, std::string ksid)
 Process the SEND_KSID response. More...
 
void ProcessSignalingPacketFromApp (HTTPMessage &header, Ptr< Socket > socket)
 Process a signaling packets from the peer QKD application. More...
 
void RegisterAckTime (Time oldRtt, Time newRtt)
 Register the acknowledgement time. More...
 
uint32_t ScheduleAction (Time t, std::string action)
 Schedule the action. More...
 
void SendKsidRequest (std::string ksid, uint32_t input)
 Inform the peer QKD application of the established key stream session. More...
 
void SendKsidResponse (HTTPMessage::HttpStatus httpStatus, std::string msg="")
 Send a response on the SEND_KSID request. 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 authentication key stream identifier. More...
 
void SetKsidEncryption (UUID val)
 Set encryption key stream 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 application. More...
 
void SwitchAppState (QKDAppState 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 (QKDAppState state)
 Convert application state to a string notation. 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 (due to the lack of keys). 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
 A trace for the 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
 

Private Member Functions

void AppTransitionTree (void)
 Transition through a tree of the application states and trigger actions. More...
 
void CheckAssociationsState ()
 Check if the required key stream sessions are successfuly established. More...
 
void CheckQueues ()
 Request new keys from the KMS until the key queues at the application layer are established with a set amount of keys. More...
 
void ClearAssociation (std::string ksid)
 Delete all records of key stream session identified with a given KSID. More...
 
void CloseSocketToKms ()
 Close the connecting sockets with the KMS. More...
 
void CreateKeyQueues ()
 Create the required key queues to store a set amount of keys from the respective key stream sessions. More...
 
void CreateKeyQueuesResponse ()
 Once the receiving application establishes the queues, it sends a response to the sender application. More...
 
QKDAppKey GetAuthKey ()
 Get the authentication key from the queue. More...
 
QKDAppKey GetEncKey ()
 Get the encryption key from the queue. More...
 
uint32_t GetKeyTypeFromHttp004KMSQuery (std::string uri)
 Map the HTTP reponse from the KMS and obtain the key type. More...
 
std::string GetKsidFromHttp004AppQuery (void)
 Map the HTTP response from the peer QKD application and obtain the key stream identifier. More...
 
std::string GetKsidFromHttp004KMSQuery (std::string uri)
 Map the HTTP response from the KMS and obtain the key stream identifier. More...
 
uint32_t GetMethodFromHttp004AppQuery (void)
 Map the HTTP response from the peer QKD application and obtain the ETSI method type. More...
 
uint32_t GetMethodFromHttp004KMSQuery (std::string uri)
 Read the ETSI request method from the URI. More...
 
void Http004AppQuery (uint32_t methodType, std::string ksid)
 Memories the HTTP request made to the peer QKD application. More...
 
void Http004AppQueryComplete (void)
 Remove the request from the vector of HTTP requests made to the peer QKD application. More...
 
void Http004KMSQuery (std::string uri, std::string ksid, uint32_t keyType)
 Memories the HTTP request made to the local KMS. More...
 
void Http004KMSQueryComplete (std::string uri)
 Remove the request from the vector of HTTP requests made to the KMS. More...
 
void InitializeAssociations ()
 Initialize the key stream sessions. More...
 
std::string PacketToString (Ptr< Packet > packet)
 Convert the packet to a string. More...
 
void ProcessCreateQueuesResponse ()
 Start establishing key queues at the reciving application once requested by the sender. More...
 
void ProcessPacketsToKMSFromQueue ()
 Process and send any remaining packets to the KMS. More...
 
void ScheduleTx (void)
 Schedule the next time slot to send the data. More...
 
void SendMaliciousRequestToKMS ()
 Send a malicious request to the KMS. 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

uint32_t m_aesLifetime
 The AES key lifetime. More...
 
QKDAppState m_appState
 The application state. More...
 
std::pair< Association004, Association004m_associations
 A pair (encryption/authentication) of the establihed key stream session. 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_qkdapp
 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...
 
EventId m_closeSocketEvent
 The closing socket event. 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...
 
double m_delay
 The time interval between two successive data transmissions (calculated based on the application data rate). More...
 
Time m_dosAttackIntensity
 The intensity of the DoS attack. 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...
 
Time m_holdTime
 The holding time before closing sockets. More...
 
std::vector< std::pair< uint32_t, std::string > > m_httpRequestsApp
 A vector of HTTP requests sent to the peer application. More...
 
std::map< std::string, std::pair< std::string, uint32_t > > m_httpRequestsKMS
 A vector of HTTP requests set to the KMS. More...
 
UUID m_id
 The application identifier. More...
 
uint32_t m_keyBufferLengthAuthentication
 The size of the authentication key queue at the application layer. More...
 
uint32_t m_keyBufferLengthEncryption
 The size of the encryption key queue at the application layer. 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_malicious
 Is a malicious application? More...
 
Ptr< Packetm_maliciousPacket
 The malicious packet. More...
 
uint32_t m_master
 Is a master (sender/primary) application? More...
 
DataRate m_minDataRate
 The minimum application data rate. 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...
 
bool m_primaryQueueEstablished
 Is the queue established at the sender application? More...
 
uint32_t m_priority
 The application priority (QoS). More...
 
std::vector< KMSPacketm_queue_kms
 The queue of packets waiting for the transmission to the KMS. More...
 
Ptr< UniformRandomVariablem_random
 The uniform random variable. More...
 
bool m_replicaQueueEstablished
 Is the queue established at the receiver application? 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_ttl
 The time-to-live of the key stream session. More...
 
uint32_t m_useCrypto
 Execute actual cryptographic algorithms? 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 QKDApp 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. The applications use ETSI QKD 004 interface to communicate with LKSM, hence the name "QKDApp004".

Config Paths

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

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

Attributes

  • Protocol: The type of protocol to use.
  • 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: 2
    • 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: 3
    • Flags: construct write read
  • AESLifetime: Lifetime of AES key expressed in number of packets
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • 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
  • LengthOfKeyBufferForEncryption: How many keys to store in local buffer of QKDApp004 for encryption?
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 10
    • Flags: construct write read
  • LengthOfKeyBufferForAuthentication: How many keys to store in local buffer of QKDApp004 for authentication?
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 10
    • Flags: construct write read
  • SocketToKMSHoldTime: How long (seconds) should QKDApp004 wait to close socket to KMS after receiving REST response?
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+08ns
    • Flags: construct write read
  • MaliciousApplication: Is this application malicious?
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 0
    • Flags: construct write read
  • DoSAttackIntensity: The time elapsed between successive malicious requests; For testing DoS/DDoS attacks;
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+08ns
    • Flags: construct write read
  • MinDataRate: The minimal data key rate (encryption+authentication) of the app (QoS settings).
    • Set with class: DataRateValue
    • Underlying type: DataRate
    • Initial value: 0bps
    • Flags: construct write read
  • Priority: QoS Priority (0 - default, 1 - premium)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 0
    • Flags: construct write read
  • TTL: QoS TTL - defines duration (seconds) of ETSI004 association
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 5
    • 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 QKDApp 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::QKDApp004::KeyObtained

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

Definition at line 71 of file qkd-app-004.h.

Member Enumeration Documentation

◆ QKDAppState

The QKD application states.

Enumerator
NOT_STARTED 
INITIALIZED 
ESTABLISHING_ASSOCIATIONS 
ASSOCIATIONS_ESTABLISHED 
ESTABLISHING_KEY_QUEUES 
KEY_QUEUES_ESTABLISHED 
READY 
WAIT 
SEND_DATA 
DECRYPT_DATA 
STOPPED 

Definition at line 109 of file qkd-app-004.h.

Constructor & Destructor Documentation

◆ QKDApp004()

ns3::QKDApp004::QKDApp004 ( )

Constructor.


   SETUP

Definition at line 180 of file qkd-app-004.cc.

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

+ Here is the call graph for this function:

◆ ~QKDApp004()

ns3::QKDApp004::~QKDApp004 ( )
virtual

Member Function Documentation

◆ AppTransitionTree()

void ns3::QKDApp004::AppTransitionTree ( void  )
private

◆ CancelScheduledAction()

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

Cancel the scheduled event.

Parameters
Theidentifier of the scheduled event.

Definition at line 308 of file qkd-app-004.cc.

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

+ Here is the call graph for this function:

◆ CheckAssociationsState()

void ns3::QKDApp004::CheckAssociationsState ( )
private

Check if the required key stream sessions are successfuly established.

Definition at line 1058 of file qkd-app-004.cc.

References AppTransitionTree(), ASSOCIATIONS_ESTABLISHED, ESTABLISHING_ASSOCIATIONS, GetAuthenticationKeySize(), GetEncryptionKeySize(), m_appState, m_associations, m_master, NS_ASSERT, NS_LOG_FUNCTION, and SwitchAppState().

Referenced by ProcessSendKsidResponse().

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

◆ CheckQueues()

void ns3::QKDApp004::CheckQueues ( )
private

Request new keys from the KMS until the key queues at the application layer are established with a set amount of keys.

The pplication establishes key queues of desired number of keys prior to the secure communication to support a fast rekeying.

Definition at line 1085 of file qkd-app-004.cc.

References AppTransitionTree(), GetKeyFromKMS(), KEY_QUEUES_ESTABLISHED, m_associations, m_master, m_primaryQueueEstablished, m_replicaQueueEstablished, NS_LOG_FUNCTION, and SwitchAppState().

Referenced by AppTransitionTree(), ProcessGetKeyResponse(), and ProcessSignalingPacketFromApp().

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

◆ ClearAssociation()

void ns3::QKDApp004::ClearAssociation ( std::string  ksid)
private

Delete all records of key stream session identified with a given KSID.

Parameters
ksidThe key stream identifier (KSID).

Definition at line 2472 of file qkd-app-004.cc.

References m_associations, and NS_LOG_FUNCTION.

Referenced by ProcessOpenConnectResponse().

+ Here is the caller graph for this function:

◆ Close()

◆ CloseSocketToKms()

void ns3::QKDApp004::CloseSocketToKms ( )
private

Close the connecting sockets with the KMS.

Definition at line 718 of file qkd-app-004.cc.

References ns3::Socket::Close(), m_queue_kms, m_sendSocketToKMS, and NS_LOG_FUNCTION.

Referenced by HandleReadFromKMS().

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

◆ ConnectionRequestedFromKMS()

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

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

Parameters
socketThe connected socket.
addressThe address of the KMS.

Definition at line 521 of file qkd-app-004.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::QKDApp004::ConnectionSignalingToAppFailed ( Ptr< Socket socket)

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

Parameters
socketThe connected socket.

Definition at line 600 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionSignalingToAppSucceeded()

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

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

Parameters
socketThe connected socket.

Definition at line 594 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToAppFailed()

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

Callback function after the connection to the APP has failed.

Parameters
socketThe connected socket.

Definition at line 588 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToAppSucceeded()

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

Callback function after the connection to the APP is complete.

Parameters
socketThe connected socket.

Definition at line 582 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToKMSFailed()

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

Callback function after the connection to the KMS has failed.

Parameters
socketThe connected socket.

Definition at line 576 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToKMS().

+ Here is the caller graph for this function:

◆ ConnectionToKMSSucceeded()

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

Callback function after the connection to the KMS is complete.

Parameters
socketThe connected socket.

Definition at line 570 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToKMS().

+ Here is the caller graph for this function:

◆ CreateKeyQueues()

void ns3::QKDApp004::CreateKeyQueues ( )
private

Create the required key queues to store a set amount of keys from the respective key stream sessions.

Definition at line 2389 of file qkd-app-004.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), GetId(), ns3::InetSocketAddress::GetIpv4(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), Http004AppQuery(), m_dataSent, m_master, m_packetsSent, m_peer, m_sendSignalingSocketApp, m_txSigTrace, NS_ASSERT, NS_LOG_FUNCTION, 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:

◆ CreateKeyQueuesResponse()

void ns3::QKDApp004::CreateKeyQueuesResponse ( )
private

Once the receiving application establishes the queues, it sends a response to the sender application.

Definition at line 2422 of file qkd-app-004.cc.

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

Referenced by AppTransitionTree().

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

◆ CreateKeyStreamAssociations()

void ns3::QKDApp004::CreateKeyStreamAssociations ( )

Definition at line 2461 of file qkd-app-004.cc.

References GetAuthenticationKeySize(), GetEncryptionKeySize(), m_associations, NS_LOG_FUNCTION, and OpenConnect().

Referenced by AppTransitionTree().

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

◆ DataPacketReceivedFromApp()

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

Check for the tcp segmentation of the signaling packets received from the KMS.

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

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

References ns3::Packet::AddAtEnd(), ns3::Packet::CreateFragment(), GetAppStateString(), ns3::QKDAppHeader::GetLength(), ns3::QKDAppHeader::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_appState, m_associations, m_buffer_qkdapp, m_master, m_txTrace, NS_ABORT_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Packet::PeekHeader(), ProcessDataPacketFromApp(), READY, ns3::Packet::RemoveAtStart(), and ns3::Packet::RemoveHeader().

Referenced by HandleReadFromApp().

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

◆ DataToKMSSend()

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

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

Parameters
Theconnected socket.
Theamount of data sent.

Definition at line 1021 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToKMS().

+ Here is the caller graph for this function:

◆ GetAppState()

QKDApp004::QKDAppState ns3::QKDApp004::GetAppState ( ) const

Get the current state of the application.

Returns
The current state.

Definition at line 2553 of file qkd-app-004.cc.

References m_appState.

Referenced by GetKeyFromKMS(), and SendMaliciousRequestToKMS().

+ Here is the caller graph for this function:

◆ GetAppStateString() [1/2]

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

Get the current state of the application in a string notation.

Returns
The current state.

Definition at line 2605 of file qkd-app-004.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::QKDApp004::GetAppStateString ( QKDApp004::QKDAppState  state)
static

Convert application state to a string notation.

Parameters
stateThe application state.
Returns
The application state in the string notation.

Definition at line 2559 of file qkd-app-004.cc.

References ASSOCIATIONS_ESTABLISHED, DECRYPT_DATA, ESTABLISHING_ASSOCIATIONS, ESTABLISHING_KEY_QUEUES, INITIALIZED, KEY_QUEUES_ESTABLISHED, NOT_STARTED, NS_FATAL_ERROR, READY, SEND_DATA, STOPPED, and WAIT.

◆ GetAuthenticationKeySize()

uint32_t ns3::QKDApp004::GetAuthenticationKeySize ( )

◆ GetAuthKey()

QKDApp004::QKDAppKey ns3::QKDApp004::GetAuthKey ( )
private

Get the authentication key from the queue.

Returns
The authentication key.

Definition at line 1186 of file qkd-app-004.cc.

References GetKeyFromKMS(), ns3::QKDApp004::QKDAppKey::key, m_associations, m_master, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ProcessDataPacketFromApp(), and SendPacket().

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

◆ GetEncKey()

QKDApp004::QKDAppKey ns3::QKDApp004::GetEncKey ( )
private

Get the encryption key from the queue.

Returns
The encryption key.

Definition at line 1120 of file qkd-app-004.cc.

References GetKeyFromKMS(), ns3::QKDApp004::QKDAppKey::key, ns3::QKDApp004::QKDAppKey::lifetime, m_associations, m_master, m_packetSize, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ProcessDataPacketFromApp(), and SendPacket().

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

◆ GetEncryptionKeySize()

uint32_t ns3::QKDApp004::GetEncryptionKeySize ( )

Get the required key size for the choosen encryption algorithm.

Returns
The key size.

Definition at line 2717 of file qkd-app-004.cc.

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

Referenced by AppTransitionTree(), CheckAssociationsState(), CreateKeyStreamAssociations(), OpenConnect(), ProcessGetKeyResponse(), and SendPacket().

+ Here is the caller graph for this function:

◆ GetId()

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

Get the application identifier.

Returns
The application identifier.

Definition at line 541 of file qkd-app-004.h.

References m_id.

Referenced by CreateKeyQueues(), and SendKsidRequest().

+ Here is the caller graph for this function:

◆ GetKeyFromKMS()

void ns3::QKDApp004::GetKeyFromKMS ( std::string  ksid,
uint32_t  index = 0 
)

◆ GetKeyTypeFromHttp004KMSQuery()

uint32_t ns3::QKDApp004::GetKeyTypeFromHttp004KMSQuery ( std::string  uri)
private

Map the HTTP reponse from the KMS and obtain the key type.

Parameters
uriThe HTTP request URI.
Returns
The key type.

Definition at line 1373 of file qkd-app-004.cc.

References m_httpRequestsKMS, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ProcessOpenConnectResponse().

+ Here is the caller graph for this function:

◆ GetKsidFromHttp004AppQuery()

std::string ns3::QKDApp004::GetKsidFromHttp004AppQuery ( void  )
private

Map the HTTP response from the peer QKD application and obtain the key stream identifier.

Returns
The key stream identifier.

Definition at line 1262 of file qkd-app-004.cc.

References m_httpRequestsApp, and NS_LOG_FUNCTION.

Referenced by ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ GetKsidFromHttp004KMSQuery()

std::string ns3::QKDApp004::GetKsidFromHttp004KMSQuery ( std::string  uri)
private

Map the HTTP response from the KMS and obtain the key stream identifier.

Returns
The key stream identifier.

Definition at line 1335 of file qkd-app-004.cc.

References m_httpRequestsKMS, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ProcessCloseResponse(), ProcessGetKeyResponse(), and ProcessOpenConnectResponse().

+ Here is the caller graph for this function:

◆ GetMaxAuthenticationKeyRate()

uint64_t ns3::QKDApp004::GetMaxAuthenticationKeyRate ( )

Get the maximum key rate required for the authentication (QoS settings).

Returns
The key rate (bps).

Definition at line 2803 of file qkd-app-004.cc.

References ns3::DataRate::GetBitRate(), m_aesLifetime, m_authenticationType, m_dataRate, m_packetSize, NS_ASSERT, ns3::QKDEncryptor::QKDCRYPTO_AUTH_MD5, ns3::QKDEncryptor::QKDCRYPTO_AUTH_SHA1, ns3::QKDEncryptor::QKDCRYPTO_AUTH_VMAC, and ns3::QKDEncryptor::UNAUTHENTICATED.

Referenced by OpenConnect().

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

◆ GetMaxEncryptionKeyRate()

uint64_t ns3::QKDApp004::GetMaxEncryptionKeyRate ( )

Get the maximum key rate required for the encryption (QoS settings).

Returns
The key rate (bps).

Definition at line 2734 of file qkd-app-004.cc.

References ns3::DataRate::GetBitRate(), m_aesLifetime, m_dataRate, m_encryptionType, NS_LOG_FUNCTION, ns3::QKDEncryptor::QKDCRYPTO_AES, ns3::QKDEncryptor::QKDCRYPTO_OTP, and ns3::QKDEncryptor::UNENCRYPTED.

Referenced by OpenConnect().

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

◆ GetMethodFromHttp004AppQuery()

uint32_t ns3::QKDApp004::GetMethodFromHttp004AppQuery ( void  )
private

Map the HTTP response from the peer QKD application and obtain the ETSI method type.

Returns
The ETSI method type.

Definition at line 1255 of file qkd-app-004.cc.

References m_httpRequestsApp, and NS_LOG_FUNCTION.

Referenced by ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ GetMethodFromHttp004KMSQuery()

uint32_t ns3::QKDApp004::GetMethodFromHttp004KMSQuery ( std::string  uri)
private

Read the ETSI request method from the URI.

Returns
The ETSI request method.

Definition at line 1302 of file qkd-app-004.cc.

References NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ProcessResponseFromKMS().

+ Here is the caller graph for this function:

◆ GetPacketContent()

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

Generate a random packet payload (the message).

Parameters
msgLengthThe length of the message.
Returns
The random message.

Definition at line 2692 of file qkd-app-004.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:

◆ GetSendSocketToKMS()

Ptr<Socket> ns3::QKDApp004::GetSendSocketToKMS ( )
inline

Get the sending socket to the KMS.

Returns
The sending socket.

Definition at line 565 of file qkd-app-004.h.

References m_sendSocketToKMS.

◆ GetSinkSocketFromKMS()

Ptr<Socket> ns3::QKDApp004::GetSinkSocketFromKMS ( )
inline

Get the receiving socket from the KMS.

Returns
The receiving socket.

Definition at line 573 of file qkd-app-004.h.

References m_sinkSocketFromKMS.

◆ GetTypeId()

◆ HandleAcceptFromApp()

void ns3::QKDApp004::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 546 of file qkd-app-004.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::QKDApp004::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 533 of file qkd-app-004.cc.

References ns3::InetSocketAddress::ConvertFrom(), HandleReadFromKMS(), ns3::MakeCallback(), NS_LOG_FUNCTION, ProcessPacketsToKMSFromQueue(), 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::QKDApp004::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 558 of file qkd-app-004.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::QKDApp004::HandlePeerCloseFromApp ( Ptr< Socket socket)

Handle a connection close from the peer QKD application.

Parameters
socketThe connected socket.

Definition at line 652 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromApp().

+ Here is the caller graph for this function:

◆ HandlePeerCloseFromKMS()

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

Handle a connection close from the KMS.

Parameters
socketThe connected socket.

Definition at line 606 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromKMS().

+ Here is the caller graph for this function:

◆ HandlePeerCloseSignalingFromApp()

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

Handle a signaling connection close from the peer QKD application.

Parameters
socketThe connected socket.

Definition at line 663 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromApp().

+ Here is the caller graph for this function:

◆ HandlePeerCloseToKMS()

void ns3::QKDApp004::HandlePeerCloseToKMS ( Ptr< Socket socket)

Handle a connection close to the KMS.

Parameters
socketThe connected socket.

Definition at line 618 of file qkd-app-004.cc.

References m_sendSocketToKMS, ns3::MakeNullCallback(), NS_LOG_FUNCTION, ns3::Socket::SetCloseCallbacks(), and ns3::Socket::SetConnectCallback().

Referenced by PrepareSendSocketToKMS().

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

◆ HandlePeerErrorFromApp()

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

Handle a connection error from the peer QKD application.

Parameters
socketThe connected socket.

Definition at line 657 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromApp().

+ Here is the caller graph for this function:

◆ HandlePeerErrorFromKMS()

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

Handle a connection error from the KMS.

Parameters
socketThe connected socket.

Definition at line 612 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromKMS().

+ Here is the caller graph for this function:

◆ HandlePeerErrorSignalingFromApp()

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

Handle a signaling connection error from the peer QKD application.

Parameters
socketThe connected socket.

Definition at line 669 of file qkd-app-004.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocketFromApp().

+ Here is the caller graph for this function:

◆ HandlePeerErrorToKMS()

void ns3::QKDApp004::HandlePeerErrorToKMS ( Ptr< Socket socket)

Handle a connection error to the KMS.

Parameters
socketThe connected socket.

Definition at line 635 of file qkd-app-004.cc.

References m_sendSocketToKMS, ns3::MakeNullCallback(), NS_LOG_FUNCTION, ns3::Socket::SetCloseCallbacks(), and ns3::Socket::SetConnectCallback().

Referenced by PrepareSendSocketToKMS().

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

◆ HandleReadFromApp()

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

Handle a packet received from the peer QKD application.

Parameters
socketThe receiving socket.

Definition at line 838 of file qkd-app-004.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::QKDApp004::HandleReadFromKMS ( Ptr< Socket socket)

◆ HandleReadSignalingFromApp()

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

Handle a signaling packet received from the peer QKD application.

Parameters
socketThe receiving socket.

Definition at line 925 of file qkd-app-004.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:

◆ Http004AppQuery()

void ns3::QKDApp004::Http004AppQuery ( uint32_t  methodType,
std::string  ksid 
)
private

Memories the HTTP request made to the peer QKD application.

Parameters
methodTypeThe request method.
ksidThe key stream identifier.

   HTTP handling to APP

Definition at line 1241 of file qkd-app-004.cc.

References m_httpRequestsApp, and NS_LOG_FUNCTION.

Referenced by CreateKeyQueues(), and SendKsidRequest().

+ Here is the caller graph for this function:

◆ Http004AppQueryComplete()

void ns3::QKDApp004::Http004AppQueryComplete ( void  )
private

Remove the request from the vector of HTTP requests made to the peer QKD application.

Definition at line 1248 of file qkd-app-004.cc.

References m_httpRequestsApp.

Referenced by ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ Http004KMSQuery()

void ns3::QKDApp004::Http004KMSQuery ( std::string  uri,
std::string  ksid,
uint32_t  keyType 
)
private

Memories the HTTP request made to the local KMS.

Parameters
uriThe HTTP request URI.
ksidThe key stream session identifier.
keyTypeThe key type.

HTTP requests are memorised in a vector for the purpose of mapping received responses.


   HTTP handling to KMS

Definition at line 1278 of file qkd-app-004.cc.

References m_httpRequestsKMS, and NS_LOG_FUNCTION.

Referenced by Close(), GetKeyFromKMS(), OpenConnect(), and ProcessPacketsToKMSFromQueue().

+ Here is the caller graph for this function:

◆ Http004KMSQueryComplete()

void ns3::QKDApp004::Http004KMSQueryComplete ( std::string  uri)
private

Remove the request from the vector of HTTP requests made to the KMS.

Parameters
uriThe HTTP request URI.

Definition at line 1291 of file qkd-app-004.cc.

References m_httpRequestsKMS, and NS_LOG_FUNCTION.

Referenced by ProcessResponseFromKMS().

+ Here is the caller graph for this function:

◆ InitializeAssociations()

void ns3::QKDApp004::InitializeAssociations ( )
private

Initialize the key stream sessions.

Delete all the records of the key stream sessions (as well as the remaining keys).


   KEY BUFFER functions

Definition at line 1036 of file qkd-app-004.cc.

References m_associations, m_keyBufferLengthAuthentication, m_keyBufferLengthEncryption, m_primaryQueueEstablished, m_replicaQueueEstablished, and NS_LOG_FUNCTION.

Referenced by ProcessCloseResponse(), Setup(), and StopApplication().

+ Here is the caller graph for this function:

◆ OpenConnect()

void ns3::QKDApp004::OpenConnect ( std::string  ksid,
uint32_t  keyType = 0 
)

Request a key stream session (an association) from the local KMS.

Parameters
ksidThe key stream session identifier.
keyTypeThe key type.

Replica (or receiving) QKDApp always states KSID in OPEN_CONNECT call. Primary (or sender) QKDApp does not state KSID (design decision). Each QKDApp is limited (by design decisions) to establish up to 2 associations (one for the encryption and one for the authentification). QKDApps are able to establish unidirectional communication with one peer QKDApp.


   KEY MANAGEMENT functions

Definition at line 1799 of file qkd-app-004.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), GetAuthenticationKeySize(), ns3::DataRate::GetBitRate(), GetEncryptionKeySize(), ns3::InetSocketAddress::GetIpv4(), GetMaxAuthenticationKeyRate(), GetMaxEncryptionKeyRate(), ns3::Socket::GetPeerName(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), Http004KMSQuery(), ns3::QKDApp004::KMSPacket::keyType, ns3::QKDApp004::KMSPacket::ksid, m_associations, m_dstSaeId, m_id, m_kms, m_master, m_minDataRate, m_priority, m_queue_kms, m_sendSocketToKMS, m_sinkSocketFromKMS, m_ttl, m_txKmsTrace, ns3::QKDApp004::KMSPacket::methodType, NS_ASSERT, NS_LOG_FUNCTION, ns3::QKDApp004::KMSPacket::packet, PrepareSendSocketToKMS(), PrepareSinkSocketFromKMS(), ns3::Ipv4Address::Print(), ns3::Socket::Send(), ns3::UUID::string(), nlohmann::to_string(), ns3::HTTPMessage::ToString(), and ns3::QKDApp004::KMSPacket::uri.

Referenced by CreateKeyStreamAssociations(), ProcessOpenConnectResponse(), and ProcessSignalingPacketFromApp().

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

◆ PacketReceivedFromKMS()

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

◆ PacketToString()

std::string ns3::QKDApp004::PacketToString ( Ptr< Packet packet)
private

Convert the packet to a string.

Parameters
packetThe packet.
Returns
The packet in the string format.

Definition at line 2852 of file qkd-app-004.cc.

References ns3::Packet::CopyData(), ns3::Packet::GetSize(), and NS_LOG_FUNCTION.

Referenced by ProcessDataPacketFromApp().

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

◆ PrepareSendSocketToApp()

◆ PrepareSendSocketToKMS()

◆ PrepareSinkSocketFromApp()