A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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  KMSPacket
 

Public Types

enum  Method {
  OPEN_CONNECT , GET_KEY , CLOSE , SEND_KSID ,
  ESTABLISH_QUEUES
}
 
enum  State {
  NOT_STARTED , INITIALIZED , ESTABLISHING_ASSOCIATIONS , ASSOCIATIONS_ESTABLISHED ,
  ESTABLISHING_KEY_QUEUES , KEY_QUEUES_ESTABLISHED , READY , WAIT ,
  SEND_DATA , DECRYPT_DATA , STOPPED
}
 QKD App states(App) States that refer to QKDApp 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

 QKDApp004 ()
 
 ~QKDApp004 () override
 
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 application identifier.
 
Ipv4Address GetIp ()
 Get application Ipv4 address.
 
Ipv4Address GetKmsIp ()
 Get KMS Ipv4 address.
 
std::string GetPeerId ()
 Get peer application identifier.
 
Ipv4Address GetPeerIp ()
 Get peer application Ipv4 address.
 
State GetState () const
 Returns the current state of the application.
 
void SetCryptoSettings (uint32_t encryptionType, uint32_t authenticationType, uint32_t authenticationTagLengthInBits)
 Set encryption and authentication type.
 
void SetState (State state)
 Set 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.
 

Public Attributes

TracedCallback< const std::string &, Ptr< const Packet > > m_mxTrace
 Traced Callback: missed send packet call.
 
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.
 
ns3::TracedCallback< const std::string &, const std::string & > m_stateTransitionTrace
 The StateTransition trace source.
 
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.
 

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.
 
void CheckQueues ()
 Application establishing key queues before establishing data traffic.
 
void CheckStreamSessions ()
 Check if the associations are successfuly established.
 
void Close (std::string ksid)
 Terminate the association.
 
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 CreateKeyStreamSessions ()
 
