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

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

#include "qkd-app-014.h"

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

Classes

struct  AddressHash
 Hashing for the Address class. More...
 

Public Types

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

Public Member Functions

 QKDApp014 ()
 
 ~QKDApp014 () override
 
void CheckAppState ()
 Checks the conditions to change the application state.
 
bool ConnectionRequestedFromApp (Ptr< Socket > socket, const Address &address)
 Callback function after the connection for response from KMS has been received.
 
bool ConnectionRequestedFromKMS (Ptr< Socket > socket, const Address &address)
 Callback function after the connection for response from KMS has been received.
 
bool ConnectionRequestedSignalingFromApp (Ptr< Socket > socket, const Address &address)
 Callback function after the connection for response from KMS has been received.
 
void ConnectionSignalingToAppFailed (Ptr< Socket > socket)
 Callback function after the signaling connection to the APP has.
 
void ConnectionSignalingToAppSucceeded (Ptr< Socket > socket)
 Callback function after the signaling connection to the APP is complete.
 
void ConnectionToAppFailed (Ptr< Socket > socket)
 Callback function after the connection to the APP has failed.
 
void ConnectionToAppSucceeded (Ptr< Socket > socket)
 Callback function after the connection to the APP is complete.
 
void ConnectionToKMSFailed (Ptr< Socket > socket)
 Callback function after the connection to the KMS has failed.
 
void ConnectionToKMSSucceeded (Ptr< Socket > socket)
 Callback function after the connection to the KMS is complete.
 
void DataToKMSSend (Ptr< Socket >, uint32_t)
 Callback function to notify that data to KMS has been sent.
 
std::string GetAppStateString () const
 Returns the current state of the application in string format.
 
uint32_t GetAuthenticationKeySize ()
 Get key size for defined authentication algorithm.
 
uint32_t GetEncryptionKeySize ()
 Get key size for defined encryption algorithm.
 
std::string GetId ()
 Get the application ID.
 
Ipv4Address GetIp ()
 Get ipv4 address of source.
 
void GetKeysFromKMS (std::string keyType)
 Get keys from local KMS.
 
void GetKeyWithKeyIDs (std::string keyIds)
 Get keys identified with given IDs from local KMS.
 
Ipv4Address GetKmsIp ()
 Get ipv4 address of local KMS.
 
Ptr< AppKeyGetLocalKey (std::string keyType, std::string keyId="")
 Get key from key store.
 
Ipv4Address GetPeerIp ()
 Get ipv4 address of destination.
 
State GetState () const
 returns application state
 
void GetStatusFromKMS ()
 Get status from local KMS.
 
void HandleAcceptFromApp (Ptr< Socket > s, const Address &from)
 Handle an incoming connection from peer QKD application.
 
void HandleAcceptFromKMS (Ptr< Socket > s, const Address &from)
 Handle an incoming connection from KMS.
 
void HandleAcceptSignalingFromApp (Ptr< Socket > s, const Address &from)
 Handle a signaling incoming connection from peer QKD application.
 
void HandlePeerCloseFromApp (Ptr< Socket > socket)
 Handle a connection close from peer QKD application.
 
void HandlePeerCloseFromKMS (Ptr< Socket > socket)
 Handle a connection close from KMS.
 
void HandlePeerCloseSignalingFromApp (Ptr< Socket > socket)
 Handle a signaling connection close from peer QKD application.
 
void HandlePeerErrorFromApp (Ptr< Socket > socket)
 Handle a connection error from peer QKD application.
 
void HandlePeerErrorFromKMS (Ptr< Socket > socket)
 Handle a connection error from KMS.
 
void HandlePeerErrorSignalingFromApp (Ptr< Socket > socket)
 Handle a signaling connection error from peer QKD application.
 
void HandleReadFromApp (Ptr< Socket > socket)
 Handle a packet received by the QKD application from peer QKD application.
 
void HandleReadFromKMS (Ptr< Socket > socket)
 Handle a packet received by the QKD application from KMS application.
 
void HandleReadSignalingFromApp (Ptr< Socket > socket)
 Handle a signaling packet received by the QKD application from peer QKD application.
 
