A Discrete-Event Network Simulator
API
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ns3::TrafficControlLayer Class Reference


Introspection did not find any typical Config paths. More...

#include "traffic-control-layer.h"

+ Inheritance diagram for ns3::TrafficControlLayer:

Classes

class  NetDeviceInfo
 Information to store for each device. More...
 
struct  ProtocolHandlerEntry
 Protocol handler entry. More...
 

Public Types

typedef std::vector< Ptr< QueueDisc > > QueueDiscVector
 Typedef for queue disc vector. More...
 
typedef Callback< uint8_t, Ptr< QueueItem > > SelectQueueCallback
 Callback invoked to determine the tx queue selected for a given packet. More...
 

Public Member Functions

 TrafficControlLayer ()
 Constructor. More...
 
virtual ~TrafficControlLayer ()
 
virtual void DeleteRootQueueDiscOnDevice (Ptr< NetDevice > device)
 This method can be used to remove the root queue disc (and associated filters, classes and queues) installed on a device. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the type ID for the instance. More...
 
virtual Ptr< QueueDiscGetRootQueueDiscOnDevice (Ptr< NetDevice > device) const
 This method can be used to get the root queue disc installed on a device. More...
 
virtual void Receive (Ptr< NetDevice > device, Ptr< const Packet > p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
 Called by NetDevices, incoming packet. More...
 
void RegisterProtocolHandler (Node::ProtocolHandler handler, uint16_t protocolType, Ptr< NetDevice > device)
 Register an IN handler. More...
 
virtual void Send (Ptr< NetDevice > device, Ptr< QueueDiscItem > item)
 Called from upper layer to queue a packet for the transmission. More...
 
void SetNode (Ptr< Node > node)
 Set node associated with this stack. More...
 
virtual void SetRootQueueDiscOnDevice (Ptr< NetDevice > device, Ptr< QueueDisc > qDisc)
 This method can be used to set the root queue disc installed on a device. More...
 
virtual void SetupDevice (Ptr< NetDevice > device)
 Perform the operations that the traffic control layer needs to do when an IPv4/v6 interface is added to 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...
 

Private Types

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

Private Member Functions

 TrafficControlLayer (TrafficControlLayer const &)
 Copy constructor Disable default implementation to avoid misuse. More...
 
uint32_t GetNDevices (void) const
 Required by the object map accessor. More...
 
Ptr< QueueDiscGetRootQueueDiscOnDeviceByIndex (uint32_t index) const
 Required by the object map accessor. More...
 
TrafficControlLayeroperator= (TrafficControlLayer const &)
 Assignment operator. More...
 

Private Attributes

ProtocolHandlerList m_handlers
 List of upper-layer handlers. More...
 
std::map< Ptr< NetDevice >, NetDeviceInfom_netDevices
 Map storing the required information for each device with a queue disc installed. More...
 
Ptr< Nodem_node
 The node this TrafficControlLayer object is aggregated to. More...
 

Additional Inherited Members

Detailed Description


Introspection did not find any typical Config paths.


Attributes

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

Definition at line 89 of file traffic-control-layer.h.

Member Typedef Documentation

◆ ProtocolHandlerList

Typedef for protocol handlers container.

Definition at line 268 of file traffic-control-layer.h.

◆ QueueDiscVector

Typedef for queue disc vector.

Definition at line 133 of file traffic-control-layer.h.

◆ SelectQueueCallback

Callback invoked to determine the tx queue selected for a given packet.

Definition at line 199 of file traffic-control-layer.h.

Constructor & Destructor Documentation

◆ TrafficControlLayer() [1/2]

ns3::TrafficControlLayer::TrafficControlLayer ( )

Constructor.

Definition at line 57 of file traffic-control-layer.cc.

References NS_LOG_FUNCTION_NOARGS.

◆ ~TrafficControlLayer()

ns3::TrafficControlLayer::~TrafficControlLayer ( )
virtual

Definition at line 63 of file traffic-control-layer.cc.

References NS_LOG_FUNCTION.

◆ TrafficControlLayer() [2/2]

ns3::TrafficControlLayer::TrafficControlLayer ( TrafficControlLayer const &  )
private

Copy constructor Disable default implementation to avoid misuse.

Member Function Documentation

◆ DeleteRootQueueDiscOnDevice()

void ns3::TrafficControlLayer::DeleteRootQueueDiscOnDevice ( Ptr< NetDevice device)
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 236 of file traffic-control-layer.cc.

References m_netDevices, NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

◆ DoDispose()

void ns3::TrafficControlLayer::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 69 of file traffic-control-layer.cc.

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

◆ DoInitialize()

void ns3::TrafficControlLayer::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 95 of file traffic-control-layer.cc.

References ns3::Object::DoInitialize(), m_netDevices, ns3::MakeCallback(), NS_ASSERT, NS_ASSERT_MSG(), NS_LOG_FUNCTION, ns3::QueueDisc::Run(), ns3::QueueDisc::WAKE_CHILD, and ns3::QueueDisc::WAKE_ROOT.

◆ GetInstanceTypeId()

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

Get the type ID for the instance.

Returns
the instance TypeId

Reimplemented from ns3::Object.

Definition at line 52 of file traffic-control-layer.cc.

References GetTypeId().

◆ GetNDevices()

uint32_t ns3::TrafficControlLayer::GetNDevices ( void  ) const
private

Required by the object map accessor.

Returns
the number of devices in the m_netDevices map

Definition at line 275 of file traffic-control-layer.cc.

References ns3::Node::GetNDevices(), and m_node.

Referenced by GetTypeId().

◆ GetRootQueueDiscOnDevice()

Ptr< QueueDisc > ns3::TrafficControlLayer::GetRootQueueDiscOnDevice ( Ptr< NetDevice device) const
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 215 of file traffic-control-layer.cc.

References m_netDevices, and NS_LOG_FUNCTION.

Referenced by TcFlowControlTestCase::CheckPacketsInQueueDisc(), and GetRootQueueDiscOnDeviceByIndex().

◆ GetRootQueueDiscOnDeviceByIndex()

Ptr< QueueDisc > ns3::TrafficControlLayer::GetRootQueueDiscOnDeviceByIndex ( uint32_t  index) const
private

Required by the object map accessor.

Parameters
indexthe index of the device in the node's device list
Returns
the root queue disc installed on the specified device

Definition at line 229 of file traffic-control-layer.cc.

References ns3::Node::GetDevice(), GetRootQueueDiscOnDevice(), m_node, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

◆ GetTypeId()

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

Get the type ID.

Returns
the object TypeId

Definition at line 36 of file traffic-control-layer.cc.

References GetNDevices(), GetRootQueueDiscOnDeviceByIndex(), ns3::MakeObjectMapAccessor(), and ns3::TypeId::SetParent().

Referenced by GetInstanceTypeId().

◆ NotifyNewAggregate()

void ns3::TrafficControlLayer::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 258 of file traffic-control-layer.cc.

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

◆ operator=()

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

Assignment operator.

Returns
this object Disable default implementation to avoid misuse

◆ Receive()

void ns3::TrafficControlLayer::Receive ( Ptr< NetDevice device,
Ptr< const Packet p,
uint16_t  protocol,
const Address from,
const Address to,
NetDevice::PacketType  packetType 
)
virtual

Called by NetDevices, incoming packet.

After analyses and scheduling, this method will call the right handler to pass the packet up in the stack.

Parameters
devicenetwork device
pthe packet
protocolnext header value
fromaddress of the correspondent
toaddress of the destination
packetTypetype of the packet

Definition at line 282 of file traffic-control-layer.cc.

References m_handlers, NS_FATAL_ERROR, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6L3Protocol::AddInterface(), and ns3::Ipv4L3Protocol::AddInterface().

◆ RegisterProtocolHandler()

void ns3::TrafficControlLayer::RegisterProtocolHandler ( Node::ProtocolHandler  handler,
uint16_t  protocolType,
Ptr< NetDevice device 
)

Register an IN handler.

The handler will be invoked when a packet is received to pass it to upper layers.

Parameters
handlerthe handler to register
protocolTypethe type of protocol this handler is interested in. This protocol type is a so-called EtherType, as registered here: http://standards.ieee.org/regauth/ethertype/eth.txt the value zero is interpreted as matching all protocols.
devicethe device attached to this handler. If the value is zero, the handler is attached to all devices.

Definition at line 174 of file traffic-control-layer.cc.

References ns3::TrafficControlLayer::ProtocolHandlerEntry::device, ns3::TrafficControlLayer::ProtocolHandlerEntry::handler, m_handlers, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::TrafficControlLayer::ProtocolHandlerEntry::promiscuous, and ns3::TrafficControlLayer::ProtocolHandlerEntry::protocol.

◆ Send()

void ns3::TrafficControlLayer::Send ( Ptr< NetDevice device,
Ptr< QueueDiscItem item 
)
virtual

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

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

Definition at line 316 of file traffic-control-layer.cc.

References ns3::QueueDisc::Enqueue(), m_netDevices, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::QueueDisc::Run().

Referenced by TcFlowControlTestCase::SendPackets().

◆ SetNode()

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

Set node associated with this stack.

Parameters
nodenode to set

Definition at line 251 of file traffic-control-layer.cc.

References m_node, and NS_LOG_FUNCTION.

Referenced by NotifyNewAggregate().

◆ SetRootQueueDiscOnDevice()

void ns3::TrafficControlLayer::SetRootQueueDiscOnDevice ( Ptr< NetDevice device,
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 192 of file traffic-control-layer.cc.

References m_netDevices, NS_ASSERT, NS_ASSERT_MSG(), NS_LOG_FUNCTION, and SetupDevice().

Referenced by TbfQueueDiscTestCase::RunTbfTest().

◆ SetupDevice()

void ns3::TrafficControlLayer::SetupDevice ( Ptr< NetDevice device)
virtual

Perform the operations that the traffic control layer needs to do when an IPv4/v6 interface is added to a device.

Parameters
devicethe device which the IPv4/v6 interface has been added to

This method creates a NetDeviceQueueInterface for the device

Definition at line 135 of file traffic-control-layer.cc.

References m_netDevices, NS_ASSERT_MSG(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by SetRootQueueDiscOnDevice().

Member Data Documentation

◆ m_handlers

ProtocolHandlerList ns3::TrafficControlLayer::m_handlers
private

List of upper-layer handlers.

Definition at line 286 of file traffic-control-layer.h.

Referenced by DoDispose(), Receive(), and RegisterProtocolHandler().

◆ m_netDevices

std::map<Ptr<NetDevice>, NetDeviceInfo> ns3::TrafficControlLayer::m_netDevices
private

Map storing the required information for each device with a queue disc installed.

Definition at line 285 of file traffic-control-layer.h.

Referenced by DeleteRootQueueDiscOnDevice(), DoDispose(), DoInitialize(), GetRootQueueDiscOnDevice(), Send(), SetRootQueueDiscOnDevice(), and SetupDevice().

◆ m_node

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

The node this TrafficControlLayer object is aggregated to.

Definition at line 283 of file traffic-control-layer.h.

Referenced by DoDispose(), GetNDevices(), GetRootQueueDiscOnDeviceByIndex(), NotifyNewAggregate(), and SetNode().


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