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

QKD Traffic control layer definition. More...

#include "qkd-l4-traffic-control-layer.h"

+ Inheritance diagram for ns3::QKDL4TrafficControlLayer:
+ Collaboration diagram for ns3::QKDL4TrafficControlLayer:

Classes

struct  ProtocolHandlerEntry
 Protocol handler entry. More...
 

Public Types

typedef std::vector< Ptr< QueueDisc > > QueueDiscVector
 Typedef for queue disc vector. More...
 

Public Member Functions

 QKDL4TrafficControlLayer ()
 Constructor. More...
 
virtual void DeleteRootQueueDisc ()
 This method can be used to remove the root queue disc (and associated filters, classes and queues) installed on a device. More...
 
void DeliverToL3 (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route)
 FORWARD FROM QUEUE TO LOWER LAERS. More...
 
IpL4Protocol::DownTargetCallback GetDownTarget (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 Get the type ID for the instance. More...
 
Ptr< NodeGetNode ()
 Set node associated with this stack. More...
 
virtual Ptr< QueueDiscGetRootQueueDisc (uint32_t index)
 This method can be used to get the root queue disc installed on a device. More...
 
void Send (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route)
 Called from upper layer (L4) to queue a packet for the transmission. More...
 
void SetDownTarget (IpL4Protocol::DownTargetCallback cb)
 Define Down target which can be IPv4 or Virtual IPv4. More...
 
void SetNode (Ptr< Node > node)
 Set node associated with this stack. More...
 
virtual void SetRootQueueDisc (Ptr< QueueDisc > qDisc)
 This method can be used to set the root queue disc installed on a device. 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...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. 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)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (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::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)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. 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::Object
 Object (const Object &o)
 Copy an Object. 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...
 

Protected Attributes

IpL4Protocol::DownTargetCallback m_downTarget
 Callback to send packets over IPv4. More...
 

Private Types

typedef std::vector< struct ProtocolHandlerEntryProtocolHandlerList
 Typedef for protocol handlers container. More...
 

Private Member Functions

 QKDL4TrafficControlLayer (QKDL4TrafficControlLayer const &)
 Copy constructor Disable default implementation to avoid misuse. More...
 
QKDL4TrafficControlLayeroperator= (QKDL4TrafficControlLayer const &)
 Assignment operator Disable default implementation to avoid misuse. More...
 

Private Attributes

ProtocolHandlerList m_handlers
 This map plays the role of the qdisc field of the netdev_queue struct in Linux. More...
 
Ptr< Nodem_node
 The node this QKDL4TrafficControlLayer object is aggregated to. More...
 
QueueDiscVector m_rootQueueDiscs
 This vector stores the root queue discs installed on all the devices of the node. More...
 

Additional Inherited Members

Detailed Description

QKD Traffic control layer definition.

Introspection did not find any typical Config paths.

This layer stays between L4 and any network protocol (e.g. IP). When enabled, it is responsible to analyze packets and to perform actions on them: the most common is scheduling.

Basically, we manage only OUT directions! The OUT direction is easy to follow, since it involves direct calls: upper layer (e.g. IP) calls the Send method on an instance of this class, which then calls the Enqueue method of the QueueDisc associated with the device. The Dequeue method of the QueueDisc finally calls the Send method of the NetDevice.

The IN direction uses a little trick to reduce dependencies between modules. In simple words, we use Callbacks to connect upper layer (which should register their Receive callback through RegisterProtocolHandler) and NetDevices.

An example of the IN connection between this layer and IP layer is the following:

Ptr<QKDL4TrafficControlLayer> tc = m_node->GetObject<QKDL4TrafficControlLayer> ();

NS_ASSERT (tc != 0);

m_node->RegisterProtocolHandler (MakeCallback (&QKDL4TrafficControlLayer::Receive, tc),
                                 Ipv4L3Protocol::PROT_NUMBER, device);
m_node->RegisterProtocolHandler (MakeCallback (&QKDL4TrafficControlLayer::Receive, tc),
                                 ArpL3Protocol::PROT_NUMBER, device);

tc->RegisterProtocolHandler (MakeCallback (&Ipv4L3Protocol::Receive, this),
                             Ipv4L3Protocol::PROT_NUMBER, device);
