DESERT 4.0.0
UwMultiTrafficControl Class Reference

#include <uwmulti-traffic-control.h>

Inheritance diagram for UwMultiTrafficControl:
Inheritance graph
Collaboration diagram for UwMultiTrafficControl:
Collaboration graph

Public Member Functions

 UwMultiTrafficControl ()
 
virtual ~UwMultiTrafficControl ()
 
virtual int command (int, const char *const *)
 
virtual void recv (Packet *p)
 

Protected Member Functions

virtual void recvFromUpperLayers (Packet *p)
 
virtual void manageBuffer (int traffic)
 
virtual void insertInBuffer (Packet *p, int traffic)
 
virtual Packet * removeFromBuffer (int traffic)
 
virtual Packet * getFromBuffer (int traffic)
 
void insertTraffic2UpLayer (int traffic, int upper_layer_id)
 
void insertTraffic2LowerLayer (int traffic, int lower_layer_stack, int lower_layer_id, int behavior)
 
virtual int getBestLowerLayer (int traffic, Packet *p=NULL)
 
virtual int getUpperLayer (int traffic)
 
virtual void eraseTraffic2LowerLayer (int traffic, int lower_layer_stack)
 
virtual void eraseTraffic2Low (int traffic)
 
virtual void eraseTraffic2Up (int traffic)
 
virtual bool addUpLayerFromTag (int traffic_id, const std::string &tag)
 
virtual bool addLowLayerFromTag (int traffic_id, const std::string &tag, int behavior)
 
void setBufferFeature (int traffic_id, int max_size, bool is_circular, double send_down_delay=0)
 
virtual void incrPktLoss (int traffic_id)
 
virtual uint getDiscardedPacket (int traffic_id) const
 

Protected Attributes

int debug_
 
UpTrafficMap up_map
 
DownTrafficMap down_map
 
DownTrafficBuffer down_buffer
 
BufferTrafficFeature buffer_feature_map
 

Detailed Description

Class used to represents the UwMultiTrafficControl layer of a node.

Constructor & Destructor Documentation

◆ UwMultiTrafficControl()

UwMultiTrafficControl::UwMultiTrafficControl ( )

Constructor of UwMultiPhy class.

References debug_.

◆ ~UwMultiTrafficControl()

virtual UwMultiTrafficControl::~UwMultiTrafficControl ( )
inlinevirtual

Destructor of UwMultiPhy class.

Member Function Documentation

◆ addLowLayerFromTag()

bool UwMultiTrafficControl::addLowLayerFromTag ( int  traffic_id,
const std::string &  tag,
int  behavior 
)
protectedvirtual

add a lower layer from the tag name in the map

Parameters
trafficapplication traffic id
tagtag of the lower module
behaviorbehavior of the layer
Returns
true if there is a valid layer associated to tag, false otherwise.

References debug_, and insertTraffic2LowerLayer().

Referenced by command(), and UwMultiTrafficRangeCtr::command().

Here is the call graph for this function:

◆ addUpLayerFromTag()

bool UwMultiTrafficControl::addUpLayerFromTag ( int  traffic_id,
const std::string &  tag 
)
protectedvirtual

add an upper layer from the tag name in the map

Parameters
trafficapplication traffic id
tagtag of the upper module
Returns
true if there is a valid layer associated to tag, false otherwise.

References debug_, and insertTraffic2UpLayer().

Referenced by command().

Here is the call graph for this function:

◆ command()

int UwMultiTrafficControl::command ( int  argc,
const char *const *  argv 
)
virtual

TCL command interpreter. It implements the following OTcl methods:

Parameters
argcNumber of arguments in argv.
argvArray of strings which are the command parameters (Note that argv[0] is the name of the object).
Returns
TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not.

Reimplemented in UwMultiTrafficRangeCtr.

References addLowLayerFromTag(), addUpLayerFromTag(), getDiscardedPacket(), and setBufferFeature().

Referenced by UwMultiTrafficRangeCtr::command().

Here is the call graph for this function:

◆ eraseTraffic2Low()

void UwMultiTrafficControl::eraseTraffic2Low ( int  traffic)
protectedvirtual

remove the traffic from the lower layers matrix

Parameters
trafficapplication traffic id

References up_map.

◆ eraseTraffic2LowerLayer()

void UwMultiTrafficControl::eraseTraffic2LowerLayer ( int  traffic,
int  lower_layer_stack 
)
protectedvirtual

remove the behavior from the traffic lower layers matrix

Parameters
trafficapplication traffic id
lower_layer_stacklower layer stack id

References down_map.

◆ eraseTraffic2Up()

void UwMultiTrafficControl::eraseTraffic2Up ( int  traffic)
protectedvirtual

remove the traffic from the upper layers matrix

Parameters
trafficapplication traffic id

References up_map.

◆ getBestLowerLayer()

int UwMultiTrafficControl::getBestLowerLayer ( int  traffic,
Packet *  p = NULL 
)
protectedvirtual

return the Best Lower Layer id where to forward the packet of traffic type

Parameters
trafficapplication traffic id
Returns
the layer id

Reimplemented in UwMultiTrafficRangeCtr.

References debug_, and down_map.

Referenced by manageBuffer().

◆ getDiscardedPacket()

uint UwMultiTrafficControl::getDiscardedPacket ( int  traffic_id) const
protectedvirtual

get discarded packets

