A Discrete-Event Network Simulator
API
ns3::QKDSDNController Class Reference

#include "qkd-sdn-controller.h"

+ Inheritance diagram for ns3::QKDSDNController:
+ Collaboration diagram for ns3::QKDSDNController:

Classes

struct  AddressHash
 Hashing for the Address class. More...
 
struct  Association004
 
struct  ChunkKey
 
struct  HttpQuery
 
struct  QoS
 

Public Types

enum  RequestType {
  NONE = 50 , GET_ROUTE = 12 , REGISTER_SAE_LINK = 13 , REGISTER_QKD_LINK = 14 ,
  KEY_ASSOCIATION_STATUS = 15 , ETSI_QKD_014_GET_STATUS = 0 , ETSI_QKD_014_GET_KEY = 1 , ETSI_QKD_014_GET_KEY_WITH_KEY_IDS = 2 ,
  ETSI_QKD_004_OPEN_CONNECT = 3 , ETSI_QKD_004_GET_KEY = 4 , ETSI_QKD_004_CLOSE = 5 , NEW_APP = 6 ,
  REGISTER = 7 , FILL = 8 , STORE_PP_KEYS = 9 , TRANSFORM_KEYS = 10 ,
  ETSI_QKD_004_KMS_CLOSE = 11
}
 Request types. 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

 QKDSDNController ()
 QKDSDNController constructor. More...
 
virtual ~QKDSDNController ()
 QKDSDNController destructor. More...
 
void AddNewLink (uint32_t srcSaeId, uint32_t dstSaeId, Ipv4Address kmsDstAddress, Ptr< QKDBuffer > srcBuffer)
 Inform KMS about the new QKD connection/link. More...
 
std::map< Ptr< Socket >, Ptr< Socket > > GetAcceptedSockets (void) const
 Get list of all accepted sockets. More...
 
Ipv4Address GetAddress ()
 Get local address. More...
 
uint32_t GetId ()
 Get key menager system ID. More...
 
uint32_t GetMaxKeyPerRequest ()
 Get maximum number of keys per request (ETSI QKD 014) More...
 
Ptr< NodeGetNode ()
 Get node. More...
 
uint32_t GetPort ()
 Get local port. More...
 
Ptr< SocketGetSocket (void) const
 Get sink socket. More...
 
uint32_t GetTotalRx () const
 Get the total amount of bytes received. More...
 
void RegisterSaePair (Ptr< Node > srcNode, Ptr< Node > dstNode, uint32_t srcSaeId, uint32_t dstSaeId, std::string type)
 Inform KMS about the SAE connection. More...
 
void SetAddress (Ipv4Address address)
 Set local address. More...
 
void SetNode (Ptr< Node > n)
 Set node. More...
 
void SetPort (uint32_t port)
 Set local port. More...
 
void SetSocket (std::string type, Ptr< Socket > socket)
 Set sink socket. More...
 
- Public Member Functions inherited from ns3::Application
 Application ()
 
virtual ~Application ()
 