tc->RegisterProtocolHandler (MakeCallback (&ArpL3Protocol::Receive, PeekPointer (GetObject<ArpL3Protocol> ())),
                             ArpL3Protocol::PROT_NUMBER, device);

On the node, for IPv4 and ARP packet, is registered the QKDL4TrafficControlLayer::Receive callback. At the same time, on the QKDL4TrafficControlLayer object, is registered the callbacks associated to the upper layers (IPv4 or ARP).

When the node receives an IPv4 or ARP packet, it calls the Receive method on QKDL4TrafficControlLayer, that calls the right upper-layer callback once it finishes the operations on the packet received.

Discrimination through callbacks (in other words: what is the right upper-layer callback for this packet?) is done through checks over the device and the protocol number.

Note
Additional waiting queues are installed between the L3 and L4 ISO/OSI layer to avoid conflicts in decision making which could lead to inaccurate routing. Experimental testing and usage!


Attributes

No TraceSources are defined for this type.
Size of this type is 96 bytes (on a 64-bit architecture).

Definition at line 100 of file qkd-l4-traffic-control-layer.h.

Member Typedef Documentation

Typedef for protocol handlers container.

Definition at line 213 of file qkd-l4-traffic-control-layer.h.

Typedef for queue disc vector.

Definition at line 121 of file qkd-l4-traffic-control-layer.h.

Constructor & Destructor Documentation

ns3::QKDL4TrafficControlLayer::QKDL4TrafficControlLayer ( )

Constructor.

Definition at line 58 of file qkd-l4-traffic-control-layer.cc.

References NS_LOG_FUNCTION_NOARGS.

ns3::QKDL4TrafficControlLayer::QKDL4TrafficControlLayer ( QKDL4TrafficControlLayer const &  )
private

Copy constructor Disable default implementation to avoid misuse.

Member Function Documentation

void ns3::QKDL4TrafficControlLayer::DeleteRootQueueDisc ( )
virtual

This method can be used to remove the root queue disc (and associated filters, classes and queues) installed on a device.

Parameters
devicethe device on which the installed queue disc will be deleted

Definition at line 129 of file qkd-l4-traffic-control-layer.cc.

References m_rootQueueDiscs.

void ns3::QKDL4TrafficControlLayer::DeliverToL3 ( Ptr< Packet packet,
Ipv4Address  source,
Ipv4Address  destination,
uint8_t  protocol,
Ptr< Ipv4Route route 
)

FORWARD FROM QUEUE TO LOWER LAERS.

Definition at line 196 of file qkd-l4-traffic-control-layer.cc.