void DataPacketReceived (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for tcp segmentation of signaling packets received from KMS.
 
void DataToKMSSend (Ptr< Socket >, uint32_t)
 Callback function to notify that data to KMS has been sent.
 
void EstablishQueues ()
 Sends ESTABLISH_QUEUES request(for sende App004) or response(for receiver App004)
 
void GetKeyFromKMS (std::string ksid)
 Obtain the required amount of key material.
 
std::string GetPacketContent (uint32_t msgLength=0)
 Get the packet payload content.
 
std::string GetSessionScope (KeyStreamSession::Type type)
 
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 HandlePeerCloseToKMS (Ptr< Socket > socket)
 Handle a connection close to KMS.
 
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 HandlePeerErrorToKMS (Ptr< Socket > socket)
 Handle a connection error to KMS.
 
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.
 
std::string IpToString (Ipv4Address address)
 
void OpenConnect (std::string ksid, KeyStreamSession::Type sessionType)
 QKDApp reserves an association(Key_stream_ID)
 
void PacketReceivedFromKMS (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for tcp segmentation of packets received from KMS.
 
std::string PacketToString (Ptr< Packet > packet)
 Convert packet to string.
 
KeyStreamSession::Type PopHttpKmsRequest (std::string uri)
 Pop HTTP request from the queue(mapping response)
 
void PrepareSocketToApp ()
 Prepare send socket to communicate with QKD Application.
 
void PrepareSocketToKMS ()
 Prepare send socket to communicate with KMS Application.
 
void ProcessCloseResponse (HTTPMessage &header)
 Process response from KMS on CLOSE call.
 
void ProcessDataPacket (QKDAppHeader header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process data packets from peer QKD application.
 
void ProcessGetKeyResponse (HTTPMessage &header)
 Process Get Key response from KMS.
 
void ProcessOpenConnectResponse (HTTPMessage &header)
 Process response from KMS on OPEN_CONNECT call.
 
void ProcessPacketsToKMSFromQueue ()
 
void ProcessResponseFromKMS (HTTPMessage &header, Ptr< Packet > packet, Ptr< Socket > socket)
 Process response from KMS application.
 
void ProcessSignalingPacketFromApp (HTTPMessage &header, Ptr< Socket > socket)
 Process signaling packets from peer QKD application.
 
void PushHttpKmsRequest (std::string uri, KeyStreamSession::Type sessionType=KeyStreamSession::ENCRYPTION)
 Add HTTP request to queue to map response later.
 
std::vector< std::string > ReadUri (std::string s)
 
void RegisterAckTime (Time oldRtt, Time newRtt)
 
void ScheduleTx ()
 
void SendKsid (std::string ksid, KeyStreamSession::Type sessionType, HTTPMessage::HttpStatus statusCode=HTTPMessage::Ok)
 Sends SEND_KSID request(for sender App004) or response(for receiver App004)
 
void SendPacket ()
 QKDApp encrypts the data with obtained keys and sends this encrypted data to the peer QKDApp.
 
void SignalingPacketReceivedFromApp (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Check for tcp segmentation of signaling packets received from APP.
 
void StartApplication () override
 
void StopApplication () override
 Application specific shutdown code.
 

Private Attributes

uint32_t m_aesLifetime
 
std::string m_appId
 
uint32_t m_authentication
 
uint32_t m_authenticationTagLengthInBits
 length of the authentication tag in bits(32 by default)
 
TracedCallback< Ptr< Packet >, std::string > m_authenticationTrace
 trace callback for authentication
 
QKDEncryptor::AuthenticationType m_authenticationType
 
Ptr< KeyStreamSessionm_authStream
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_buffer_kms
 Buffer for received packets(fragmentation)
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_buffer_qkdapp
 Buffer for received packets(fragmentation)
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_buffer_sig
 Buffer for received packets(fragmentation)
 
EventId m_closeSocketEvent
 
DataRate m_dataRate
 
uint32_t m_dataSent
 
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_dstAppId
 
uint32_t m_encryption
 
TracedCallback< Ptr< Packet > > m_encryptionTrace
 trace callback for encryption
 
QKDEncryptor::EncryptionType m_encryptionType
 
Ptr< QKDEncryptorm_encryptor
 
Ptr< KeyStreamSessionm_encStream
 
Time m_holdTime
 
std::multimap< std::string, KeyStreamSession::Typem_httpRequestsKMS
 
bool m_isDataConnectedToApp
 
bool m_isSignalingConnectedToApp
 
uint32_t m_keyBufferLengthAuthentication
 
uint32_t m_keyBufferLengthEncryption
 
Address m_kms
 
Address m_local
 
uint32_t m_master
 
uint32_t m_packetSize
 
uint32_t m_packetsSent
 
Address m_peer
 
uint16_t m_portSignaling
 
bool m_primaryQueueEstablished
 
std::vector< KMSPacketm_queue_kms
 
bool m_replicaQueueEstablished
 
EventId m_sendEvent
 
Ptr< Socketm_signalingSocketApp
 
Ptr< Socketm_socketToKMS
 
std::string m_socketType
 
State m_state
 
TypeId m_tid
 
std::multimap< std::string, std::string > m_transitionMatrix
 transition map of protocol states
 
uint32_t m_useCrypto
 

Static Private Attributes

static uint32_t m_applicationCounts = 0
 

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 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.

Config Paths

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

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

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: 3
    • 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: 2
    • 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
  • 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: constructwriteread
    • Support level: SUPPORTED
  • 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: constructwriteread
    • Support level: SUPPORTED
  • Protocol: The type of protocol to use.
  • 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: constructwriteread
    • Support level: SUPPORTED
  • 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

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 QKDApp 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 1064 bytes (on a 64-bit architecture).

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

Member Enumeration Documentation

◆ Method

Enumerator
OPEN_CONNECT 
GET_KEY 
CLOSE 
SEND_KSID 
ESTABLISH_QUEUES 

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

◆ State

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

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

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

Constructor & Destructor Documentation

◆ QKDApp004()

ns3::QKDApp004::QKDApp004 ( )

   SETUP

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

References m_applicationCounts.

◆ ~QKDApp004()

ns3::QKDApp004::~QKDApp004 ( )
override

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

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AppTransitionTree()

void ns3::QKDApp004::AppTransitionTree ( )
private

Transition tree of the application.

Change states and take actions!


   STATE functions

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

References ASSOCIATIONS_ESTABLISHED, CheckQueues(), CreateKeyStreamSessions(), ESTABLISHING_ASSOCIATIONS, ESTABLISHING_KEY_QUEUES, EstablishQueues(), GetAuthenticationKeySize(), GetEncryptionKeySize(), GetState(), INITIALIZED, KEY_QUEUES_ESTABLISHED, m_master, NS_FATAL_ERROR, NS_LOG_FUNCTION, PrepareSocketToKMS(), READY, SendPacket(), and SetState().

Referenced by CheckQueues(), CheckStreamSessions(), ProcessSignalingPacketFromApp(), and StartApplication().

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

◆ CheckQueues()

void ns3::QKDApp004::CheckQueues ( )
private

Application establishing key queues before establishing data traffic.

Application can establish key queues of desired size prior to secure communication to support fast rekeying scenarios.

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

References AppTransitionTree(), ns3::Create(), GetKeyFromKMS(), KEY_QUEUES_ESTABLISHED, m_authStream, m_encStream, m_master, m_primaryQueueEstablished, m_replicaQueueEstablished, NS_LOG_FUNCTION, and SetState().

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

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

◆ CheckStreamSessions()

void ns3::QKDApp004::CheckStreamSessions ( )
private

Check if the associations are successfuly established.

If the associations are established, establishing queues is started!


   KEY BUFFER functions

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

References AppTransitionTree(), ASSOCIATIONS_ESTABLISHED, ns3::Create(), ESTABLISHING_ASSOCIATIONS, GetState(), m_authStream, m_encStream, m_master, NS_ASSERT, NS_LOG_FUNCTION, and SetState().

Referenced by ProcessSignalingPacketFromApp().

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

◆ Close()

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

Terminate the association.

Parameters
ksidUnique identifier of association

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

References ns3::Create(), ns3::HTTPMessage::CreateRequest(), ns3::KeyStreamSession::ENCRYPTION, GetId(), GetKmsIp(), IpToString(), m_authStream, m_encStream, m_master, m_queue_kms, m_socketToKMS, m_txKmsTrace, NS_ASSERT, NS_LOG_ERROR, NS_LOG_FUNCTION, PrepareSocketToKMS(), PushHttpKmsRequest(), ns3::Socket::Send(), ns3::HTTPMessage::SetHeader(), and ns3::HTTPMessage::ToString().

Referenced by ProcessSignalingPacketFromApp(), and StopApplication().

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

◆ ConnectionRequestedFromApp()

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

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

Parameters
socketthe connected socket
addressaddress of the KMS

Definition at line 494 of file qkd-app-004.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::QKDApp004::ConnectionRequestedFromKMS ( Ptr< Socket socket,
const Address address 
)
private

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

Parameters
socketthe connected socket
addressaddress of the KMS

Definition at line 469 of file qkd-app-004.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::QKDApp004::ConnectionRequestedSignalingFromApp ( Ptr< Socket socket,
const Address address 
)
private

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

Parameters
socketthe connected socket
addressaddress of the KMS

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

Callback function after the signaling connection to the APP has.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionSignalingToAppSucceeded()

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

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

Parameters
socketthe connected socket

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

References m_isSignalingConnectedToApp, and NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToAppFailed()

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

Callback function after the connection to the APP has failed.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToAppSucceeded()

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

Callback function after the connection to the APP is complete.

Parameters
socketthe connected socket

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

References m_isDataConnectedToApp, and NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ ConnectionToKMSFailed()

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

Callback function after the connection to the KMS has failed.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ ConnectionToKMSSucceeded()

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

Callback function after the connection to the KMS is complete.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ CreateKeyStreamSessions()

void ns3::QKDApp004::CreateKeyStreamSessions ( )
private

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

References ns3::KeyStreamSession::AUTHENTICATION, ns3::KeyStreamSession::ENCRYPTION, GetAuthenticationKeySize(), GetEncryptionKeySize(), m_authStream, m_encStream, m_master, NS_ASSERT, NS_LOG_FUNCTION, and OpenConnect().

Referenced by AppTransitionTree().

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

◆ DataPacketReceived()

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

Check for tcp segmentation of signaling packets received from KMS.

Parameters
packet
addressaddress of the KMS
socketthe connected socket

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

References ns3::Create(), GetAppStateString(), GetId(), ns3::QKDAppHeader::GetLength(), ns3::QKDAppHeader::GetSerializedSize(), GetState(), m_buffer_qkdapp, 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:

◆ DataToKMSSend()

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

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

Parameters
socketthe connected socket
uint32_tamount of data sent

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ DoDispose()

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

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

+ Here is the call graph for this function:

◆ EstablishQueues()

void ns3::QKDApp004::EstablishQueues ( )
private

Sends ESTABLISH_QUEUES request(for sende App004) or response(for receiver App004)

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

References ns3::Create(), ns3::HTTPMessage::CreateRequest(), ns3::HTTPMessage::CreateResponse(), GetId(), GetIp(), GetPeerId(), GetPeerIp(), ns3::HTTPMessage::GetStatus(), ns3::HTTPMessage::GetUri(), IpToString(), m_master, m_signalingSocketApp, m_txSigTrace, NS_ASSERT, NS_LOG_FUNCTION, ns3::HTTPMessage::Ok, 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:

◆ GetAppStateString() [1/2]

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

Returns the current state of the application in string format.

Returns
string current state of the application.

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

References GetAppStateString(), and GetState().

Referenced by DataPacketReceived(), GetAppStateString(), ScheduleTx(), SendPacket(), SetState(), and StartApplication().

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

◆ GetAppStateString() [2/2]

std::string ns3::QKDApp004::GetAppStateString ( QKDApp004::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 1802 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 ( )

Get key size for defined authentication algorithm.

Returns
uint32_t key size

Definition at line 1970 of file qkd-app-004.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(), CreateKeyStreamSessions(), OpenConnect(), ProcessDataPacket(), ProcessGetKeyResponse(), and SendPacket().

+ Here is the caller graph for this function:

◆ GetEncryptionKeySize()

uint32_t ns3::QKDApp004::GetEncryptionKeySize ( )

Get key size for defined encryption algorithm.

Returns
uint32_t key size

Definition at line 1953 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(), CreateKeyStreamSessions(), OpenConnect(), ProcessGetKeyResponse(), and SendPacket().

+ Here is the caller graph for this function:

◆ GetId()

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

Get application identifier.

Returns
string application id

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

References m_appId.

Referenced by Close(), DataPacketReceived(), EstablishQueues(), GetKeyFromKMS(), OpenConnect(), PacketReceivedFromKMS(), ProcessPacketsToKMSFromQueue(), SendKsid(), SendPacket(), and SignalingPacketReceivedFromApp().

+ Here is the caller graph for this function:

◆ GetIp()

Ipv4Address ns3::QKDApp004::GetIp ( )

Get application Ipv4 address.

Returns
Ipv4Address address

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

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

Referenced by EstablishQueues(), and SendKsid().

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

◆ GetKeyFromKMS()

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

Obtain the required amount of key material.

Parameters
ksidUnique identifier for the group of syncronized bits

QKDApp request key via ETSI GS 004 interface. In current version QKDApps request keys in synchronous order and index is not specified!

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

References ns3::Create(), ns3::HTTPMessage::CreateRequest(), ns3::KeyStreamSession::ENCRYPTION, GetId(), GetKmsIp(), ns3::Socket::GetPeerName(), GetState(), IpToString(), m_master, m_queue_kms, m_socketToKMS, m_txKmsTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSocketToKMS(), PushHttpKmsRequest(), ns3::Socket::Send(), ns3::HTTPMessage::SetHeader(), STOPPED, and ns3::HTTPMessage::ToString().

Referenced by CheckQueues(), ProcessDataPacket(), ProcessGetKeyResponse(), and SendPacket().

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

◆ GetKmsIp()

Ipv4Address ns3::QKDApp004::GetKmsIp ( )

Get KMS Ipv4 address.

Returns
Ipv4Address address

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

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

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

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

◆ GetPacketContent()

std::string ns3::QKDApp004::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 1931 of file qkd-app-004.cc.

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

Referenced by SendPacket().

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

◆ GetPeerId()

std::string ns3::QKDApp004::GetPeerId ( )
inline

Get peer application identifier.

Returns
string application id

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

References m_dstAppId.

Referenced by EstablishQueues(), OpenConnect(), and SendKsid().

+ Here is the caller graph for this function:

◆ GetPeerIp()

Ipv4Address ns3::QKDApp004::GetPeerIp ( )

Get peer application Ipv4 address.

Returns
Ipv4Address address

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

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

Referenced by EstablishQueues(), and SendKsid().

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

◆ GetSessionScope()

std::string ns3::QKDApp004::GetSessionScope ( KeyStreamSession::Type  type)
inlineprivate

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

References ns3::KeyStreamSession::ENCRYPTION.

Referenced by ProcessPacketsToKMSFromQueue(), and SendKsid().

+ Here is the caller graph for this function:

◆ GetState()

QKDApp004::State ns3::QKDApp004::GetState ( ) const

Returns the current state of the application.

Returns
string current state of the application.

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

References m_state.

Referenced by AppTransitionTree(), CheckStreamSessions(), DataPacketReceived(), GetAppStateString(), GetKeyFromKMS(), HandleReadFromKMS(), ProcessGetKeyResponse(), ProcessResponseFromKMS(), ScheduleTx(), SendPacket(), and StartApplication().

+ Here is the caller graph for this function:

◆ GetTypeId()

◆ HandleAcceptFromApp()

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

Handle an incoming connection from peer QKD application.

Parameters
sthe incoming connection socket
fromthe address the connection is from

Definition at line 522 of file qkd-app-004.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::QKDApp004::HandleAcceptFromKMS ( Ptr< Socket s,
const Address from 
)
private

Handle an incoming connection from KMS.

Parameters
sthe incoming connection socket
fromthe address the connection is from

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

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

Referenced by PrepareSocketToKMS().

+ 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 
)
private

Handle a signaling incoming connection from peer QKD application.

Parameters
sthe incoming connection socket
fromthe address the connection is from

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

Handle a connection close from peer QKD application.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ HandlePeerCloseFromKMS()

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

Handle a connection close from KMS.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ HandlePeerCloseSignalingFromApp()

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

Handle a signaling connection close from peer QKD application.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ HandlePeerCloseToKMS()

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

Handle a connection close to KMS.

Parameters
socketthe connected socket

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

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

Referenced by PrepareSocketToKMS().

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

◆ HandlePeerErrorFromApp()

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

Handle a connection error from peer QKD application.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ HandlePeerErrorFromKMS()

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

Handle a connection error from KMS.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

+ Here is the caller graph for this function:

◆ HandlePeerErrorSignalingFromApp()

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

Handle a signaling connection error from peer QKD application.

Parameters
socketthe connected socket

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

References NS_LOG_FUNCTION.

Referenced by PrepareSocketToApp().

+ Here is the caller graph for this function:

◆ HandlePeerErrorToKMS()

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

Handle a connection error to KMS.

Parameters
socketthe connected socket

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

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

Referenced by PrepareSocketToKMS().

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

◆ HandleReadFromApp()

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

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

Parameters
socketthe receiving socket

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

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

Referenced by HandleAcceptFromApp(), and PrepareSocketToApp().

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

◆ HandleReadFromKMS()

void ns3::QKDApp004::HandleReadFromKMS ( Ptr< Socket socket)
private

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

Parameters
socketthe receiving socket

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

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), GetState(), ns3::InetSocketAddress::IsMatchingType(), ns3::Simulator::Now(), NS_LOG_FUNCTION, PacketReceivedFromKMS(), ProcessPacketsToKMSFromQueue(), and STOPPED.

Referenced by HandleAcceptFromKMS(), and PrepareSocketToKMS().

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

◆ HandleReadSignalingFromApp()

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

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

Parameters
socketthe receiving socket

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

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

Referenced by HandleAcceptSignalingFromApp(), and PrepareSocketToApp().

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

◆ IpToString()

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

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

References ns3::Create(), and NS_LOG_FUNCTION.

Referenced by Close(), EstablishQueues(), GetKeyFromKMS(), OpenConnect(), and SendKsid().

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

◆ OpenConnect()

void ns3::QKDApp004::OpenConnect ( std::string  ksid,
KeyStreamSession::Type  sessionType 
)
private

QKDApp reserves an association(Key_stream_ID)

Parameters
ksidunique identifier for the group of syncronized bits
sessionTypethe purpose of given session

Replica QKDApp always states KSID in OPEN_CONNECT call. Primary QKDApp does not state KSID(design decision). Each QKDApp is limited(by design decisions) to establish up to 2 associations(one for encryption and one for authentification).


   KEY MANAGEMENT functions

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

References ns3::Create(), ns3::HTTPMessage::CreateRequest(), ns3::KeyStreamSession::ENCRYPTION, GetAuthenticationKeySize(), GetEncryptionKeySize(), GetId(), GetKmsIp(), GetPeerId(), IpToString(), m_master, m_queue_kms, m_socketToKMS, m_txKmsTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSocketToKMS(), PushHttpKmsRequest(), ns3::Socket::Send(), ns3::HTTPMessage::SetHeader(), and ns3::HTTPMessage::ToString().

Referenced by CreateKeyStreamSessions(), 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 
)
private

Check for tcp segmentation of packets received from KMS.

Parameters
packet
addressaddress of the KMS
socketthe connected socket

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

References ns3::Create(), GetId(), m_buffer_kms, m_rxKmsTrace, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ProcessResponseFromKMS().

Referenced by HandleReadFromKMS().

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

◆ PacketToString()

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

Convert packet to string.

Parameters
packetpacket
Returns
string packet as a string

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

◆ PopHttpKmsRequest()

KeyStreamSession::Type ns3::QKDApp004::PopHttpKmsRequest ( std::string  uri)
private

Pop HTTP request from the queue(mapping response)

Parameters
urirequest URI
Returns
KeyStreamSession::Type session scope

Deletes request from the queue.

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

References ns3::Create(), ns3::KeyStreamSession::EMPTY, m_httpRequestsKMS, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

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

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

◆ PrepareSocketToApp()

◆ PrepareSocketToKMS()

◆ ProcessCloseResponse()

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

Process response from KMS on CLOSE call.

Parameters
headerreceived HTTP header

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

References ns3::Socket::Close(), ns3::Create(), ns3::KeyStreamSession::ENCRYPTION, ns3::HTTPMessage::GetRequestUri(), ns3::HTTPMessage::GetStatus(), m_authStream, m_encStream, m_httpRequestsKMS, m_socketToKMS, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::HTTPMessage::Ok, and PopHttpKmsRequest().

Referenced by ProcessResponseFromKMS().

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

◆ ProcessDataPacket()

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

◆ ProcessGetKeyResponse()

◆ ProcessOpenConnectResponse()

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

Process response from KMS on OPEN_CONNECT call.

Parameters
headerreceived HTTP header

m_master

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

References ns3::HTTPMessage::BadRequest, ns3::Create(), ns3::KeyStreamSession::ENCRYPTION, ns3::HTTPMessage::GetMessageBodyString(), ns3::HTTPMessage::GetRequestUri(), ns3::HTTPMessage::GetStatus(), m_authStream, m_encStream, m_master, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_ERROR, NS_LOG_FUNCTION, ns3::HTTPMessage::Ok, PopHttpKmsRequest(), and SendKsid().

Referenced by ProcessResponseFromKMS().

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

◆ ProcessPacketsToKMSFromQueue()

void ns3::QKDApp004::ProcessPacketsToKMSFromQueue ( )
private

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

References ns3::Create(), GetId(), ns3::Socket::GetPeerName(), GetSessionScope(), m_queue_kms, m_socketToKMS, m_txKmsTrace, NS_LOG_FUNCTION, PrepareSocketToKMS(), PushHttpKmsRequest(), 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 
)
private

Process response from KMS application.

Parameters
headerreceived HTTP header
packetreceived packet
socketthe receiving socket

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

References ns3::Create(), ns3::HTTPMessage::GetRequestUri(), GetState(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ProcessCloseResponse(), ProcessGetKeyResponse(), ProcessOpenConnectResponse(), ReadUri(), and STOPPED.

Referenced by PacketReceivedFromKMS().

+ 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 
)
private

◆ PushHttpKmsRequest()

void ns3::QKDApp004::PushHttpKmsRequest ( std::string  uri,
KeyStreamSession::Type  sessionType = KeyStreamSession::ENCRYPTION 
)
private

Add HTTP request to queue to map response later.

Parameters
urirequest URI
sessionTypesession scope

   HTTP handling to KMS

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

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

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

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

◆ ReadUri()

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

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

References ns3::Create(), and NS_LOG_FUNCTION.

Referenced by ProcessResponseFromKMS(), and ProcessSignalingPacketFromApp().

+ 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 
)
private

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

