DESERT 4.0.0
UwMultiStackController Class Reference

#include <uwmulti-stack-controller.h>

Inheritance diagram for UwMultiStackController:
Inheritance graph
Collaboration diagram for UwMultiStackController:
Collaboration graph

Public Member Functions

 UwMultiStackController ()
 
virtual ~UwMultiStackController ()
 
virtual int command (int, const char *const *)
 
virtual void addLayer (int id, int order)
 
virtual void addThreshold (int i, int j, double thres_ij)
 
virtual void recv (Packet *p)
 
int getOrder (int layer_id)
 
int getId (int layer_order)
 

Static Public Attributes

static int const layer_not_exist = -1
 

Protected Types

enum  Mode { UW_MANUAL_SWITCH = 0 , UW_AUTOMATIC_SWITCH }
 

Protected Member Functions

virtual void recvFromUpperLayers (Packet *p)
 
virtual int getBestLayer (Packet *p)
 
virtual bool isLayerAvailable (int id)
 
virtual double getMetricFromSelectedLowerLayer (int id, Packet *p)
 
virtual bool getThreshold (int i, int j, double &thres_ij)
 
virtual void eraseThreshold (int i, int j)
 
void setThreshold (int i, int j, double thres_ij)
 

Protected Attributes

int debug_
 
double min_delay_
 
Mode switch_mode_
 
int lower_id_active_
 
std::map< int, int > id2order
 
ThresMatrix threshold_map
 
std::map< int, int > order2id
 
int signaling_pktSize_
 

Detailed Description

Class used to represents the UwMultiStackController layer of a node.

Member Enumeration Documentation

◆ Mode

< Switch modes >

Enumerator
UW_MANUAL_SWITCH 

State to switch-mode manually.

UW_AUTOMATIC_SWITCH 

State to switch-mode automatically.

Constructor & Destructor Documentation

◆ UwMultiStackController()

UwMultiStackController::UwMultiStackController ( )

Constructor of UwMultiPhy class.

References debug_, lower_id_active_, min_delay_, signaling_pktSize_, and switch_mode_.

◆ ~UwMultiStackController()

virtual UwMultiStackController::~UwMultiStackController ( )
inlinevirtual

Destructor of UwMultiPhy class.

Member Function Documentation

◆ addLayer()

void UwMultiStackController::addLayer ( int  id,
int  order 
)
virtual

Add a layer in the layer map

Parameters
idunique identifier of the module
orderof the id in the controller logic

References id2order, and order2id.

Referenced by command().

◆ addThreshold()

void UwMultiStackController::addThreshold ( int  i,
int  j,
double  thres_ij 
)
virtual

set the threshold value for the transition from layer i to layer j, checking first whether the layers exists

Parameters
iid of the layer i
jid of the layer j
thres_ijthreshold to pass from i to j

References id2order, and setThreshold().

Referenced by command().

Here is the call graph for this function:

◆ command()

int UwMultiStackController::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.

parameters: layer_id, layer_order, a positive and unique integer to order the set if physical ids

parameters: layer_id1, layer_id2, transition threshold

Reimplemented in UwMultiStackControllerPhyMaster, UwMultiStackControllerPhySlave, and UwMultiStackControllerPhy.

References addLayer(), addThreshold(), lower_id_active_, switch_mode_, UW_AUTOMATIC_SWITCH, and UW_MANUAL_SWITCH.

Referenced by UwMultiStackControllerPhy::command().

Here is the call graph for this function:

◆ eraseThreshold()

void UwMultiStackController::eraseThreshold ( int  i,
int  j 
)
protectedvirtual

remove the threshold value for the transition from layer i to layer j, checking first whether the layers exists

Parameters
iid of the layer i
jid of the layer j

References threshold_map.

◆ getBestLayer()

virtual int UwMultiStackController::getBestLayer ( Packet *  p)
inlineprotectedvirtual

Return the best layer to forward the packet when the system works in AUTOMATIC_MODE. It has to be overloaded in the extended classes to implement the choice rule.

Parameters
ppointer to the packet
Returns
id of the module representing the best layer. ///@fgue what if there is no layer id active?

Reimplemented in UwMultiStackControllerPhyMaster, and UwMultiStackControllerPhySlave.

