DESERT 4.0.0
UwCsmaAloha_Trigger_SINK Class Reference

#include <uw-csma-aloha-trigger-sink.h>

Inheritance diagram for UwCsmaAloha_Trigger_SINK:
Inheritance graph
Collaboration diagram for UwCsmaAloha_Trigger_SINK:
Collaboration graph

Classes

class  GenericTimer
 
class  ReceiveTimer
 

Public Member Functions

 UwCsmaAloha_Trigger_SINK ()
 
virtual ~UwCsmaAloha_Trigger_SINK ()
 
virtual int command (int argc, const char *const *argv)
 
virtual int crLayCommand (ClMessage *m)
 

Protected Types

enum  UW_CS_ALOHA_TRIG_SINK_STATUS {
  UW_CS_ALOHA_TRIG_SINK_STATE_IDLE = 1 , UW_CS_ALOHA_TRIG_SINK_STATE_NOT_SET , UW_CS_ALOHA_TRIG_SINK_STATE_TX_TRIGGER , UW_CS_ALOHA_TRIG_SINK_STATE_ENABLE_RX ,
  UW_CS_ALOHA_TRIG_SINK_STATE_DISABLE_RX , UW_CS_ALOHA_TRIG_SINK_STATE_DATA_RX
}
 
enum  UW_CS_ALOHA_TRIG_SINK_REASON_STATUS {
  UW_CS_ALOHA_TRIG_SINK_REASON_DATA_RX = 1 , UW_CS_ALOHA_TRIG_SINK_REASON_NOT_SET , UW_CS_ALOHA_TRIG_SINK_REASON_START_RX , UW_CS_ALOHA_TRIG_SINK_REASON_PKT_NOT_FOR_ME ,
  UW_CS_ALOHA_TRIG_SINK_REASON_PKT_ERROR , UW_CS_ALOHA_TRIG_SINK_REASON_TX_TRIGGER
}
 
enum  UW_CS_ALOHA_TRIG_SINK_TIMER_STATUS { UW_CS_ALOHA_TRIG_SINK_IDLE = 1 , UW_CS_ALOHA_TRIG_SINK_RUNNING , UW_CS_ALOHA_TRIG_SINK_FROZEN , UW_CS_ALOHA_TRIG_SINK_EXPIRED }
 

Protected Member Functions

virtual void recvFromUpperLayers (Packet *p)
 
virtual void Mac2PhyStartTx (Packet *p)
 
virtual void Phy2MacEndTx (const Packet *p)
 
virtual void Phy2MacStartRx (const Packet *p)
 
virtual void Phy2MacEndRx (Packet *p)
 
virtual void initPkt (Packet *p, int dest_addr=0)
 
virtual void stateIdle ()
 
virtual void stateEnableRx ()
 
virtual void stateDisableRx ()
 
virtual void stateTxTRIGGER ()
 
virtual void txTRIGGER (Packet *p)
 
virtual void stateRxData (Packet *p)
 
virtual void stateRxPacketNotForMe (Packet *p)
 
void refreshState (UW_CS_ALOHA_TRIG_SINK_STATUS state)
 
void refreshReason (UW_CS_ALOHA_TRIG_SINK_REASON_STATUS reason)
 
int getTriggerMsgSent ()
 
virtual void waitForUser ()
 
virtual void incrUpperDataRx ()
 
void incrTRIGGERPacketTx ()
 

Protected Attributes

int TRIGGER_size
 
int buffer_pkts
 
double tx_timer_duration
 
bool receiving_state_active
 
UW_CS_ALOHA_TRIG_SINK_STATUS curr_state
 
UW_CS_ALOHA_TRIG_SINK_STATUS prev_state
 
UW_CS_ALOHA_TRIG_SINK_REASON_STATUS last_reason
 
ReceiveTimer receive_timer
 
int trigger_pkts_tx
 

Detailed Description

Class that describes a UwCsmaAloha_Trigger_SINK module

Member Enumeration Documentation

◆ UW_CS_ALOHA_TRIG_SINK_REASON_STATUS

Enumerator
UW_CS_ALOHA_TRIG_SINK_REASON_DATA_RX 
UW_CS_ALOHA_TRIG_SINK_REASON_NOT_SET 
UW_CS_ALOHA_TRIG_SINK_REASON_START_RX 
UW_CS_ALOHA_TRIG_SINK_REASON_PKT_NOT_FOR_ME 
UW_CS_ALOHA_TRIG_SINK_REASON_PKT_ERROR 
UW_CS_ALOHA_TRIG_SINK_REASON_TX_TRIGGER 

◆ UW_CS_ALOHA_TRIG_SINK_STATUS

< Variable that rapresent the status of the protocol machine state

Enumerator
UW_CS_ALOHA_TRIG_SINK_STATE_IDLE 
UW_CS_ALOHA_TRIG_SINK_STATE_NOT_SET 
UW_CS_ALOHA_TRIG_SINK_STATE_TX_TRIGGER 
UW_CS_ALOHA_TRIG_SINK_STATE_ENABLE_RX 
UW_CS_ALOHA_TRIG_SINK_STATE_DISABLE_RX 
UW_CS_ALOHA_TRIG_SINK_STATE_DATA_RX 