References ns3::Create(), and NS_LOG_FUNCTION.

Referenced by PrepareSocketToKMS().

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

◆ ScheduleTx()

void ns3::QKDApp004::ScheduleTx ( )
private

   SCHEDULE functions

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

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

Referenced by SendPacket().

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

◆ SendKsid()

void ns3::QKDApp004::SendKsid ( std::string  ksid,
KeyStreamSession::Type  sessionType,
HTTPMessage::HttpStatus  statusCode = HTTPMessage::Ok 
)
private

Sends SEND_KSID request(for sender App004) or response(for receiver App004)

Parameters
ksidunique key stream identifier
sessionTypescope of the session
statusCodeHTTP status code in case is response

   Application SIGNALING

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

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

Referenced by ProcessOpenConnectResponse().

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

◆ SendPacket()

◆ SetCryptoSettings()

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

References ns3::Create(), m_authenticationType, m_encryptionType, m_encryptor, NS_LOG_FUNCTION, ns3::QKDEncryptor::QKDCRYPTO_AES, 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::QKDApp004::SetState ( QKDApp004::State  state)

Set state.

Parameters
statenew application state.

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

References ns3::Create(), GetAppStateString(), m_authStream, m_encStream, m_state, NS_LOG_FUNCTION, and WAIT.

