A Discrete-Event Network Simulator
API
qkd-app-014.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 DOTFEESA www.tk.etf.unsa.ba
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Emir Dervisevic <emir.dervisevic@etf.unsa.ba>
19  * Miralem Mehic <miralem.mehic@ieee.org>
20  */
21 #ifndef QKD014_SEND_H
22 #define QKD014_SEND_H
23 
24 #include "ns3/application.h"
25 #include "ns3/event-id.h"
26 #include "ns3/ptr.h"
27 #include "ns3/traced-callback.h"
28 #include "ns3/address.h"
29 #include "ns3/core-module.h"
30 #include "ns3/applications-module.h"
31 #include "ns3/random-variable-stream.h"
32 #include "ns3/core-module.h"
33 #include "ns3/http.h"
34 #include "qkd-app-header.h"
35 #include "ns3/qkd-encryptor.h"
36 #include <unordered_map>
37 #include <string>
38 #include "ns3/uuid.h"
39 
40 #include <iostream>
41 #include <sstream>
42 #include <unistd.h>
43 
44 namespace ns3 {
45 
46 class Address;
47 class Socket;
48 class Packet;
49 
81 class QKDApp014 : public Application
82 {
83 public:
88  static TypeId GetTypeId (void);
89 
93  QKDApp014 ();
94 
98  virtual ~QKDApp014();
99 
105  m_ksid_enc = val;
106  }
107 
113  m_ksid_auth = val;
114  }
115 
120  {
121  std::string key;
122  std::string keyId;
123  uint32_t keyType; //0-enc key, 1-auth key
124  uint64_t lifetime; //Value of lifetime used with ciphers such as AES! Value is exspresed in seconds!
125  //Lifetime is counted from the first use!
126  };
127 
132  {
133  std::map<std::string, QKDApp014Key> outboundEncKeyStore; //Store for enc keys used for outbound traffic!
134  std::map<std::string, QKDApp014Key> outboundAuthKeyStore; //Store for auth keys used for outbound traffic!
135  std::map<std::string, QKDApp014Key> inboundKeyStore; //Store for enc/auth keys used for inbound traffic!
136  std::map<std::string, QKDApp014Key> temporaryKeyStoreMaster; //Temporary memory for keys to be negotiated with peer QKDApp014!
137 
138  };
139 
150  STOPPED
151  };
152 
162  void Setup (
163  std::string socketType,
164  Address src,
165  Address dst,
166  Address kms,
167  UUID dstSaeId,
168  std::string type
169  );
170 
183  void Setup (
184  std::string socketType,
185  Address src,
186  Address dst,
187  Address kms,
188  UUID dstSaeId,
189  uint32_t packetSize,
190  uint32_t nPackets,
191  DataRate dataRate,
192  std::string type
193  );
194 
195 
199  void InitializeAppKeyBuffer();
200 
205  void RemoveKeysFromTemporaryKeyStore (std::vector<std::string> keyIds);
206 
207 
213 
219 
225 
230 
235 
242  void CheckAppBufferState ();
243 
250  void CheckAppState ();
251 
256  void GetStatusFromKMS (uint32_t keyType);
257 
262  void GetKeysFromKMS (uint32_t keyType);
263 
269  void GetKeyWithKeyIDs();
270 
275  void ConnectionToKMSFailed (Ptr<Socket> socket);
276 
282 
287  void ConnectionToAppFailed (Ptr<Socket> socket);
288 
294 
300 
306 
312  void DataToKMSSend (Ptr<Socket>, uint32_t);
313 
318  void HandleReadFromKMS (Ptr<Socket> socket);
319 
324  void HandlePeerCloseFromKMS (Ptr<Socket> socket);
325 
330  void HandlePeerErrorFromKMS (Ptr<Socket> socket);
331 
337  void HandleAcceptFromKMS (Ptr<Socket> s, const Address& from);
338 
343  void HandleReadFromApp (Ptr<Socket> socket);
344 
349  void HandlePeerCloseFromApp (Ptr<Socket> socket);
350 
355  void HandlePeerErrorFromApp (Ptr<Socket> socket);
356 
362  void HandleAcceptFromApp (Ptr<Socket> s, const Address& from);
363 
369 
375 
381 
387  void HandleAcceptSignalingFromApp (Ptr<Socket> s, const Address& from);
388 
395 
402  void PacketReceivedFromKMS (const Ptr<Packet> &p, const Address &from, Ptr<Socket> socket);
403 
410  void SignalingPacketReceivedFromApp (const Ptr<Packet> &p, const Address &from, Ptr<Socket> socket);
411 
418  void DataPacketReceivedFromApp (const Ptr<Packet> &p, const Address &from, Ptr<Socket> socket);
419 
426  void ProcessResponseFromKMS(HTTPMessage& header, Ptr<Packet> packet, Ptr<Socket> socket);
427 
433  void ProcessStatusResponse (HTTPMessage& header, nlohmann::json jstatusResponse);
434 
440  void ProcessGetKeyResponse (HTTPMessage& header, nlohmann::json jGetKeyResponse);
441 
447  void ProcessGetKeyWithKeyIDsResponse(HTTPMessage& header, nlohmann::json jGetKeyWithKeyIDsResponse);
448 
456 
463  void ProcessDataPacketFromApp(QKDAppHeader header, Ptr<Packet> packet, Ptr<Socket> socket);
464 
469 
473  void PrepareSendSocketToKMS();
474 
479 
483  void PrepareSendSocketToApp();
484 
491  uint32_t ScheduleAction(Time t, std::string action);
492 
497  void CancelScheduledAction(uint32_t eventId);
498 
506  uint32_t encryptionType,
507  uint32_t authenticationType,
508  uint32_t authenticationTagLengthInBits
509  );
510 
515  uint32_t GetEncryptionKeySize();
516 
521  uint32_t GetAuthenticationKeySize ();
522 
529 
536  QKDApp014::QKDApp014Key GetKeyFromAppKeyBuffer (std::string keyId, std::string keyType);
537 
542  QKDApp014State GetAppState () const;
543 
548  std::string GetAppStateString () const;
549 
555  static std::string GetAppStateString (QKDApp014State state);
556 
561  UUID GetId (void) {
562  return m_id;
563  }
564 
569  void SwitchAppState (QKDApp014State state);
570 
571 
577  std::string GetPacketContent(uint32_t msgLength = 0);
578 
587 
588 private:
589 
590 
598  void MemoriesRequestKMS (uint32_t methodType, uint32_t keyType = 0);
599 
607  std::string CreateKeyIdField(std::string keyId);
608 
614  std::string ReadKeyIdField(std::string keyId);
615 
620  void MemoriesRequestApp (std::vector<std::string> keyIds);
621 
625  void RequestProcessedKMS (void);
626 
630  void RequestProcessedApp (void);
631 
636  uint32_t GetETSIMethod (void);
637 
642  uint32_t GetKeyType (void);
643 
647  struct AddressHash
648  {
659  size_t operator() (const Address &x) const
660  {
663  return std::hash<uint32_t>()(a.GetIpv4 ().Get ());
664  }
665  };
666 
667  virtual void StartApplication (void);
668  virtual void StopApplication (void);
669 
673  void ScheduleTx (void);
674 
678  void AppTransitionTree (void);
679 
691  std::string ksid,
692  std::vector<std::string> keyIds,
694  );
695 
699  void SendPacket (void);
700 
705 
708 
711 
714 
716 
717  std::string m_socketType;
718 
719  uint32_t m_packetSize;
722  uint32_t m_packetsSent;
723  uint32_t m_dataSent;
725  uint32_t m_master;
726 
729 
731 
734 
735  //HTTP mapping responses to requests!
736  std::vector<std::pair<uint32_t, uint32_t> > m_httpRequestsKMS;
737  std::vector<std::vector<std::string> > m_httpRequestsApp;
738 
741 
744 
745  static uint32_t m_applicationCounts;
746 
747  //LKMS PARAMS
748  uint32_t m_numberOfKeysKMS;
749 
750  //Crypto params
751  uint32_t m_useCrypto;
755  uint64_t m_aesLifetime;
763 
765 
767 
768  std::unordered_map<Address, Ptr<Packet>, AddressHash> m_buffer_kms;
769  std::unordered_map<Address, Ptr<Packet>, AddressHash> m_buffer_sig;
770  std::unordered_map<Address, Ptr<Packet>, AddressHash> m_buffer_QKDApp014;
771 
773  std::map<uint32_t, EventId > m_scheduledEvents;
774  std::multimap<std::string, std::string> m_transitionMatrix;
775 
776 };
777 
778 
779 } // namespace ns3
780 
781 #endif /* QKD_SINK_H */
a polymophic address class
Definition: address.h:91
The base class for all ns3 applications.
Definition: application.h:61
Class for representing data rates.
Definition: data-rate.h:89
An identifier for simulation events.
Definition: event-id.h:54
The basic class to represent both HTTP requests and responses.
Definition: http.h:78
an Inet address class
Ipv4Address GetIpv4(void) const
static bool IsMatchingType(const Address &address)
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
uint32_t Get(void) const
Get the host-order 32-bit IP address.
Establish secure communication on application lavel to use the key and test LKSM.
Definition: qkd-app-014.h:82
uint32_t m_master
Is a master (sender/primary) application?
Definition: qkd-app-014.h:725
void HandleAcceptFromKMS(Ptr< Socket > s, const Address &from)
Handle an incoming connection from the KMS.
Definition: qkd-app-014.cc:518
void GetKeyWithKeyIDs()
Requests keys with given identifiers from the KMS (ETSI QKD 014 - Get key with key IDs method).
void PrepareSendSocketToKMS()
Prepare the send socket to communicate with the KMS Application.
Definition: qkd-app-014.cc:378
uint32_t GetKeyType(void)
Map the HTTP response and obtain the key type.
Definition: qkd-app-014.cc:939
void SwitchAppState(QKDApp014State state)
Change the state of the application.
void HandleReadFromKMS(Ptr< Socket > socket)
Handle a packet received from the KMS application.
Definition: qkd-app-014.cc:625
Ptr< QKDEncryptor > m_encryptor
The QKD encryptor.
Definition: qkd-app-014.h:762
void ConnectionSignalingToAppSucceeded(Ptr< Socket > socket)
Callback function after the signaling connection to the APP is complete.
Definition: qkd-app-014.cc:578
TracedCallback< const uint32_t & > m_obtainedKeyMaterialTrace
A trace callback for the obtained key material.
Definition: qkd-app-014.h:764
std::string CreateKeyIdField(std::string keyId)
Adjust the encryption key identifier for the QKDApp header.
void HandlePeerCloseSignalingFromApp(Ptr< Socket > socket)
Handle a signaling connection close from the peer QKD application.
Definition: qkd-app-014.cc:613
TracedCallback< Ptr< const Packet >, std::string > m_txTrace
A trace for transmitted data packets.
Definition: qkd-app-014.h:579
void ConnectionSignalingToAppFailed(Ptr< Socket > socket)
Callback function after the signaling connection to the APP has failed.
Definition: qkd-app-014.cc:584
void AddAuthKeyInKeyStore(QKDApp014::QKDApp014Key &key)
Add a new key to the authentication key store.
Definition: qkd-app-014.cc:777
void ProcessStatusResponse(HTTPMessage &header, nlohmann::json jstatusResponse)
Process the status response from the KMS.
QKDApp014State
The application states.
Definition: qkd-app-014.h:143
std::string GetPacketContent(uint32_t msgLength=0)
Generate a random packet (message) of a given size.
void HandlePeerErrorFromKMS(Ptr< Socket > socket)
Handle a connection error from the KMS.
Definition: qkd-app-014.cc:596
std::unordered_map< Address, Ptr< Packet >, AddressHash > m_buffer_kms
The buffer for the received packets from the KMS (fragmentation).
Definition: qkd-app-014.h:768
QKDApp014State GetAppState() const
Get the current state of the application.
TypeId m_tid
The type identifier.
Definition: qkd-app-014.h:724
UUID m_ksid_auth
The authentication key stream identifier.
Definition: qkd-app-014.h:743
static TypeId GetTypeId(void)
Get the type ID.
Definition: qkd-app-014.cc:44
void GetKeysFromKMS(uint32_t keyType)
Request keys from the KMS (ETSI QKD 014 - Get key method).
Time m_waitInsufficient
The amount of time spent waiting before issuing a new GET_KEY request when the previous one resulted ...
Definition: qkd-app-014.h:727
void SendPacket(void)
Send the application packet (includes the generation of a random message and optional encryption or/a...
void ConnectionToKMSSucceeded(Ptr< Socket > socket)
Callback function after the connection to the KMS is complete.
Definition: qkd-app-014.cc:554
void ProcessDataPacketFromApp(QKDAppHeader header, Ptr< Packet > packet, Ptr< Socket > socket)
Process the data packets from the peer QKD application.
std::vector< std::vector< std::string > > m_httpRequestsApp
A vector of HTTP requests sent to the peer application.
Definition: qkd-app-014.h:737
std::map< uint32_t, EventId > m_scheduledEvents
The map of scheduled events.
Definition: qkd-app-014.h:773
void MemoriesRequestKMS(uint32_t methodType, uint32_t keyType=0)
Memories the HTTP request made to the local KMS.
Definition: qkd-app-014.cc:909
TracedCallback< Ptr< const Packet >, std::string > m_mxTrace
A trace for the missed time slots to send data packets.
Definition: qkd-app-014.h:586
UUID m_dstSaeId
The peer application identifier.
Definition: qkd-app-014.h:740
uint32_t ScheduleAction(Time t, std::string action)
Schedule the action.
Definition: qkd-app-014.cc:296
DataRate m_dataRate
The application data rate.
Definition: qkd-app-014.h:720
UUID m_ksid_enc
The encryption key stream identifier.
Definition: qkd-app-014.h:742
void AddEncKeyInKeyStore(QKDApp014::QKDApp014Key &key)
Add a new key to the encryption key store.
Definition: qkd-app-014.cc:770
void PacketReceivedFromKMS(const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
Check for the TCP segmentation of the packets received from the KMS.
uint32_t GetETSIMethod(void)
Map the HTTP response and obtrain the request method.
Definition: qkd-app-014.cc:933
void HandleAcceptSignalingFromApp(Ptr< Socket > s, const Address &from)
Handle a signaling incoming connection from the peer QKD application.
Definition: qkd-app-014.cc:542
uint32_t GetAuthenticationKeySize()
Get required key size for the choosen authentication algorithm.
TracedCallback< Ptr< const Packet > > m_txKmsTrace
A trace for transmitted packets to the KMS.
Definition: qkd-app-014.h:581
void HandlePeerCloseFromKMS(Ptr< Socket > socket)
Handle a connection close from the KMS.
Definition: qkd-app-014.cc:590
QKDApp014State m_appState
The application state.
Definition: qkd-app-014.h:766
uint32_t GetEncryptionKeySize()
Get required key size for the choosen encryption algorithm.
void MemoriesRequestApp(std::vector< std::string > keyIds)
Memories the HTTP request made to the peer QKD application.
Definition: qkd-app-014.cc:915
Ptr< Socket > m_sendSocketToKMS
The sending socket to the KMS.
Definition: qkd-app-014.h:706
void ProcessResponseFromKMS(HTTPMessage &header, Ptr< Packet > packet, Ptr< Socket > socket)
Process the response from the KMS application.
uint32_t m_encryptionTypeInt
The encryption algorithm.
Definition: qkd-app-014.h:752
void ProcessGetKeyResponse(HTTPMessage &header, nlohmann::json jGetKeyResponse)
Process the GET_KEY response from the KMS.
void HandleAcceptFromApp(Ptr< Socket > s, const Address &from)
Handle an incoming connection from the peer QKD application.
Definition: qkd-app-014.cc:530
void ConnectionToAppFailed(Ptr< Socket > socket)
Callback function after the connection to the APP has failed.
Definition: qkd-app-014.cc:572
std::string GetAppStateString() const
Get the current state of the application in the string format.
Address m_kms
The local KMS address.
Definition: qkd-app-014.h:715
uint32_t m_authenticationTagLengthInBits
The size of the authentication tag in bits (32 by default).
Definition: qkd-app-014.h:754
TracedCallback< Ptr< const Packet > > m_rxSigTrace
A trace for received signaling packets.
Definition: qkd-app-014.h:583
void ExchangeInfoMessages(std::string ksid, std::vector< std::string > keyIds, HTTPMessage::HttpStatus statusCode=HTTPMessage::Ok)
Exchange key identifiers between sending and receiving application.
ns3::TracedCallback< const std::string &, const std::string & > m_stateTransitionTrace
The posible application state transitions.
Definition: qkd-app-014.h:585
TracedCallback< Ptr< Packet >, std::string > m_authenticationTrace
A trace callback for the authentication event.
Definition: qkd-app-014.h:758
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 QKD application.
QKDApp014()
Constructor.
Definition: qkd-app-014.cc:153
uint32_t m_numberOfKeysKMS
The number of keys to fetch per request.
Definition: qkd-app-014.h:748
std::string ReadKeyIdField(std::string keyId)
Rebuild the key identifier for the QKDApp header.
bool ConnectionRequestedFromKMS(Ptr< Socket > socket, const Address &address)
Callback function after the connection response from the KMS has been received.
Definition: qkd-app-014.cc:506
void RequestProcessedKMS(void)
Remove the request from the HTTP requests store (once the response from the KMS has been processed).
Definition: qkd-app-014.cc:921
virtual void StartApplication(void)
Definition: qkd-app-014.cc:953
void CheckAppBufferState()
Check the state of the application key buffer.
Definition: qkd-app-014.cc:802
std::string m_socketType
The sockets type.
Definition: qkd-app-014.h:717
QKDApp014KeyBuffer m_appKeyBuffer
The application key buffer.
Definition: qkd-app-014.h:732
UUID GetId(void)
Get the application identifier.
Definition: qkd-app-014.h:561
Address m_localSignaling
The local address for the signaling data transmission.
Definition: qkd-app-014.h:713
TracedCallback< Ptr< Packet > > m_encryptionTrace
A trace callback for the encryption event.
Definition: qkd-app-014.h:756
std::vector< std::pair< uint32_t, uint32_t > > m_httpRequestsKMS
A vector of HTTP requests set to the KMS.
Definition: qkd-app-014.h:736
EventId m_sendEvent
The data transmission event.
Definition: qkd-app-014.h:721
void PrintAppBufferStatusInformation()
Print the status information on the application key buffer.
Definition: qkd-app-014.cc:794
uint32_t m_authenticationTypeInt
The authentication algorithm.
Definition: qkd-app-014.h:753
void ProcessGetKeyWithKeyIDsResponse(HTTPMessage &header, nlohmann::json jGetKeyWithKeyIDsResponse)
Process the Get Key with Key IDs response from the KMS.
void InitializeAppKeyBuffer()
Initialize the application key buffer.
Definition: qkd-app-014.cc:736
uint32_t m_packetSize
The data packet size.
Definition: qkd-app-014.h:719
void HandleReadFromApp(Ptr< Socket > socket)
Handle a packet received from the peer QKD application.
Definition: qkd-app-014.cc:658
TracedCallback< Ptr< const Packet > > m_txSigTrace
A trace for transmitted signaling packets.
Definition: qkd-app-014.h:580
Ptr< Socket > m_sendDataSocketApp
The sending socket for the data.
Definition: qkd-app-014.h:703
TracedCallback< Ptr< const Packet > > m_rxKmsTrace
A trace for received packets from the KMS.
Definition: qkd-app-014.h:584
virtual void StopApplication(void)
Application specific shutdown code.
Definition: qkd-app-014.cc:992
void HandlePeerErrorFromApp(Ptr< Socket > socket)
Handle a connection error from the peer QKD application.
Definition: qkd-app-014.cc:607
void ConnectionToAppSucceeded(Ptr< Socket > socket)
Callback function after the connection to the APP is complete.
Definition: qkd-app-014.cc:566
void ProcessSignalingPacketFromApp(HTTPMessage &header, Ptr< Packet > packet, Ptr< Socket > socket)
Process the signaling packets received from the peer QKD application.
uint32_t m_packetsSent
The number of sent data packets.
Definition: qkd-app-014.h:722
uint64_t m_aesLifetime
The AES key lifetime.
Definition: qkd-app-014.h:755
void DataPacketReceivedFromApp(const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
Check for the TCP segmentation of the data packets received from the peer QKD application.
void DataToKMSSend(Ptr< Socket >, uint32_t)
Callback function to notify that data to KMS has been sent.
Definition: qkd-app-014.cc:722
void ConnectionToKMSFailed(Ptr< Socket > socket)
Callback function after the connection to the KMS has failed.
Definition: qkd-app-014.cc:560
Ptr< Socket > m_sinkDataSocketApp
The receiving socket for the data.
Definition: qkd-app-014.h:704
TracedCallback< Ptr< const Packet >, std::string > m_rxTrace
A trace for received data packets.
Definition: qkd-app-014.h:582
std::unordered_map< Address, Ptr< Packet >, AddressHash > m_buffer_QKDApp014
The buffer for received data packets (fragmentation).
Definition: qkd-app-014.h:770
void SetEncryptionAndAuthenticationSettings(uint32_t encryptionType, uint32_t authenticationType, uint32_t authenticationTagLengthInBits)
Set the encryption and the authentication algorithms.
void CancelScheduledAction(uint32_t eventId)
Cancel the scheduled event/action.
Definition: qkd-app-014.cc:318
Ptr< Socket > m_sinkSocketFromKMS
The receiving socket from the KMS.
Definition: qkd-app-014.h:707
QKDApp014::QKDApp014Key GetKeyFromAppKeyBuffer(uint32_t keyType)
Get the key from the application key buffer.
Definition: qkd-app-014.cc:833
void RemoveKeysFromTemporaryKeyStore(std::vector< std::string > keyIds)
Remove keys from the temporary key store.
Definition: qkd-app-014.cc:748
Address m_local
The local address for the data transmission.
Definition: qkd-app-014.h:712
void HandlePeerErrorSignalingFromApp(Ptr< Socket > socket)
Handle a signaling connection error from the peer QKD application.
Definition: qkd-app-014.cc:619
static uint32_t m_applicationCounts
The number of running applications.
Definition: qkd-app-014.h:745
nlohmann::json m_keyIDs
The latest received key identifiers from the sender application.
Definition: qkd-app-014.h:733
bool m_internalAppWait
The indicator for the longer wait (used after the GetKey error!).
Definition: qkd-app-014.h:772
void AppTransitionTree(void)
Transition through a tree of the application states and trigger actions.
void CheckAppState()
Check the conditions to change the application state.
Definition: qkd-app-014.cc:817
uint32_t m_useCrypto
Execute actual cryptographic algorithms?
Definition: qkd-app-014.h:751
std::multimap< std::string, std::string > m_transitionMatrix
The map of the possible state transitions.
Definition: qkd-app-014.h:774
void RequestProcessedApp(void)
Remove request from the HTTP requests store (once the response from the peer application has been pro...
Definition: qkd-app-014.cc:927
virtual ~QKDApp014()
Destructor.
Definition: qkd-app-014.cc:190
Ptr< UniformRandomVariable > m_random
The uniform random variable.
Definition: qkd-app-014.h:730
TracedCallback< Ptr< Packet >, std::string > m_deauthenticationTrace
A trace callback for the authentication check event.
Definition: qkd-app-014.h:759
void PrintTemporaryKeyStoreContent()
Print the content of the temporary key store.
Definition: qkd-app-014.cc:784
void PrepareSendSocketToApp()
Prepare the send socket to communicate with the peer QKD Application.
Definition: qkd-app-014.cc:404
void SetKsidAuthentication(UUID val)
Set the authentication identifier.
Definition: qkd-app-014.h:112
void Setup(std::string socketType, Address src, Address dst, Address kms, UUID dstSaeId, std::string type)
Configure the application.
Definition: qkd-app-014.cc:204
UUID m_id
The application identifier.
Definition: qkd-app-014.h:739
void HandleReadSignalingFromApp(Ptr< Socket > socket)
Handle a signaling packet received from the peer QKD application.
Definition: qkd-app-014.cc:690
void GetStatusFromKMS(uint32_t keyType)
Request status information from the KMS (ETSI QKD 014 - Get status method).
Time m_waitTransform
The amount of time spent waiting before issuing a new GET_KEY request when the previous one resulted ...
Definition: qkd-app-014.h:728
TracedCallback< Ptr< Packet > > m_decryptionTrace
A trace callback for the decryption event.
Definition: qkd-app-014.h:757
Ptr< Socket > m_sendSignalingSocketApp
The sending socket for the signaling messages.
Definition: qkd-app-014.h:701
void ScheduleTx(void)
Schedule the time slot to send the data packets.
Definition: qkd-app-014.cc:279
Address m_peer
The address of the peer for the data transmission.
Definition: qkd-app-014.h:709
QKDEncryptor::AuthenticationType m_authenticationType
The authentication algorithm.
Definition: qkd-app-014.h:761
Address m_peerSignaling
The address of the peer for the signaling data transmission.
Definition: qkd-app-014.h:710
void HandlePeerCloseFromApp(Ptr< Socket > socket)
Handle a connection close from the peer QKD application.
Definition: qkd-app-014.cc:602
uint32_t m_dataSent
The amount of the sent data.
Definition: qkd-app-014.h:723
void AddKeyInInboundKeyStore(QKDApp014::QKDApp014Key &key)
Add a new key to the inbound key store.
Definition: qkd-app-014.cc:763
Ptr< Socket > m_sinkSignalingSocketApp
The receiving socket for the signaling messages.
Definition: qkd-app-014.h:702
void PrepareSinkSocketFromApp()
Prepare the sink socket to listen from the peer QKD Application.
Definition: qkd-app-014.cc:446
QKDEncryptor::EncryptionType m_encryptionType
The encryption algorithm.
Definition: qkd-app-014.h:760
void SetKsidEncryption(UUID val)
Set the encryption identifier.
Definition: qkd-app-014.h:104
std::unordered_map< Address, Ptr< Packet >, AddressHash > m_buffer_sig
The buffer for the received signaling packets (fragmentation).
Definition: qkd-app-014.h:769
void PrepareSinkSocketFromKMS()
Prepare the sink socket to listen from the KMS Application.
Definition: qkd-app-014.cc:340
QKD app packet header that carries info about used encryption, auth tag and other.
EncryptionType
Encryption type.
Definition: qkd-encryptor.h:96
AuthenticationType
Authentication type.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Universally unique identifier (UUID)
Definition: uuid.h:35
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
address
Definition: first.py:44
basic_json<> json
default JSON class
Definition: json.h:3000
Every class exported by the ns3 library is enclosed in the ns3 namespace.
list x
Random number samples.
Hashing for the Address class.
Definition: qkd-app-014.h:648
size_t operator()(const Address &x) const
operator ()
Definition: qkd-app-014.h:659
The key buffer at the application layer.
Definition: qkd-app-014.h:132
std::map< std::string, QKDApp014Key > outboundEncKeyStore
Definition: qkd-app-014.h:133
std::map< std::string, QKDApp014Key > outboundAuthKeyStore
Definition: qkd-app-014.h:134
std::map< std::string, QKDApp014Key > inboundKeyStore
Definition: qkd-app-014.h:135
std::map< std::string, QKDApp014Key > temporaryKeyStoreMaster
Definition: qkd-app-014.h:136
The cryptographic key at the application layer.
Definition: qkd-app-014.h:120
static const uint32_t packetSize