DESERT 4.0.0
UwAloha_Q_NODE Class Reference

#include <uw-aloha-q-node.h>

Inheritance diagram for UwAloha_Q_NODE:
Inheritance graph
Collaboration diagram for UwAloha_Q_NODE:
Collaboration graph

Public Member Functions

 UwAloha_Q_NODE ()
 
virtual ~UwAloha_Q_NODE ()=default
 
virtual int recvSyncClMsg (ClMessage *m)
 

Protected Types

enum  UWALOHAQ_PKT_TYPE { UWALOHAQ_ACK_PKT , UWALOHAQ_DATA_PKT }
 
enum  UWALOHAQ_STATUS { IDLE , TRANSMITTING , RECEIVING , WAIT_ACK }
 
enum  UWALOHAQ_ACK_STATUS { ACK_RECEIVED , ACK_NOT_RECEIVED }
 
enum  UWALOHAQ_BACKOFF_STATUS { ADD_BACKOFF , HALT }
 
enum  UWALOHAQ_BACKOFF_MODE { B1 , B2 }
 

Protected Member Functions

virtual int decide_if_backoff (int slot)
 
virtual void stateRxAck (Packet *p)
 
virtual int getLayerIdFromTag (const std::string &tag)
 
virtual int findMySlot ()
 
virtual void updateQ_table (int ack_received)
 
virtual void handleTimerExpiration ()
 
virtual void txData ()
 
virtual void start (double delay)
 
virtual void stop ()
 
virtual void recvFromUpperLayers (Packet *p) override
 
virtual void Phy2MacEndRx (Packet *p)
 
virtual void Phy2MacStartRx (const Packet *p)
 
virtual void Phy2MacEndTx (const Packet *p)
 
virtual void rxPacketNotForMe (Packet *p)
 
virtual void initPkt (Packet *p)
 
virtual int command (int argc, const char *const *argv)
 

Protected Attributes

UwAlohaQTimer alohaq_timer
 
int slot_status
 
double slot_duration
 
std::vector< double > Q_table {}
 
double start_time
 
UWALOHAQ_STATUS transceiver_status
 
UWALOHAQ_ACK_STATUS ack_status
 
UWALOHAQ_BACKOFF_STATUS backoff_status
 
UWALOHAQ_BACKOFF_MODE backoff_mode
 
double guard_time
 
int tot_slots
 
int HDR_size
 
int max_packet_per_slot
 
int packet_sent_curr_slot_
 
int packet_sent_curr_frame
 
int max_queue_size
 
bool enable
 
int debug_
 
int sea_trial_
 
std::deque< Packet * > buffer
 
int curr_slot
 
int my_curr_slot
 
int data_phy_id
 
int decide_backoff
 
std::string phy_data_tag
 

Friends

class UwAlohaQTimer
 

Detailed Description

Class that represents a UwAloha_Q Node

Member Enumeration Documentation

◆ UWALOHAQ_ACK_STATUS

Enumeration class of UWALOHAQ ACK status.

Enumerator
ACK_RECEIVED 
ACK_NOT_RECEIVED 

◆ UWALOHAQ_BACKOFF_MODE

B1 - backoff after every unsuccessful transmission ; B2 - backoff after best slot change

Enumerator
B1 
B2 

◆ UWALOHAQ_BACKOFF_STATUS

Enumeration class of UWALOHAQ backoff activation flag

Enumerator
ADD_BACKOFF 
HALT 

◆ UWALOHAQ_PKT_TYPE

Enumerator
UWALOHAQ_ACK_PKT 
UWALOHAQ_DATA_PKT 

◆ UWALOHAQ_STATUS

Enumeration class of UWALOHAQ status.

Enumerator
IDLE 
TRANSMITTING 
RECEIVING 
WAIT_ACK 

Constructor & Destructor Documentation

◆ UwAloha_Q_NODE()

UwAloha_Q_NODE::UwAloha_Q_NODE ( )

Constructor of the UW_Aloha_Q_NODE class

References backoff_mode, debug_, guard_time, HDR_size, max_packet_per_slot, max_queue_size, sea_trial_, slot_duration, start_time, and tot_slots.

◆ ~UwAloha_Q_NODE()

virtual UwAloha_Q_NODE::~UwAloha_Q_NODE ( )
virtualdefault

Destructor of the UW_Aloha_Q_NODE class

Member Function Documentation

◆ command()

int UwAloha_Q_NODE::command ( int  argc,
const char *const *  argv 
)
protectedvirtual

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 phy_data_tag, start(), start_time, and stop().

