21 #ifndef QKD_POSTPROCESSING_APPLICATION_H
22 #define QKD_POSTPROCESSING_APPLICATION_H
24 #include "ns3/application.h"
25 #include "ns3/address.h"
26 #include "ns3/event-id.h"
27 #include "ns3/nstime.h"
30 #include "ns3/data-rate.h"
31 #include "ns3/traced-callback.h"
32 #include "ns3/event-id.h"
34 #include "ns3/ipv4-address.h"
35 #include "ns3/random-variable-stream.h"
36 #include "ns3/qkd-key-manager-system-application.h"
37 #include "ns3/socket-factory.h"
38 #include "ns3/tcp-socket-factory.h"
39 #include "ns3/udp-socket-factory.h"
40 #include "ns3/ipv4-l3-protocol.h"
a polymophic address class
The base class for all ns3 applications.
Class for representing data rates.
An identifier for simulation events.
Ptr< Socket > m_sinkSocketKMS
Associated socket.
void HandleRead(Ptr< Socket > socket)
Handle a packet received from the peer application.
void SendPacketToKMS(Ptr< QKDKey > packet)
Send the packet to the local KMS.
void HandleAccept(Ptr< Socket > socket, const Address &from)
Handle an incoming connection from the application.
std::list< Ptr< Socket > > m_sinkSocketList
the accepted sockets
void PrepareOutput(std::string value, std::string action)
Prepare the output data.
bool m_connected
Connection Status.
void ConnectionFailedSifting(Ptr< Socket > socket)
Callback function after the sifting connection has failed.
void StartApplication(void)
Start the post-processing application.
void HandlePeerCloseKMS(Ptr< Socket > socket)
Handle a connection close from the KMS.
std::string m_lastUUID
The latest UUID of the key.
Ptr< Socket > GetSinkSocket(void) const
Get the sink socket.
Ptr< Socket > GetListeningSocket(void) const
Get the listening socket.
TracedCallback< Ptr< const Packet >, const Address & > m_rxTraceKMS
Ptr< Node > GetSrc()
Get the source node.
uint64_t m_keyId
ID counter of generated keys.
void HandleAcceptKMS(Ptr< Socket > socket, const Address &from)
Handle an incoming connection from the KMS.
Ptr< Node > GetDst()
Get the destination node.
std::list< Ptr< Socket > > GetAcceptedSockets(void) const
Get the list of the accepted sockets.
QKDPostprocessingApplication()
Constructor.
Address m_peer_sifting
Peer address for sifting.
std::string GenerateRandomString(const int len)
Generate a random string with a given length.
uint32_t m_maxPackets_sifting
Limitation for the number of sifting packets.
void SetSiftingSocket(std::string type, Ptr< Socket > socket)
Set the sifting socket.
void HandlePeerError(Ptr< Socket > socket)
Handle a connection error from the peer application.
Ptr< Socket > m_sendSocket_sifting
Sockets used for SIFTING.
uint32_t m_pktSize
Size of packets.
Time GetLastAckTime()
Get the timestamp of the last acknowledgement.
DataRate m_dataRate
Rate that data is generatedm_pktSize.
void ConnectionFailed(Ptr< Socket > socket)
Callback function after the connection to the peer application has failed.
Ptr< Socket > m_sinkSocket_sifting
Associated socket for sifting.
void SetSocket(std::string type, Ptr< Socket > socket, bool isMaster)
Set the socket.
void HandleReadKMS(Ptr< Socket > socket)
Handle a packet received from the KMS.
TracedCallback< Ptr< const Packet > > m_txTrace
static TypeId GetTypeId(void)
Get the type ID.
void HandleReadSifting(Ptr< Socket > socket)
Handle a sifting packet received from the application.
void SendData()
Schedule time slot to send data.
void GenerateRandomKeyId()
Generate a random seed that will be used to generate key values.
virtual ~QKDPostprocessingApplication()
Donstructor.
void SendPacket(Ptr< Packet > packet)
Send the packet to the socket.
Address m_local_sifting
Local address for sifting to bind to.
bool m_master
Alice (1) or Bob (0)
void SendSiftingPacket(void)
Send the sifting packet to the socket.
void RegisterAckTime(Time oldRtt, Time newRtt)
Callback for ack messages.
void ConnectionSucceededSifting(Ptr< Socket > socket)
Callback function after the sifting connection is complete.
Address m_local
Local address to bind to.
void ConnectionSucceededKMS(Ptr< Socket > socket)
Callback function after the connection to the KMS is complete.
std::string m_appId
Random string marking the app ID.
void DataSend(Ptr< Socket > s, uint32_t)
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
Traced Callback: received packets, source address.
EventId m_sendEvent
Event id of pending "send packet" event.
uint32_t m_totalRx
Total bytes received
void ScheduleNextReset()
Schedule a reset of the post-processing round.
Ptr< UniformRandomVariable > m_random
The uniform random variable.
Ptr< Socket > m_sendSocket
IMITATE post-processing traffic (CASCADE, PRIVACY AMPLIFICATION and etc.
void ConnectionSucceeded(Ptr< Socket > socket)
Callback function after the connection to the peer application is complete.
Ptr< Node > m_src
The source node.
void ProcessIncomingPacket(Ptr< Packet > packet)
Process data received.
Ptr< Socket > m_sendSocketKMS
Sockets to talk with LKMS.
Ptr< Socket > m_sinkSocket
Associated socket.
uint32_t GetTotalRx() const
Get the total amount of data received (in bytes).
void ResetCounter()
Reset the counter after completing the post-processing round.
void SetSrc(Ptr< Node >)
Set the source node.
DataRate m_keyRate
QKD Key rate.
TracedCallback< Ptr< const Packet > > m_txTraceKMS
void ConnectionFailedKMS(Ptr< Socket > socket)
Callback function after the connection to the KMS has failed.
uint32_t m_keySizeInBits
KeyRate of the QKDlink.
void DataSendKMS(Ptr< Socket > s, uint32_t)
virtual void DoDispose(void)
Destructor implementation.
Ptr< Node > m_dst
The destination node.
void HandlePeerErrorKMS(Ptr< Socket > socket)
Handle a connection error from the KMS.
uint32_t m_packetNumber_sifting
How many sifting packets have been sent.
Address m_peer
Peer address.
void StopApplication(void)
Stop the post-processing application.
void HandleAcceptSifting(Ptr< Socket > socket, const Address &from)
Handle an incoming connection for the sifting.
Ptr< Socket > GetSendSocket(void) const
Get the send socket.
void HandlePeerClose(Ptr< Socket > socket)
Handle a connection close from the peer application.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.