void HttpPacketReceived (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for tcp segmentation of packets received.
 
void InitKeyStores ()
 Initialize key stores at application layer.
 
void ManageStores ()
 Checks the state of the key stores.
 
void PrepareSocketToApp ()
 Prepare send socket to communicate with QKD Application.
 
void PrepareSocketToKMS ()
 Prepare send socket to communicate with KMS Application.
 
void PrintStoreStats ()
 Print status information on key stores.
 
void ProcessDataPacket (QKDAppHeader header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process data packets from peer QKD application.
 
void ProcessResponseFromKMS (HTTPMessage &header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process response from KMS application.
 
void ProcessSignalingPacketFromApp (HTTPMessage &header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process signaling packets from peer QKD application.
 
void QAppPacketReceived (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for tcp segmentation of signaling packets received from KMS.
 
void ScheduleAction (Time t, std::string action)
 Schedule action to performe.
 
void SetCryptoSettings (uint32_t encryptionType, uint32_t authenticationType, uint32_t authenticationTagLengthInBits)
 Set encryption and authentication type.
 
void SetState (State state)
 set application state
 
void Setup (std::string socketType, std::string appId, std::string remoteAppId, const Address &appAddress, const Address &remoteAppAddress, const Address &kmAddress, std::string type)
 
void Setup (std::string socketType, std::string appId, std::string remoteAppId, const Address &appAddress, const Address &remoteAppAddress, const Address &kmAddress, uint32_t packetSize, DataRate dataRate, std::string type)
 
- Public Member Functions inherited from ns3::Application
 Application ()
 
 ~Application () override
 
virtual int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this Application object.
 
Ptr< NodeGetNode () const
 
void SetNode (Ptr< Node > node)
 
void SetStartTime (Time start)
 Specify application start time.
 
void SetStopTime (Time stop)
 Specify application stop time.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static std::string GetAppStateString (State state)
 Returns the given application state in string format.
 
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Application
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Protected Member Functions

void DoDispose () override
 Destructor implementation.
 
- Protected Member Functions inherited from ns3::Application
void DoInitialize () override
 Initialize() implementation.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Private Member Functions

void AppTransitionTree ()
 Transition tree of the application.
 
std::string CreateKeyIdField (std::string keyId)
 Create encryption key id field for the QKDApp header.
 
std::string GetPacketContent (uint32_t msgLength=0)
 Get the packet payload content.
 
std::string IpToString (Ipv4Address address)
 Convert ipv4 address in string.
 
std::vector< std::string > PopHttpAppRequest ()
 Pop HTTP request from app queue.
 
std::string PopHttpKmsRequest ()
 Pop HTTP request from kms queue.
 
void PushHttpAppRequest (std::vector< std::string > keyIds)
 Adds HTTP request to app queue to properly map response later.
 
void PushHttpKmsRequest (std::string input)
 Adds HTTP request to kms queue to properly map response later.
 
std::string ReadKeyIdField (std::string keyId)
 Read key ID from the encryption key ID field of the QKDApp header.
 
std::vector< std::string > ReadUri (std::string s)
 Read http uri in vector.
 
void ScheduleTx ()
 Schedule event to send data.
 
void SendDataPacket ()
 Send protected data.
 
void SendKeyIds (std::vector< std::string > keyIds, HTTPMessage::HttpStatus statusCode=HTTPMessage::Ok)
 Implementation of send KEY_IDS notification.
 
void StartApplication () override
 Start application.
 
void StopApplication () override
 Stop application.
 
void SwitchAppState (State state)
 Change the state of the application.
 

Private Attributes

uint32_t m_aesLifetime
 key lifetime in bytes
 
std::vector< std::vector< std::string > > m_appHttpReqQueue
 
uint32_t m_authentication
 authentication type
 
TracedCallback< Ptr< Packet >, std::string > m_authenticationTrace
 trace callback for authentication
 
QKDEncryptor::AuthenticationType m_authenticationType
 authentication type
 
std::map< std::string, Ptr< AppKey > > m_authStore
 
uint32_t m_authTagSize
 length of the authentication tag in bits
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_buffer_kms
 Buffer for received packets(fragmentation)
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_buffer_QKDApp014
 Buffer for received packets(fragmentation)
 
std::map< std::string, Ptr< AppKey > > m_commonStore
 
Ptr< Socketm_dataSocketApp
 
TracedCallback< Ptr< Packet >, std::string > m_deauthenticationTrace
 trace callback for authentication check
 
TracedCallback< Ptr< Packet > > m_decryptionTrace
 trace callback for decryption
 
std::string m_dstId
 destination application id
 
uint32_t m_encryption
 encryption type
 
TracedCallback< Ptr< Packet > > m_encryptionTrace
 trace callback for encryption
 
QKDEncryptor::EncryptionType m_encryptionType
 encryption type
 
Ptr< QKDEncryptorm_encryptor
 encryptor
 
std::map< std::string, Ptr< AppKey > > m_encStore
 
std::string m_id
 source application id
 
bool m_internalAppWait
 
bool m_isDataConnectedToApp
 
bool m_isSignalingConnectedToApp
 
Address m_kms
 local kms address
 
std::vector< std::string > m_kmsHttpReqQueue
 
Address m_local
 local address
 
uint32_t m_master
 is master App014
 
TracedCallback< const std::string &, Ptr< const Packet > > m_mxTrace
 Traced Callback: missed send packet call.
 
uint32_t m_numberOfKeysKMS
 number of keys to fetch per request
 
Address m_peer
 peer address
 
uint16_t m_portSignaling
 
DataRate m_rate
 data rate
 
TracedCallback< const std::string &, Ptr< const Packet > > m_rxKmsTrace
 Traced Callback: received packets from KMS.
 
TracedCallback< const std::string &, Ptr< const Packet > > m_rxSigTrace
 Traced Callback: received signaling packets.
 
TracedCallback< const std::string &, Ptr< const Packet > > m_rxTrace
 Traced Callback: received data packets.
 
EventId m_scheduleManageStores
 
EventId m_sendEvent
 
Ptr< Socketm_signalingSocketApp
 
uint32_t m_size
 data packet size
 
Ptr< Socketm_socketToKMS
 
std::string m_socketType
 
State m_state
 application state
 
ns3::TracedCallback< const std::string &, const std::string & > m_stateTransitionTrace
 The StateTransition trace source.
 
TypeId m_tid
 tid
 
std::multimap< std::string, std::string > m_transitionMatrix
 transition map of protocol states
 
TracedCallback< const std::string &, Ptr< const Packet > > m_txKmsTrace
 Traced Callback: transmitted packets to KMS.
 
TracedCallback< const std::string &, Ptr< const Packet > > m_txSigTrace
 Traced Callback: transmitted signaling packets.
 
TracedCallback< const std::string &, Ptr< const Packet > > m_txTrace
 Traced Callback: transmitted data packets.
 
uint32_t m_useCrypto
 execute crypo algorithms
 
Time m_waitInsufficient
 time wait before submitting new get_key after error
 

Static Private Attributes

static uint32_t m_applicationCounts = 0
 application count
 

Additional Inherited Members

- Protected Attributes inherited from ns3::Application
Ptr< Nodem_node
 The node that this application is installed on.
 
EventId m_startEvent
 The event that will fire at m_startTime to start the application.
 
Time m_startTime
 The simulation time that the application will start.
 
EventId m_stopEvent
 The event that will fire at m_stopTime to end the application.
 
Time m_stopTime
 The simulation time that the application will end.
 

Detailed Description

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

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

Config Paths

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

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

Attributes

  • 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: constructwriteread
    • Support level: SUPPORTED
  • 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: 0
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • EncryptionType: The type of encryption to be used(0-unencrypted, 1-OTP, 2-AES)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • LengthOfAuthenticationTag: The default length of the authentication tag
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 256
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • NumberOfKeyToFetchFromKMS: The total number of keys per request to LKMS(ESTI QKD 014)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 3
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • Protocol: The type of protocol to use.
  • 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: constructwriteread
    • Support level: SUPPORTED
  • WaitInsufficient: Penalty time(in seconds) when there is insufficient amount of key
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+08ns
    • Flags: constructwriteread
    • Support level: SUPPORTED

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: constructwriteread
    • Support level: SUPPORTED
  • 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: constructwriteread
    • Support level: SUPPORTED

TraceSources

  • Mx: Missed send packet call
  • PacketAuthenticated: The change trance for currenly authenticated packet
    • Callback signature: ns3::QKDCrypto::PacketAuthenticated
    • Support level: SUPPORTED
  • PacketDeAuthenticated: The change trance for currenly deauthenticated packet
    • Callback signature: ns3::QKDCrypto::PacketDeAuthenticated
    • Support level: SUPPORTED
  • PacketDecrypted: The change trance for currenly decrypted packet
    • Callback signature: ns3::QKDCrypto::PacketDecrypted
    • Support level: SUPPORTED
  • PacketEncrypted: The change trance for currenly ecrypted packet
    • Callback signature: ns3::QKDCrypto::PacketEncrypted
    • Support level: SUPPORTED
  • Rx: A new packet is received
  • RxKMS: A new packet is received from local KMS
  • RxSig: A new signaling packet is received
  • StateTransition: Trace fired upon every QKDApp014 state transition.
  • Tx: A new packet is created and is sent
  • TxKMS: A new packet is created and is sent to local KMS
  • TxSig: A new signaling packet is created and is sent

Group: Applications

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

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

Member Enumeration Documentation

◆ State

QKD App states(App) States that refer to QKDApp014 data transmision!

Enumerator
NOT_STARTED 
INITIALIZED 
READY 
WAIT 
SEND_DATA 
DECRYPT_DATA 
STOPPED 

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

Constructor & Destructor Documentation

◆ QKDApp014()

ns3::QKDApp014::QKDApp014 ( )

   SETUP

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

References m_applicationCounts, and m_transitionMatrix.

◆ ~QKDApp014()

ns3::QKDApp014::~QKDApp014 ( )
override

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

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AppTransitionTree()

void ns3::QKDApp014::AppTransitionTree ( )
private

Transition tree of the application.

Change states and take actions!


   STATE functions

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

References GetAuthenticationKeySize(), GetEncryptionKeySize(), GetState(), GetStatusFromKMS(), INITIALIZED, m_master, NS_FATAL_ERROR, NS_LOG_FUNCTION, PrepareSocketToApp(), PrepareSocketToKMS(), READY, SendDataPacket(), SwitchAppState(), and WAIT.

Referenced by StartApplication().

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

◆ CheckAppState()

void ns3::QKDApp014::CheckAppState ( )

Checks the conditions to change the application state.

Based on the states of the key stores, the application will change its states between READY and WAIT.

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

References ns3::Create(), GetAppStateString(), GetAuthenticationKeySize(), GetEncryptionKeySize(), GetState(), m_authStore, m_encStore, NS_LOG_FUNCTION, READY, SwitchAppState(), and WAIT.

Referenced by ManageStores(), and ProcessSignalingPacketFromApp().

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

◆ ConnectionRequestedFromApp()

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

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

Parameters
socketthe connected socket
addressaddress of the KMS

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

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

Referenced by PrepareSocketToApp().

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

◆ ConnectionRequestedFromKMS()

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

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

Parameters
socketthe connected socket
addressaddress of the KMS

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

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

Referenced by PrepareSocketToKMS().

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

◆ ConnectionRequestedSignalingFromApp()

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

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

Parameters
socketthe connected socket
addressaddress of the KMS

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

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

Referenced by PrepareSocketToApp().

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

◆ ConnectionSignalingToAppFailed()

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

Callback function after the signaling connection to the APP has.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionSignalingToAppSucceeded()

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

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

Parameters
socketthe connected socket

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

References m_isSignalingConnectedToApp, and NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToAppFailed()

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

Callback function after the connection to the APP has failed.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToAppSucceeded()

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

Callback function after the connection to the APP is complete.

Parameters
socketthe connected socket

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

References m_isDataConnectedToApp, and NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToKMSFailed()

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

Callback function after the connection to the KMS has failed.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ ConnectionToKMSSucceeded()

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

Callback function after the connection to the KMS is complete.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ CreateKeyIdField()

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

Create encryption key id field for the QKDApp header.

Parameters
keyIdkey ID used to create encryption key id field
Returns
string key ID prepared to be added to the field

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

References ns3::Create().

Referenced by SendDataPacket().

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

◆ DataToKMSSend()

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

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

Parameters
socketthe connected socket
uint32_tamount of data sent

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::QKDApp014::DoDispose ( )
overrideprotectedvirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Application.

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

References ns3::Application::DoDispose(), m_dataSocketApp, m_signalingSocketApp, m_socketToKMS, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetAppStateString() [1/2]

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

Returns the current state of the application in string format.

Returns
string current state of the application.

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

References GetAppStateString(), and GetState().

Referenced by CheckAppState(), GetAppStateString(), QAppPacketReceived(), ScheduleTx(), SendDataPacket(), StartApplication(), and SwitchAppState().

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

◆ GetAppStateString() [2/2]

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

Returns the given application state in string format.

Parameters
stateAn arbitrary state of an application.
Returns
string given state equivalently expressed in string format.

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

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

◆ GetAuthenticationKeySize()

uint32_t ns3::QKDApp014::GetAuthenticationKeySize ( )

Get key size for defined authentication algorithm.

Returns
uint32_t key size

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

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

Referenced by AppTransitionTree(), CheckAppState(), GetKeysFromKMS(), ManageStores(), ProcessDataPacket(), and SendDataPacket().

+ Here is the caller graph for this function:

◆ GetEncryptionKeySize()

uint32_t ns3::QKDApp014::GetEncryptionKeySize ( )

Get key size for defined encryption algorithm.

Returns
uint32_t key size

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

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

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

+ Here is the caller graph for this function:

◆ GetId()

std::string ns3::QKDApp014::GetId ( )
inline

Get the application ID.

Returns
uint32_t application ID

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

References m_id.

Referenced by GetKeysFromKMS(), GetKeyWithKeyIDs(), GetStatusFromKMS(), HttpPacketReceived(), QAppPacketReceived(), SendDataPacket(), and SendKeyIds().

+ Here is the caller graph for this function:

◆ GetIp()

Ipv4Address ns3::QKDApp014::GetIp ( )

Get ipv4 address of source.

Returns
ipv4 address

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

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

Referenced by SendKeyIds().

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

◆ GetKeysFromKMS()

void ns3::QKDApp014::GetKeysFromKMS ( std::string  keyType)

Get keys from local KMS.

Parameters
keyTypekey type(encryption or authentication)

Method defined by the ETSI QKD 014 document

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

References ns3::Create(), ns3::HTTPMessage::CreateRequest(), GetAuthenticationKeySize(), GetEncryptionKeySize(), GetId(), GetKmsIp(), IpToString(), m_dstId, m_numberOfKeysKMS, m_socketToKMS, m_txKmsTrace, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_ERROR, NS_LOG_FUNCTION, PrepareSocketToKMS(), PushHttpKmsRequest(), ns3::Socket::Send(), ns3::HTTPMessage::SetHeader(), and ns3::HTTPMessage::ToString().

Referenced by ManageStores(), and ProcessSignalingPacketFromApp().

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

◆ GetKeyWithKeyIDs()

void ns3::QKDApp014::GetKeyWithKeyIDs ( std::string  keyIds)

Get keys identified with given IDs from local KMS.

Parameters
keyIdskey identifiers in JSON key_Ids string format

Method defined by the ETSI QKD 014 document

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

References ns3::Create(), ns3::HTTPMessage::CreateRequest(), GetId(), GetKmsIp(), IpToString(), m_dstId, m_socketToKMS, m_txKmsTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSocketToKMS(), ns3::Socket::Send(), ns3::HTTPMessage::SetHeader(), and ns3::HTTPMessage::ToString().

Referenced by ProcessSignalingPacketFromApp().

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

◆ GetKmsIp()

Ipv4Address ns3::QKDApp014::GetKmsIp ( )

Get ipv4 address of local KMS.

Returns
ipv4 address

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

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

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

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

◆ GetLocalKey()

Ptr< AppKey > ns3::QKDApp014::GetLocalKey ( std::string  keyType,
std::string  keyId = "" 
)

Get key from key store.

Parameters
keyTypekey type(encryption or authentication)
keyIdkey identifier(optional)

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

References ns3::Create(), ns3::AppKey::ENCRYPTION, m_authStore, m_commonStore, m_encStore, m_master, m_size, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ProcessDataPacket(), and SendDataPacket().

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

◆ GetPacketContent()

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

Get the packet payload content.

Parameters
msgLengthlength of random string to generate
Returns
string random string

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

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

Referenced by SendDataPacket().

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

◆ GetPeerIp()

Ipv4Address ns3::QKDApp014::GetPeerIp ( )

Get ipv4 address of destination.

Returns
ipv4 address

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

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

Referenced by HttpPacketReceived(), and SendKeyIds().

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

◆ GetState()

State ns3::QKDApp014::GetState ( ) const
inline

returns application state

Returns
State application state

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

References m_state.

Referenced by AppTransitionTree(), CheckAppState(), GetAppStateString(), QAppPacketReceived(), ScheduleTx(), SendDataPacket(), and StartApplication().

+ Here is the caller graph for this function:

◆ GetStatusFromKMS()

void ns3::QKDApp014::GetStatusFromKMS ( )

Get status from local KMS.

Method defined by the ETSI QKD 014 document


   KEY MANAGEMENT functions

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

References ns3::Create(), ns3::HTTPMessage::CreateRequest(), GetId(), GetKmsIp(), IpToString(), m_dstId, m_socketToKMS, m_txKmsTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSocketToKMS(), ns3::Socket::Send(), ns3::HTTPMessage::SetHeader(), and ns3::HTTPMessage::ToString().

Referenced by AppTransitionTree().

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

◆ GetTypeId()

◆ HandleAcceptFromApp()

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

Handle an incoming connection from peer QKD application.

Parameters
sthe incoming connection socket
fromthe address the connection is from

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

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

Referenced by PrepareSocketToApp().

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

◆ HandleAcceptFromKMS()

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

Handle an incoming connection from KMS.

Parameters
sthe incoming connection socket
fromthe address the connection is from

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

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

Referenced by PrepareSocketToKMS().

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

◆ HandleAcceptSignalingFromApp()

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

Handle a signaling incoming connection from peer QKD application.

Parameters
sthe incoming connection socket
fromthe address the connection is from

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

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

Referenced by PrepareSocketToApp().

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

◆ HandlePeerCloseFromApp()

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

Handle a connection close from peer QKD application.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ HandlePeerCloseFromKMS()

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

Handle a connection close from KMS.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ HandlePeerCloseSignalingFromApp()

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

Handle a signaling connection close from peer QKD application.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ HandlePeerErrorFromApp()

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

Handle a connection error from peer QKD application.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ HandlePeerErrorFromKMS()

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

Handle a connection error from KMS.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ HandlePeerErrorSignalingFromApp()

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

Handle a signaling connection error from peer QKD application.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ HandleReadFromApp()

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

Handle a packet received by the QKD application from peer QKD application.

Parameters
socketthe receiving socket

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

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::InetSocketAddress::IsMatchingType(), ns3::Simulator::Now(), NS_LOG_FUNCTION, and QAppPacketReceived().

Referenced by HandleAcceptFromApp(), and PrepareSocketToApp().

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

◆ HandleReadFromKMS()

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

Handle a packet received by the QKD application from KMS application.

Parameters
socketthe receiving socket

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

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), HttpPacketReceived(), ns3::InetSocketAddress::IsMatchingType(), ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Referenced by HandleAcceptFromKMS(), and PrepareSocketToKMS().

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

◆ HandleReadSignalingFromApp()

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

Handle a signaling packet received by the QKD application from peer QKD application.

Parameters
socketthe receiving socket

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

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), HttpPacketReceived(), ns3::InetSocketAddress::IsMatchingType(), ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Referenced by HandleAcceptSignalingFromApp(), and PrepareSocketToApp().

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

◆ HttpPacketReceived()

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

Check for tcp segmentation of packets received.

Parameters
packet
addressaddress of the KMS
socketthe connected socket

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

References ns3::InetSocketAddress::ConvertFrom(), ns3::Create(), GetId(), ns3::InetSocketAddress::GetIpv4(), GetPeerIp(), m_buffer_kms, m_rxKmsTrace, m_rxSigTrace, NS_LOG_DEBUG, NS_LOG_FUNCTION, ProcessResponseFromKMS(), and ProcessSignalingPacketFromApp().

Referenced by HandleReadFromKMS(), and HandleReadSignalingFromApp().

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

◆ InitKeyStores()

void ns3::QKDApp014::InitKeyStores ( )

Initialize key stores at application layer.


   KEY BUFFER functions

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

References m_authStore, m_commonStore, m_encStore, and NS_LOG_FUNCTION.

Referenced by Setup(), and StopApplication().

+ Here is the caller graph for this function:

◆ IpToString()

std::string ns3::QKDApp014::IpToString ( Ipv4Address  address)
private

Convert ipv4 address in string.

Parameters
addressipv4 address
Returns
string ipv4 address

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

References ns3::Create(), and NS_LOG_FUNCTION.

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

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

◆ ManageStores()

void ns3::QKDApp014::ManageStores ( )

Checks the state of the key stores.

Function checks ste state of the application key stores and submits get_key request if neccessary.

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

References CheckAppState(), GetAuthenticationKeySize(), GetEncryptionKeySize(), GetKeysFromKMS(), m_authStore, m_encStore, m_internalAppWait, m_master, NS_LOG_FUNCTION, and PrintStoreStats().

Referenced by ProcessResponseFromKMS(), ScheduleAction(), and SendDataPacket().

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

◆ PopHttpAppRequest()

std::vector< std::string > ns3::QKDApp014::PopHttpAppRequest ( )
private

Pop HTTP request from app queue.

Returns
vector of strings key ids

It deletes request from queue!

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

References ns3::Create(), m_appHttpReqQueue, NS_LOG_ERROR, and NS_LOG_FUNCTION.

Referenced by ProcessSignalingPacketFromApp().

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

◆ PopHttpKmsRequest()

std::string ns3::QKDApp014::PopHttpKmsRequest ( )
private

Pop HTTP request from kms queue.

Returns
string key type

It deletes request from queue!

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

References ns3::Create(), m_kmsHttpReqQueue, NS_LOG_ERROR, and NS_LOG_FUNCTION.

Referenced by ProcessResponseFromKMS().

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

◆ PrepareSocketToApp()

◆ PrepareSocketToKMS()

◆ PrintStoreStats()

void ns3::QKDApp014::PrintStoreStats ( )

Print status information on key stores.

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

References m_authStore, m_commonStore, m_encStore, and NS_LOG_FUNCTION.

Referenced by ManageStores(), and ProcessSignalingPacketFromApp().

+ Here is the caller graph for this function:

◆ ProcessDataPacket()

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

Process data packets from peer QKD application.

Parameters
headerQKDApp014 packet header
packetreceived packet
socketthe receiving socket

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

References ns3::Create(), DECRYPT_DATA, ns3::QKDAppHeader::GetAuthenticated(), ns3::QKDAppHeader::GetAuthenticationKeyId(), GetAuthenticationKeySize(), ns3::QKDAppHeader::GetAuthTag(), ns3::QKDAppHeader::GetEncrypted(), ns3::QKDAppHeader::GetEncryptionKeyId(), GetLocalKey(), m_authTagSize, m_encryptor, m_master, m_size, m_useCrypto, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_WARN, ReadKeyIdField(), READY, SetCryptoSettings(), and SwitchAppState().

Referenced by QAppPacketReceived().

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

◆ ProcessResponseFromKMS()

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

Process response from KMS application.

Parameters
headerreceived HTTP header
packetreceived packet
socketthe receiving socket

status

enc_keys

dec_keys

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

References ns3::AppKey::AUTHENTICATION, ns3::Create(), ns3::AppKey::ENCRYPTION, ns3::HTTPMessage::GetMessageBodyString(), ns3::HTTPMessage::GetRequestUri(), ns3::HTTPMessage::GetStatus(), m_aesLifetime, m_commonStore, m_encryptionType, m_size, m_waitInsufficient, ManageStores(), NS_FATAL_ERROR, NS_LOG_ERROR, NS_LOG_FUNCTION, ns3::HTTPMessage::Ok, PopHttpKmsRequest(), ns3::QKDEncryptor::QKDCRYPTO_AES, ReadUri(), ScheduleAction(), and SendKeyIds().

Referenced by HttpPacketReceived().

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

◆ ProcessSignalingPacketFromApp()

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

Process signaling packets from peer QKD application.

Parameters
headerHTTP packet header
packetreceived packet
socketthe receiving socket

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

References ns3::AppKey::AUTHENTICATION, CheckAppState(), ns3::Create(), ns3::AppKey::ENCRYPTION, GetKeysFromKMS(), GetKeyWithKeyIDs(), ns3::HTTPMessage::GetMessageBodyString(), ns3::HTTPMessage::GetStatus(), m_authStore, m_commonStore, m_encStore, m_internalAppWait, m_master, NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_WARN, ns3::HTTPMessage::Ok, PopHttpAppRequest(), and PrintStoreStats().

Referenced by HttpPacketReceived().

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

◆ PushHttpAppRequest()

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

Adds HTTP request to app queue to properly map response later.

Parameters
keyIdsvector of key ids

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

References m_appHttpReqQueue, NS_LOG_ERROR, and NS_LOG_FUNCTION.

Referenced by SendKeyIds().

+ Here is the caller graph for this function:

◆ PushHttpKmsRequest()

void ns3::QKDApp014::PushHttpKmsRequest ( std::string  input)
private

Adds HTTP request to kms queue to properly map response later.

Parameters
inputkey type

   HTTP mapping

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

References ns3::Create(), m_kmsHttpReqQueue, NS_LOG_ERROR, and NS_LOG_FUNCTION.

Referenced by GetKeysFromKMS().

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

◆ QAppPacketReceived()

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

Check for tcp segmentation of signaling packets received from KMS.

Parameters
packet
addressaddress of the KMS
socketthe connected socket

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

References ns3::Create(), GetAppStateString(), GetId(), ns3::QKDAppHeader::GetLength(), ns3::QKDAppHeader::GetSerializedSize(), GetState(), m_buffer_QKDApp014, m_master, m_rxTrace, NS_ABORT_IF, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ProcessDataPacket(), and READY.

Referenced by HandleReadFromApp().

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

◆ ReadKeyIdField()

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

Read key ID from the encryption key ID field of the QKDApp header.

Parameters
keyIdkey ID from the encryption key ID field
Returns
string read key ID

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

References ns3::Create(), and NS_LOG_FUNCTION.

Referenced by ProcessDataPacket().

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

◆ ReadUri()

std::vector< std::string > ns3::QKDApp014::ReadUri ( std::string  s)
private

Read http uri in vector.

Parameters
suri string
Returns
vector of uri parameters

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

References ns3::Create(), and NS_LOG_FUNCTION.

Referenced by ProcessResponseFromKMS().

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

◆ ScheduleAction()

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

Schedule action to performe.

Parameters
timeeventTime
stringeventAction

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

References ns3::Create(), ns3::EventId::IsPending(), m_scheduleManageStores, ManageStores(), NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by ProcessResponseFromKMS(), and SendDataPacket().

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

◆ ScheduleTx()

void ns3::QKDApp014::ScheduleTx ( )
private

Schedule event to send data.


   SCHEDULE functions

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

References GetAppStateString(), ns3::DataRate::GetBitRate(), GetState(), ns3::EventId::IsPending(), m_rate, m_sendEvent, m_size, NOT_STARTED, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::Seconds(), SendDataPacket(), and STOPPED.

Referenced by SendDataPacket().

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

◆ SendDataPacket()

void ns3::QKDApp014::SendDataPacket ( )
private

◆ SendKeyIds()

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

Implementation of send KEY_IDS notification.

Parameters
keyIdskey identifiers
statusCodehttp status code of response(default status is Ok)

Master App014(Alice) sends key IDs of obtained keys from KMS that will be used for encryption of outgoing messages. Slave App014 (Bob) agree or disagree on proposed key IDs.

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

References ns3::Create(), ns3::HTTPMessage::CreateRequest(), ns3::HTTPMessage::CreateResponse(), GetId(), GetIp(), GetPeerIp(), IpToString(), m_isSignalingConnectedToApp, m_master, m_signalingSocketApp, m_txSigTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSocketToApp(), PushHttpAppRequest(), ns3::Socket::Send(), ns3::HTTPMessage::SetHeader(), and ns3::HTTPMessage::ToString().

Referenced by ProcessResponseFromKMS().

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

◆ SetCryptoSettings()

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

Set encryption and authentication type.

Parameters
ecryptionTypeencryption type
authenticationTypeauthentication type

   ADDTIONAL functions

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

References ns3::Create(), 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 ProcessDataPacket(), and StartApplication().

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

◆ SetState()

void ns3::QKDApp014::SetState ( State  state)
inline

set application state

Parameters
stateapplication state

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

References m_state.

Referenced by SwitchAppState().

+ Here is the caller graph for this function:

◆ Setup() [1/2]

void ns3::QKDApp014::Setup ( std::string  socketType,
std::string  appId,
std::string  remoteAppId,
const Address appAddress,
const Address remoteAppAddress,
const Address kmAddress,
std::string  type 
)

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

References ns3::Create(), and Setup().

+ Here is the call graph for this function:

◆ Setup() [2/2]

void ns3::QKDApp014::Setup ( std::string  socketType,
std::string  appId,
std::string  remoteAppId,
const Address appAddress,
const Address remoteAppAddress,
const Address kmAddress,
uint32_t  packetSize,
DataRate  dataRate,
std::string  type 
)

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

References ns3::InetSocketAddress::ConvertFrom(), ns3::Create(), INITIALIZED, InitKeyStores(), m_applicationCounts, m_dstId, m_id, m_internalAppWait, m_kms, m_local, m_master, m_peer, m_portSignaling, m_rate, m_size, m_socketType, NS_LOG_FUNCTION, packetSize, and SwitchAppState().

Referenced by Setup().

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

◆ StartApplication()

void ns3::QKDApp014::StartApplication ( )
overrideprivatevirtual

Start application.


   APPLICATION functions

Reimplemented from ns3::Application.

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

References AppTransitionTree(), ns3::Create(), GetAppStateString(), GetState(), INITIALIZED, m_aesLifetime, m_authentication, m_authTagSize, m_encryption, m_local, m_master, m_peer, m_size, NS_FATAL_ERROR, NS_LOG_FUNCTION, PrepareSocketToApp(), and SetCryptoSettings().

+ Here is the call graph for this function:

◆ StopApplication()

void ns3::QKDApp014::StopApplication ( )
overrideprivatevirtual

Stop application.

Reimplemented from ns3::Application.

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

References ns3::Simulator::Cancel(), ns3::Socket::Close(), InitKeyStores(), ns3::EventId::IsPending(), m_dataSocketApp, m_sendEvent, m_signalingSocketApp, m_socketToKMS, NS_LOG_FUNCTION, STOPPED, and SwitchAppState().

+ Here is the call graph for this function:

◆ SwitchAppState()

void ns3::QKDApp014::SwitchAppState ( QKDApp014::State  state)
private

Change the state of the application.

Fires the AppStateTransition trace source.

Parameters
stateThe new application state.

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

References ns3::Create(), GetAppStateString(), m_stateTransitionTrace, m_transitionMatrix, NS_FATAL_ERROR, NS_LOG_DEBUG, and SetState().

Referenced by AppTransitionTree(), CheckAppState(), ProcessDataPacket(), SendDataPacket(), Setup(), 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::QKDApp014::m_aesLifetime
private

key lifetime in bytes

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

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

◆ m_appHttpReqQueue

std::vector<std::vector<std::string> > ns3::QKDApp014::m_appHttpReqQueue
private

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

Referenced by PopHttpAppRequest(), and PushHttpAppRequest().

◆ m_applicationCounts

uint32_t ns3::QKDApp014::m_applicationCounts = 0
staticprivate

application count

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

Referenced by QKDApp014(), and Setup().

◆ m_authentication

uint32_t ns3::QKDApp014::m_authentication
private

authentication type

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

Referenced by GetTypeId(), and StartApplication().

◆ m_authenticationTrace

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

trace callback for authentication

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

Referenced by GetTypeId(), and SendDataPacket().

◆ m_authenticationType

QKDEncryptor::AuthenticationType ns3::QKDApp014::m_authenticationType
private

authentication type

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

Referenced by GetAuthenticationKeySize(), SendDataPacket(), and SetCryptoSettings().

◆ m_authStore

std::map<std::string, Ptr<AppKey> > ns3::QKDApp014::m_authStore
private

◆ m_authTagSize

uint32_t ns3::QKDApp014::m_authTagSize
private

length of the authentication tag in bits

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

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

◆ m_buffer_kms

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

Buffer for received packets(fragmentation)

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

Referenced by HttpPacketReceived().

◆ m_buffer_QKDApp014

std::unordered_map<Address, Ptr<Packet>, AddressHash> ns3::QKDApp014::m_buffer_QKDApp014
private

Buffer for received packets(fragmentation)

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

Referenced by QAppPacketReceived().

◆ m_commonStore

std::map<std::string, Ptr<AppKey> > ns3::QKDApp014::m_commonStore
private

◆ m_dataSocketApp

Ptr<Socket> ns3::QKDApp014::m_dataSocketApp
private

◆ m_deauthenticationTrace

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

trace callback for authentication check

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

Referenced by GetTypeId().

◆ m_decryptionTrace

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

trace callback for decryption

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

Referenced by GetTypeId().

◆ m_dstId

std::string ns3::QKDApp014::m_dstId
private

destination application id

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

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

◆ m_encryption

uint32_t ns3::QKDApp014::m_encryption
private

encryption type

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

Referenced by GetTypeId(), and StartApplication().

◆ m_encryptionTrace

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

trace callback for encryption

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

Referenced by GetTypeId().

◆ m_encryptionType

QKDEncryptor::EncryptionType ns3::QKDApp014::m_encryptionType
private

encryption type

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

Referenced by GetEncryptionKeySize(), ProcessResponseFromKMS(), SendDataPacket(), and SetCryptoSettings().

◆ m_encryptor

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

encryptor

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

Referenced by ProcessDataPacket(), SendDataPacket(), and SetCryptoSettings().

◆ m_encStore

std::map<std::string, Ptr<AppKey> > ns3::QKDApp014::m_encStore
private

◆ m_id

std::string ns3::QKDApp014::m_id
private

source application id

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

Referenced by GetId(), and Setup().

◆ m_internalAppWait

bool ns3::QKDApp014::m_internalAppWait
private

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

Referenced by ManageStores(), ProcessSignalingPacketFromApp(), and Setup().

◆ m_isDataConnectedToApp

bool ns3::QKDApp014::m_isDataConnectedToApp
private

◆ m_isSignalingConnectedToApp

bool ns3::QKDApp014::m_isSignalingConnectedToApp
private

◆ m_kms

Address ns3::QKDApp014::m_kms
private

local kms address

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

Referenced by GetKmsIp(), PrepareSocketToKMS(), and Setup().

◆ m_kmsHttpReqQueue

std::vector<std::string> ns3::QKDApp014::m_kmsHttpReqQueue
private

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

Referenced by PopHttpKmsRequest(), and PushHttpKmsRequest().

◆ m_local

Address ns3::QKDApp014::m_local
private

local address

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

Referenced by GetIp(), PrepareSocketToApp(), Setup(), and StartApplication().

◆ m_master

◆ m_mxTrace

TracedCallback<const std::string&, Ptr<const Packet> > ns3::QKDApp014::m_mxTrace
private

Traced Callback: missed send packet call.

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

Referenced by GetTypeId(), and SendDataPacket().

◆ m_numberOfKeysKMS

uint32_t ns3::QKDApp014::m_numberOfKeysKMS
private

number of keys to fetch per request

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

Referenced by GetKeysFromKMS(), and GetTypeId().

◆ m_peer

Address ns3::QKDApp014::m_peer
private

peer address

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

Referenced by GetPeerIp(), PrepareSocketToApp(), Setup(), and StartApplication().

◆ m_portSignaling

uint16_t ns3::QKDApp014::m_portSignaling
private

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

Referenced by PrepareSocketToApp(), and Setup().

◆ m_rate

DataRate ns3::QKDApp014::m_rate
private

data rate

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

Referenced by ScheduleTx(), and Setup().

◆ m_rxKmsTrace

TracedCallback<const std::string&, Ptr<const Packet> > ns3::QKDApp014::m_rxKmsTrace
private

Traced Callback: received packets from KMS.

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

Referenced by GetTypeId(), and HttpPacketReceived().

◆ m_rxSigTrace

TracedCallback<const std::string&, Ptr<const Packet> > ns3::QKDApp014::m_rxSigTrace
private

Traced Callback: received signaling packets.

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

Referenced by GetTypeId(), and HttpPacketReceived().

◆ m_rxTrace

TracedCallback<const std::string&, Ptr<const Packet> > ns3::QKDApp014::m_rxTrace
private

Traced Callback: received data packets.

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

Referenced by GetTypeId(), and QAppPacketReceived().

◆ m_scheduleManageStores

EventId ns3::QKDApp014::m_scheduleManageStores
private

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

Referenced by ScheduleAction(), and SendDataPacket().

◆ m_sendEvent

EventId ns3::QKDApp014::m_sendEvent
private

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

Referenced by ScheduleTx(), and StopApplication().

◆ m_signalingSocketApp

Ptr<Socket> ns3::QKDApp014::m_signalingSocketApp
private

◆ m_size

uint32_t ns3::QKDApp014::m_size
private

◆ m_socketToKMS

Ptr<Socket> ns3::QKDApp014::m_socketToKMS
private

◆ m_socketType

std::string ns3::QKDApp014::m_socketType
private

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

Referenced by PrepareSocketToApp(), and Setup().

◆ m_state

State ns3::QKDApp014::m_state
private

application state

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

Referenced by GetState(), and SetState().

◆ m_stateTransitionTrace

ns3::TracedCallback<const std::string&, const std::string&> ns3::QKDApp014::m_stateTransitionTrace
private

The StateTransition trace source.

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

Referenced by GetTypeId(), and SwitchAppState().

◆ m_tid

TypeId ns3::QKDApp014::m_tid
private

tid

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

Referenced by GetTypeId().

◆ m_transitionMatrix

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

transition map of protocol states

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

Referenced by QKDApp014(), and SwitchAppState().

◆ m_txKmsTrace

TracedCallback<const std::string&, Ptr<const Packet> > ns3::QKDApp014::m_txKmsTrace
private

Traced Callback: transmitted packets to KMS.

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

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

◆ m_txSigTrace

TracedCallback<const std::string&, Ptr<const Packet> > ns3::QKDApp014::m_txSigTrace
private

Traced Callback: transmitted signaling packets.

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

Referenced by GetTypeId(), and SendKeyIds().

◆ m_txTrace

TracedCallback<const std::string&, Ptr<const Packet> > ns3::QKDApp014::m_txTrace
private

Traced Callback: transmitted data packets.

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

Referenced by GetTypeId(), and SendDataPacket().

◆ m_useCrypto

uint32_t ns3::QKDApp014::m_useCrypto
private

execute crypo algorithms

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

Referenced by GetTypeId(), ProcessDataPacket(), and SendDataPacket().

◆ m_waitInsufficient

Time ns3::QKDApp014::m_waitInsufficient
private

time wait before submitting new get_key after error

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

Referenced by GetTypeId(), ProcessResponseFromKMS(), and SendDataPacket().


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