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()

◆ PrepareSinkSocketFromKMS()

◆ ProcessCloseResponse()

void ns3::QKDApp004::ProcessCloseResponse ( HTTPMessage header)

Process the CLOSE response.

Parameters
headerThe received HTTP message.

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

References ns3::Socket::Close(), GetKsidFromHttp004KMSQuery(), ns3::HTTPMessage::GetRequestUri(), ns3::HTTPMessage::GetStatus(), InitializeAssociations(), m_httpRequestsKMS, m_sendSocketToKMS, m_sinkSocketFromKMS, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ProcessResponseFromKMS().

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

◆ ProcessCreateQueuesResponse()

void ns3::QKDApp004::ProcessCreateQueuesResponse ( )
private

Start establishing key queues at the reciving application once requested by the sender.

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

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

Referenced by ProcessSignalingPacketFromApp().

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

◆ ProcessDataPacketFromApp()

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

◆ ProcessGetKeyResponse()

◆ ProcessOpenConnectResponse()

void ns3::QKDApp004::ProcessOpenConnectResponse ( HTTPMessage header)

◆ ProcessPacketsToKMSFromQueue()

void ns3::QKDApp004::ProcessPacketsToKMSFromQueue ( )
private

Process and send any remaining packets to the KMS.

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

References ns3::Socket::GetPeerName(), Http004KMSQuery(), m_queue_kms, m_sendSocketToKMS, m_txKmsTrace, NS_LOG_FUNCTION, PrepareSendSocketToKMS(), and ns3::Socket::Send().

Referenced by HandleAcceptFromKMS(), and HandleReadFromKMS().

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

◆ ProcessResponseFromKMS()

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

Process a response from the KMS application.

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

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

References GetMethodFromHttp004KMSQuery(), ns3::HTTPMessage::GetRequestUri(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), Http004KMSQueryComplete(), m_appState, NS_FATAL_ERROR, NS_LOG_FUNCTION, ProcessCloseResponse(), ProcessGetKeyResponse(), ProcessOpenConnectResponse(), and STOPPED.

Referenced by PacketReceivedFromKMS().

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

◆ ProcessSendKsidResponse()

void ns3::QKDApp004::ProcessSendKsidResponse ( HTTPMessage header,
std::string  ksid 
)

Process the SEND_KSID response.

Parameters
headerThe received HTTP message.
ksidThe key stream indentifier.

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

References CheckAssociationsState(), Close(), ns3::HTTPMessage::GetStatus(), m_associations, m_master, NS_ASSERT, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ProcessSignalingPacketFromApp().

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

◆ ProcessSignalingPacketFromApp()

void ns3::QKDApp004::ProcessSignalingPacketFromApp ( HTTPMessage header,
Ptr< Socket socket 
)

Process a signaling packets from the peer QKD application.

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

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

References CheckQueues(), ESTABLISHING_ASSOCIATIONS, ESTABLISHING_KEY_QUEUES, GetKsidFromHttp004AppQuery(), ns3::HTTPMessage::GetMessageBodyString(), GetMethodFromHttp004AppQuery(), ns3::HTTPMessage::GetUri(), Http004AppQueryComplete(), m_associations, m_master, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, OpenConnect(), ProcessCreateQueuesResponse(), ProcessSendKsidResponse(), and SwitchAppState().

Referenced by SignalingPacketReceivedFromApp().

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

◆ RegisterAckTime()

void ns3::QKDApp004::RegisterAckTime ( Time  oldRtt,
Time  newRtt 
)

Register the acknowledgement time.

Parameters
oldRttThe previous round-trip time.
newRttThe new rount-trip time.

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

References NS_LOG_FUNCTION.

Referenced by PrepareSendSocketToKMS().

+ Here is the caller graph for this function:

◆ ScheduleAction()

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

Schedule the action.

Parameters
tThe scheduled time.
actionThe action.
Returns
The identifier of the scheduled event.

◆ ScheduleTx()

void ns3::QKDApp004::ScheduleTx ( void  )
private