Referenced by AppTransitionTree(), CheckQueues(), CheckStreamSessions(), ProcessDataPacket(), ProcessGetKeyResponse(), ProcessSignalingPacketFromApp(), SendPacket(), Setup(), and StopApplication().

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

◆ Setup() [1/2]

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

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

Referenced by Setup().

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

◆ Setup() [2/2]

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

◆ SignalingPacketReceivedFromApp()

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

Check for tcp segmentation of signaling packets received from APP.

Parameters
packet
addressaddress of the KMS
socketthe connected socket

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

References ns3::Create(), GetId(), m_buffer_sig, m_rxSigTrace, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ProcessSignalingPacketFromApp().

Referenced by HandleReadSignalingFromApp().

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

◆ StartApplication()

void ns3::QKDApp004::StartApplication ( )
overrideprivatevirtual

◆ StopApplication()

void ns3::QKDApp004::StopApplication ( )
overrideprivatevirtual

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 1042 of file qkd-app-004.cc.

References ns3::Simulator::Cancel(), ns3::Socket::Close(), Close(), ns3::EventId::IsPending(), m_authStream, m_dataSocketApp, m_encStream, m_master, m_sendEvent, m_signalingSocketApp, m_socketToKMS, NS_LOG_FUNCTION, NS_LOG_WARN, SetState(), and STOPPED.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_aesLifetime