References lower_id_active_, switch_mode_, and UW_AUTOMATIC_SWITCH.

Referenced by recvFromUpperLayers().

◆ getId()

int UwMultiStackController::getId ( int  layer_order)
inline

return the id of the controlled layer given its order in the controller logic

Parameters
orderof the mapped layer
Returns
the layer id

References layer_not_exist, and order2id.

Referenced by UwMultiStackControllerPhyMaster::getLongerRangeLayer(), and UwMultiStackControllerPhyMaster::getShorterRangeLayer().

◆ getMetricFromSelectedLowerLayer()

double UwMultiStackController::getMetricFromSelectedLowerLayer ( int  id,
Packet *  p 
)
protectedvirtual

return the new metrics value obtained from the selected lower layer, in proactive way via ClMessage

Parameters
idto select the lower layer
ppointer to the packet
Returns
the value of the new value of the metrics obtained in proactive way ///@fgue what happens if the requested id is not present?

References ClMsgController::getMetrics().

Here is the call graph for this function:

◆ getOrder()

int UwMultiStackController::getOrder ( int  layer_id)
inline

return the order of the id for the controller logic

Parameters
idto select the layer
Returns
the order of the id

References id2order, and layer_not_exist.

Referenced by UwMultiStackControllerPhyMaster::getLongerRangeLayer(), and UwMultiStackControllerPhyMaster::getShorterRangeLayer().

◆ getThreshold()

bool UwMultiStackController::getThreshold ( int  i,
int  j,
double &  thres_ij 
)
protectedvirtual

get the threshold value for the transition from layer i to layer j, checking first whether the layers exists

Parameters
iid of the layer i
jid of the layer j
thres_ijoutput reference to threshold(i,j); if it doesn't exist, the original value is left untouched
Returns
True iff threshold exists and thres_ij is set

References threshold_map.

Referenced by UwMultiStackControllerPhyMaster::checkBestLayer().

◆ isLayerAvailable()

bool UwMultiStackController::isLayerAvailable ( int  id)
protectedvirtual

return if the specified layer, identified by id, is available

Parameters
idunique identifier of the module
Returns
if the specified layer is available

References id2order.

◆ recv()

void UwMultiStackController::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 min_delay_, and recvFromUpperLayers().

Here is the call graph for this function:

◆ recvFromUpperLayers()

void UwMultiStackController::recvFromUpperLayers ( Packet *  p)
protectedvirtual

By default the signaling is not employed, if it is needed, here where to set the signaling packet size Handle a packet coming from upper layers

Parameters
ppointer to the packet

References getBestLayer(), lower_id_active_, min_delay_, switch_mode_, and UW_AUTOMATIC_SWITCH.

Referenced by recv(), and UwMultiStackControllerPhy::stateBusy2Tx().

Here is the call graph for this function:

◆ setThreshold()

void UwMultiStackController::setThreshold ( int  i,
int  j,
double  thres_ij 
)
inlineprotected

set the threshold value for the transition from layer i to layer j

Parameters
iid of the layer i
jid of the layer j
thres_ijthreshold to pass from i to j

References threshold_map.

Referenced by addThreshold().

Member Data Documentation

◆ debug_

◆ id2order

std::map<int, int> UwMultiStackController::id2order
protected

Maps each layer id to its order in the threshold matrix. (layer_id, order).

Referenced by addLayer(), addThreshold(), getOrder(), and isLayerAvailable().

◆ layer_not_exist

const int UwMultiStackController::layer_not_exist = -1
static

This constant is returned when a searched layer does not exist>

Referenced by getId(), UwMultiStackControllerPhyMaster::getLongerRangeLayer(), getOrder(), and UwMultiStackControllerPhyMaster::getShorterRangeLayer().

◆ lower_id_active_

◆ min_delay_

◆ order2id

std::map<int, int> UwMultiStackController::order2id
protected

Return the layer order given its order in the threshold matrix. (layer_order, layer_id).

Referenced by addLayer(), and getId().

◆ signaling_pktSize_

int UwMultiStackController::signaling_pktSize_
protected

◆ switch_mode_

◆ threshold_map

ThresMatrix UwMultiStackController::threshold_map
protected

Returns the switch layer theshold given a layer order.

Referenced by eraseThreshold(), getThreshold(), and setThreshold().


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