Parameters
traffic_idapplication traffic id
Returns
number of discarded packets for the given traffic id buffer)

References buffer_feature_map.

Referenced by command().

◆ getFromBuffer()

Packet * UwMultiTrafficControl::getFromBuffer ( int  traffic)
protectedvirtual

get a packet of a certain type from the buffer and return it

Parameters
trafficapplication traffic id
Returns
the pointer of the removed packet

References debug_, and down_buffer.

Referenced by UwMultiTrafficRangeCtr::manageBuffer(), UwMultiTrafficRangeCtr::manageCheckedLayer(), and UwMultiTrafficRangeCtr::timerExpired().

◆ getUpperLayer()

int UwMultiTrafficControl::getUpperLayer ( int  traffic)
protectedvirtual

return the Upper Layer id where to forward the received packet of traffic type

Parameters
trafficapplication traffic id
Returns
the layer id

References debug_, and up_map.

Referenced by recv().

◆ incrPktLoss()

void UwMultiTrafficControl::incrPktLoss ( int  traffic_id)
protectedvirtual

Increment by 1 the number of lost packets for the given traffic

Parameters
traffic_idapplication traffic id

References buffer_feature_map.

Referenced by insertInBuffer().

◆ insertInBuffer()

void UwMultiTrafficControl::insertInBuffer ( Packet *  p,
int  traffic 
)
protectedvirtual

insert a packet of a certain type in the buffer

Parameters
ppointer of the packet
trafficapplication traffic id

References buffer_feature_map, BufferType::CIRCULAR, debug_, down_buffer, incrPktLoss(), and q.

Referenced by UwMultiTrafficRangeCtr::manageCheckedLayer(), and recvFromUpperLayers().

Here is the call graph for this function:

◆ insertTraffic2LowerLayer()

void UwMultiTrafficControl::insertTraffic2LowerLayer ( int  traffic,
int  lower_layer_stack,
int  lower_layer_id,
int  behavior 
)
inlineprotected

Set to which upper layer forward a specific kind of traffic received from the lower layers

Parameters
applicationtraffic id
lower_layer_stackunique identifier of the lower layer stack
check_rangeif TRUE follows the CHECK_RANGE behavior, else the ROBUST one

References down_map.

Referenced by addLowLayerFromTag().

◆ insertTraffic2UpLayer()

void UwMultiTrafficControl::insertTraffic2UpLayer ( int  traffic,
int  upper_layer_id 
)
inlineprotected

Set to which upper layer forward a specific kind of traffic received from the lower layers

Parameters
trafficapplication traffic id
upper_layer_idunique identifier of the upper layer id

References up_map.

Referenced by addUpLayerFromTag().

◆ manageBuffer()

void UwMultiTrafficControl::manageBuffer ( int  traffic)
protectedvirtual

manage to tx a packet of traffic type

Parameters
trafficapplication traffic id

Reimplemented in UwMultiTrafficRangeCtr.

References buffer_feature_map, debug_, down_buffer, getBestLowerLayer(), and removeFromBuffer().

Referenced by recvFromUpperLayers().

Here is the call graph for this function:

◆ recv()

void UwMultiTrafficControl::recv ( Packet *  p)
virtual

recv method. It is called when a packet is received from the other layers

Parameters
Packet*Pointer to the packet that are going to be received

References debug_, getUpperLayer(), recvFromUpperLayers(), and hdr_uwcbr::traffic_type().

Referenced by UwMultiTrafficRangeCtr::recv().

Here is the call graph for this function:

◆ recvFromUpperLayers()

void UwMultiTrafficControl::recvFromUpperLayers ( Packet *  p)
protectedvirtual

Handle a packet coming from upper layers

Parameters
ppointer to the packet

References debug_, insertInBuffer(), manageBuffer(), and hdr_uwcbr::traffic_type().

Referenced by recv().

Here is the call graph for this function:

◆ removeFromBuffer()

Packet * UwMultiTrafficControl::removeFromBuffer ( int  traffic)
protectedvirtual

remove a packet of a certain type from the buffer and return it

Parameters
trafficapplication traffic id
Returns
the pointer of the removed packet

References debug_, and down_buffer.

Referenced by manageBuffer(), UwMultiTrafficRangeCtr::manageBuffer(), and UwMultiTrafficRangeCtr::manageCheckedLayer().

◆ setBufferFeature()

void UwMultiTrafficControl::setBufferFeature ( int  traffic_id,
int  max_size,
bool  is_circular,
double  send_down_delay = 0 
)
protected

set buffer features for the given traffic type

Parameters
traffic_idapplication traffic id
max_sizemaximum buffer size
is_circulartrue if buffer is circular, false otherwise (discard new) buffer)
send_down_delaydelay used to send down packets

References buffer_feature_map, BufferType::CIRCULAR, debug_, and BufferType::DISCARD_INCOMING.

Referenced by command().

Member Data Documentation

◆ buffer_feature_map

◆ debug_

◆ down_buffer

DownTrafficBuffer UwMultiTrafficControl::down_buffer
protected

Map of buffer per traffic types

Referenced by getFromBuffer(), insertInBuffer(), manageBuffer(), and removeFromBuffer().

◆ down_map

DownTrafficMap UwMultiTrafficControl::down_map
protected

◆ up_map

UpTrafficMap UwMultiTrafficControl::up_map
protected

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