Ptr< NodeGetNode () 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...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<>
Ptr< ObjectGetObject () 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< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) 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 (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= ([[maybe_unused]] const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) 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 erros. 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 TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Application
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

virtual void DoDispose (void)
 @toDo More...
 
- Protected Member Functions inherited from ns3::Application
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void NotifyNewAggregate (void)
 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 (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Private Member Functions

std::string Base64Decode (std::string input)
 Base64 decoder. More...
 
std::string Base64Encode (std::string input)
 Base64 encoder. More...
 
void CheckSocketsKMS (Ipv4Address dstSaeId)
 Prepare send socket to communicate with peer KMS Application. More...
 
void ConnectionFailed (Ptr< Socket > socket)
 
void ConnectionFailedKMSs (Ptr< Socket > socket)
 
void ConnectionSucceeded (Ptr< Socket > socket)
 @toDo:following functions More...
 
void ConnectionSucceededKMSs (Ptr< Socket > socket)
 
nlohmann::json CreateKeyContainer (std::vector< Ptr< QKDKey >> keys)
 Check the correctness of QKD application request and ability of KMS to fullfil correct request. More...
 
std::string CreateNew004Association (uint32_t srcSaeId, uint32_t dstSaeId, QKDSDNController::QoS inQos, Ipv4Address dstKms, std::string ksid)
 Create a new assocation. More...
 
void DataSend (Ptr< Socket >, uint32_t)
 
void DataSendKMSs (Ptr< Socket >, uint32_t)
 
QKDSDNController::RequestType FetchRequestType (std::string s)
 Get request type. More...
 
Ipv4Address GetDestinationKmsAddress (Ptr< Socket > socket)
 
Ptr< SocketGetSendSocketKMS (Ipv4Address kmsDstAddress)
 Obtain send socket. More...
 
Ptr< SocketGetSocketFromHttp004AppQuery (uint32_t saeId)
 
void HandleAccept (Ptr< Socket > s, const Address &from)
 Handle an incoming connection. More...
 
void HandlePeerClose (Ptr< Socket > socket)
 Handle an connection close. More...
 
void HandlePeerError (Ptr< Socket > socket)
 Handle an connection error. More...
 
void HandleRead (Ptr< Socket > socket)
 Handle a packet received by the KMS application. More...
 
void Http004AppQuery (uint32_t saeId, Ptr< Socket > socket)
 
void Http004AppQueryComplete (uint32_t saeId)
 
void HttpKMSAddQuery (Ipv4Address dstKms, HttpQuery request)
 remember HTTP request made to peer KMS More...
 
void HttpKMSCompleteQuery (Ipv4Address dstKms)
 remove mapped HTTP response from query More...
 
RequestType HttpQueryMethod (Ipv4Address dstKms)
 obtain method_type to map the HTTP response More...
 
void PacketReceived (const Ptr< Packet > &p, const Address &from, Ptr< Socket > socket)
 Assemble byte stream to extract HTTPMessage. More...
 
std::string PacketToString (Ptr< Packet > packet)
 Convert packet to string. More...
 
void PrepareSinkSocket ()
 
void ProcessAddKeysRequest (HTTPMessage h, Ptr< Socket > socket, std::string ksid)
 Process FILL request. More...
 
void ProcessAddKeysResponse (HTTPMessage header, Ptr< Socket > socket)
 Process FILL response. More...
 
void ProcessCloseRequest (std::string ksid, HTTPMessage header, Ptr< Socket > socket)
 
void ProcessGetKey004Request (std::string ksid, HTTPMessage header, Ptr< Socket > socket)
 
void ProcessNewAppRequest (HTTPMessage header, Ptr< Socket > socket)
 
void ProcessNewAppResponse (HTTPMessage header, Ptr< Socket > socket)
 
void ProcessOpenConnectRequest (HTTPMessage header, Ptr< Socket > socket)
 
void ProcessRegisterRequest (HTTPMessage header, std::string ksid, Ptr< Socket > socket)
 
void ProcessRegisterResponse (HTTPMessage header, Ptr< Socket > socket)
 
void ProcessRequest (HTTPMessage header, Ptr< Packet > packet, Ptr< Socket > socket)
 QKD key manager system application process the request from QKDApp, and complete certain actions to respond on received request. More...
 
void ReadJsonQos (QKDSDNController::QoS &inQos, nlohmann::json jOpenConnectRequest)
 Read the parameters from the JSON OPEN_CONNECT structure! More...
 
void RegisterRequest (std::string ksid)
 
void ReleaseAssociation (std::string ksid, std::string surplusKeyId, uint32_t syncIndex)
 release key stream association More...
 
void SendToSocketPair (Ptr< Socket > socket, Ptr< Packet > packet)
 Send packet to the pair socket. More...
 
void SendToSocketPairKMS (Ptr< Socket > socket, Ptr< Packet > packet)
 Send packet to the pair socket. More...
 
void StartApplication (void)
 Start KMS Application. More...
 
void StopApplication (void)
 Stop KMS Application. More...
 

Private Attributes

std::map< std::string, Association004m_associations004
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_buffer
 Buffer for received packets (TCP segmentation) More...
 
std::unordered_map< Address, Ptr< Packet >, AddressHashm_bufferKMS
 Buffer for received packets (TCP segmentation) More...
 
EventId m_closeSocketEvent
 
uint32_t m_defaultKeySize
 
TracedCallback< const Ipv4Address &, Ptr< const Packet > > m_dropTrace
 Traced callback: fired when a packet is dropped. More...
 
std::map< Ipv4Address, uint32_t > m_flagedIPAdr
 
std::multimap< uint32_t, Ptr< Socket > > m_http004App
 
std::map< Ipv4Address, std::vector< HttpQuery > > m_httpRequestsQueryKMS
 
TracedCallback< const std::string &, const uint32_t &, const uint32_t &, const uint32_t & > m_keyServedETSI004Trace
 
TracedCallback< const std::string &, const uint32_t &, Ptr< QKDKey > > m_keyServedETSI014Trace
 
TracedCallback< const uint32_t & > m_keyServedTraceEmir
 
uint32_t m_kms_id
 
uint32_t m_kms_key_id
 
Ipv4Address m_local
 Local address to bind to. More...
 
uint32_t m_maliciousBlocking
 
uint32_t m_maxKeyPerRequest
 
uint32_t m_maxKeySize
 
uint32_t m_minKeySize
 
TracedCallback< const uint32_t &, const uint32_t & > m_newKeyGeneratedTrace
 
TracedCallback< const uint32_t & > m_newKeyGeneratedTraceEmir
 
Ptr< Nodem_node
 
std::map< Ptr< Socket >, Ptr< Packet > > m_packetQueues
 Buffering unsend messages due to connection problems. More...
 
uint32_t m_port
 Local port to bind to. More...
 
double m_qkdLinkDefaultUpdateInterval
 Default update interval of QKD link status (seconds) More...
 
Ptr< QKDKMSQueueLogicm_queueLogic
 KMS Queue Logic for ETSI 004 QoS handling. More...
 
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
 Traced Callback: received packets, source address. More...
 
TracedCallback< Ptr< const Packet >, const Address & > m_rxTraceSDNs
 
std::map< uint32_t, EventIdm_scheduledChecks
 
Ptr< Socketm_sinkSocket
 
std::map< Ptr< Socket >, Ptr< Socket > > m_socketPairs
 the accepted sockets More...
 
std::map< Ipv4Address, std::pair< Ptr< Socket >, Ptr< Socket > > > m_socketPairsKMS
 the accepted sockets for communication between KMSs More...
 
TypeId m_tid
 
uint32_t m_totalRx
 Total bytes received
More...
 
uint32_t m_totalRxKMSs
 Total bytes received between KMSs. More...
 
TracedCallback< Ptr< const Packet > > m_txTrace
 
TracedCallback< Ptr< const Packet > > m_txTraceSDNs
 

Additional Inherited Members

- Protected Attributes inherited from ns3::Application
Ptr< Nodem_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...
 

Detailed Description

Config Paths

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

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

Attributes

  • Protocol: The type of protocol to use.
  • LocalAddress: The ipv4 address of the application
  • MaximalKeysPerRequest: The maximal number of keys per request (ESTI QKD 014)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 20
    • Flags: construct write read
  • MinimalKeySize: The minimal size of key QKDApp can request
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 32
    • Flags: construct write read
  • MaximalKeySize: The maximal size of key QKDApp can request
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 10240
    • Flags: construct write read
  • DefaultKeySize: The default size of the key
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 512
    • Flags: construct write read
  • MaliciousRequestBlocking: Does SDN detects and blocks malicious get_key_004 request?
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1
    • Flags: construct write read
  • QKDLinkUpdateInterval: Default value of QKD link status update interval (in seconds)
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 5
    • Flags: construct write read

Attributes defined in parent class ns3::Application

  • StartTime: Time at which the application will start
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +0ns
    • Flags: construct write read
  • StopTime: Time at which the application will stop
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +0ns
    • Flags: construct write read

TraceSources

  • Tx: A new packet is created and is sent to the APP
    Callback signature: ns3::QKDSDNController::Tx
  • Rx: A packet from the APP has been received
    Callback signature: ns3::QKDSDNController::Rx
  • TxSDNs: A new packet is created and is sent to the SDN
    Callback signature: ns3::QKDSDNController::TxSDNs
  • RxSDNs: A packet from the APP has been received
    Callback signature: ns3::QKDSDNController::RxSDNs
  • NewKeyGeneratedEmir: The trace to monitor key material received from QL
    Callback signature: ns3::QKDSDNController::NewKeyGeneratedEmir
  • KeyServedEmir: The trace to monitor key material served to QKD Apps
    Callback signature: ns3:QKDSDNController::KeyServedEmir
  • NewKeyGenerated: The trace to monitor key material received from QL
    Callback signature: ns3::QKDSDNController::NewKeyGenerated
  • KeyServedEtsi014: The threce to monitor key usage by etsi 014
    Callback signature: ns3::QKDSDNController::KeyServedEtsi014
  • KeyServedEtsi004: The threce to monitor key usage by etsi 004
    Callback signature: ns3::QKDSDNController::KeyServedEtsi004
  • DropKMSRequest: Drop a request from the queue disc
    Callback signature: ns3::QKDSDNController::TracedCallback

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

Definition at line 66 of file qkd-sdn-controller.h.

Member Enumeration Documentation

◆ RequestType

Request types.

Enumerator
NONE 
GET_ROUTE 
REGISTER_SAE_LINK 
REGISTER_QKD_LINK 
KEY_ASSOCIATION_STATUS 
ETSI_QKD_014_GET_STATUS 

Integer equivalent = 0.

ETSI_QKD_014_GET_KEY 

Integer equivalent = 1.

ETSI_QKD_014_GET_KEY_WITH_KEY_IDS 

Integer equivalent = 2.

ETSI_QKD_004_OPEN_CONNECT 
ETSI_QKD_004_GET_KEY 
ETSI_QKD_004_CLOSE 
NEW_APP 
REGISTER 
FILL 
STORE_PP_KEYS 
TRANSFORM_KEYS 
ETSI_QKD_004_KMS_CLOSE 

Definition at line 73 of file qkd-sdn-controller.h.

Constructor & Destructor Documentation

◆ QKDSDNController()

ns3::QKDSDNController::QKDSDNController ( )

QKDSDNController constructor.

Definition at line 135 of file qkd-sdn-controller.cc.

References m_totalRx, and NS_LOG_FUNCTION.

◆ ~QKDSDNController()

ns3::QKDSDNController::~QKDSDNController ( )
virtual

QKDSDNController destructor.

Definition at line 142 of file qkd-sdn-controller.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AddNewLink()

void ns3::QKDSDNController::AddNewLink ( uint32_t  srcSaeId,
uint32_t  dstSaeId,
Ipv4Address  kmsDstAddress,
Ptr< QKDBuffer srcBuffer 
)

Inform KMS about the new QKD connection/link.

Parameters
uint32_tmaster SAE ID
uint32_tslave SAE ID
Ipv4Addressslave KMS address
Ptr<QKDBuffer>srcQKDBuffer

Definition at line 816 of file qkd-sdn-controller.cc.

References GetNode(), ns3::Object::GetObject(), m_local, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ Base64Decode()

std::string ns3::QKDSDNController::Base64Decode ( std::string  input)
private

Base64 decoder.

Parameters
inputinput data
Returns
string decoded input

Definition at line 919 of file qkd-sdn-controller.cc.

◆ Base64Encode()

std::string ns3::QKDSDNController::Base64Encode ( std::string  input)
private

Base64 encoder.

Parameters
inputinput data
Returns
string base64 encoded input

Definition at line 907 of file qkd-sdn-controller.cc.

◆ CheckSocketsKMS()

void ns3::QKDSDNController::CheckSocketsKMS ( Ipv4Address  dstSaeId)
private

Prepare send socket to communicate with peer KMS Application.

Parameters
uint32_tdestination SAE ID

◆ ConnectionFailed()

void ns3::QKDSDNController::ConnectionFailed ( Ptr< Socket socket)
private

Definition at line 261 of file qkd-sdn-controller.cc.

References NS_LOG_FUNCTION.

Referenced by HandleAccept().

+ Here is the caller graph for this function:

◆ ConnectionFailedKMSs()

void ns3::QKDSDNController::ConnectionFailedKMSs ( Ptr< Socket socket)
private

◆ ConnectionSucceeded()

void ns3::QKDSDNController::ConnectionSucceeded ( Ptr< Socket socket)
private

@toDo:following functions

Definition at line 243 of file qkd-sdn-controller.cc.

References m_packetQueues, m_txTrace, and NS_LOG_FUNCTION.

Referenced by HandleAccept().

+ Here is the caller graph for this function:

◆ ConnectionSucceededKMSs()

void ns3::QKDSDNController::ConnectionSucceededKMSs ( Ptr< Socket socket)
private

◆ CreateKeyContainer()

nlohmann::json ns3::QKDSDNController::CreateKeyContainer ( std::vector< Ptr< QKDKey >>  keys)
private

Check the correctness of QKD application request and ability of KMS to fullfil correct request.

Parameters
requestjson structure of application request
connconnection details
Returns
json error structure defined by ETSI014 document

Create key container data structure described in ETSI014 document.

Parameters
keysvector of pointers on the QKD key
Returns
json data structure for key container

◆ CreateNew004Association()

std::string ns3::QKDSDNController::CreateNew004Association ( uint32_t  srcSaeId,
uint32_t  dstSaeId,
QKDSDNController::QoS  inQos,
Ipv4Address  dstKms,
std::string  ksid 
)
private

Create a new assocation.

Parameters
srcSaeIdsource secure application entity
dstSaeIddestination secure application entity
inQosQuality of Service
dstKmsdestination KMS address
ksidUnique identifier of the association
Returns
string Unique identifier of the association

Input ksid can be empty if it is not predefined. In that case new ksid is generated for this new association and return from the function.

◆ DataSend()

void ns3::QKDSDNController::DataSend ( Ptr< Socket ,
uint32_t   
)
private

Definition at line 268 of file qkd-sdn-controller.cc.

References NS_LOG_FUNCTION.

Referenced by HandleAccept().

+ Here is the caller graph for this function:

◆ DataSendKMSs()

void ns3::QKDSDNController::DataSendKMSs ( Ptr< Socket ,
uint32_t   
)
private

◆ DoDispose()

void ns3::QKDSDNController::DoDispose ( void  )
protectedvirtual

@toDo

Reimplemented from ns3::Application.

Definition at line 191 of file qkd-sdn-controller.cc.

References ns3::Application::DoDispose(), m_sinkSocket, m_socketPairs, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ FetchRequestType()

QKDSDNController::RequestType ns3::QKDSDNController::FetchRequestType ( std::string  s)
private

◆ GetAcceptedSockets()

std::map< Ptr< Socket >, Ptr< Socket > > ns3::QKDSDNController::GetAcceptedSockets ( void  ) const

Get list of all accepted sockets.

Returns
list of pointers to accepted sockets

Definition at line 160 of file qkd-sdn-controller.cc.

References m_socketPairs, and NS_LOG_FUNCTION.

◆ GetAddress()

Ipv4Address ns3::QKDSDNController::GetAddress ( )
inline

Get local address.

Returns
return local address

Definition at line 205 of file qkd-sdn-controller.h.

References m_local.

◆ GetDestinationKmsAddress()

Ipv4Address ns3::QKDSDNController::GetDestinationKmsAddress ( Ptr< Socket socket)
private

◆ GetId()

uint32_t ns3::QKDSDNController::GetId ( void  )

Get key menager system ID.

Returns
uint32_t key manager system ID

Definition at line 148 of file qkd-sdn-controller.cc.

References m_kms_id.

◆ GetMaxKeyPerRequest()

uint32_t ns3::QKDSDNController::GetMaxKeyPerRequest ( )

Get maximum number of keys per request (ETSI QKD 014)

Returns
uint32_t maximum number of keys per request

Definition at line 735 of file qkd-sdn-controller.cc.

References m_maxKeyPerRequest.

◆ GetNode()

Ptr< Node > ns3::QKDSDNController::GetNode ( )

Get node.

Returns
pointer to node

Definition at line 901 of file qkd-sdn-controller.cc.

References m_node.

Referenced by AddNewLink(), HandleAccept(), PrepareSinkSocket(), ProcessRequest(), and RegisterSaePair().

+ Here is the caller graph for this function:

◆ GetPort()

uint32_t ns3::QKDSDNController::GetPort ( )
inline

Get local port.

Returns
return local port

Definition at line 221 of file qkd-sdn-controller.h.

References m_port.

◆ GetSendSocketKMS()

Ptr<Socket> ns3::QKDSDNController::GetSendSocketKMS ( Ipv4Address  kmsDstAddress)
private

Obtain send socket.

Parameters
kmsDstAddressAddress of the destination KMS
Returns
Socket send socket

◆ GetSocket()

Ptr< Socket > ns3::QKDSDNController::GetSocket ( void  ) const

Get sink socket.

Returns
pointer to the sink socket

   SOCKET functions

Definition at line 177 of file qkd-sdn-controller.cc.

References m_sinkSocket, and NS_LOG_FUNCTION.

◆ GetSocketFromHttp004AppQuery()

Ptr<Socket> ns3::QKDSDNController::GetSocketFromHttp004AppQuery ( uint32_t  saeId)
private

◆ GetTotalRx()

uint32_t ns3::QKDSDNController::GetTotalRx ( ) const

Get the total amount of bytes received.

Returns
the total bytes received in this sink app

Definition at line 153 of file qkd-sdn-controller.cc.

References m_totalRx, and NS_LOG_FUNCTION.

◆ GetTypeId()

◆ HandleAccept()

void ns3::QKDSDNController::HandleAccept ( Ptr< Socket s,
const Address from 
)
private

◆ HandlePeerClose()

void ns3::QKDSDNController::HandlePeerClose ( Ptr< Socket socket)
private

Handle an connection close.

Parameters
socketthe connected socket

Definition at line 274 of file qkd-sdn-controller.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocket().

+ Here is the caller graph for this function:

◆ HandlePeerError()

void ns3::QKDSDNController::HandlePeerError ( Ptr< Socket socket)
private

Handle an connection error.

Parameters
socketthe connected socket

Definition at line 280 of file qkd-sdn-controller.cc.

References NS_LOG_FUNCTION.

Referenced by PrepareSinkSocket().

+ Here is the caller graph for this function:

◆ HandleRead()

void ns3::QKDSDNController::HandleRead ( Ptr< Socket socket)
private

Handle a packet received by the KMS application.

Parameters
socketthe receiving socket

Definition at line 313 of file qkd-sdn-controller.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::InetSocketAddress::IsMatchingType(), m_rxTrace, m_totalRx, ns3::Simulator::Now(), NS_LOG_FUNCTION, PacketReceived(), and ns3::Socket::RecvFrom().

Referenced by HandleAccept(), and PrepareSinkSocket().

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

◆ Http004AppQuery()

void ns3::QKDSDNController::Http004AppQuery ( uint32_t  saeId,
Ptr< Socket socket 
)
private

◆ Http004AppQueryComplete()

void ns3::QKDSDNController::Http004AppQueryComplete ( uint32_t  saeId)
private

◆ HttpKMSAddQuery()

void ns3::QKDSDNController::HttpKMSAddQuery ( Ipv4Address  dstKms,
HttpQuery  request 
)
private

remember HTTP request made to peer KMS

Parameters
dstKmsdestination kms IP address
requestrequest parameters

◆ HttpKMSCompleteQuery()

void ns3::QKDSDNController::HttpKMSCompleteQuery ( Ipv4Address  dstKms)
private

remove mapped HTTP response from query

Parameters
dstKmsdestination kms IP address

◆ HttpQueryMethod()

RequestType ns3::QKDSDNController::HttpQueryMethod ( Ipv4Address  dstKms)
private

obtain method_type to map the HTTP response

Parameters
dstKmsdestination KMS IP address
Returns
RequestType method function

◆ PacketReceived()

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

Assemble byte stream to extract HTTPMessage.

Parameters
preceived packet
fromfrom address

The method assembles a received byte stream and extracts HTTPMessage instances from the stream to export in a trace source.

Definition at line 347 of file qkd-sdn-controller.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, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::HTTPMessageParser::Parse(), ProcessRequest(), ns3::Packet::RemoveAtStart(), ns3::HTTPMessage::ToString(), and ns3::Packet::ToString().

Referenced by HandleRead().

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

◆ PacketToString()

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

Convert packet to string.

Parameters
packetthe packet
Returns
string packet

◆ PrepareSinkSocket()

◆ ProcessAddKeysRequest()

void ns3::QKDSDNController::ProcessAddKeysRequest ( HTTPMessage  h,
Ptr< Socket socket,
std::string  ksid 
)
private

Process FILL request.

Parameters
headerreceived request
socketreceiving socket
ksidUnique identifier of the association

Process the proposal of keys to fill the dedicated key store reserved for association identified with KSID.

◆ ProcessAddKeysResponse()

void ns3::QKDSDNController::ProcessAddKeysResponse ( HTTPMessage  header,
Ptr< Socket socket 
)
private

Process FILL response.

Parameters
headerreceived http header
socketreceiving socket

Process the response on the FILL method where the primary KMS (the initiator) will obtain and store QKD keys that are accepted by the replica KMS for this association.

◆ ProcessCloseRequest()

void ns3::QKDSDNController::ProcessCloseRequest ( std::string  ksid,
HTTPMessage  header,
Ptr< Socket socket 
)
private

◆ ProcessGetKey004Request()

void ns3::QKDSDNController::ProcessGetKey004Request ( std::string  ksid,
HTTPMessage  header,
Ptr< Socket socket 
)
private

◆ ProcessNewAppRequest()

void ns3::QKDSDNController::ProcessNewAppRequest ( HTTPMessage  header,
Ptr< Socket socket 
)
private

◆ ProcessNewAppResponse()

void ns3::QKDSDNController::ProcessNewAppResponse ( HTTPMessage  header,
Ptr< Socket socket 
)
private

◆ ProcessOpenConnectRequest()

void ns3::QKDSDNController::ProcessOpenConnectRequest ( HTTPMessage  header,
Ptr< Socket socket 
)
private

◆ ProcessRegisterRequest()

void ns3::QKDSDNController::ProcessRegisterRequest ( HTTPMessage  header,
std::string  ksid,
Ptr< Socket socket 
)
private

◆ ProcessRegisterResponse()

void ns3::QKDSDNController::ProcessRegisterResponse ( HTTPMessage  header,
Ptr< Socket socket 
)
private

◆ ProcessRequest()

void ns3::QKDSDNController::ProcessRequest ( HTTPMessage  headerIn,
Ptr< Packet packet,
Ptr< Socket socket 
)
private

QKD key manager system application process the request from QKDApp, and complete certain actions to respond on received request.

Parameters
headerreceived HTTP header
packetreceived packet
socketthe receiving socket

Data structure of key managment respond is described in ETSI014 document.


   Southbound interface functions (ETSI 014 & ETSI 004)

Definition at line 490 of file qkd-sdn-controller.cc.

References ns3::HTTPMessage::CreateResponse(), FetchRequestType(), ns3::HTTPMessage::GetMessageBodyString(), ns3::HTTPMessage::GetMethod(), GetNode(), ns3::Object::GetObject(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::HTTPMessage::GetUri(), KEY_ASSOCIATION_STATUS, m_qkdLinkDefaultUpdateInterval, NONE, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, REGISTER_QKD_LINK, REGISTER_SAE_LINK, SendToSocketPair(), ns3::QKDKeyAssociationLinkEntry::SetEffectiveSKR(), ns3::QKDKeyAssociationLinkEntry::SetExpectedConsumption(), ns3::QKDKeyAssociationLinkEntry::SetId(), ns3::QKDKeyAssociationLinkEntry::SetSKR(), ns3::QKDKeyAssociationLinkEntry::SetUpdateStatusInterval(), and ns3::HTTPMessage::ToString().

Referenced by PacketReceived().

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

◆ ReadJsonQos()

void ns3::QKDSDNController::ReadJsonQos ( QKDSDNController::QoS inQos,
nlohmann::json  jOpenConnectRequest 
)
private

Read the parameters from the JSON OPEN_CONNECT structure!

Parameters
&dstSaeIddestination secure application entity
&srcSaeIdsource secure application entity
&inQosrequested QoS
&ksidUnique identifier of the association
jOpenConncetRequestJSON structure of the OPEN_CONNECT call

◆ RegisterRequest()

void ns3::QKDSDNController::RegisterRequest ( std::string  ksid)
private

◆ RegisterSaePair()

void ns3::QKDSDNController::RegisterSaePair ( Ptr< Node srcNode,
Ptr< Node dstNode,
uint32_t  srcSaeId,
uint32_t  dstSaeId,
std::string  type 
)

Inform KMS about the SAE connection.

This function register the pair of QKDApps (srcSaeId, dstSaeId) to use keys that are produced by the QKD systems on nodes srcNode and dstNode via this KMS.

Parameters
Ptr<Node>source
Ptr<Node>destination
uint32_tsource SAE_ID
uint32_tdestination SAE_ID
std::stringtype

Definition at line 849 of file qkd-sdn-controller.cc.

References GetNode(), ns3::Object::GetObject(), NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ ReleaseAssociation()

void ns3::QKDSDNController::ReleaseAssociation ( std::string  ksid,
std::string  surplusKeyId,
uint32_t  syncIndex 
)
private

release key stream association

Parameters
ksidunique key stream identifier
surplusKeyIdunique key identifier for surplus key material in dedicated association buffer
syncIndexunique key index in dedicated association buffer for synchronisation

◆ SendToSocketPair()

void ns3::QKDSDNController::SendToSocketPair ( Ptr< Socket socket,
Ptr< Packet packet 
)
private

Send packet to the pair socket.

Parameters
socketreceiving socket
packetpacket to send

Definition at line 286 of file qkd-sdn-controller.cc.

References ns3::Socket::GetPeerName(), ns3::Packet::GetUid(), m_packetQueues, m_socketPairs, m_txTrace, NS_LOG_FUNCTION, and ns3::Socket::Send().

Referenced by ProcessRequest().

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

◆ SendToSocketPairKMS()

void ns3::QKDSDNController::SendToSocketPairKMS ( Ptr< Socket socket,
Ptr< Packet packet 
)
private

Send packet to the pair socket.

Parameters
socketreceiving socket
packetpacket to send

◆ SetAddress()

void ns3::QKDSDNController::SetAddress ( Ipv4Address  address)
inline

Set local address.

Parameters
Ipv4Addressaddress

Definition at line 197 of file qkd-sdn-controller.h.

References first::address, and m_local.

◆ SetNode()

void ns3::QKDSDNController::SetNode ( Ptr< Node n)

Set node.

Parameters
nnode to be set

Definition at line 896 of file qkd-sdn-controller.cc.

References m_node.

◆ SetPort()

void ns3::QKDSDNController::SetPort ( uint32_t  port)
inline

Set local port.

Parameters
uint32_tport

Definition at line 213 of file qkd-sdn-controller.h.

References m_port, and port.

◆ SetSocket()

void ns3::QKDSDNController::SetSocket ( std::string  type,
Ptr< Socket socket 
)

Set sink socket.

Parameters
typesocket type
socketpointer to socket to be set

Definition at line 184 of file qkd-sdn-controller.cc.

References m_sinkSocket, and NS_LOG_FUNCTION.

◆ StartApplication()

void ns3::QKDSDNController::StartApplication ( void  )
privatevirtual

Start KMS Application.


   APPLICATION functions

Reimplemented from ns3::Application.

Definition at line 418 of file qkd-sdn-controller.cc.

References NS_LOG_FUNCTION, and PrepareSinkSocket().

+ Here is the call graph for this function:

◆ StopApplication()

void ns3::QKDSDNController::StopApplication ( void  )
privatevirtual

Stop KMS Application.

Reimplemented from ns3::Application.

Definition at line 457 of file qkd-sdn-controller.cc.

References ns3::Socket::Close(), m_sinkSocket, m_socketPairs, ns3::MakeNullCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_associations004

std::map<std::string, Association004> ns3::QKDSDNController::m_associations004
private

Definition at line 500 of file qkd-sdn-controller.h.

◆ m_buffer

std::unordered_map<Address, Ptr<Packet>, AddressHash> ns3::QKDSDNController::m_buffer
private

Buffer for received packets (TCP segmentation)

Definition at line 546 of file qkd-sdn-controller.h.

Referenced by PacketReceived().

◆ m_bufferKMS

std::unordered_map<Address, Ptr<Packet>, AddressHash> ns3::QKDSDNController::m_bufferKMS
private

Buffer for received packets (TCP segmentation)

Definition at line 547 of file qkd-sdn-controller.h.

◆ m_closeSocketEvent

EventId ns3::QKDSDNController::m_closeSocketEvent
private

Definition at line 518 of file qkd-sdn-controller.h.

◆ m_defaultKeySize

uint32_t ns3::QKDSDNController::m_defaultKeySize
private

Definition at line 544 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_dropTrace

TracedCallback<const Ipv4Address&, Ptr<const Packet> > ns3::QKDSDNController::m_dropTrace
private

Traced callback: fired when a packet is dropped.

Definition at line 531 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_flagedIPAdr

std::map<Ipv4Address, uint32_t> ns3::QKDSDNController::m_flagedIPAdr
private

Definition at line 522 of file qkd-sdn-controller.h.

◆ m_http004App

std::multimap<uint32_t, Ptr<Socket> > ns3::QKDSDNController::m_http004App
private

Definition at line 580 of file qkd-sdn-controller.h.

◆ m_httpRequestsQueryKMS

std::map<Ipv4Address, std::vector<HttpQuery> > ns3::QKDSDNController::m_httpRequestsQueryKMS
private
HTTP handling

Each application can open only one connection with its local KMS (current socket). Each KMS can have only one connection with arbitrary KMS (current socket).

Definition at line 579 of file qkd-sdn-controller.h.

◆ m_keyServedETSI004Trace

TracedCallback<const std::string &, const uint32_t&, const uint32_t&, const uint32_t& > ns3::QKDSDNController::m_keyServedETSI004Trace
private

Definition at line 539 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_keyServedETSI014Trace

TracedCallback<const std::string &, const uint32_t&, Ptr<QKDKey> > ns3::QKDSDNController::m_keyServedETSI014Trace
private

Definition at line 538 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_keyServedTraceEmir

TracedCallback<const uint32_t&> ns3::QKDSDNController::m_keyServedTraceEmir
private

Definition at line 534 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_kms_id

uint32_t ns3::QKDSDNController::m_kms_id
private

Definition at line 514 of file qkd-sdn-controller.h.

Referenced by GetId().

◆ m_kms_key_id

uint32_t ns3::QKDSDNController::m_kms_key_id
private

Definition at line 516 of file qkd-sdn-controller.h.

◆ m_local

Ipv4Address ns3::QKDSDNController::m_local
private

Local address to bind to.

Definition at line 504 of file qkd-sdn-controller.h.

Referenced by AddNewLink(), GetAddress(), GetTypeId(), PrepareSinkSocket(), and SetAddress().

◆ m_maliciousBlocking

uint32_t ns3::QKDSDNController::m_maliciousBlocking
private

Definition at line 523 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_maxKeyPerRequest

uint32_t ns3::QKDSDNController::m_maxKeyPerRequest
private

Definition at line 541 of file qkd-sdn-controller.h.

Referenced by GetMaxKeyPerRequest(), and GetTypeId().

◆ m_maxKeySize

uint32_t ns3::QKDSDNController::m_maxKeySize
private

Definition at line 543 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_minKeySize

uint32_t ns3::QKDSDNController::m_minKeySize
private

Definition at line 542 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_newKeyGeneratedTrace

TracedCallback<const uint32_t& , const uint32_t&> ns3::QKDSDNController::m_newKeyGeneratedTrace
private

Definition at line 536 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_newKeyGeneratedTraceEmir

TracedCallback<const uint32_t&> ns3::QKDSDNController::m_newKeyGeneratedTraceEmir
private

Definition at line 533 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_node

Ptr<Node> ns3::QKDSDNController::m_node
private

Definition at line 555 of file qkd-sdn-controller.h.

Referenced by GetNode(), and SetNode().

◆ m_packetQueues

std::map<Ptr<Socket>, Ptr<Packet> > ns3::QKDSDNController::m_packetQueues
private

Buffering unsend messages due to connection problems.

Definition at line 556 of file qkd-sdn-controller.h.

Referenced by ConnectionSucceeded(), and SendToSocketPair().

◆ m_port

uint32_t ns3::QKDSDNController::m_port
private

Local port to bind to.

Definition at line 506 of file qkd-sdn-controller.h.

Referenced by GetPort(), PrepareSinkSocket(), and SetPort().

◆ m_qkdLinkDefaultUpdateInterval

double ns3::QKDSDNController::m_qkdLinkDefaultUpdateInterval
private

Default update interval of QKD link status (seconds)

Definition at line 498 of file qkd-sdn-controller.h.

Referenced by GetTypeId(), and ProcessRequest().

◆ m_queueLogic

Ptr<QKDKMSQueueLogic> ns3::QKDSDNController::m_queueLogic
private

KMS Queue Logic for ETSI 004 QoS handling.

Definition at line 558 of file qkd-sdn-controller.h.

◆ m_rxTrace

TracedCallback<Ptr<const Packet>, const Address &> ns3::QKDSDNController::m_rxTrace
private

Traced Callback: received packets, source address.

Definition at line 526 of file qkd-sdn-controller.h.

Referenced by GetTypeId(), and HandleRead().

◆ m_rxTraceSDNs

TracedCallback<Ptr<const Packet>, const Address &> ns3::QKDSDNController::m_rxTraceSDNs
private

Definition at line 528 of file qkd-sdn-controller.h.

Referenced by GetTypeId().

◆ m_scheduledChecks

std::map<uint32_t, EventId > ns3::QKDSDNController::m_scheduledChecks
private

Definition at line 520 of file qkd-sdn-controller.h.

◆ m_sinkSocket

Ptr<Socket> ns3::QKDSDNController::m_sinkSocket
private

◆ m_socketPairs

std::map<Ptr<Socket>, Ptr<Socket> > ns3::QKDSDNController::m_socketPairs
private

the accepted sockets

Definition at line 551 of file qkd-sdn-controller.h.

Referenced by DoDispose(), GetAcceptedSockets(), HandleAccept(), SendToSocketPair(), and StopApplication().

◆ m_socketPairsKMS

std::map<Ipv4Address, std::pair<Ptr<Socket>, Ptr<Socket> > > ns3::QKDSDNController::m_socketPairsKMS
private

the accepted sockets for communication between KMSs

Definition at line 553 of file qkd-sdn-controller.h.

◆ m_tid

TypeId ns3::QKDSDNController::m_tid
private

Definition at line 512 of file qkd-sdn-controller.h.

Referenced by GetTypeId(), and PrepareSinkSocket().

◆ m_totalRx

uint32_t ns3::QKDSDNController::m_totalRx
private

Total bytes received

Definition at line 508 of file qkd-sdn-controller.h.

Referenced by QKDSDNController(), GetTotalRx(), and HandleRead().

◆ m_totalRxKMSs

uint32_t ns3::QKDSDNController::m_totalRxKMSs
private

Total bytes received between KMSs.

Definition at line 510 of file qkd-sdn-controller.h.

◆ m_txTrace

TracedCallback<Ptr<const Packet> > ns3::QKDSDNController::m_txTrace
private

Definition at line 527 of file qkd-sdn-controller.h.

Referenced by ConnectionSucceeded(), GetTypeId(), and SendToSocketPair().

◆ m_txTraceSDNs

TracedCallback<Ptr<const Packet> > ns3::QKDSDNController::m_txTraceSDNs
private

Definition at line 529 of file qkd-sdn-controller.h.

Referenced by GetTypeId().


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