Schedule the next time slot to send the data.


   SCHEDULE functions

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

References GetAppStateString(), ns3::DataRate::GetBitRate(), m_appState, m_dataRate, m_delay, 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:

◆ SendKsidRequest()

void ns3::QKDApp004::SendKsidRequest ( std::string  ksid,
uint32_t  keyType 
)

Inform the peer QKD application of the established key stream session.

Parameters
ksidThe key stream session identifier.
inputThe key stream session purpose.

   Application SIGNALING

Definition at line 2291 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_sinkSignalingSocketApp, m_txSigTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), ns3::Ipv4Address::Print(), ns3::Socket::Send(), ns3::UUID::string(), nlohmann::to_string(), and ns3::HTTPMessage::ToString().

Referenced by ProcessOpenConnectResponse().

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

◆ SendKsidResponse()

void ns3::QKDApp004::SendKsidResponse ( HTTPMessage::HttpStatus  httpStatus,
std::string  msg = "" 
)

Send a response on the SEND_KSID request.

Parameters
httpStatusThe HTTP status code.
msgThe error message (if any).

Definition at line 2332 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_sinkSignalingSocketApp, m_txSigTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), ns3::Socket::Send(), and ns3::HTTPMessage::ToString().

Referenced by ProcessOpenConnectResponse().

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

◆ SendMaliciousRequestToKMS()

void ns3::QKDApp004::SendMaliciousRequestToKMS ( )
private

Send a malicious request to the KMS.

This funtion is used in the simulation of the Denail-of-Service attacks on the KMS using malicios/incorrect requests.


MALICIOUS functions


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

