Establish secure communication on application lavel to use the key and test LKSM. More...
#include "qkd-app-004.h"
Classes | |
struct | AddressHash |
Hashing for the Address class. More... | |
struct | Association004 |
The key stream session details. More... | |
struct | KMSPacket |
The KMS packet. More... | |
struct | QKDAppKey |
A cryptographic key at the application layer. More... | |
Public Types | |
enum | QKDAppState { NOT_STARTED , INITIALIZED , ESTABLISHING_ASSOCIATIONS , ASSOCIATIONS_ESTABLISHED , ESTABLISHING_KEY_QUEUES , KEY_QUEUES_ESTABLISHED , READY , WAIT , SEND_DATA , DECRYPT_DATA , STOPPED } |
The QKD application states. More... | |
Public Types inherited from ns3::Application | |
typedef void(* | DelayAddressCallback) (const Time &delay, const Address &from) |
Common callback signature for packet delay and address. More... | |
typedef void(* | StateTransitionCallback) (const std::string &oldState, const std::string &newState) |
Common signature used by callbacks to application's state transition trace source. More... | |
Public Member Functions | |
QKDApp004 () | |
Constructor. More... | |
virtual | ~QKDApp004 () |
Destructor. More... | |
void | CancelScheduledAction (uint32_t eventId) |
Cancel the scheduled event. More... | |
void | Close (std::string ksid) |
Close the keys stream session (the association). More... | |
bool | ConnectionRequestedFromKMS (Ptr< Socket > socket, const Address &address) |
Callback function after the connection for response from the KMS has been received. More... | |
void | ConnectionSignalingToAppFailed (Ptr< Socket > socket) |
Callback function after the signaling connection to the APP has failed. More... | |
void | ConnectionSignalingToAppSucceeded (Ptr< Socket > socket) |
Callback function after the signaling connection to the APP is complete. More... | |
void | ConnectionToAppFailed (Ptr< Socket > socket) |
Callback function after the connection to the APP has failed. More... | |
void | ConnectionToAppSucceeded (Ptr< Socket > socket) |
Callback function after the connection to the APP is complete. More... | |
void | ConnectionToKMSFailed (Ptr< Socket > socket) |
Callback function after the connection to the KMS has failed. More... | |
void | ConnectionToKMSSucceeded (Ptr< Socket > socket) |
Callback function after the connection to the KMS is complete. More... | |
void | CreateKeyStreamAssociations () |
void | DataPacketReceivedFromApp (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket) |
Check for the tcp segmentation of the signaling packets received from the KMS. More... | |
void | DataToKMSSend (Ptr< Socket >, uint32_t) |
Callback function to notify that data to KMS has been sent. More... | |
QKDAppState | GetAppState () const |
Get the current state of the application. More... | |
std::string | GetAppStateString () const |
Get the current state of the application in a string notation. More... | |
uint32_t | GetAuthenticationKeySize () |
Get the required key size for the choosen authentication algorithm. More... | |
uint32_t | GetEncryptionKeySize () |
Get the required key size for the choosen encryption algorithm. More... | |
UUID | GetId (void) |
Get the application identifier. More... | |
void | GetKeyFromKMS (std::string ksid, uint32_t index=0) |
Get key for the key stream. More... | |
uint64_t | GetMaxAuthenticationKeyRate () |
Get the maximum key rate required for the authentication (QoS settings). More... | |
uint64_t | GetMaxEncryptionKeyRate () |
Get the maximum key rate required for the encryption (QoS settings). More... | |
std::string | GetPacketContent (uint32_t msgLength=0) |
Generate a random packet payload (the message). More... | |
Ptr< Socket > | GetSendSocketToKMS () |
Get the sending socket to the KMS. More... | |
Ptr< Socket > | GetSinkSocketFromKMS () |
Get the receiving socket from the KMS. More... | |
void | HandleAcceptFromApp (Ptr< Socket > s, const Address &from) |
Handle an incoming connection from the peer QKD application. More... | |
void | HandleAcceptFromKMS (Ptr< Socket > s, const Address &from) |
Handle an incoming connection from the KMS. More... | |
void | HandleAcceptSignalingFromApp (Ptr< Socket > s, const Address &from) |
Handle a signaling incoming connection from the peer QKD application. More... | |
void | HandlePeerCloseFromApp (Ptr< Socket > socket) |
Handle a connection close from the peer QKD application. More... | |
void | HandlePeerCloseFromKMS (Ptr< Socket > socket) |
Handle a connection close from the KMS. More... | |
void | HandlePeerCloseSignalingFromApp (Ptr< Socket > socket) |
Handle a signaling connection close from the peer QKD application. More... | |
void | HandlePeerCloseToKMS (Ptr< Socket > socket) |
Handle a connection close to the KMS. More... | |
void | HandlePeerErrorFromApp (Ptr< Socket > socket) |
Handle a connection error from the peer QKD application. More... | |
void | HandlePeerErrorFromKMS (Ptr< Socket > socket) |
Handle a connection error from the KMS. More... | |
void | HandlePeerErrorSignalingFromApp (Ptr< Socket > socket) |
Handle a signaling connection error from the peer QKD application. More... | |
void | HandlePeerErrorToKMS (Ptr< Socket > socket) |
Handle a connection error to the KMS. More... | |
void | HandleReadFromApp (Ptr< Socket > socket) |
Handle a packet received from the peer QKD application. More... | |
void | HandleReadFromKMS (Ptr< Socket > socket) |
Handle a packet received by the QKD application from the KMS application. More... | |
void | HandleReadSignalingFromApp (Ptr< Socket > socket) |
Handle a signaling packet received from the peer QKD application. More... | |
void | OpenConnect (std::string ksid, uint32_t keyType=0) |
Request a key stream session (an association) from the local KMS. More... | |
void | PacketReceivedFromKMS (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket) |
Check for the tcp segmentation of packets received from the KMS. More... | |
void | PrepareSendSocketToApp () |
Prepare the send socket to communicate with the peer QKD Application. More... | |
void | PrepareSendSocketToKMS () |
Prepare the send socket to communicate with the KMS Application. More... | |
void | PrepareSinkSocketFromApp () |
Prepare the sink socket to listen from the peer QKD Application. More... | |
void | PrepareSinkSocketFromKMS () |
Prepare the sink socket to listen from the KMS Application. More... | |
void | ProcessCloseResponse (HTTPMessage &header) |
Process the CLOSE response. More... | |
void | ProcessDataPacketFromApp (QKDAppHeader header, Ptr< Packet > packet, Ptr< Socket > socket) |
Process data packets from the peer QKD application. More... | |
void | ProcessGetKeyResponse (HTTPMessage &header) |
Process the GET_KEY response. More... | |
void | ProcessOpenConnectResponse (HTTPMessage &header) |
Process the OPEN_CONNECT response. More... | |
void | ProcessResponseFromKMS (HTTPMessage &header, Ptr< Packet > packet, Ptr< Socket > socket) |
Process a response from the KMS application. More... | |
void | ProcessSendKsidResponse (HTTPMessage &header, std::string ksid) |
Process the SEND_KSID response. More... | |
void | ProcessSignalingPacketFromApp (HTTPMessage &header, Ptr< Socket > socket) |
Process a signaling packets from the peer QKD application. More... | |
void | RegisterAckTime (Time oldRtt, Time newRtt) |
Register the acknowledgement time. More... | |
uint32_t | ScheduleAction (Time t, std::string action) |
Schedule the action. More... | |
void | SendKsidRequest (std::string ksid, uint32_t input) |
Inform the peer QKD application of the established key stream session. More... | |
void | SendKsidResponse (HTTPMessage::HttpStatus httpStatus, std::string msg="") |
Send a response on the SEND_KSID request. More... | |
void | SetEncryptionAndAuthenticationSettings (uint32_t encryptionType, uint32_t authenticationType, uint32_t authenticationTagLengthInBits) |
Set the encryption and the authentication algorithms. More... | |
void | SetKsidAuthentication (UUID val) |
Set authentication key stream identifier. More... | |
void | SetKsidEncryption (UUID val) |
Set encryption key stream identifier. More... | |
void | Setup (std::string socketType, Address src, Address dst, Address kms, UUID dstSaeId, std::string type) |
Configure the application. More... | |
void | Setup (std::string socketType, Address src, Address dst, Address kms, UUID dstSaeId, uint32_t packetSize, uint32_t nPackets, DataRate dataRate, std::string type) |
Configure the application. More... | |
void | SignalingPacketReceivedFromApp (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket) |
Check for the tcp segmentation of the signaling packets received from the peer application. More... | |
void | SwitchAppState (QKDAppState state) |
Change the state of the application. More... | |
Public Member Functions inherited from ns3::Application | |
Application () | |
~Application () override | |
Ptr< Node > | GetNode () const |
void | SetNode (Ptr< Node > node) |
void | SetStartTime (Time start) |
Specify application start time. More... | |
void | SetStopTime (Time stop) |
Specify application stop time. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static std::string | GetAppStateString (QKDAppState state) |
Convert application state to a string notation. More... | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Application | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Public Attributes | |
TracedCallback< Ptr< const Packet >, std::string > | m_mxTrace |
A trace for the missed time slots to send data (due to the lack of keys). More... | |
TracedCallback< Ptr< const Packet > > | m_rxKmsTrace |
A trace for received packets from the KMS. More... | |
TracedCallback< Ptr< const Packet > > | m_rxSigTrace |
A trace for received signaling packets. More... | |
TracedCallback< Ptr< const Packet >, std::string > | m_rxTrace |
A trace for received data packets. More... | |
ns3::TracedCallback< const std::string &, const std::string & > | m_stateTransitionTrace |
A trace for the application state transitions. More... | |
TracedCallback< Ptr< const Packet > > | m_txKmsTrace |
A trace for transmitted packets to the KMS. More... | |
TracedCallback< Ptr< const Packet > > | m_txSigTrace |
A trace for transmitted signaling packets. More... | |
TracedCallback< Ptr< const Packet >, std::string > | m_txTrace |
Private Member Functions | |
void | AppTransitionTree (void) |
Transition through a tree of the application states and trigger actions. More... | |
void | CheckAssociationsState () |
Check if the required key stream sessions are successfuly established. More... | |
void | CheckQueues () |
Request new keys from the KMS until the key queues at the application layer are established with a set amount of keys. More... | |
void | ClearAssociation (std::string ksid) |
Delete all records of key stream session identified with a given KSID. More... | |
void | CloseSocketToKms () |
Close the connecting sockets with the KMS. More... | |
void | CreateKeyQueues () |
Create the required key queues to store a set amount of keys from the respective key stream sessions. More... | |
void | CreateKeyQueuesResponse () |
Once the receiving application establishes the queues, it sends a response to the sender application. More... | |
QKDAppKey | GetAuthKey () |
Get the authentication key from the queue. More... | |
QKDAppKey | GetEncKey () |
Get the encryption key from the queue. More... | |
uint32_t | GetKeyTypeFromHttp004KMSQuery (std::string uri) |
Map the HTTP reponse from the KMS and obtain the key type. More... | |
std::string | GetKsidFromHttp004AppQuery (void) |
Map the HTTP response from the peer QKD application and obtain the key stream identifier. More... | |
std::string | GetKsidFromHttp004KMSQuery (std::string uri) |
Map the HTTP response from the KMS and obtain the key stream identifier. More... | |
uint32_t | GetMethodFromHttp004AppQuery (void) |
Map the HTTP response from the peer QKD application and obtain the ETSI method type. More... | |
uint32_t | GetMethodFromHttp004KMSQuery (std::string uri) |
Read the ETSI request method from the URI. More... | |
void | Http004AppQuery (uint32_t methodType, std::string ksid) |
Memories the HTTP request made to the peer QKD application. More... | |
void | Http004AppQueryComplete (void) |
Remove the request from the vector of HTTP requests made to the peer QKD application. More... | |
void | Http004KMSQuery (std::string uri, std::string ksid, uint32_t keyType) |
Memories the HTTP request made to the local KMS. More... | |
void | Http004KMSQueryComplete (std::string uri) |
Remove the request from the vector of HTTP requests made to the KMS. More... | |
void | InitializeAssociations () |
Initialize the key stream sessions. More... | |
std::string | PacketToString (Ptr< Packet > packet) |
Convert the packet to a string. More... | |
void | ProcessCreateQueuesResponse () |
Start establishing key queues at the reciving application once requested by the sender. More... | |
void | ProcessPacketsToKMSFromQueue () |
Process and send any remaining packets to the KMS. More... | |
void | ScheduleTx (void) |
Schedule the next time slot to send the data. More... | |
void | SendMaliciousRequestToKMS () |
Send a malicious request to the KMS. More... | |
void | SendPacket (void) |
Send the application packet (includes the generation of a random message and optional encryption or/and authentication on the message). More... | |
virtual void | StartApplication (void) |
virtual void | StopApplication (void) |
Application specific shutdown code. More... | |
Private Attributes | |
uint32_t | m_aesLifetime |
The AES key lifetime. More... | |
QKDAppState | m_appState |
The application state. More... | |
std::pair< Association004, Association004 > | m_associations |
A pair (encryption/authentication) of the establihed key stream session. More... | |
uint32_t | m_authenticationTagLengthInBits |
The size of the authentication tag in bits (32 by default). More... | |
TracedCallback< Ptr< Packet >, std::string > | m_authenticationTrace |
A trace callback for the authentication event. More... | |
QKDEncryptor::AuthenticationType | m_authenticationType |
The authentication algorithm. More... | |
uint32_t | m_authenticationTypeInt |
The authentication algorithm. More... | |
std::unordered_map< Address, Ptr< Packet >, AddressHash > | m_buffer_kms |
The buffer for the received packets from the KMS (fragmentation). More... | |
std::unordered_map< Address, Ptr< Packet >, AddressHash > | m_buffer_qkdapp |
The buffer for received data packets (fragmentation). More... | |
std::unordered_map< Address, Ptr< Packet >, AddressHash > | m_buffer_sig |
The buffer for the received signaling packets (fragmentation). More... | |
EventId | m_closeSocketEvent |
The closing socket event. More... | |
DataRate | m_dataRate |
The application data rate. More... | |
uint32_t | m_dataSent |
The amount of the sent data. More... | |
TracedCallback< Ptr< Packet >, std::string > | m_deauthenticationTrace |
A trace callback for the authentication check event. More... | |
TracedCallback< Ptr< Packet > > | m_decryptionTrace |
A trace callback for the decryption event. More... | |
double | m_delay |
The time interval between two successive data transmissions (calculated based on the application data rate). More... | |
Time | m_dosAttackIntensity |
The intensity of the DoS attack. More... | |
UUID | m_dstSaeId |
The peer application identifier. More... | |
TracedCallback< Ptr< Packet > > | m_encryptionTrace |
A trace callback for the encryption event. More... | |
QKDEncryptor::EncryptionType | m_encryptionType |
The encryption algorithm. More... | |
uint32_t | m_encryptionTypeInt |
The encryption algorithm. More... | |
Ptr< QKDEncryptor > | m_encryptor |
The QKD encryptor. More... | |
Time | m_holdTime |
The holding time before closing sockets. More... | |
std::vector< std::pair< uint32_t, std::string > > | m_httpRequestsApp |
A vector of HTTP requests sent to the peer application. More... | |
std::map< std::string, std::pair< std::string, uint32_t > > | m_httpRequestsKMS |
A vector of HTTP requests set to the KMS. More... | |
UUID | m_id |
The application identifier. More... | |
uint32_t | m_keyBufferLengthAuthentication |
The size of the authentication key queue at the application layer. More... | |
uint32_t | m_keyBufferLengthEncryption |
The size of the encryption key queue at the application layer. More... | |
Address | m_kms |
The local KMS address. More... | |
UUID | m_ksid_auth |
The authentication key stream identifier. More... | |
UUID | m_ksid_enc |
The encryption key stream identifier. More... | |
Address | m_local |
The local address for the data transmission. More... | |
Address | m_localSignaling |
The local address for the signaling data transmission. More... | |
uint32_t | m_malicious |
Is a malicious application? More... | |
Ptr< Packet > | m_maliciousPacket |
The malicious packet. More... | |
uint32_t | m_master |
Is a master (sender/primary) application? More... | |
DataRate | m_minDataRate |
The minimum application data rate. More... | |
TracedCallback< const uint32_t & > | m_obtainedKeyMaterialTrace |
A trace callback for the obtained key material. More... | |
uint32_t | m_packetSize |
The data packet size. More... | |
uint32_t | m_packetsSent |
The number of sent data packets. More... | |
Address | m_peer |
The address of the peer for the data transmission. More... | |
Address | m_peerSignaling |
The address of the peer for the signaling data transmission. More... | |
bool | m_primaryQueueEstablished |
Is the queue established at the sender application? More... | |
uint32_t | m_priority |
The application priority (QoS). More... | |
std::vector< KMSPacket > | m_queue_kms |
The queue of packets waiting for the transmission to the KMS. More... | |
Ptr< UniformRandomVariable > | m_random |
The uniform random variable. More... | |
bool | m_replicaQueueEstablished |
Is the queue established at the receiver application? More... | |
std::map< uint32_t, EventId > | m_scheduledEvents |
The map of scheduled events. More... | |
Ptr< Socket > | m_sendDataSocketApp |
The sending socket for the data. More... | |
EventId | m_sendEvent |
The data transmission event. More... | |
Ptr< Socket > | m_sendSignalingSocketApp |
The sending socket for the signaling messages. More... | |
Ptr< Socket > | m_sendSocketToKMS |
The sending socket to the KMS. More... | |
Ptr< Socket > | m_sinkDataSocketApp |
The receiving socket for the data. More... | |
Ptr< Socket > | m_sinkSignalingSocketApp |
The receiving socket for the signaling messages. More... | |
Ptr< Socket > | m_sinkSocketFromKMS |
The receiving socket from the KMS. More... | |
std::string | m_socketType |
The sockets type. More... | |
TypeId | m_tid |
The type identifier. More... | |
std::multimap< std::string, std::string > | m_transitionMatrix |
The map of the possible state transitions. More... | |
uint32_t | m_ttl |
The time-to-live of the key stream session. More... | |
uint32_t | m_useCrypto |
Execute actual cryptographic algorithms? More... | |
Static Private Attributes | |
static uint32_t | m_applicationCounts = 0 |
The number of running applications. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Application | |
void | DoDispose () override |
Destructor implementation. More... | |
void | DoInitialize () override |
Initialize() implementation. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Protected Attributes inherited from ns3::Application | |
Ptr< Node > | m_node |
The node that this application is installed on. More... | |
EventId | m_startEvent |
The event that will fire at m_startTime to start the application. More... | |
Time | m_startTime |
The simulation time that the application will start. More... | |
EventId | m_stopEvent |
The event that will fire at m_stopTime to end the application. More... | |
Time | m_stopTime |
The simulation time that the application will end. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Establish secure communication on application lavel to use the key and test LKSM.
This application was written to complement simple application to consume keys so a generic QKDApp name was selected. The application (Alice) implements sockets for connection with counter-party application (Bob) and implements sockets for communication with local key management system. The applications use ETSI QKD 004 interface to communicate with LKSM, hence the name "QKDApp004".
Definition at line 71 of file qkd-app-004.h.
The QKD application states.
Enumerator | |
---|---|
NOT_STARTED | |
INITIALIZED | |
ESTABLISHING_ASSOCIATIONS | |
ASSOCIATIONS_ESTABLISHED | |
ESTABLISHING_KEY_QUEUES | |
KEY_QUEUES_ESTABLISHED | |
READY | |
WAIT | |
SEND_DATA | |
DECRYPT_DATA | |
STOPPED |
Definition at line 109 of file qkd-app-004.h.
ns3::QKDApp004::QKDApp004 | ( | ) |
Constructor.
SETUP
Definition at line 180 of file qkd-app-004.cc.
References m_applicationCounts, m_id, m_random, and ns3::UUID::Random().
|
virtual |
Destructor.
Definition at line 201 of file qkd-app-004.cc.
References m_sendDataSocketApp, m_sendSignalingSocketApp, m_sendSocketToKMS, m_sinkDataSocketApp, m_sinkSignalingSocketApp, and m_sinkSocketFromKMS.
|
private |
Transition through a tree of the application states and trigger actions.
STATE functions
Definition at line 2507 of file qkd-app-004.cc.
References ASSOCIATIONS_ESTABLISHED, CheckQueues(), CreateKeyQueues(), CreateKeyQueuesResponse(), CreateKeyStreamAssociations(), ESTABLISHING_ASSOCIATIONS, ESTABLISHING_KEY_QUEUES, GetAuthenticationKeySize(), GetEncryptionKeySize(), INITIALIZED, KEY_QUEUES_ESTABLISHED, m_appState, m_associations, m_master, NS_FATAL_ERROR, NS_LOG_FUNCTION, PrepareSendSocketToApp(), PrepareSendSocketToKMS(), READY, SendPacket(), and SwitchAppState().
Referenced by CheckAssociationsState(), CheckQueues(), ProcessCreateQueuesResponse(), and StartApplication().
void ns3::QKDApp004::CancelScheduledAction | ( | uint32_t | eventId | ) |
Cancel the scheduled event.
The | identifier of the scheduled event. |
Definition at line 308 of file qkd-app-004.cc.
References ns3::Simulator::Cancel(), m_scheduledEvents, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
|
private |
Check if the required key stream sessions are successfuly established.
Definition at line 1060 of file qkd-app-004.cc.
References AppTransitionTree(), ASSOCIATIONS_ESTABLISHED, ESTABLISHING_ASSOCIATIONS, GetAuthenticationKeySize(), GetEncryptionKeySize(), m_appState, m_associations, m_master, NS_ASSERT, NS_LOG_FUNCTION, and SwitchAppState().
Referenced by ProcessSendKsidResponse().
|
private |
Request new keys from the KMS until the key queues at the application layer are established with a set amount of keys.
The pplication establishes key queues of desired number of keys prior to the secure communication to support a fast rekeying.
Definition at line 1087 of file qkd-app-004.cc.
References AppTransitionTree(), GetKeyFromKMS(), KEY_QUEUES_ESTABLISHED, m_associations, m_master, m_primaryQueueEstablished, m_replicaQueueEstablished, NS_LOG_FUNCTION, and SwitchAppState().
Referenced by AppTransitionTree(), ProcessGetKeyResponse(), and ProcessSignalingPacketFromApp().
|
private |
Delete all records of key stream session identified with a given KSID.
ksid | The key stream identifier (KSID). |
Definition at line 2474 of file qkd-app-004.cc.
References m_associations, and NS_LOG_FUNCTION.
Referenced by ProcessOpenConnectResponse().
void ns3::QKDApp004::Close | ( | std::string | ksid | ) |
Close the keys stream session (the association).
ksid | The key stream session identifier. |
Definition at line 1950 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), ns3::InetSocketAddress::GetIpv4(), ns3::Socket::GetPeerName(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), Http004KMSQuery(), ns3::QKDApp004::KMSPacket::keyType, ns3::QKDApp004::KMSPacket::ksid, m_associations, m_kms, m_master, m_queue_kms, m_sendSocketToKMS, m_sinkSocketFromKMS, m_txKmsTrace, ns3::QKDApp004::KMSPacket::methodType, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::QKDApp004::KMSPacket::packet, PrepareSendSocketToKMS(), PrepareSinkSocketFromKMS(), ns3::Ipv4Address::Print(), ns3::Socket::Send(), ns3::HTTPMessage::ToString(), and ns3::QKDApp004::KMSPacket::uri.
Referenced by ProcessSendKsidResponse(), and StopApplication().
|
private |
Close the connecting sockets with the KMS.
Definition at line 720 of file qkd-app-004.cc.
References ns3::Socket::Close(), m_queue_kms, m_sendSocketToKMS, and NS_LOG_FUNCTION.
Referenced by HandleReadFromKMS().
Callback function after the connection for response from the KMS has been received.
socket | The connected socket. |
address | The address of the KMS. |
Definition at line 523 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), and NS_LOG_FUNCTION.
Referenced by PrepareSinkSocketFromKMS().
Callback function after the signaling connection to the APP has failed.
socket | The connected socket. |
Definition at line 602 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSendSocketToApp().
Callback function after the signaling connection to the APP is complete.
socket | The connected socket. |
Definition at line 596 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSendSocketToApp().
Callback function after the connection to the APP has failed.
socket | The connected socket. |
Definition at line 590 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSendSocketToApp().
Callback function after the connection to the APP is complete.
socket | The connected socket. |
Definition at line 584 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSendSocketToApp().
Callback function after the connection to the KMS has failed.
socket | The connected socket. |
Definition at line 578 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSendSocketToKMS().
Callback function after the connection to the KMS is complete.
socket | The connected socket. |
Definition at line 572 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSendSocketToKMS().
|
private |
Create the required key queues to store a set amount of keys from the respective key stream sessions.
Definition at line 2391 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), GetId(), ns3::InetSocketAddress::GetIpv4(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), Http004AppQuery(), m_dataSent, m_master, m_packetsSent, m_peer, m_sendSignalingSocketApp, m_txSigTrace, NS_ASSERT, NS_LOG_FUNCTION, ns3::Ipv4Address::Print(), ns3::Socket::Send(), ns3::UUID::string(), and ns3::HTTPMessage::ToString().
Referenced by AppTransitionTree().
|
private |
Once the receiving application establishes the queues, it sends a response to the sender application.
Definition at line 2424 of file qkd-app-004.cc.
References ns3::HTTPMessage::CreateResponse(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_dataSent, m_master, m_packetsSent, m_sendSignalingSocketApp, m_txSigTrace, NS_ASSERT, NS_LOG_FUNCTION, ns3::Socket::Send(), and ns3::HTTPMessage::ToString().
Referenced by AppTransitionTree().
void ns3::QKDApp004::CreateKeyStreamAssociations | ( | ) |
Definition at line 2463 of file qkd-app-004.cc.
References GetAuthenticationKeySize(), GetEncryptionKeySize(), m_associations, NS_LOG_FUNCTION, and OpenConnect().
Referenced by AppTransitionTree().
void ns3::QKDApp004::DataPacketReceivedFromApp | ( | const Ptr< Packet > & | p, |
const Address & | from, | ||
Ptr< Socket > | socket | ||
) |
Check for the tcp segmentation of the signaling packets received from the KMS.
p | The received packet. |
from | The address of the KMS. |
socket | The connected socket. |
Definition at line 872 of file qkd-app-004.cc.
References ns3::Packet::AddAtEnd(), ns3::Packet::CreateFragment(), GetAppStateString(), ns3::QKDAppHeader::GetLength(), ns3::QKDAppHeader::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_appState, m_associations, m_buffer_qkdapp, m_master, m_txTrace, NS_ABORT_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Packet::PeekHeader(), ProcessDataPacketFromApp(), READY, ns3::Packet::RemoveAtStart(), and ns3::Packet::RemoveHeader().
Referenced by HandleReadFromApp().
Callback function to notify that data to KMS has been sent.
The | connected socket. |
The | amount of data sent. |
Definition at line 1023 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSendSocketToKMS().
QKDApp004::QKDAppState ns3::QKDApp004::GetAppState | ( | ) | const |
Get the current state of the application.
Definition at line 2555 of file qkd-app-004.cc.
References m_appState.
Referenced by GetKeyFromKMS(), and SendMaliciousRequestToKMS().
std::string ns3::QKDApp004::GetAppStateString | ( | ) | const |
Get the current state of the application in a string notation.
Definition at line 2607 of file qkd-app-004.cc.
References m_appState.
Referenced by DataPacketReceivedFromApp(), ScheduleTx(), SendPacket(), StartApplication(), and SwitchAppState().
|
static |
Convert application state to a string notation.
state | The application state. |
Definition at line 2561 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.
uint32_t ns3::QKDApp004::GetAuthenticationKeySize | ( | ) |
Get the required key size for the choosen authentication algorithm.
Definition at line 2771 of file qkd-app-004.cc.
References m_authenticationType, NS_LOG_FUNCTION, ns3::QKDEncryptor::QKDCRYPTO_AUTH_MD5, ns3::QKDEncryptor::QKDCRYPTO_AUTH_SHA1, ns3::QKDEncryptor::QKDCRYPTO_AUTH_VMAC, and ns3::QKDEncryptor::UNAUTHENTICATED.
Referenced by AppTransitionTree(), CheckAssociationsState(), CreateKeyStreamAssociations(), OpenConnect(), ProcessDataPacketFromApp(), ProcessGetKeyResponse(), and SendPacket().
|
private |
Get the authentication key from the queue.
Definition at line 1188 of file qkd-app-004.cc.
References GetKeyFromKMS(), ns3::QKDApp004::QKDAppKey::key, m_associations, m_master, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ProcessDataPacketFromApp(), and SendPacket().
|
private |
Get the encryption key from the queue.
Definition at line 1122 of file qkd-app-004.cc.
References GetKeyFromKMS(), ns3::QKDApp004::QKDAppKey::key, ns3::QKDApp004::QKDAppKey::lifetime, m_associations, m_master, m_packetSize, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ProcessDataPacketFromApp(), and SendPacket().
uint32_t ns3::QKDApp004::GetEncryptionKeySize | ( | ) |
Get the required key size for the choosen encryption algorithm.
Definition at line 2719 of file qkd-app-004.cc.
References m_encryptionType, m_packetSize, ns3::QKDEncryptor::QKDCRYPTO_AES, ns3::QKDEncryptor::QKDCRYPTO_OTP, and ns3::QKDEncryptor::UNENCRYPTED.
Referenced by AppTransitionTree(), CheckAssociationsState(), CreateKeyStreamAssociations(), OpenConnect(), ProcessGetKeyResponse(), and SendPacket().
|
inline |
Get the application identifier.
Definition at line 541 of file qkd-app-004.h.
References m_id.
Referenced by CreateKeyQueues(), and SendKsidRequest().
void ns3::QKDApp004::GetKeyFromKMS | ( | std::string | ksid, |
uint32_t | index = 0 |
||
) |
Get key for the key stream.
ksid | The key stream session identifier. |
index | The position of the key within the key stream. (optional) |
Note QKDApps request keys in an ordered manner. Access by the index is currently not supported.
Definition at line 1899 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), GetAppState(), ns3::InetSocketAddress::GetIpv4(), ns3::Socket::GetPeerName(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::UniformRandomVariable::GetValue(), Http004KMSQuery(), ns3::QKDApp004::KMSPacket::keyType, ns3::QKDApp004::KMSPacket::ksid, m_kms, m_master, m_queue_kms, m_random, m_sendSocketToKMS, m_sinkSocketFromKMS, m_txKmsTrace, ns3::QKDApp004::KMSPacket::methodType, NS_ASSERT, NS_LOG_FUNCTION, ns3::QKDApp004::KMSPacket::packet, PrepareSendSocketToKMS(), PrepareSinkSocketFromKMS(), ns3::Ipv4Address::Print(), ns3::Socket::Send(), STOPPED, nlohmann::to_string(), ns3::HTTPMessage::ToString(), and ns3::QKDApp004::KMSPacket::uri.
Referenced by CheckQueues(), GetAuthKey(), GetEncKey(), ProcessDataPacketFromApp(), and ProcessGetKeyResponse().
|
private |
Map the HTTP reponse from the KMS and obtain the key type.
uri | The HTTP request URI. |
Definition at line 1375 of file qkd-app-004.cc.
References m_httpRequestsKMS, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by ProcessOpenConnectResponse().
|
private |
Map the HTTP response from the peer QKD application and obtain the key stream identifier.
Definition at line 1264 of file qkd-app-004.cc.
References m_httpRequestsApp, and NS_LOG_FUNCTION.
Referenced by ProcessSignalingPacketFromApp().
|
private |
Map the HTTP response from the KMS and obtain the key stream identifier.
Definition at line 1337 of file qkd-app-004.cc.
References m_httpRequestsKMS, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by ProcessCloseResponse(), ProcessGetKeyResponse(), and ProcessOpenConnectResponse().
uint64_t ns3::QKDApp004::GetMaxAuthenticationKeyRate | ( | ) |
Get the maximum key rate required for the authentication (QoS settings).
Definition at line 2805 of file qkd-app-004.cc.
References ns3::DataRate::GetBitRate(), m_aesLifetime, m_authenticationType, m_dataRate, m_packetSize, NS_ASSERT, ns3::QKDEncryptor::QKDCRYPTO_AUTH_MD5, ns3::QKDEncryptor::QKDCRYPTO_AUTH_SHA1, ns3::QKDEncryptor::QKDCRYPTO_AUTH_VMAC, and ns3::QKDEncryptor::UNAUTHENTICATED.
Referenced by OpenConnect().
uint64_t ns3::QKDApp004::GetMaxEncryptionKeyRate | ( | ) |
Get the maximum key rate required for the encryption (QoS settings).
Definition at line 2736 of file qkd-app-004.cc.
References ns3::DataRate::GetBitRate(), m_aesLifetime, m_dataRate, m_encryptionType, NS_LOG_FUNCTION, ns3::QKDEncryptor::QKDCRYPTO_AES, ns3::QKDEncryptor::QKDCRYPTO_OTP, and ns3::QKDEncryptor::UNENCRYPTED.
Referenced by OpenConnect().
|
private |
Map the HTTP response from the peer QKD application and obtain the ETSI method type.
Definition at line 1257 of file qkd-app-004.cc.
References m_httpRequestsApp, and NS_LOG_FUNCTION.
Referenced by ProcessSignalingPacketFromApp().
|
private |
Read the ETSI request method from the URI.
Definition at line 1304 of file qkd-app-004.cc.
References NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by ProcessResponseFromKMS().
std::string ns3::QKDApp004::GetPacketContent | ( | uint32_t | msgLength = 0 | ) |
Generate a random packet payload (the message).
msgLength | The length of the message. |
Definition at line 2694 of file qkd-app-004.cc.
References ns3::UniformRandomVariable::GetValue(), m_packetSize, m_random, and NS_LOG_FUNCTION.
Referenced by SendPacket().
Get the sending socket to the KMS.
Definition at line 565 of file qkd-app-004.h.
References m_sendSocketToKMS.
Get the receiving socket from the KMS.
Definition at line 573 of file qkd-app-004.h.
References m_sinkSocketFromKMS.
|
static |
Get the type ID.
Definition at line 44 of file qkd-app-004.cc.
References ns3::TcpSocketFactory::GetTypeId(), m_aesLifetime, m_authenticationTagLengthInBits, m_authenticationTrace, m_authenticationTypeInt, m_deauthenticationTrace, m_decryptionTrace, m_dosAttackIntensity, m_encryptionTrace, m_encryptionTypeInt, m_holdTime, m_keyBufferLengthAuthentication, m_keyBufferLengthEncryption, m_malicious, m_minDataRate, m_mxTrace, m_obtainedKeyMaterialTrace, m_priority, m_rxKmsTrace, m_rxSigTrace, m_rxTrace, m_stateTransitionTrace, m_tid, m_ttl, m_txKmsTrace, m_txSigTrace, m_txTrace, m_useCrypto, ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeTraceSourceAccessor(), ns3::MakeTypeIdAccessor(), ns3::MakeTypeIdChecker(), ns3::MakeUintegerAccessor(), ns3::Seconds(), and ns3::TypeId::SetParent().
Handle an incoming connection from the peer QKD application.
s | The incoming connection socket. |
from | The address the connection is from. |
Definition at line 548 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), HandleReadFromApp(), ns3::MakeCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().
Referenced by PrepareSinkSocketFromApp().
Handle an incoming connection from the KMS.
s | The incoming connection socket. |
from | The address the connection is from. |
Definition at line 535 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), HandleReadFromKMS(), ns3::MakeCallback(), NS_LOG_FUNCTION, ProcessPacketsToKMSFromQueue(), and ns3::Socket::SetRecvCallback().
Referenced by PrepareSinkSocketFromKMS().
Handle a signaling incoming connection from the peer QKD application.
s | The incoming connection socket. |
from | The address the connection is from. |
Definition at line 560 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), HandleReadSignalingFromApp(), ns3::MakeCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().
Referenced by PrepareSinkSocketFromApp().
Handle a connection close from the peer QKD application.
socket | The connected socket. |
Definition at line 654 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSinkSocketFromApp().
Handle a connection close from the KMS.
socket | The connected socket. |
Definition at line 608 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSinkSocketFromKMS().
Handle a signaling connection close from the peer QKD application.
socket | The connected socket. |
Definition at line 665 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSinkSocketFromApp().
Handle a connection close to the KMS.
socket | The connected socket. |
Definition at line 620 of file qkd-app-004.cc.
References m_sendSocketToKMS, ns3::MakeNullCallback(), NS_LOG_FUNCTION, ns3::Socket::SetCloseCallbacks(), and ns3::Socket::SetConnectCallback().
Referenced by PrepareSendSocketToKMS().
Handle a connection error from the peer QKD application.
socket | The connected socket. |
Definition at line 659 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSinkSocketFromApp().
Handle a connection error from the KMS.
socket | The connected socket. |
Definition at line 614 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSinkSocketFromKMS().
Handle a signaling connection error from the peer QKD application.
socket | The connected socket. |
Definition at line 671 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSinkSocketFromApp().
Handle a connection error to the KMS.
socket | The connected socket. |
Definition at line 637 of file qkd-app-004.cc.
References m_sendSocketToKMS, ns3::MakeNullCallback(), NS_LOG_FUNCTION, ns3::Socket::SetCloseCallbacks(), and ns3::Socket::SetConnectCallback().
Referenced by PrepareSendSocketToKMS().
Handle a packet received from the peer QKD application.
socket | The receiving socket. |
Definition at line 840 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), DataPacketReceivedFromApp(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::InetSocketAddress::IsMatchingType(), ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::Socket::RecvFrom().
Referenced by HandleAcceptFromApp(), and PrepareSinkSocketFromApp().
Handle a packet received by the QKD application from the KMS application.
socket | The receiving socket. |
Definition at line 677 of file qkd-app-004.cc.
References ns3::Simulator::Cancel(), CloseSocketToKms(), ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::InetSocketAddress::IsMatchingType(), ns3::EventId::IsRunning(), m_closeSocketEvent, m_holdTime, m_queue_kms, m_sendSocketToKMS, ns3::Simulator::Now(), NS_LOG_FUNCTION, PacketReceivedFromKMS(), ProcessPacketsToKMSFromQueue(), ns3::Socket::RecvFrom(), and ns3::Simulator::Schedule().
Referenced by HandleAcceptFromKMS(), and PrepareSinkSocketFromKMS().
Handle a signaling packet received from the peer QKD application.
socket | The receiving socket. |
Definition at line 927 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::InetSocketAddress::IsMatchingType(), ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::Socket::RecvFrom(), and SignalingPacketReceivedFromApp().
Referenced by HandleAcceptSignalingFromApp(), and PrepareSinkSocketFromApp().
|
private |
Memories the HTTP request made to the peer QKD application.
methodType | The request method. |
ksid | The key stream identifier. |
HTTP handling to APP
Definition at line 1243 of file qkd-app-004.cc.
References m_httpRequestsApp, and NS_LOG_FUNCTION.
Referenced by CreateKeyQueues(), and SendKsidRequest().
|
private |
Remove the request from the vector of HTTP requests made to the peer QKD application.
Definition at line 1250 of file qkd-app-004.cc.
References m_httpRequestsApp.
Referenced by ProcessSignalingPacketFromApp().
|
private |
Memories the HTTP request made to the local KMS.
uri | The HTTP request URI. |
ksid | The key stream session identifier. |
keyType | The key type. |
HTTP requests are memorised in a vector for the purpose of mapping received responses.
HTTP handling to KMS
Definition at line 1280 of file qkd-app-004.cc.
References m_httpRequestsKMS, and NS_LOG_FUNCTION.
Referenced by Close(), GetKeyFromKMS(), OpenConnect(), and ProcessPacketsToKMSFromQueue().
|
private |
Remove the request from the vector of HTTP requests made to the KMS.
uri | The HTTP request URI. |
Definition at line 1293 of file qkd-app-004.cc.
References m_httpRequestsKMS, and NS_LOG_FUNCTION.
Referenced by ProcessResponseFromKMS().
|
private |
Initialize the key stream sessions.
Delete all the records of the key stream sessions (as well as the remaining keys).
KEY BUFFER functions
Definition at line 1038 of file qkd-app-004.cc.
References m_associations, m_keyBufferLengthAuthentication, m_keyBufferLengthEncryption, m_primaryQueueEstablished, m_replicaQueueEstablished, and NS_LOG_FUNCTION.
Referenced by ProcessCloseResponse(), Setup(), and StopApplication().
void ns3::QKDApp004::OpenConnect | ( | std::string | ksid, |
uint32_t | keyType = 0 |
||
) |
Request a key stream session (an association) from the local KMS.
ksid | The key stream session identifier. |
keyType | The key type. |
Replica (or receiving) QKDApp always states KSID in OPEN_CONNECT call. Primary (or sender) QKDApp does not state KSID (design decision). Each QKDApp is limited (by design decisions) to establish up to 2 associations (one for the encryption and one for the authentification). QKDApps are able to establish unidirectional communication with one peer QKDApp.
KEY MANAGEMENT functions
Definition at line 1801 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), GetAuthenticationKeySize(), ns3::DataRate::GetBitRate(), GetEncryptionKeySize(), ns3::InetSocketAddress::GetIpv4(), GetMaxAuthenticationKeyRate(), GetMaxEncryptionKeyRate(), ns3::Socket::GetPeerName(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), Http004KMSQuery(), ns3::QKDApp004::KMSPacket::keyType, ns3::QKDApp004::KMSPacket::ksid, m_associations, m_dstSaeId, m_id, m_kms, m_master, m_minDataRate, m_priority, m_queue_kms, m_sendSocketToKMS, m_sinkSocketFromKMS, m_ttl, m_txKmsTrace, ns3::QKDApp004::KMSPacket::methodType, NS_ASSERT, NS_LOG_FUNCTION, ns3::QKDApp004::KMSPacket::packet, PrepareSendSocketToKMS(), PrepareSinkSocketFromKMS(), ns3::Ipv4Address::Print(), ns3::Socket::Send(), ns3::UUID::string(), nlohmann::to_string(), ns3::HTTPMessage::ToString(), and ns3::QKDApp004::KMSPacket::uri.
Referenced by CreateKeyStreamAssociations(), ProcessOpenConnectResponse(), and ProcessSignalingPacketFromApp().
void ns3::QKDApp004::PacketReceivedFromKMS | ( | const Ptr< Packet > & | p, |
const Address & | from, | ||
Ptr< Socket > | socket | ||
) |
Check for the tcp segmentation of packets received from the KMS.
p | The received packet. |
from | The address of the KMS. |
socket | The connected socket. |
Definition at line 759 of file qkd-app-004.cc.
References ns3::Packet::AddAtEnd(), ns3::Packet::CopyData(), ns3::Packet::CreateFragment(), ns3::HTTPMessage::GetContentLength(), ns3::HTTPMessage::GetHeadersSize(), ns3::HTTPMessage::GetSize(), ns3::Packet::GetSize(), ns3::HTTPMessage::GetStatusMessage(), ns3::Packet::GetUid(), ns3::HTTPMessage::IsFragmented(), m_buffer_kms, m_malicious, m_rxKmsTrace, NS_LOG_DEBUG, NS_LOG_FUNCTION, check-style-clang-format::parser, ProcessResponseFromKMS(), ns3::Packet::RemoveAtStart(), ns3::HTTPMessage::ToString(), and ns3::Packet::ToString().
Referenced by HandleReadFromKMS().
Convert the packet to a string.
packet | The packet. |
Definition at line 2854 of file qkd-app-004.cc.
References ns3::Packet::CopyData(), ns3::Packet::GetSize(), and NS_LOG_FUNCTION.
Referenced by ProcessDataPacketFromApp().
void ns3::QKDApp004::PrepareSendSocketToApp | ( | ) |
Prepare the send socket to communicate with the peer QKD Application.
Definition at line 402 of file qkd-app-004.cc.
References ns3::Socket::Connect(), ConnectionSignalingToAppFailed(), ConnectionSignalingToAppSucceeded(), ConnectionToAppFailed(), ConnectionToAppSucceeded(), ns3::InetSocketAddress::ConvertFrom(), ns3::Socket::CreateSocket(), ns3::Application::GetNode(), ns3::TcpSocketFactory::GetTypeId(), ns3::UdpSocketFactory::GetTypeId(), m_local, m_localSignaling, m_peer, m_peerSignaling, m_sendDataSocketApp, m_sendSignalingSocketApp, m_socketType, ns3::MakeCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetConnectCallback().
Referenced by AppTransitionTree(), SendKsidRequest(), SendKsidResponse(), and SendPacket().
void ns3::QKDApp004::PrepareSendSocketToKMS | ( | ) |
Prepare the send socket to communicate with the KMS Application.
Definition at line 368 of file qkd-app-004.cc.
References ns3::Socket::Connect(), ConnectionToKMSFailed(), ConnectionToKMSSucceeded(), ns3::InetSocketAddress::ConvertFrom(), ns3::Socket::CreateSocket(), DataToKMSSend(), ns3::Application::GetNode(), ns3::Socket::GetPeerName(), ns3::TcpSocketFactory::GetTypeId(), HandlePeerCloseToKMS(), HandlePeerErrorToKMS(), m_kms, m_sendSocketToKMS, ns3::MakeCallback(), NS_LOG_FUNCTION, RegisterAckTime(), ns3::Socket::SetCloseCallbacks(), ns3::Socket::SetConnectCallback(), ns3::Socket::SetDataSentCallback(), and ns3::ObjectBase::TraceConnectWithoutContext().
Referenced by AppTransitionTree(), Close(), GetKeyFromKMS(), OpenConnect(), ProcessPacketsToKMSFromQueue(), and SendMaliciousRequestToKMS().
void ns3::QKDApp004::PrepareSinkSocketFromApp | ( | ) |
Prepare the sink socket to listen from the peer QKD Application.
Definition at line 452 of file qkd-app-004.cc.
References ns3::Socket::Bind(), ns3::InetSocketAddress::ConvertFrom(), ns3::Socket::CreateSocket(), ns3::Application::GetNode(), ns3::TcpSocketFactory::GetTypeId(), ns3::UdpSocketFactory::GetTypeId(), HandleAcceptFromApp(), HandleAcceptSignalingFromApp(), HandlePeerCloseFromApp(), HandlePeerCloseSignalingFromApp(), HandlePeerErrorFromApp(), HandlePeerErrorSignalingFromApp(), HandleReadFromApp(), HandleReadSignalingFromApp(), ns3::Socket::Listen(), m_local, m_localSignaling, m_sinkDataSocketApp, m_sinkSignalingSocketApp, m_socketType, ns3::MakeCallback(), ns3::MakeNullCallback(), NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Socket::SetAcceptCallback(), ns3::Socket::SetCloseCallbacks(), ns3::Socket::SetRecvCallback(), and ns3::Socket::ShutdownSend().
Referenced by SendKsidRequest(), SendKsidResponse(), and StartApplication().
void ns3::QKDApp004::PrepareSinkSocketFromKMS | ( | ) |
Prepare the sink socket to listen from the KMS Application.
SOCKET functions
Definition at line 330 of file qkd-app-004.cc.
References ns3::Socket::Bind(), ConnectionRequestedFromKMS(), ns3::InetSocketAddress::ConvertFrom(), ns3::Socket::CreateSocket(), ns3::Ipv4Address::GetAny(), ns3::Application::GetNode(), ns3::TcpSocketFactory::GetTypeId(), HandleAcceptFromKMS(), HandlePeerCloseFromKMS(), HandlePeerErrorFromKMS(), HandleReadFromKMS(), ns3::Socket::Listen(), m_sinkSocketFromKMS, ns3::MakeCallback(), NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Socket::SetAcceptCallback(), ns3::Socket::SetCloseCallbacks(), ns3::Socket::SetRecvCallback(), and ns3::Socket::ShutdownSend().
Referenced by Close(), GetKeyFromKMS(), OpenConnect(), ProcessOpenConnectResponse(), and SendMaliciousRequestToKMS().
void ns3::QKDApp004::ProcessCloseResponse | ( | HTTPMessage & | header | ) |
Process the CLOSE response.
header | The received HTTP message. |
Definition at line 2170 of file qkd-app-004.cc.
References ns3::Socket::Close(), GetKsidFromHttp004KMSQuery(), ns3::HTTPMessage::GetRequestUri(), ns3::HTTPMessage::GetStatus(), InitializeAssociations(), m_httpRequestsKMS, m_sendSocketToKMS, m_sinkSocketFromKMS, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by ProcessResponseFromKMS().
|
private |
Start establishing key queues at the reciving application once requested by the sender.
Definition at line 2449 of file qkd-app-004.cc.
References AppTransitionTree(), KEY_QUEUES_ESTABLISHED, m_primaryQueueEstablished, m_replicaQueueEstablished, NS_LOG_FUNCTION, and SwitchAppState().
Referenced by ProcessSignalingPacketFromApp().
void ns3::QKDApp004::ProcessDataPacketFromApp | ( | QKDAppHeader | header, |
Ptr< Packet > | packet, | ||
Ptr< Socket > | socket | ||
) |
Process data packets from the peer QKD application.
header | The received QKDApp packet header. |
packet | The received packet. |
socket | The receiving socket. |
Definition at line 1676 of file qkd-app-004.cc.
References DECRYPT_DATA, ns3::QKDAppHeader::GetAuthenticated(), ns3::QKDAppHeader::GetAuthenticationKeyId(), GetAuthenticationKeySize(), GetAuthKey(), ns3::QKDAppHeader::GetAuthTag(), GetEncKey(), ns3::QKDAppHeader::GetEncrypted(), ns3::QKDAppHeader::GetEncryptionKeyId(), GetKeyFromKMS(), ns3::QKDApp004::QKDAppKey::index, ns3::QKDApp004::QKDAppKey::key, m_associations, m_authenticationTagLengthInBits, m_encryptor, m_master, m_useCrypto, NS_FATAL_ERROR, NS_LOG_FUNCTION, PacketToString(), READY, SetEncryptionAndAuthenticationSettings(), and SwitchAppState().
Referenced by DataPacketReceivedFromApp().
void ns3::QKDApp004::ProcessGetKeyResponse | ( | HTTPMessage & | header | ) |
Process the GET_KEY response.
header | The received HTTP message. |
Definition at line 2092 of file qkd-app-004.cc.
References CheckQueues(), ESTABLISHING_KEY_QUEUES, GetAuthenticationKeySize(), GetEncryptionKeySize(), GetKeyFromKMS(), GetKsidFromHttp004KMSQuery(), ns3::HTTPMessage::GetMessageBodyString(), ns3::HTTPMessage::GetRequestUri(), ns3::HTTPMessage::GetStatus(), ns3::QKDApp004::QKDAppKey::index, ns3::QKDApp004::QKDAppKey::key, ns3::QKDApp004::QKDAppKey::lifetime, m_aesLifetime, m_appState, m_associations, m_master, m_obtainedKeyMaterialTrace, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, READY, ns3::Simulator::Schedule(), SwitchAppState(), and WAIT.
Referenced by ProcessResponseFromKMS().
void ns3::QKDApp004::ProcessOpenConnectResponse | ( | HTTPMessage & | header | ) |
Process the OPEN_CONNECT response.
header | The received HTTP message. |
Definition at line 2008 of file qkd-app-004.cc.
References ClearAssociation(), GetKeyTypeFromHttp004KMSQuery(), GetKsidFromHttp004KMSQuery(), ns3::HTTPMessage::GetMessageBodyString(), ns3::HTTPMessage::GetRequestUri(), ns3::HTTPMessage::GetStatus(), m_associations, m_master, m_sinkSocketFromKMS, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, OpenConnect(), PrepareSinkSocketFromKMS(), ns3::Simulator::Schedule(), SendKsidRequest(), and SendKsidResponse().
Referenced by ProcessResponseFromKMS().
|
private |
Process and send any remaining packets to the KMS.
Definition at line 730 of file qkd-app-004.cc.
References ns3::Socket::GetPeerName(), Http004KMSQuery(), m_queue_kms, m_sendSocketToKMS, m_txKmsTrace, NS_LOG_FUNCTION, PrepareSendSocketToKMS(), and ns3::Socket::Send().
Referenced by HandleAcceptFromKMS(), and HandleReadFromKMS().
void ns3::QKDApp004::ProcessResponseFromKMS | ( | HTTPMessage & | header, |
Ptr< Packet > | packet, | ||
Ptr< Socket > | socket | ||
) |
Process a response from the KMS application.
header | The received HTTP message. |
packet | The received packet. |
socket | The receiving socket. |
Definition at line 1768 of file qkd-app-004.cc.
References GetMethodFromHttp004KMSQuery(), ns3::HTTPMessage::GetRequestUri(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), Http004KMSQueryComplete(), m_appState, NS_FATAL_ERROR, NS_LOG_FUNCTION, ProcessCloseResponse(), ProcessGetKeyResponse(), ProcessOpenConnectResponse(), and STOPPED.
Referenced by PacketReceivedFromKMS().
void ns3::QKDApp004::ProcessSendKsidResponse | ( | HTTPMessage & | header, |
std::string | ksid | ||
) |
Process the SEND_KSID response.
header | The received HTTP message. |
ksid | The key stream indentifier. |
Definition at line 2370 of file qkd-app-004.cc.
References CheckAssociationsState(), Close(), ns3::HTTPMessage::GetStatus(), m_associations, m_master, NS_ASSERT, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by ProcessSignalingPacketFromApp().
void ns3::QKDApp004::ProcessSignalingPacketFromApp | ( | HTTPMessage & | header, |
Ptr< Socket > | socket | ||
) |
Process a signaling packets from the peer QKD application.
header | The received HTTP message. |
packet | The received packet. |
socket | The receiving socket. |
Definition at line 2203 of file qkd-app-004.cc.
References CheckQueues(), ESTABLISHING_ASSOCIATIONS, ESTABLISHING_KEY_QUEUES, GetKsidFromHttp004AppQuery(), ns3::HTTPMessage::GetMessageBodyString(), GetMethodFromHttp004AppQuery(), ns3::HTTPMessage::GetUri(), Http004AppQueryComplete(), m_associations, m_master, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, OpenConnect(), ProcessCreateQueuesResponse(), ProcessSendKsidResponse(), and SwitchAppState().
Referenced by SignalingPacketReceivedFromApp().
Register the acknowledgement time.
oldRtt | The previous round-trip time. |
newRtt | The new rount-trip time. |
Definition at line 2492 of file qkd-app-004.cc.
References NS_LOG_FUNCTION.
Referenced by PrepareSendSocketToKMS().
uint32_t ns3::QKDApp004::ScheduleAction | ( | Time | t, |
std::string | action | ||
) |
Schedule the action.
t | The scheduled time. |
action | The action. |
|
private |
Schedule the next time slot to send the data.
SCHEDULE functions
Definition at line 291 of file qkd-app-004.cc.
References GetAppStateString(), ns3::DataRate::GetBitRate(), m_appState, m_dataRate, m_delay, m_packetSize, m_sendEvent, NOT_STARTED, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::Seconds(), SendPacket(), and STOPPED.
Referenced by SendPacket().
void ns3::QKDApp004::SendKsidRequest | ( | std::string | ksid, |
uint32_t | keyType | ||
) |
Inform the peer QKD application of the established key stream session.
ksid | The key stream session identifier. |
input | The key stream session purpose. |
Application SIGNALING
Definition at line 2293 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), GetId(), ns3::InetSocketAddress::GetIpv4(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), Http004AppQuery(), m_dataSent, m_master, m_packetsSent, m_peer, m_sendSignalingSocketApp, m_sinkSignalingSocketApp, m_txSigTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), ns3::Ipv4Address::Print(), ns3::Socket::Send(), ns3::UUID::string(), nlohmann::to_string(), and ns3::HTTPMessage::ToString().
Referenced by ProcessOpenConnectResponse().
void ns3::QKDApp004::SendKsidResponse | ( | HTTPMessage::HttpStatus | httpStatus, |
std::string | msg = "" |
||
) |
Send a response on the SEND_KSID request.
httpStatus | The HTTP status code. |
msg | The error message (if any). |
Definition at line 2334 of file qkd-app-004.cc.
References ns3::HTTPMessage::CreateResponse(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_dataSent, m_master, m_packetsSent, m_sendSignalingSocketApp, m_sinkSignalingSocketApp, m_txSigTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), ns3::Socket::Send(), and ns3::HTTPMessage::ToString().
Referenced by ProcessOpenConnectResponse().
|
private |
Send a malicious request to the KMS.
This funtion is used in the simulation of the Denail-of-Service attacks on the KMS using malicios/incorrect requests.
MALICIOUS functions
Definition at line 1396 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::HTTPMessage::CreateRequest(), GetAppState(), ns3::InetSocketAddress::GetIpv4(), ns3::Socket::GetPeerName(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_appState, m_dosAttackIntensity, m_dstSaeId, m_id, m_kms, m_maliciousPacket, m_sendSocketToKMS, m_sinkSocketFromKMS, m_txKmsTrace, NS_ASSERT, NS_LOG_FUNCTION, PrepareSendSocketToKMS(), PrepareSinkSocketFromKMS(), ns3::Ipv4Address::Print(), READY, ns3::Simulator::Schedule(), ns3::Socket::Send(), ns3::UUID::Sequential(), STOPPED, ns3::UUID::string(), and ns3::HTTPMessage::ToString().
Referenced by StartApplication().
|
private |
Send the application packet (includes the generation of a random message and optional encryption or/and authentication on the message).
Definition at line 1559 of file qkd-app-004.cc.
References ns3::Packet::AddHeader(), GetAppStateString(), GetAuthenticationKeySize(), GetAuthKey(), GetEncKey(), GetEncryptionKeySize(), GetPacketContent(), ns3::QKDAppHeader::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::QKDApp004::QKDAppKey::index, ns3::QKDApp004::QKDAppKey::key, m_appState, m_associations, m_authenticationTrace, m_authenticationType, m_dataSent, m_encryptionType, m_encryptor, m_master, m_packetsSent, m_sendDataSocketApp, m_txTrace, m_useCrypto, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, PrepareSendSocketToApp(), READY, ScheduleTx(), ns3::Socket::Send(), SEND_DATA, ns3::QKDAppHeader::SetAuthenticated(), ns3::QKDAppHeader::SetAuthenticationKeyId(), ns3::QKDAppHeader::SetAuthTag(), ns3::QKDAppHeader::SetEncrypted(), ns3::QKDAppHeader::SetEncryptionKeyId(), ns3::QKDAppHeader::SetLength(), SwitchAppState(), nlohmann::to_string(), and WAIT.
Referenced by AppTransitionTree(), and ScheduleTx().
void ns3::QKDApp004::SetEncryptionAndAuthenticationSettings | ( | uint32_t | encryptionType, |
uint32_t | authenticationType, | ||
uint32_t | authenticationTagLengthInBits | ||
) |
Set the encryption and the authentication algorithms.
ecryptionType | The encryption algorithm. |
authenticationType | The authentication algorithm. |
authenticationTagLengthInBits | The size of the authentication tag. |
ADDTIONAL functions
Definition at line 2642 of file qkd-app-004.cc.
References m_authenticationType, m_encryptionType, m_encryptor, NS_LOG_FUNCTION, ns3::QKDEncryptor::QKDCRYPTO_AES, ns3::QKDEncryptor::QKDCRYPTO_AUTH_MD5, ns3::QKDEncryptor::QKDCRYPTO_AUTH_SHA1, ns3::QKDEncryptor::QKDCRYPTO_AUTH_VMAC, ns3::QKDEncryptor::QKDCRYPTO_OTP, ns3::QKDEncryptor::UNAUTHENTICATED, and ns3::QKDEncryptor::UNENCRYPTED.
Referenced by ProcessDataPacketFromApp(), and StartApplication().
|
inline |
Set authentication key stream identifier.
val | The key stream identifier. |
Definition at line 102 of file qkd-app-004.h.
References m_ksid_auth.
|
inline |
Set encryption key stream identifier.
val | The key stream identifier. |
Definition at line 94 of file qkd-app-004.h.
References m_ksid_enc.
void ns3::QKDApp004::Setup | ( | std::string | socketType, |
Address | src, | ||
Address | dst, | ||
Address | kms, | ||
UUID | dstSaeId, | ||
std::string | type | ||
) |
Configure the application.
socketType | The socket type. |
src | The source address. |
dst | The destination address. |
kms | The local key manager address. |
dstSaeId | The remote application identifier. |
type | Type of the application, the sender or the receiver. |
Definition at line 215 of file qkd-app-004.cc.
References check-style-clang-format::type.
void ns3::QKDApp004::Setup | ( | std::string | socketType, |
Address | src, | ||
Address | dst, | ||
Address | kms, | ||
UUID | dstSaeId, | ||
uint32_t | packetSize, | ||
uint32_t | nPackets, | ||
DataRate | dataRate, | ||
std::string | type | ||
) |
Configure the application.
socketType | The socket type. |
src | The source address. |
dst | The destination address. |
kms | The local key manager address. |
dstSaeId | The remote application identifier. |
packetSize | The packet size that is transmitted. |
dataRate | The rate at which packets are transmitted. |
type | Type of the application, the sender or the receiver. |
Definition at line 237 of file qkd-app-004.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::DataRate::GetBitRate(), InitializeAssociations(), INITIALIZED, m_dataRate, m_dstSaeId, m_kms, m_local, m_localSignaling, m_master, m_packetSize, m_peer, m_peerSignaling, m_socketType, NS_ASSERT, NS_LOG_FUNCTION, packetSize, SwitchAppState(), and check-style-clang-format::type.
void ns3::QKDApp004::SignalingPacketReceivedFromApp | ( | const Ptr< Packet > & | p, |
const Address & | from, | ||
Ptr< Socket > | socket | ||
) |
Check for the tcp segmentation of the signaling packets received from the peer application.
p | The received packet. |
from | The address of the KMS. |
socket | The connected socket. |
Definition at line 959 of file qkd-app-004.cc.
References ns3::Packet::AddAtEnd(), ns3::Packet::CopyData(), ns3::Packet::CreateFragment(), ns3::HTTPMessage::GetSize(), ns3::Packet::GetSize(), ns3::HTTPMessage::GetStatusMessage(), ns3::Packet::GetUid(), ns3::HTTPMessage::IsFragmented(), m_buffer_sig, m_rxSigTrace, NS_LOG_DEBUG, NS_LOG_FUNCTION, check-style-clang-format::parser, ProcessSignalingPacketFromApp(), ns3::Packet::RemoveAtStart(), ns3::HTTPMessage::ToString(), and ns3::Packet::ToString().
Referenced by HandleReadSignalingFromApp().
|
privatevirtual |
APPLICATION functions
Reimplemented from ns3::Application.
Definition at line 1474 of file qkd-app-004.cc.
References AppTransitionTree(), GetAppStateString(), INITIALIZED, m_aesLifetime, m_appState, m_authenticationTagLengthInBits, m_authenticationTypeInt, m_encryptionTypeInt, m_local, m_malicious, m_maliciousPacket, m_master, m_packetSize, m_packetsSent, m_peer, NS_FATAL_ERROR, NS_LOG_FUNCTION, PrepareSinkSocketFromApp(), READY, SendMaliciousRequestToKMS(), SetEncryptionAndAuthenticationSettings(), and SwitchAppState().
|
privatevirtual |
Application specific shutdown code.
The StopApplication method is called at the stop time specified by Stop This method should be overridden by all or most application subclasses.
Reimplemented from ns3::Application.
Definition at line 1521 of file qkd-app-004.cc.
References ns3::Simulator::Cancel(), ns3::Socket::Close(), Close(), InitializeAssociations(), ns3::EventId::IsRunning(), m_associations, m_master, m_sendDataSocketApp, m_sendEvent, m_sendSignalingSocketApp, m_sendSocketToKMS, m_sinkDataSocketApp, m_sinkSignalingSocketApp, m_sinkSocketFromKMS, NS_LOG_FUNCTION, STOPPED, and SwitchAppState().
void ns3::QKDApp004::SwitchAppState | ( | QKDApp004::QKDAppState | state | ) |
Change the state of the application.
state | The new application state. |
Definition at line 2613 of file qkd-app-004.cc.
References GetAppStateString(), m_appState, m_associations, and NS_LOG_FUNCTION.
Referenced by AppTransitionTree(), CheckAssociationsState(), CheckQueues(), ProcessCreateQueuesResponse(), ProcessDataPacketFromApp(), ProcessGetKeyResponse(), ProcessSignalingPacketFromApp(), SendPacket(), Setup(), StartApplication(), and StopApplication().
|
private |
The AES key lifetime.
Definition at line 844 of file qkd-app-004.h.
Referenced by GetMaxAuthenticationKeyRate(), GetMaxEncryptionKeyRate(), GetTypeId(), ProcessGetKeyResponse(), and StartApplication().
|
staticprivate |
The number of running applications.
Definition at line 837 of file qkd-app-004.h.
Referenced by QKDApp004().
|
private |
The application state.
Definition at line 857 of file qkd-app-004.h.
Referenced by AppTransitionTree(), CheckAssociationsState(), DataPacketReceivedFromApp(), GetAppState(), GetAppStateString(), ProcessGetKeyResponse(), ProcessResponseFromKMS(), ScheduleTx(), SendMaliciousRequestToKMS(), SendPacket(), StartApplication(), and SwitchAppState().
|
private |
A pair (encryption/authentication) of the establihed key stream session.
Definition at line 604 of file qkd-app-004.h.
Referenced by AppTransitionTree(), CheckAssociationsState(), CheckQueues(), ClearAssociation(), Close(), CreateKeyStreamAssociations(), DataPacketReceivedFromApp(), GetAuthKey(), GetEncKey(), InitializeAssociations(), OpenConnect(), ProcessDataPacketFromApp(), ProcessGetKeyResponse(), ProcessOpenConnectResponse(), ProcessSendKsidResponse(), ProcessSignalingPacketFromApp(), SendPacket(), StopApplication(), and SwitchAppState().
|
private |
The size of the authentication tag in bits (32 by default).
Definition at line 843 of file qkd-app-004.h.
Referenced by GetTypeId(), ProcessDataPacketFromApp(), and StartApplication().
|
private |
A trace callback for the authentication event.
Definition at line 847 of file qkd-app-004.h.
Referenced by GetTypeId(), and SendPacket().
|
private |
The authentication algorithm.
Definition at line 852 of file qkd-app-004.h.
Referenced by GetAuthenticationKeySize(), GetMaxAuthenticationKeyRate(), SendPacket(), and SetEncryptionAndAuthenticationSettings().
|
private |
The authentication algorithm.
Definition at line 842 of file qkd-app-004.h.
Referenced by GetTypeId(), and StartApplication().
|
private |
The buffer for the received packets from the KMS (fragmentation).
Definition at line 861 of file qkd-app-004.h.
Referenced by PacketReceivedFromKMS().
|
private |
The buffer for received data packets (fragmentation).
Definition at line 863 of file qkd-app-004.h.
Referenced by DataPacketReceivedFromApp().
|
private |
The buffer for the received signaling packets (fragmentation).
Definition at line 862 of file qkd-app-004.h.
Referenced by SignalingPacketReceivedFromApp().
|
private |
The closing socket event.
Definition at line 814 of file qkd-app-004.h.
Referenced by HandleReadFromKMS().
|
private |
The application data rate.
Definition at line 810 of file qkd-app-004.h.
Referenced by GetMaxAuthenticationKeyRate(), GetMaxEncryptionKeyRate(), ScheduleTx(), and Setup().
|
private |
The amount of the sent data.
Definition at line 818 of file qkd-app-004.h.
Referenced by CreateKeyQueues(), CreateKeyQueuesResponse(), SendKsidRequest(), SendKsidResponse(), and SendPacket().
|
private |
A trace callback for the authentication check event.
Definition at line 848 of file qkd-app-004.h.
Referenced by GetTypeId().
|
private |
A trace callback for the decryption event.
Definition at line 846 of file qkd-app-004.h.
Referenced by GetTypeId().
|
private |
The time interval between two successive data transmissions (calculated based on the application data rate).
Definition at line 808 of file qkd-app-004.h.
Referenced by ScheduleTx().
|
private |
The intensity of the DoS attack.
Definition at line 824 of file qkd-app-004.h.
Referenced by GetTypeId(), and SendMaliciousRequestToKMS().
|
private |
The peer application identifier.
Definition at line 835 of file qkd-app-004.h.
Referenced by OpenConnect(), SendMaliciousRequestToKMS(), and Setup().
|
private |
A trace callback for the encryption event.
Definition at line 845 of file qkd-app-004.h.
Referenced by GetTypeId().
|
private |
The encryption algorithm.
Definition at line 851 of file qkd-app-004.h.
Referenced by GetEncryptionKeySize(), GetMaxEncryptionKeyRate(), SendPacket(), and SetEncryptionAndAuthenticationSettings().
|
private |
The encryption algorithm.
Definition at line 841 of file qkd-app-004.h.
Referenced by GetTypeId(), and StartApplication().
|
private |
The QKD encryptor.
Definition at line 853 of file qkd-app-004.h.
Referenced by ProcessDataPacketFromApp(), SendPacket(), and SetEncryptionAndAuthenticationSettings().
|
private |
The holding time before closing sockets.
Definition at line 815 of file qkd-app-004.h.
Referenced by GetTypeId(), and HandleReadFromKMS().
|
private |
A vector of HTTP requests sent to the peer application.
Definition at line 831 of file qkd-app-004.h.
Referenced by GetKsidFromHttp004AppQuery(), GetMethodFromHttp004AppQuery(), Http004AppQuery(), and Http004AppQueryComplete().
|
private |
A vector of HTTP requests set to the KMS.
Definition at line 832 of file qkd-app-004.h.
Referenced by GetKeyTypeFromHttp004KMSQuery(), GetKsidFromHttp004KMSQuery(), Http004KMSQuery(), Http004KMSQueryComplete(), and ProcessCloseResponse().
|
private |
The application identifier.
Definition at line 834 of file qkd-app-004.h.
Referenced by QKDApp004(), GetId(), OpenConnect(), and SendMaliciousRequestToKMS().
|
private |
The size of the authentication key queue at the application layer.
Definition at line 855 of file qkd-app-004.h.
Referenced by GetTypeId(), and InitializeAssociations().
|
private |
The size of the encryption key queue at the application layer.
Definition at line 854 of file qkd-app-004.h.
Referenced by GetTypeId(), and InitializeAssociations().
|
private |
The local KMS address.
Definition at line 803 of file qkd-app-004.h.
Referenced by Close(), GetKeyFromKMS(), OpenConnect(), PrepareSendSocketToKMS(), SendMaliciousRequestToKMS(), and Setup().
|
private |
The authentication key stream identifier.
Definition at line 580 of file qkd-app-004.h.
Referenced by SetKsidAuthentication().
|
private |
The encryption key stream identifier.
Definition at line 579 of file qkd-app-004.h.
Referenced by SetKsidEncryption().
|
private |
The local address for the data transmission.
Definition at line 800 of file qkd-app-004.h.
Referenced by PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), Setup(), and StartApplication().
|
private |
The local address for the signaling data transmission.
Definition at line 801 of file qkd-app-004.h.
Referenced by PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), and Setup().
|
private |
Is a malicious application?
Definition at line 821 of file qkd-app-004.h.
Referenced by GetTypeId(), PacketReceivedFromKMS(), and StartApplication().
The malicious packet.
Definition at line 823 of file qkd-app-004.h.
Referenced by SendMaliciousRequestToKMS(), and StartApplication().
|
private |
Is a master (sender/primary) application?
Definition at line 820 of file qkd-app-004.h.
Referenced by AppTransitionTree(), CheckAssociationsState(), CheckQueues(), Close(), CreateKeyQueues(), CreateKeyQueuesResponse(), DataPacketReceivedFromApp(), GetAuthKey(), GetEncKey(), GetKeyFromKMS(), OpenConnect(), ProcessDataPacketFromApp(), ProcessGetKeyResponse(), ProcessOpenConnectResponse(), ProcessSendKsidResponse(), ProcessSignalingPacketFromApp(), SendKsidRequest(), SendKsidResponse(), SendPacket(), Setup(), StartApplication(), and StopApplication().
|
private |
The minimum application data rate.
Definition at line 811 of file qkd-app-004.h.
Referenced by GetTypeId(), and OpenConnect().
TracedCallback<Ptr<const Packet>, std::string > ns3::QKDApp004::m_mxTrace |
A trace for the missed time slots to send data (due to the lack of keys).
Definition at line 559 of file qkd-app-004.h.
Referenced by GetTypeId().
|
private |
A trace callback for the obtained key material.
Definition at line 850 of file qkd-app-004.h.
Referenced by GetTypeId(), and ProcessGetKeyResponse().
|
private |
The data packet size.
Definition at line 807 of file qkd-app-004.h.
Referenced by GetEncKey(), GetEncryptionKeySize(), GetMaxAuthenticationKeyRate(), GetPacketContent(), ScheduleTx(), Setup(), and StartApplication().
|
private |
The number of sent data packets.
Definition at line 817 of file qkd-app-004.h.
Referenced by CreateKeyQueues(), CreateKeyQueuesResponse(), SendKsidRequest(), SendKsidResponse(), SendPacket(), and StartApplication().
|
private |
The address of the peer for the data transmission.
Definition at line 797 of file qkd-app-004.h.
Referenced by CreateKeyQueues(), PrepareSendSocketToApp(), SendKsidRequest(), Setup(), and StartApplication().
|
private |
The address of the peer for the signaling data transmission.
Definition at line 798 of file qkd-app-004.h.
Referenced by PrepareSendSocketToApp(), and Setup().
|
private |
Is the queue established at the sender application?
Definition at line 606 of file qkd-app-004.h.
Referenced by CheckQueues(), InitializeAssociations(), and ProcessCreateQueuesResponse().
|
private |
The application priority (QoS).
Definition at line 827 of file qkd-app-004.h.
Referenced by GetTypeId(), and OpenConnect().
|
private |
The queue of packets waiting for the transmission to the KMS.
Definition at line 859 of file qkd-app-004.h.
Referenced by Close(), CloseSocketToKms(), GetKeyFromKMS(), HandleReadFromKMS(), OpenConnect(), and ProcessPacketsToKMSFromQueue().
|
private |
The uniform random variable.
Definition at line 609 of file qkd-app-004.h.
Referenced by QKDApp004(), GetKeyFromKMS(), and GetPacketContent().
|
private |
Is the queue established at the receiver application?
Definition at line 607 of file qkd-app-004.h.
Referenced by CheckQueues(), InitializeAssociations(), and ProcessCreateQueuesResponse().
TracedCallback<Ptr<const Packet> > ns3::QKDApp004::m_rxKmsTrace |
A trace for received packets from the KMS.
Definition at line 557 of file qkd-app-004.h.
Referenced by GetTypeId(), and PacketReceivedFromKMS().
TracedCallback<Ptr<const Packet> > ns3::QKDApp004::m_rxSigTrace |
A trace for received signaling packets.
Definition at line 556 of file qkd-app-004.h.
Referenced by GetTypeId(), and SignalingPacketReceivedFromApp().
TracedCallback<Ptr<const Packet>, std::string > ns3::QKDApp004::m_rxTrace |
A trace for received data packets.
Definition at line 555 of file qkd-app-004.h.
Referenced by GetTypeId().
|
private |
The map of scheduled events.
Definition at line 865 of file qkd-app-004.h.
Referenced by CancelScheduledAction().
The sending socket for the data.
Definition at line 791 of file qkd-app-004.h.
Referenced by ~QKDApp004(), PrepareSendSocketToApp(), SendPacket(), and StopApplication().
|
private |
The data transmission event.
Definition at line 813 of file qkd-app-004.h.
Referenced by ScheduleTx(), and StopApplication().
The sending socket for the signaling messages.
Definition at line 789 of file qkd-app-004.h.
Referenced by ~QKDApp004(), CreateKeyQueues(), CreateKeyQueuesResponse(), PrepareSendSocketToApp(), SendKsidRequest(), SendKsidResponse(), and StopApplication().
The sending socket to the KMS.
Definition at line 794 of file qkd-app-004.h.
Referenced by ~QKDApp004(), Close(), CloseSocketToKms(), GetKeyFromKMS(), GetSendSocketToKMS(), HandlePeerCloseToKMS(), HandlePeerErrorToKMS(), HandleReadFromKMS(), OpenConnect(), PrepareSendSocketToKMS(), ProcessCloseResponse(), ProcessPacketsToKMSFromQueue(), SendMaliciousRequestToKMS(), and StopApplication().
The receiving socket for the data.
Definition at line 792 of file qkd-app-004.h.
Referenced by ~QKDApp004(), PrepareSinkSocketFromApp(), and StopApplication().
The receiving socket for the signaling messages.
Definition at line 790 of file qkd-app-004.h.
Referenced by ~QKDApp004(), PrepareSinkSocketFromApp(), SendKsidRequest(), SendKsidResponse(), and StopApplication().
The receiving socket from the KMS.
Definition at line 795 of file qkd-app-004.h.
Referenced by ~QKDApp004(), Close(), GetKeyFromKMS(), GetSinkSocketFromKMS(), OpenConnect(), PrepareSinkSocketFromKMS(), ProcessCloseResponse(), ProcessOpenConnectResponse(), SendMaliciousRequestToKMS(), and StopApplication().
|
private |
The sockets type.
Definition at line 805 of file qkd-app-004.h.
Referenced by PrepareSendSocketToApp(), PrepareSinkSocketFromApp(), and Setup().
ns3::TracedCallback<const std::string &, const std::string &> ns3::QKDApp004::m_stateTransitionTrace |
A trace for the application state transitions.
Definition at line 558 of file qkd-app-004.h.
Referenced by GetTypeId().
|
private |
|
private |
The map of the possible state transitions.
Definition at line 866 of file qkd-app-004.h.
|
private |
The time-to-live of the key stream session.
Definition at line 828 of file qkd-app-004.h.
Referenced by GetTypeId(), and OpenConnect().
TracedCallback<Ptr<const Packet> > ns3::QKDApp004::m_txKmsTrace |
A trace for transmitted packets to the KMS.
Definition at line 554 of file qkd-app-004.h.
Referenced by Close(), GetKeyFromKMS(), GetTypeId(), OpenConnect(), ProcessPacketsToKMSFromQueue(), and SendMaliciousRequestToKMS().
TracedCallback<Ptr<const Packet> > ns3::QKDApp004::m_txSigTrace |
A trace for transmitted signaling packets.
Definition at line 553 of file qkd-app-004.h.
Referenced by CreateKeyQueues(), CreateKeyQueuesResponse(), GetTypeId(), SendKsidRequest(), and SendKsidResponse().
TracedCallback<Ptr<const Packet>, std::string > ns3::QKDApp004::m_txTrace |
Definition at line 552 of file qkd-app-004.h.
Referenced by DataPacketReceivedFromApp(), GetTypeId(), and SendPacket().
|
private |
Execute actual cryptographic algorithms?
Definition at line 840 of file qkd-app-004.h.
Referenced by GetTypeId(), ProcessDataPacketFromApp(), and SendPacket().