DESERT 4.0.0
UwMultiDestination Class Reference

#include <uwmulti-destination.h>

Inheritance diagram for UwMultiDestination:
Inheritance graph
Collaboration diagram for UwMultiDestination:
Collaboration graph

Public Member Functions

 UwMultiDestination ()
 
virtual ~UwMultiDestination ()
 
virtual int command (int, const char *const *)
 
virtual bool addLayer (IP_range range, int id)
 
virtual void recv (Packet *p)
 

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 getDestinationLayer (Packet *p)
 
virtual bool checkNotOverlap (IP_range range)
 

Protected Attributes

int debug_
 
double min_delay_
 
Mode switch_mode_
 
int lower_id_active_
 
std::list< layer_IPrangelayer_list
 
int default_lower_id
 

Detailed Description

Class used to represents the UwMultiDestination layer of a node.

Member Enumeration Documentation

◆ Mode

enum UwMultiDestination::Mode
protected

< Switch modes >

Enumerator
UW_MANUAL_SWITCH 

State to switch-mode manually.

UW_AUTOMATIC_SWITCH 

State to switch-mode automatically.

Constructor & Destructor Documentation

◆ UwMultiDestination()

UwMultiDestination::UwMultiDestination ( )

Constructor of UwMultiDestination class.

References debug_, lower_id_active_, min_delay_, and switch_mode_.

◆ ~UwMultiDestination()

virtual UwMultiDestination::~UwMultiDestination ( )
inlinevirtual

Destructor of UwMultiDestination class.

Member Function Documentation

◆ addLayer()

bool UwMultiDestination::addLayer ( IP_range  range,
int  id 
)
virtual

Add a layer in the layer map if the IP range is valide, i.e., if the range doesn't overlap with an existing one

Parameters
rangeIP range
ididentifier of the lower layer return false if the range overlaps with an existing one, true otherwise

References checkNotOverlap(), and layer_list.

Referenced by command().

Here is the call graph for this function:

◆ checkNotOverlap()

bool UwMultiDestination::checkNotOverlap ( IP_range  range)
protectedvirtual

return true if there is not overlap between the new range and the previous rnage in the list

Parameters
rangethat has to be inserted in the list
Returns
true if there is not overlap, false otherwise

References layer_list.

Referenced by addLayer().

◆ command()

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

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

Here is the call graph for this function:

◆ getDestinationLayer()

int UwMultiDestination::getDestinationLayer ( Packet *  p)
protectedvirtual

Return the best layer to forward the packet when the system works in AUTOMATIC_MODE.

Parameters
ppointer to the packet
Returns
id of the module representing the best layer.

References hdr_uwip::daddr(), default_lower_id, and layer_list.

Referenced by recvFromUpperLayers().

Here is the call graph for this function:

◆ recv()

void UwMultiDestination::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 UwMultiDestination::recvFromUpperLayers ( Packet *  p)
protectedvirtual

Default lower id to use if dest adress is not found in the considered IP ranges. Handle a packet coming from upper layers

Parameters
ppointer to the packet

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

Referenced by recv().

Here is the call graph for this function:

Member Data Documentation

◆ debug_

int UwMultiDestination::debug_
protected

Flag to activate debug verbosity.

Referenced by UwMultiDestination().

◆ default_lower_id

int UwMultiDestination::default_lower_id
protected

Maps a layer id into an IP_range.

Referenced by command(), and getDestinationLayer().

◆ layer_list

std::list<layer_IPrange> UwMultiDestination::layer_list
protected

◆ layer_not_exist

const int UwMultiDestination::layer_not_exist = -1
static

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

◆ lower_id_active_

int UwMultiDestination::lower_id_active_
protected

Id of the current lower layer active. It is used only in MANUAL MODE.

Referenced by command(), recvFromUpperLayers(), and UwMultiDestination().

◆ min_delay_

double UwMultiDestination::min_delay_
protected

◆ switch_mode_

Mode UwMultiDestination::switch_mode_
protected

Current switch mode (either AUTOMATIC or MANUAL).

Referenced by command(), recvFromUpperLayers(), and UwMultiDestination().


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