References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), GetAppState(), ns3::InetSocketAddress::GetIpv4(), ns3::Socket::GetPeerName(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_appState, m_dosAttackIntensity, m_dstSaeId, m_id, m_kms, m_maliciousPacket, m_sendSocketToKMS, m_sinkSocketFromKMS, m_txKmsTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSendSocketToKMS(), PrepareSinkSocketFromKMS(), ns3::Ipv4Address::Print(), READY, ns3::Simulator::Schedule(), ns3::Socket::Send(), ns3::UUID::Sequential(), STOPPED, ns3::UUID::string(), and ns3::HTTPMessage::ToString().

Referenced by StartApplication().

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

◆ SendPacket()

◆ SetEncryptionAndAuthenticationSettings()

void ns3::QKDApp004::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 2640 of file qkd-app-004.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::QKDApp004::SetKsidAuthentication ( UUID  val)
inline

Set authentication key stream identifier.

Parameters
valThe key stream identifier.

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

References m_ksid_auth.

◆ SetKsidEncryption()

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

Set encryption key stream identifier.

Parameters
valThe key stream identifier.

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

References m_ksid_enc.

◆ Setup() [1/2]

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

Configure the application.

Parameters
socketTypeThe socket type.
srcThe source address.
dstThe destination address.
kmsThe local key manager address.
dstSaeIdThe remote application identifier.
typeType of the application, the sender or the receiver.

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

◆ Setup() [2/2]

void ns3::QKDApp004::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 address.
dstThe destination address.
kmsThe local key manager address.
dstSaeIdThe remote application identifier.
packetSizeThe packet size that is transmitted.
dataRateThe rate at which packets are transmitted.
typeType of the application, the sender or the receiver.

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

References ns3::InetSocketAddress::ConvertFrom(), ns3::DataRate::GetBitRate(), InitializeAssociations(), INITIALIZED, m_dataRate, m_dstSaeId, m_kms, m_local, m_localSignaling, m_master, m_packetSize, m_peer, m_peerSignaling, m_socketType, NS_ASSERT, NS_LOG_FUNCTION, packetSize, and SwitchAppState().

+ Here is the call graph for this function:

◆ SignalingPacketReceivedFromApp()

void ns3::QKDApp004::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.

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

Definition at line 957 of file qkd-app-004.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_sig, 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:
+ Here is the caller graph for this function:

◆ StartApplication()

◆ StopApplication()

void ns3::QKDApp004::StopApplication ( void  )
privatevirtual

Application specific shutdown code.

The StopApplication method is called at the stop time specified by Stop This method should be overridden by all or most application subclasses.

Reimplemented from ns3::Application.

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

References ns3::Simulator::Cancel(), Close(), ns3::Socket::Close(), InitializeAssociations(), ns3::EventId::IsRunning(), m_associations, m_master, m_sendDataSocketApp, m_sendEvent, m_sendSignalingSocketApp, m_sendSocketToKMS, m_sinkDataSocketApp, m_sinkSignalingSocketApp, m_sinkSocketFromKMS, NS_LOG_FUNCTION, STOPPED, and SwitchAppState().

+ Here is the call graph for this function:

◆ SwitchAppState()

void ns3::QKDApp004::SwitchAppState ( QKDApp004::QKDAppState  state)

Change the state of the application.

Parameters
stateThe new application state.

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

References GetAppStateString(), m_appState, m_associations, and NS_LOG_FUNCTION.

Referenced by AppTransitionTree(), CheckAssociationsState(), CheckQueues(), ProcessCreateQueuesResponse(), ProcessDataPacketFromApp(), ProcessGetKeyResponse(), ProcessSignalingPacketFromApp(), SendPacket(), Setup(), StartApplication(), and StopApplication().

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

Member Data Documentation

◆ m_aesLifetime

uint32_t ns3::QKDApp004::m_aesLifetime
private

◆ m_applicationCounts

uint32_t ns3::QKDApp004::m_applicationCounts = 0
staticprivate

The number of running applications.

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

Referenced by QKDApp004().

◆ m_appState

◆ m_associations

◆ m_authenticationTagLengthInBits

uint32_t ns3::QKDApp004::m_authenticationTagLengthInBits
private

The size of the authentication tag in bits (32 by default).

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

Referenced by GetTypeId(), ProcessDataPacketFromApp(), and StartApplication().

◆ m_authenticationTrace

TracedCallback<Ptr<Packet>, std::string > ns3::QKDApp004::m_authenticationTrace
private

A trace callback for the authentication event.

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

Referenced by GetTypeId(), and SendPacket().

◆ m_authenticationType

QKDEncryptor::AuthenticationType ns3::QKDApp004::m_authenticationType
private

The authentication algorithm.

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

Referenced by GetAuthenticationKeySize(), GetMaxAuthenticationKeyRate(), SendPacket(), and SetEncryptionAndAuthenticationSettings().

◆ m_authenticationTypeInt

uint32_t ns3::QKDApp004::m_authenticationTypeInt
private

The authentication algorithm.

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

Referenced by GetTypeId(), and StartApplication().

◆ m_buffer_kms

std::unordered_map<Address, Ptr<Packet>, AddressHash> ns3::QKDApp004::m_buffer_kms
private

The buffer for the received packets from the KMS (fragmentation).

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

Referenced by PacketReceivedFromKMS().

◆ m_buffer_qkdapp

std::unordered_map<Address, Ptr<Packet>, AddressHash> ns3::QKDApp004::m_buffer_qkdapp
private

The buffer for received data packets (fragmentation).

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

Referenced by DataPacketReceivedFromApp().

◆ m_buffer_sig

std::unordered_map<Address, Ptr<Packet>, AddressHash> ns3::QKDApp004::m_buffer_sig
private

The buffer for the received signaling packets (fragmentation).

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

Referenced by SignalingPacketReceivedFromApp().

◆ m_closeSocketEvent

EventId ns3::QKDApp004::m_closeSocketEvent
private

The closing socket event.

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

Referenced by HandleReadFromKMS().

◆ m_dataRate

DataRate ns3::QKDApp004::m_dataRate
private

The application data rate.

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

Referenced by GetMaxAuthenticationKeyRate(), GetMaxEncryptionKeyRate(), ScheduleTx(), and Setup().

◆ m_dataSent

uint32_t ns3::QKDApp004::m_dataSent
private

The amount of the sent data.

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

Referenced by CreateKeyQueues(), CreateKeyQueuesResponse(), SendKsidRequest(), SendKsidResponse(), and SendPacket().

◆ m_deauthenticationTrace

TracedCallback<Ptr<Packet>, std::string > ns3::QKDApp004::m_deauthenticationTrace
private

A trace callback for the authentication check event.

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

Referenced by GetTypeId().

◆ m_decryptionTrace

TracedCallback<Ptr<Packet> > ns3::QKDApp004::m_decryptionTrace
private

A trace callback for the decryption event.

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

Referenced by GetTypeId().

◆ m_delay

double ns3::QKDApp004::m_delay
private

The time interval between two successive data transmissions (calculated based on the application data rate).

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

Referenced by ScheduleTx().

◆ m_dosAttackIntensity

Time ns3::QKDApp004::m_dosAttackIntensity
private

The intensity of the DoS attack.

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

Referenced by GetTypeId(), and SendMaliciousRequestToKMS().

◆ m_dstSaeId

UUID ns3::QKDApp004::m_dstSaeId
private

The peer application identifier.

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

Referenced by OpenConnect(), SendMaliciousRequestToKMS(), and Setup().

◆ m_encryptionTrace

TracedCallback<Ptr<Packet> > ns3::QKDApp004::m_encryptionTrace
private

A trace callback for the encryption event.

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

Referenced by GetTypeId().

◆ m_encryptionType

QKDEncryptor::EncryptionType ns3::QKDApp004::m_encryptionType
private

The encryption algorithm.

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

Referenced by GetEncryptionKeySize(), GetMaxEncryptionKeyRate(), SendPacket(), and SetEncryptionAndAuthenticationSettings().

◆ m_encryptionTypeInt

uint32_t ns3::QKDApp004::m_encryptionTypeInt
private

The encryption algorithm.

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

Referenced by GetTypeId(), and StartApplication().

◆ m_encryptor

Ptr<QKDEncryptor> ns3::QKDApp004::m_encryptor
private

The QKD encryptor.

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

Referenced by ProcessDataPacketFromApp(), SendPacket(), and SetEncryptionAndAuthenticationSettings().

◆ m_holdTime

Time ns3::QKDApp004::m_holdTime
private

The holding time before closing sockets.

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

Referenced by GetTypeId(), and HandleReadFromKMS().

◆ m_httpRequestsApp

std::vector<std::pair<uint32_t, std::string> > ns3::QKDApp004::m_httpRequestsApp
private

A vector of HTTP requests sent to the peer application.

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

Referenced by GetKsidFromHttp004AppQuery(), GetMethodFromHttp004AppQuery(), Http004AppQuery(), and Http004AppQueryComplete().

◆ m_httpRequestsKMS

std::map<std::string, std::pair<std::string, uint32_t> > ns3::QKDApp004::m_httpRequestsKMS
private

A vector of HTTP requests set to the KMS.

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

Referenced by GetKeyTypeFromHttp004KMSQuery(), GetKsidFromHttp004KMSQuery(), Http004KMSQuery(), Http004KMSQueryComplete(), and ProcessCloseResponse().

◆ m_id

UUID ns3::QKDApp004::m_id
private

The application identifier.

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

Referenced by QKDApp004(), GetId(), OpenConnect(), and SendMaliciousRequestToKMS().

◆ m_keyBufferLengthAuthentication

uint32_t ns3::QKDApp004::m_keyBufferLengthAuthentication
private

The size of the authentication key queue at the application layer.

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

Referenced by GetTypeId(), and InitializeAssociations().

◆ m_keyBufferLengthEncryption

uint32_t ns3::QKDApp004::m_keyBufferLengthEncryption
private

The size of the encryption key queue at the application layer.

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

Referenced by GetTypeId(), and InitializeAssociations().

◆ m_kms

Address ns3::QKDApp004::m_kms
private

The local KMS address.

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

Referenced by Close(), GetKeyFromKMS(), OpenConnect(), PrepareSendSocketToKMS(), SendMaliciousRequestToKMS(), and Setup().

◆ m_ksid_auth

UUID ns3::QKDApp004::m_ksid_auth
private

The authentication key stream identifier.

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

Referenced by SetKsidAuthentication().

◆ m_ksid_enc

UUID ns3::QKDApp004::m_ksid_enc
private

The encryption key stream identifier.

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

Referenced by SetKsidEncryption().

◆ m_local

Address ns3::QKDApp004::m_local
private

The local address for the data transmission.

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

Referenced by PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), Setup(), and StartApplication().