◆ UW_CS_ALOHA_TRIG_SINK_TIMER_STATUS

Enumerator
UW_CS_ALOHA_TRIG_SINK_IDLE 
UW_CS_ALOHA_TRIG_SINK_RUNNING 
UW_CS_ALOHA_TRIG_SINK_FROZEN 
UW_CS_ALOHA_TRIG_SINK_EXPIRED 

Constructor & Destructor Documentation

◆ UwCsmaAloha_Trigger_SINK()

UwCsmaAloha_Trigger_SINK::UwCsmaAloha_Trigger_SINK ( )

Constructor of the UwCsmaAloha_Trigger_SINK class

References TRIGGER_size, and tx_timer_duration.

◆ ~UwCsmaAloha_Trigger_SINK()

UwCsmaAloha_Trigger_SINK::~UwCsmaAloha_Trigger_SINK ( )
virtual

Destructor of the UwCsmaAloha_Trigger_SINK class

Member Function Documentation

◆ command()

int UwCsmaAloha_Trigger_SINK::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 getTriggerMsgSent(), and stateIdle().

Here is the call graph for this function:

◆ crLayCommand()

int UwCsmaAloha_Trigger_SINK::crLayCommand ( ClMessage *  m)
virtual

Cross-Layer messages interpreter

Parameters
ClMessage*an instance of ClMessage that represent the message received
Returns
0 if successful.

◆ getTriggerMsgSent()

int UwCsmaAloha_Trigger_SINK::getTriggerMsgSent ( )
inlineprotected

Return the number of TRIGGER packets sent over the simulation

Returns
number of trigger packets over the simulation

References trigger_pkts_tx.

Referenced by command().

◆ incrTRIGGERPacketTx()

void UwCsmaAloha_Trigger_SINK::incrTRIGGERPacketTx ( )
inlineprotected

Increment the number of TRIGGER packets transmitted

References trigger_pkts_tx.

Referenced by txTRIGGER().

◆ incrUpperDataRx()

virtual void UwCsmaAloha_Trigger_SINK::incrUpperDataRx ( )
inlineprotectedvirtual

Increment the number of Data received from upper layers

◆ initPkt()

void UwCsmaAloha_Trigger_SINK::initPkt ( Packet *  p,
int  dest_addr = 0 
)
protectedvirtual

Init the headers of the packet in transmission

Parameters
Packet*packet to transmit
dest_adrrdestination address of the packet

References PT_MMAC_TRIGGER, and TRIGGER_size.

Referenced by stateTxTRIGGER().

◆ Mac2PhyStartTx()

void UwCsmaAloha_Trigger_SINK::Mac2PhyStartTx ( Packet *  p)
protectedvirtual

Pass the packet to the PHY layer

Parameters
Packet*pointer to the packet received

Referenced by txTRIGGER().

◆ Phy2MacEndRx()

void UwCsmaAloha_Trigger_SINK::Phy2MacEndRx ( Packet *  p)
protectedvirtual

Method called when the PHY layer finishes to receive a packet

Parameters
Packet*packet just received

References PT_MMAC_TRIGGER, receiving_state_active, refreshReason(), stateRxData(), stateRxPacketNotForMe(), UW_CS_ALOHA_TRIG_SINK_REASON_DATA_RX, UW_CS_ALOHA_TRIG_SINK_REASON_PKT_ERROR, and UW_CS_ALOHA_TRIG_SINK_REASON_PKT_NOT_FOR_ME.

Here is the call graph for this function:

◆ Phy2MacEndTx()

void UwCsmaAloha_Trigger_SINK::Phy2MacEndTx ( const Packet *  p)
protectedvirtual

Method called when the PHY layers finishes to transmit packet

Parameters
Packet*pointer to the Packet just transmitted

References refreshReason(), stateEnableRx(), and UW_CS_ALOHA_TRIG_SINK_REASON_TX_TRIGGER.

Here is the call graph for this function:

◆ Phy2MacStartRx()

void UwCsmaAloha_Trigger_SINK::Phy2MacStartRx ( const Packet *  p)
protectedvirtual

Method called when the PHY layer begins to receive a packet

Parameters
Packet*pointer to the packet in reception

References receiving_state_active, refreshReason(), and UW_CS_ALOHA_TRIG_SINK_REASON_START_RX.

Here is the call graph for this function:

◆ recvFromUpperLayers()

void UwCsmaAloha_Trigger_SINK::recvFromUpperLayers ( Packet *  p)
protectedvirtual

Receives the packet from the upper layer (e.g. IP)

Parameters
Packet*pointer to the packet received

◆ refreshReason()

void UwCsmaAloha_Trigger_SINK::refreshReason ( UW_CS_ALOHA_TRIG_SINK_REASON_STATUS  reason)
inlineprotected

Refresh the reason for the change of state

References last_reason.

Referenced by Phy2MacEndRx(), Phy2MacEndTx(), and Phy2MacStartRx().

◆ refreshState()