uint32_t ns3::QKDApp004::m_aesLifetime
private

◆ m_appId

std::string ns3::QKDApp004::m_appId
private

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

Referenced by GetId(), and Setup().

◆ m_applicationCounts

uint32_t ns3::QKDApp004::m_applicationCounts = 0
staticprivate

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

Referenced by QKDApp004(), and Setup().

◆ m_authentication

uint32_t ns3::QKDApp004::m_authentication
private

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

Referenced by GetTypeId(), and StartApplication().

◆ m_authenticationTagLengthInBits

uint32_t ns3::QKDApp004::m_authenticationTagLengthInBits
private

length of the authentication tag in bits(32 by default)

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

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

◆ m_authenticationTrace

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

trace callback for authentication

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

Referenced by GetTypeId(), and SendPacket().

◆ m_authenticationType

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

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

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

◆ m_authStream

◆ m_buffer_kms

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

Buffer for received packets(fragmentation)

Definition at line 672 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

Buffer for received packets(fragmentation)

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

Referenced by DataPacketReceived().

◆ m_buffer_sig

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

Buffer for received packets(fragmentation)

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

Referenced by SignalingPacketReceivedFromApp().

◆ m_closeSocketEvent

EventId ns3::QKDApp004::m_closeSocketEvent
private

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