Referenced by recvSyncClMsg().

Here is the call graph for this function:

◆ decide_if_backoff()

int UwAloha_Q_NODE::decide_if_backoff ( int  slot)
protectedvirtual

Decide if backoff should be applied in the following slot

References Q_table.

Referenced by handleTimerExpiration().

◆ findMySlot()

int UwAloha_Q_NODE::findMySlot ( )
protectedvirtual

Search Q-table and find optimal slot for transmission

References Q_table, and tot_slots.

Referenced by handleTimerExpiration().

◆ getLayerIdFromTag()

int UwAloha_Q_NODE::getLayerIdFromTag ( const std::string &  tag)
protectedvirtual

Check channel packet is sent through

Referenced by txData().

◆ handleTimerExpiration()

◆ initPkt()

void UwAloha_Q_NODE::initPkt ( Packet *  p)
protectedvirtual

Method called to add the MAC header size

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in transmission

References HDR_size.

Referenced by recvFromUpperLayers().

◆ Phy2MacEndRx()

void UwAloha_Q_NODE::Phy2MacEndRx ( Packet *  p)
protectedvirtual

Method called when the Phy Layer finish to receive a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in reception

References debug_, IDLE, PT_MMAC_ACK, rxPacketNotForMe(), stateRxAck(), transceiver_status, and TRANSMITTING.

Here is the call graph for this function:

◆ Phy2MacEndTx()

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

Method called when the Mac Layer finish to transmit a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in transmission

References debug_, packet_sent_curr_slot_, transceiver_status, and WAIT_ACK.

◆ Phy2MacStartRx()

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

Method called when the Phy Layer start to receive a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in reception

References debug_, RECEIVING, transceiver_status, and WAIT_ACK.

◆ recvFromUpperLayers()

void UwAloha_Q_NODE::recvFromUpperLayers ( Packet *  p)
overrideprotectedvirtual

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

Parameters
Packet*pointer to the packet received

References buffer, initPkt(), and max_queue_size.

Here is the call graph for this function:

◆ recvSyncClMsg()

int UwAloha_Q_NODE::recvSyncClMsg ( ClMessage *  m)
virtual

Cross-Layer messages synchronous interpreter.

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

References CLMSG_UWMMAC_ENABLE, command(), ClMsgUwMmac::SET_REPLY, ClMsgUwMmac::SET_REQ, start(), start_time, and stop().

Here is the call graph for this function:

◆ rxPacketNotForMe()

void UwAloha_Q_NODE::rxPacketNotForMe ( Packet *  p)
protectedvirtual

Method called when the Packet received is determined to be not for me

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in reception

References debug_.

Referenced by Phy2MacEndRx().

◆ start()

void UwAloha_Q_NODE::start ( double  delay)
protectedvirtual

Schedule the beginning of each cycle, each one after delay

Parameters
delayto await before starting the protocol

References alohaq_timer, debug_, enable, Q_table, slot_duration, slot_status, and tot_slots.

Referenced by command(), and recvSyncClMsg().

◆ stateRxAck()

void UwAloha_Q_NODE::stateRxAck ( Packet *  p)
protectedvirtual

Acknowledge ACK is received in the right slot

References ACK_RECEIVED, ack_status, debug_, IDLE, slot_status, transceiver_status, and updateQ_table().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ stop()

void UwAloha_Q_NODE::stop ( )
protectedvirtual

Cancel the timer

References alohaq_timer, and enable.

Referenced by command(), and recvSyncClMsg().

◆ txData()

void UwAloha_Q_NODE::txData ( )
protectedvirtual

Transmit a data packet if in my slot

References buffer, data_phy_id, debug_, getLayerIdFromTag(), IDLE, max_packet_per_slot, packet_sent_curr_frame, packet_sent_curr_slot_, phy_data_tag, slot_status, transceiver_status, and TRANSMITTING.

Referenced by handleTimerExpiration().

Here is the call graph for this function:

◆ updateQ_table()

void UwAloha_Q_NODE::updateQ_table ( int  ack_received)
protectedvirtual

Update Q-table

References curr_slot, debug_, Q_table, and tot_slots.

Referenced by handleTimerExpiration(), and stateRxAck().

Friends And Related Symbol Documentation

◆ UwAlohaQTimer

friend class UwAlohaQTimer
friend

Member Data Documentation

◆ ack_status

UWALOHAQ_ACK_STATUS UwAloha_Q_NODE::ack_status
protected

Variable holding ack status

Referenced by handleTimerExpiration(), and stateRxAck().