void UwCsmaAloha_Trigger_SINK::refreshState ( UW_CS_ALOHA_TRIG_SINK_STATUS  state)
inlineprotected

Refresh the state of the protocol

Parameters
UW_CS_ALOHA_TRIG_SINK_STATUSnext state of the protocol

References curr_state.

Referenced by stateDisableRx(), stateEnableRx(), stateIdle(), stateRxData(), stateTxTRIGGER(), and txTRIGGER().

◆ stateDisableRx()

void UwCsmaAloha_Trigger_SINK::stateDisableRx ( )
protectedvirtual

The sink is not allowed to receive the packet from a certain node anymore

References receiving_state_active, refreshState(), stateIdle(), and UW_CS_ALOHA_TRIG_SINK_STATE_DISABLE_RX.

Here is the call graph for this function:

◆ stateEnableRx()

void UwCsmaAloha_Trigger_SINK::stateEnableRx ( )
protectedvirtual

State in which the sink is enabled to receive packets

References receive_timer, receiving_state_active, refreshState(), tx_timer_duration, and UW_CS_ALOHA_TRIG_SINK_STATE_ENABLE_RX.

Referenced by Phy2MacEndTx().

Here is the call graph for this function:

◆ stateIdle()

void UwCsmaAloha_Trigger_SINK::stateIdle ( )
protectedvirtual

State IDLE of the protocol. All variables resetted

References receive_timer, refreshState(), stateTxTRIGGER(), and UW_CS_ALOHA_TRIG_SINK_STATE_IDLE.

Referenced by command(), and stateDisableRx().

Here is the call graph for this function:

◆ stateRxData()

void UwCsmaAloha_Trigger_SINK::stateRxData ( Packet *  p)
protectedvirtual

The sink receives a DATA packet from a node

References refreshState(), and UW_CS_ALOHA_TRIG_SINK_STATE_DATA_RX.

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ stateRxPacketNotForMe()

void UwCsmaAloha_Trigger_SINK::stateRxPacketNotForMe ( Packet *  p)
protectedvirtual

The destination address of the packet is not equal to the sink's address

Referenced by Phy2MacEndRx().

◆ stateTxTRIGGER()

void UwCsmaAloha_Trigger_SINK::stateTxTRIGGER ( )
protectedvirtual

The sink transmit the TRIGGER packet to begin the neighbour discovery phase

References initPkt(), refreshState(), txTRIGGER(), and UW_CS_ALOHA_TRIG_SINK_STATE_TX_TRIGGER.

Referenced by stateIdle().

Here is the call graph for this function:

◆ txTRIGGER()

void UwCsmaAloha_Trigger_SINK::txTRIGGER ( Packet *  p)
protectedvirtual

Transmit the TRIGGER packet

References incrTRIGGERPacketTx(), Mac2PhyStartTx(), receiving_state_active, refreshState(), and UW_CS_ALOHA_TRIG_SINK_STATE_TX_TRIGGER.

Referenced by stateTxTRIGGER().

Here is the call graph for this function:

◆ waitForUser()

void UwCsmaAloha_Trigger_SINK::waitForUser ( )
protectedvirtual

Used for debug purposes. Wait until the user press a key

Member Data Documentation

◆ buffer_pkts

int UwCsmaAloha_Trigger_SINK::buffer_pkts
protected

Length of data packet queue

◆ curr_state

UW_CS_ALOHA_TRIG_SINK_STATUS UwCsmaAloha_Trigger_SINK::curr_state
protected

Current state of the protocol

Referenced by refreshState().

◆ last_reason

UW_CS_ALOHA_TRIG_SINK_REASON_STATUS UwCsmaAloha_Trigger_SINK::last_reason
protected

Last reason of the state change of the protocol

Referenced by refreshReason().

◆ prev_state

UW_CS_ALOHA_TRIG_SINK_STATUS UwCsmaAloha_Trigger_SINK::prev_state
protected

Previous state of the protocol

◆ receive_timer

ReceiveTimer UwCsmaAloha_Trigger_SINK::receive_timer
protected

timer of receive state

Referenced by stateEnableRx(), and stateIdle().

◆ receiving_state_active

bool UwCsmaAloha_Trigger_SINK::receiving_state_active
protected

True if the sink is allowed to receive data packet

Referenced by Phy2MacEndRx(), Phy2MacStartRx(), stateDisableRx(), stateEnableRx(), and txTRIGGER().

◆ trigger_pkts_tx

int UwCsmaAloha_Trigger_SINK::trigger_pkts_tx
protected

Number of TRIGGER packet received

Referenced by getTriggerMsgSent(), and incrTRIGGERPacketTx().

◆ TRIGGER_size

int UwCsmaAloha_Trigger_SINK::TRIGGER_size
protected

Size of the TRIGGER packet

Referenced by initPkt(), and UwCsmaAloha_Trigger_SINK().

◆ tx_timer_duration

double UwCsmaAloha_Trigger_SINK::tx_timer_duration
protected

Duration of the timer in which one node is allowed to transmit

Referenced by stateEnableRx(), and UwCsmaAloha_Trigger_SINK().


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