◆ m_dataRate

DataRate ns3::QKDApp004::m_dataRate
private

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

Referenced by ScheduleTx(), and Setup().

◆ m_dataSent

uint32_t ns3::QKDApp004::m_dataSent
private

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

Referenced by SendPacket().

◆ m_dataSocketApp

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

◆ m_deauthenticationTrace

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

trace callback for authentication check

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

Referenced by GetTypeId().

◆ m_decryptionTrace

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

trace callback for decryption

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

Referenced by GetTypeId().

◆ m_dstAppId

std::string ns3::QKDApp004::m_dstAppId
private

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

Referenced by GetPeerId(), and Setup().

◆ m_encryption

uint32_t ns3::QKDApp004::m_encryption
private

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

Referenced by GetTypeId(), and StartApplication().

◆ m_encryptionTrace

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

trace callback for encryption

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

Referenced by GetTypeId().

◆ m_encryptionType

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

◆ m_encryptor

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

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

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

◆ m_encStream

◆ m_holdTime

Time ns3::QKDApp004::m_holdTime
private

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

Referenced by GetTypeId().

◆ m_httpRequestsKMS

std::multimap<std::string, KeyStreamSession::Type> ns3::QKDApp004::m_httpRequestsKMS
private

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

Referenced by PopHttpKmsRequest(), ProcessCloseResponse(), and PushHttpKmsRequest().