◆ m_localSignaling

Address ns3::QKDApp004::m_localSignaling
private

The local address for the signaling data transmission.

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

Referenced by PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), and Setup().

◆ m_malicious

uint32_t ns3::QKDApp004::m_malicious
private

Is a malicious application?

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

Referenced by GetTypeId(), PacketReceivedFromKMS(), and StartApplication().

◆ m_maliciousPacket

Ptr<Packet> ns3::QKDApp004::m_maliciousPacket
private

The malicious packet.

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

Referenced by SendMaliciousRequestToKMS(), and StartApplication().

◆ m_master

◆ m_minDataRate

DataRate ns3::QKDApp004::m_minDataRate
private

The minimum application data rate.

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

Referenced by GetTypeId(), and OpenConnect().

◆ m_mxTrace

TracedCallback<Ptr<const Packet>, std::string > ns3::QKDApp004::m_mxTrace

A trace for the missed time slots to send data (due to the lack of keys).

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

Referenced by GetTypeId().

◆ m_obtainedKeyMaterialTrace

TracedCallback<const uint32_t&> ns3::QKDApp004::m_obtainedKeyMaterialTrace
private

A trace callback for the obtained key material.

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

Referenced by GetTypeId(), and ProcessGetKeyResponse().

◆ m_packetSize