References ns3::Node::GetId(), ns3::Packet::GetUid(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_downTarget, m_node, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::QKDL4TrafficControlLayer::DoDispose ( void  )
protectedvirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 65 of file qkd-l4-traffic-control-layer.cc.

References ns3::Object::DoDispose(), m_handlers, m_node, m_rootQueueDiscs, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::QKDL4TrafficControlLayer::DoInitialize ( void  )
protectedvirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 75 of file qkd-l4-traffic-control-layer.cc.

References ns3::Object::DoInitialize(), m_node, m_rootQueueDiscs, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

IpL4Protocol::DownTargetCallback ns3::QKDL4TrafficControlLayer::GetDownTarget ( void  ) const

Definition at line 224 of file qkd-l4-traffic-control-layer.cc.

References m_downTarget, and NS_LOG_FUNCTION.

TypeId ns3::QKDL4TrafficControlLayer::GetInstanceTypeId ( void  ) const
virtual

Get the type ID for the instance.

Returns
the instance TypeId

Reimplemented from ns3::Object.

Definition at line 53 of file qkd-l4-traffic-control-layer.cc.

References GetTypeId().

+ Here is the call graph for this function:

Ptr< Node > ns3::QKDL4TrafficControlLayer::GetNode ( void  )

Set node associated with this stack.

Parameters
nodenode to set

Definition at line 149 of file qkd-l4-traffic-control-layer.cc.

References m_node, and NS_LOG_FUNCTION.

Ptr< QueueDisc > ns3::QKDL4TrafficControlLayer::GetRootQueueDisc ( uint32_t  index)
virtual

This method can be used to get the root queue disc installed on a device.

Parameters
devicethe device on which the requested root queue disc is installed
Returns
the root queue disc installed on the given device

Definition at line 118 of file qkd-l4-traffic-control-layer.cc.

References m_node, m_rootQueueDiscs, NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

TypeId ns3::QKDL4TrafficControlLayer::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 38 of file qkd-l4-traffic-control-layer.cc.

References m_rootQueueDiscs, ns3::MakeObjectVectorAccessor(), and ns3::TypeId::SetParent().

Referenced by GetInstanceTypeId().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::QKDL4TrafficControlLayer::NotifyNewAggregate ( void  )
protectedvirtual

Notify all Objects aggregated to this one of a new Object being aggregated.

This function must be implemented in the stack that needs to notify other stacks connected to the node of their presence in the node.

This method is invoked whenever two sets of Objects are aggregated together. It is invoked exactly once for each Object in both sets. This method can be overridden by subclasses who wish to be notified of aggregation events. These subclasses must chain up to their base class NotifyNewAggregate() method.

It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 156 of file qkd-l4-traffic-control-layer.cc.

References m_node, ns3::Object::NotifyNewAggregate(), NS_LOG_FUNCTION, and SetNode().

+ Here is the call graph for this function:

QKDL4TrafficControlLayer& ns3::QKDL4TrafficControlLayer::operator= ( QKDL4TrafficControlLayer const &  )
private

Assignment operator Disable default implementation to avoid misuse.

void ns3::QKDL4TrafficControlLayer::Send ( Ptr< Packet packet,
Ipv4Address  source,
Ipv4Address  destination,
uint8_t  protocol,
Ptr< Ipv4Route route 
)

Called from upper layer (L4) to queue a packet for the transmission.

SEND TO QUEUE.

Parameters
devicethe device the packet must be sent to
itema queue item including a packet and additional information

Definition at line 177 of file qkd-l4-traffic-control-layer.cc.

References ns3::Packet::GetUid(), m_rootQueueDiscs, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::QKDHelper::InstallOverlayQKD(), and ns3::QKDHelper::InstallQKD().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::QKDL4TrafficControlLayer::SetDownTarget ( IpL4Protocol::DownTargetCallback  cb)

Define Down target which can be IPv4 or Virtual IPv4.

Definition at line 217 of file qkd-l4-traffic-control-layer.cc.

References ns3::Node::GetId(), m_downTarget, m_node, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::QKDL4TrafficControlLayer::SetNode ( Ptr< Node node)

Set node associated with this stack.

Parameters
nodenode to set

Definition at line 142 of file qkd-l4-traffic-control-layer.cc.

References m_node, and NS_LOG_FUNCTION.

Referenced by NotifyNewAggregate().

+ Here is the caller graph for this function:

void ns3::QKDL4TrafficControlLayer::SetRootQueueDisc ( Ptr< QueueDisc qDisc)
virtual

This method can be used to set the root queue disc installed on a device.

Parameters
devicethe device on which the provided queue disc will be installed
qDiscthe queue disc to be installed as root queue disc on device

Definition at line 100 of file qkd-l4-traffic-control-layer.cc.

References ns3::Node::GetId(), m_node, m_rootQueueDiscs, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Member Data Documentation

IpL4Protocol::DownTargetCallback ns3::QKDL4TrafficControlLayer::m_downTarget
protected

Callback to send packets over IPv4.

Definition at line 187 of file qkd-l4-traffic-control-layer.h.

Referenced by DeliverToL3(), GetDownTarget(), and SetDownTarget().

ProtocolHandlerList ns3::QKDL4TrafficControlLayer::m_handlers
private

This map plays the role of the qdisc field of the netdev_queue struct in Linux.

List of upper-layer handlers

Definition at line 224 of file qkd-l4-traffic-control-layer.h.

Referenced by DoDispose().

Ptr<Node> ns3::QKDL4TrafficControlLayer::m_node
private
QueueDiscVector ns3::QKDL4TrafficControlLayer::m_rootQueueDiscs
private

This vector stores the root queue discs installed on all the devices of the node.

Devices are sorted as in Node::m_devices

Definition at line 219 of file qkd-l4-traffic-control-layer.h.

Referenced by DeleteRootQueueDisc(), DoDispose(), DoInitialize(), GetRootQueueDisc(), GetTypeId(), Send(), and SetRootQueueDisc().


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