◆ m_isDataConnectedToApp

bool ns3::QKDApp004::m_isDataConnectedToApp
private

◆ m_isSignalingConnectedToApp

bool ns3::QKDApp004::m_isSignalingConnectedToApp
private

◆ m_keyBufferLengthAuthentication

uint32_t ns3::QKDApp004::m_keyBufferLengthAuthentication
private

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

Referenced by GetTypeId(), and Setup().

◆ m_keyBufferLengthEncryption

uint32_t ns3::QKDApp004::m_keyBufferLengthEncryption
private

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

Referenced by GetTypeId(), and Setup().

◆ m_kms

Address ns3::QKDApp004::m_kms
private

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

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

◆ m_local

Address ns3::QKDApp004::m_local
private

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

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

◆ m_master

◆ m_mxTrace

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

Traced Callback: missed send packet call.

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

Referenced by GetTypeId(), and SendPacket().

◆ m_packetSize

uint32_t ns3::QKDApp004::m_packetSize
private

◆ m_packetsSent

uint32_t ns3::QKDApp004::m_packetsSent
private

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

Referenced by SendPacket(), and StartApplication().

◆ m_peer

Address ns3::QKDApp004::m_peer
private

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

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

◆ m_portSignaling

uint16_t ns3::QKDApp004::m_portSignaling
private

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