uint32_t ns3::QKDApp004::m_packetSize
private

◆ m_packetsSent

uint32_t ns3::QKDApp004::m_packetsSent
private

The number of sent data packets.

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

Referenced by CreateKeyQueues(), CreateKeyQueuesResponse(), SendKsidRequest(), SendKsidResponse(), SendPacket(), and StartApplication().

◆ m_peer

Address ns3::QKDApp004::m_peer
private

The address of the peer for the data transmission.

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

Referenced by CreateKeyQueues(), PrepareSendSocketToApp(), SendKsidRequest(), Setup(), and StartApplication().

◆ m_peerSignaling

Address ns3::QKDApp004::m_peerSignaling
private

The address of the peer for the signaling data transmission.

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

Referenced by PrepareSendSocketToApp(), and Setup().

◆ m_primaryQueueEstablished

bool ns3::QKDApp004::m_primaryQueueEstablished
private

Is the queue established at the sender application?

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

Referenced by CheckQueues(), InitializeAssociations(), and ProcessCreateQueuesResponse().

◆ m_priority

uint32_t ns3::QKDApp004::m_priority
private

The application priority (QoS).

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

Referenced by GetTypeId(), and OpenConnect().

◆ m_queue_kms

std::vector<KMSPacket > ns3::QKDApp004::m_queue_kms
private

The queue of packets waiting for the transmission to the KMS.

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

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

◆ m_random

Ptr<UniformRandomVariable> ns3::QKDApp004::m_random
private

The uniform random variable.

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

Referenced by QKDApp004(), GetKeyFromKMS(), and GetPacketContent().

◆ m_replicaQueueEstablished

bool ns3::QKDApp004::m_replicaQueueEstablished
private

Is the queue established at the receiver application?

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

Referenced by CheckQueues(), InitializeAssociations(), and ProcessCreateQueuesResponse().

◆ m_rxKmsTrace

TracedCallback<Ptr<const Packet> > ns3::QKDApp004::m_rxKmsTrace

A trace for received packets from the KMS.

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

Referenced by GetTypeId(), and PacketReceivedFromKMS().