◆ alohaq_timer

UwAlohaQTimer UwAloha_Q_NODE::alohaq_timer
protected

TDMA timer handler

Referenced by handleTimerExpiration(), start(), and stop().

◆ backoff_mode

UWALOHAQ_BACKOFF_MODE UwAloha_Q_NODE::backoff_mode
protected

Variable holding backoff mode

Referenced by handleTimerExpiration(), and UwAloha_Q_NODE().

◆ backoff_status

UWALOHAQ_BACKOFF_STATUS UwAloha_Q_NODE::backoff_status
protected

Variable holding backoff status

Referenced by handleTimerExpiration().

◆ buffer

std::deque<Packet *> UwAloha_Q_NODE::buffer
protected

Buffer of the MAC node

Referenced by recvFromUpperLayers(), and txData().

◆ curr_slot

int UwAloha_Q_NODE::curr_slot
protected

Current slot

Referenced by handleTimerExpiration(), and updateQ_table().

◆ data_phy_id

int UwAloha_Q_NODE::data_phy_id
protected

Data channel identifier

Referenced by txData().

◆ debug_

int UwAloha_Q_NODE::debug_
protected

Debug variable: 0 for no info, 1 for displaying debug info

Referenced by handleTimerExpiration(), Phy2MacEndRx(), Phy2MacEndTx(), Phy2MacStartRx(), rxPacketNotForMe(), start(), stateRxAck(), txData(), updateQ_table(), and UwAloha_Q_NODE().

◆ decide_backoff

int UwAloha_Q_NODE::decide_backoff
protected

Dercide about triggering backoff

Referenced by handleTimerExpiration().

◆ enable

bool UwAloha_Q_NODE::enable
protected

Referenced by start(), and stop().

◆ guard_time

double UwAloha_Q_NODE::guard_time
protected

Guard time between slots

Referenced by UwAloha_Q_NODE().

◆ HDR_size

int UwAloha_Q_NODE::HDR_size
protected

Size of the HDR if any

Referenced by initPkt(), and UwAloha_Q_NODE().

◆ max_packet_per_slot

int UwAloha_Q_NODE::max_packet_per_slot
protected

max numer of packet it can transmit per slot

Referenced by txData(), and UwAloha_Q_NODE().

◆ max_queue_size

int UwAloha_Q_NODE::max_queue_size
protected

Maximum dimension of Queue

Referenced by recvFromUpperLayers(), and UwAloha_Q_NODE().

◆ my_curr_slot

int UwAloha_Q_NODE::my_curr_slot
protected

Node's current slot in the ongoing frame

Referenced by handleTimerExpiration().

◆ packet_sent_curr_frame

int UwAloha_Q_NODE::packet_sent_curr_frame
protected

counter of packet has been sent in the current frame

Referenced by handleTimerExpiration(), and txData().

◆ packet_sent_curr_slot_

int UwAloha_Q_NODE::packet_sent_curr_slot_
protected

counter of packet has been sent in the current slot

Referenced by handleTimerExpiration(), Phy2MacEndTx(), and txData().

◆ phy_data_tag

std::string UwAloha_Q_NODE::phy_data_tag
protected

Referenced by command(), and txData().

◆ Q_table

std::vector<double> UwAloha_Q_NODE::Q_table {}
protected

Slot duration

Referenced by decide_if_backoff(), findMySlot(), start(), and updateQ_table().

◆ sea_trial_

int UwAloha_Q_NODE::sea_trial_
protected

Written log variable

Referenced by UwAloha_Q_NODE().

◆ slot_duration

double UwAloha_Q_NODE::slot_duration
protected

◆ slot_status

int UwAloha_Q_NODE::slot_status
protected

Is it my turn to transmit data?

Referenced by handleTimerExpiration(), start(), stateRxAck(), and txData().

◆ start_time

double UwAloha_Q_NODE::start_time
protected

Time to wait before starting the protocol

Referenced by command(), recvSyncClMsg(), and UwAloha_Q_NODE().

◆ tot_slots

int UwAloha_Q_NODE::tot_slots
protected

Number of slots in the frame

Referenced by findMySlot(), handleTimerExpiration(), start(), updateQ_table(), and UwAloha_Q_NODE().

◆ transceiver_status

UWALOHAQ_STATUS UwAloha_Q_NODE::transceiver_status
protected

Variable holding transceiver status

Referenced by handleTimerExpiration(), Phy2MacEndRx(), Phy2MacEndTx(), Phy2MacStartRx(), stateRxAck(), and txData().


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