Referenced by PrepareSocketToApp(), and Setup().

◆ m_primaryQueueEstablished

bool ns3::QKDApp004::m_primaryQueueEstablished
private

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

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

◆ m_queue_kms

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

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

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

◆ m_replicaQueueEstablished

bool ns3::QKDApp004::m_replicaQueueEstablished
private

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

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

◆ m_rxKmsTrace

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

Traced Callback: received packets from KMS.

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

Referenced by GetTypeId(), and PacketReceivedFromKMS().

◆ m_rxSigTrace

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

Traced Callback: received signaling packets.

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

Referenced by GetTypeId(), and SignalingPacketReceivedFromApp().

◆ m_rxTrace

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

Traced Callback: received data packets.

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

Referenced by DataPacketReceived(), and GetTypeId().

◆ m_sendEvent

EventId ns3::QKDApp004::m_sendEvent
private

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

Referenced by ScheduleTx(), and StopApplication().

◆ m_signalingSocketApp

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

◆ m_socketToKMS

◆ m_socketType

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

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

Referenced by PrepareSocketToApp(), and Setup().

◆ m_state

State ns3::QKDApp004::m_state
private

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

Referenced by GetState(), and SetState().

◆ m_stateTransitionTrace

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

The StateTransition trace source.

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

Referenced by GetTypeId().

◆ m_tid

TypeId ns3::QKDApp004::m_tid
private

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

Referenced by GetTypeId().

◆ m_transitionMatrix

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

transition map of protocol states

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

◆ m_txKmsTrace

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

Traced Callback: transmitted packets to KMS.

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

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

◆ m_txSigTrace

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

Traced Callback: transmitted signaling packets.

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

Referenced by EstablishQueues(), GetTypeId(), and SendKsid().

◆ m_txTrace

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

Traced Callback: transmitted data packets.

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

Referenced by GetTypeId(), and SendPacket().

◆ m_useCrypto

uint32_t ns3::QKDApp004::m_useCrypto
private

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

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


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