◆ m_rxSigTrace

TracedCallback<Ptr<const Packet> > ns3::QKDApp004::m_rxSigTrace

A trace for received signaling packets.

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

Referenced by GetTypeId(), and SignalingPacketReceivedFromApp().

◆ m_rxTrace

TracedCallback<Ptr<const Packet>, std::string > ns3::QKDApp004::m_rxTrace

A trace for received data packets.

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

Referenced by GetTypeId().

◆ m_scheduledEvents

std::map<uint32_t, EventId > ns3::QKDApp004::m_scheduledEvents
private

The map of scheduled events.

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

Referenced by CancelScheduledAction().

◆ m_sendDataSocketApp

Ptr<Socket> ns3::QKDApp004::m_sendDataSocketApp
private

The sending socket for the data.

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

Referenced by ~QKDApp004(), PrepareSendSocketToApp(), SendPacket(), and StopApplication().

◆ m_sendEvent

EventId ns3::QKDApp004::m_sendEvent
private

The data transmission event.

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

Referenced by ScheduleTx(), and StopApplication().

◆ m_sendSignalingSocketApp

Ptr<Socket> ns3::QKDApp004::m_sendSignalingSocketApp
private

The sending socket for the signaling messages.

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

Referenced by ~QKDApp004(), CreateKeyQueues(), CreateKeyQueuesResponse(), PrepareSendSocketToApp(), SendKsidRequest(), SendKsidResponse(), and StopApplication().

◆ m_sendSocketToKMS

◆ m_sinkDataSocketApp

Ptr<Socket> ns3::QKDApp004::m_sinkDataSocketApp
private

The receiving socket for the data.

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

Referenced by ~QKDApp004(), PrepareSinkSocketFromApp(), and StopApplication().

◆ m_sinkSignalingSocketApp

Ptr<Socket> ns3::QKDApp004::m_sinkSignalingSocketApp
private

The receiving socket for the signaling messages.

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

Referenced by ~QKDApp004(), PrepareSinkSocketFromApp(), SendKsidRequest(), SendKsidResponse(), and StopApplication().

◆ m_sinkSocketFromKMS

Ptr<Socket> ns3::QKDApp004::m_sinkSocketFromKMS
private

◆ m_socketType

std::string ns3::QKDApp004::m_socketType
private

The sockets type.

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

Referenced by PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), and Setup().

◆ m_stateTransitionTrace

ns3::TracedCallback<const std::string &, const std::string &> ns3::QKDApp004::m_stateTransitionTrace

A trace for the application state transitions.

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

Referenced by GetTypeId().

◆ m_tid

TypeId ns3::QKDApp004::m_tid
private

The type identifier.

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

Referenced by GetTypeId().

◆ m_transitionMatrix

std::multimap<std::string, std::string> ns3::QKDApp004::m_transitionMatrix
private

The map of the possible state transitions.

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

◆ m_ttl

uint32_t ns3::QKDApp004::m_ttl
private

The time-to-live of the key stream session.

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

Referenced by GetTypeId(), and OpenConnect().

◆ m_txKmsTrace

TracedCallback<Ptr<const Packet> > ns3::QKDApp004::m_txKmsTrace

A trace for transmitted packets to the KMS.

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

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

◆ m_txSigTrace

TracedCallback<Ptr<const Packet> > ns3::QKDApp004::m_txSigTrace

A trace for transmitted signaling packets.

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

Referenced by CreateKeyQueues(), CreateKeyQueuesResponse(), GetTypeId(), SendKsidRequest(), and SendKsidResponse().

◆ m_txTrace

TracedCallback<Ptr<const Packet>, std::string > ns3::QKDApp004::m_txTrace

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

Referenced by DataPacketReceivedFromApp(), GetTypeId(), and SendPacket().

◆ m_useCrypto

uint32_t ns3::QKDApp004::m_useCrypto
private

Execute actual cryptographic algorithms?

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

Referenced by GetTypeId(), ProcessDataPacketFromApp(), and SendPacket().


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