DESERT 4.0.0
MMacDACAP Class Reference

#include <uw-mac-DACAP-alter.h>

Inheritance diagram for MMacDACAP:
Inheritance graph
Collaboration diagram for MMacDACAP:
Collaboration graph

Public Member Functions

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

Protected Member Functions

virtual void recvFromUpperLayers (Packet *p)
 
virtual void Phy2MacEndTx (const Packet *p)
 
virtual void Phy2MacStartRx (const Packet *p)
 
virtual void Phy2MacEndRx (Packet *p)
 
virtual double computeWaitTime (int mode, double distance)
 
virtual double computeTxTime (int type)
 
virtual void initPkt (Packet *p, int pkt_type)
 
virtual double getBackoffTime ()
 
virtual double getRecontendTime ()
 
virtual void txAck ()
 
virtual void txData ()
 
virtual void txRts ()
 
virtual void txCts ()
 
virtual void txWrn ()
 
virtual void rxStateIdle (Packet *p)
 
virtual void rxStateBackoff (Packet *p)
 
virtual void rxStateWaitCTS (Packet *p)
 
virtual void rxStateWaitACK (Packet *p)
 
virtual void rxStateWaitData (Packet *p)
 
virtual void rxStateWaitXCts (Packet *p)
 
virtual void rxStateWaitXData (Packet *p)
 
virtual void rxStateWaitXAck (Packet *p)
 
virtual void rxStateWaitXWarning (Packet *p)
 
virtual void rxStateWaitWarning (Packet *p)
 
virtual void rxStateSendWarning (Packet *p)
 
virtual void rxStateRecontendWindow (Packet *p)
 
virtual void stateIdle ()
 
virtual void stateSendRTS ()
 
virtual void stateBackoff ()
 
virtual void stateWaitCTS ()
 
virtual void stateDeferData ()
 
virtual void stateSendData ()
 
virtual void stateWaitACK ()
 
virtual void stateCTSReceived ()
 
virtual void stateWaitData ()
 
virtual void stateDataReceived (Packet *data_pkt)
 
virtual void stateWaitXCts ()
 
virtual void stateWaitXData ()
 
virtual void stateWaitXAck ()
 
virtual void stateWaitXWarning ()
 
virtual void stateSendAck ()
 
virtual void stateSendCTS ()
 
virtual void stateWaitWarning ()
 
virtual void stateSendWarning ()
 
virtual void stateRecontendWindow ()
 
virtual void printStateInfo (double delay=0)
 
virtual void initInfo ()
 
virtual void refreshState (int state)
 
virtual void setBackoffNodes (double node, double node_b)
 
virtual void exitBackoff ()
 
virtual void exitSleep ()
 
virtual void freezeBackoff ()
 
virtual int getQueueSize ()
 
virtual void queuePop (bool flag=true)
 
virtual void waitForUser ()
 
int getUpLayersDataPktsRx ()
 
virtual void incrWrnPktsTx ()
 
virtual void incrWrnPktsRx ()
 
virtual void incrRtsPktsTx ()
 
virtual void incrRtsPktsRx ()
 
virtual void incrCtsPktsTx ()
 
virtual void incrCtsPktsRx ()
 
virtual void incrTotalDeferTimes ()
 
virtual void resetStats ()
 
virtual int getRemainingPkts ()
 
virtual int getWrnPktsTx ()
 
virtual int getWrnPktsRx ()
 
virtual int getRtsPktsTx ()
 
virtual int getRtsPktsRx ()
 
virtual int getCtsPktsTx ()
 
virtual int getCtsPktsRx ()
 
virtual int getTotalDeferTimes ()
 
virtual void backoffStartTime ()
 
virtual void deferEndTime (double duration)
 
virtual void backoffEndTime ()
 
virtual double getMeanDeferTime ()
 

Protected Attributes

int wrn_pkts_tx
 
int wrn_pkts_rx
 
int rts_pkts_tx
 
int rts_pkts_rx
 
int cts_pkts_tx
 
int cts_pkts_rx
 
double defer_times_no
 
double sum_defer_time
 
double start_tx_time
 
double srtt
 
double sumrtt
 
double sumrtt2
 
int rttsamples
 
std::queue< Packet * > Q
 
bool TxActive
 
bool RxActive
 
bool defer_data
 
bool session_active
 
bool backoff_pending
 
bool warning_sent
 
bool backoff_freeze_mode
 
bool print_transitions
 
bool has_buffer_queue
 
bool multihop_mode
 
int sleep_node_1
 
int sleep_node_2
 
int last_reason
 
double t_min
 
double T_W_min
 
double delta_D
 
double delta_data
 
double max_prop_delay
 
int op_mode
 
double max_tx_tries
 
int buffer_pkts
 
double backoff_tuner
 
double wait_costant
 
int max_payload
 
double max_backoff_counter
 
double alpha_
 
int curr_dest_addr
 
int CTS_size
 
int RTS_size
 
int WRN_size
 
int HDR_size
 
int ACK_size
 
int curr_state
 
int prev_state
 
double RTS_sent_time
 
double session_distance
 
double backoff_start_time
 
double backoff_duration
 
double backoff_remaining
 
double backoff_first_start
 
Packet * curr_data_pkt
 
int last_data_id_tx
 
int last_data_id_rx
 
int u_data_id
 
DACAPTimer timer
 
DACAPBTimer backoff_timer
 
int txsn
 
int backoff_counter
 
ofstream fout
 

Static Protected Attributes

static int u_pkt_id
 
static map< int, string > info
 

Friends

class DACAPTimer
 
class DACAPBTimer
 

Detailed Description

Class that represents a DACAP node

Constructor & Destructor Documentation

◆ MMacDACAP()

MMacDACAP::MMacDACAP ( )

◆ ~MMacDACAP()

MMacDACAP::~MMacDACAP ( )
virtual

Destructor of the MMacDACAP class

Member Function Documentation

◆ backoffEndTime()

virtual void MMacDACAP::backoffEndTime ( )
inlineprotectedvirtual

calculates the End Time of the backoff timer

References backoff_first_start.

Referenced by exitBackoff().

◆ backoffStartTime()

virtual void MMacDACAP::backoffStartTime ( )
inlineprotectedvirtual

Sets the start time of the backoff timer to NOW

References backoff_first_start.

Referenced by stateBackoff().

◆ command()

int MMacDACAP::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 ACK_MODE, backoff_freeze_mode, fout, getCtsPktsRx(), getCtsPktsTx(), getMeanDeferTime(), getQueueSize(), getRtsPktsRx(), getRtsPktsTx(), getTotalDeferTimes(), getUpLayersDataPktsRx(), getWrnPktsRx(), getWrnPktsTx(), multihop_mode, NO_ACK_MODE, op_mode, and print_transitions.

Here is the call graph for this function:

◆ computeTxTime()

double MMacDACAP::computeTxTime ( int  type)
protectedvirtual

Computes the time that is needed to transmit a packet, implementing a CrLayMessage for asking the PHY layer to perform this calculation

Parameters
typeof the packet
Returns
double the time needed for transmission in seconds

References ACK_PKT, ACK_size, CTS_PKT, CTS_size, DATA_PKT, HDR_size, max_payload, Q, RTS_PKT, RTS_size, WRN_PKT, and WRN_size.

Referenced by computeWaitTime(), stateWaitACK(), stateWaitCTS(), stateWaitData(), stateWaitWarning(), stateWaitXAck(), stateWaitXCts(), stateWaitXData(), and stateWaitXWarning().

◆ computeWaitTime()

double MMacDACAP::computeWaitTime ( int  mode,
double  distance 
)
protectedvirtual

Computes the T_w parameter, that is the minimum time that the sender has to wait between the reception of CTS packet and the effective transmission of data packet

Parameters
modeindicates whether the ACK mode or no_ACK mode is activated
distancebetween the sender and the receiver
Returns
double the value of T_w

References computeTxTime(), DATA_PKT, delta_D, delta_data, max_prop_delay, NO_ACK_MODE, t_min, and T_W_min.

Referenced by stateDeferData(), stateWaitData(), and stateWaitXData().

Here is the call graph for this function:

◆ crLayCommand()

int MMacDACAP::crLayCommand ( ClMessage *  m)
virtual

Cross-Layer messages interpreter

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

◆ deferEndTime()

virtual void MMacDACAP::deferEndTime ( double  duration)
inlineprotectedvirtual

Sets the end time of the defer summing the duration to the actual duration of defer

Parameters
doubleduration of the defer time

References sum_defer_time.

Referenced by stateDeferData().

◆ exitBackoff()

void MMacDACAP::exitBackoff ( )
inlineprotectedvirtual

The backoff timer is stopped

References backoff_duration, backoff_first_start, backoff_freeze_mode, backoff_pending, backoff_remaining, backoff_start_time, backoff_timer, backoffEndTime(), NOT_SET, and timer.

Referenced by rxStateBackoff().

Here is the call graph for this function:

◆ exitSleep()

void MMacDACAP::exitSleep ( )
protectedvirtual

This method erase the MAC address of the two nodes that have intiated a handshake procedure if this handshake is done

References NOT_SET, sleep_node_1, and sleep_node_2.

Referenced by rxStateWaitXAck(), rxStateWaitXCts(), rxStateWaitXData(), rxStateWaitXWarning(), and stateIdle().

◆ freezeBackoff()

void MMacDACAP::freezeBackoff ( )
inlineprotectedvirtual

Freezes the Backoff timer

References backoff_duration, backoff_pending, backoff_remaining, backoff_start_time, NOT_SET, and timer.

Referenced by rxStateBackoff().

◆ getBackoffTime()

double MMacDACAP::getBackoffTime ( )
protectedvirtual

Calculate the backoff time if the node didn't received the ACK

References backoff_counter, backoff_tuner, max_backoff_counter, and max_prop_delay.

Referenced by stateBackoff().

◆ getCtsPktsRx()

virtual int MMacDACAP::getCtsPktsRx ( )
inlineprotectedvirtual
Returns
number of CTS packets received

References cts_pkts_rx.

Referenced by command().

◆ getCtsPktsTx()

virtual int MMacDACAP::getCtsPktsTx ( )
inlineprotectedvirtual
Returns
number of CTS packets transmitted

References cts_pkts_tx.

Referenced by command().

◆ getMeanDeferTime()

virtual double MMacDACAP::getMeanDeferTime ( )
inlineprotectedvirtual
Returns
Mean of all the defer times

References defer_times_no, and sum_defer_time.

Referenced by command().

◆ getQueueSize()

virtual int MMacDACAP::getQueueSize ( )
inlineprotectedvirtual
Returns
the size of DATA queue at the end of simulation

References Q.

Referenced by command().

◆ getRecontendTime()

double MMacDACAP::getRecontendTime ( )
protectedvirtual

Used in multihop mode

References max_prop_delay, and wait_costant.

Referenced by stateRecontendWindow().

◆ getRemainingPkts()

virtual int MMacDACAP::getRemainingPkts ( )
inlineprotectedvirtual
Returns
Number of data packets that are remained in the data queue at the end of simulation

References Q.

◆ getRtsPktsRx()

virtual int MMacDACAP::getRtsPktsRx ( )
inlineprotectedvirtual
Returns
number of RTS packets received

References rts_pkts_rx.

Referenced by command().

◆ getRtsPktsTx()

virtual int MMacDACAP::getRtsPktsTx ( )
inlineprotectedvirtual
Returns
number of RTS packets transmitted

References rts_pkts_tx.

Referenced by command().

◆ getTotalDeferTimes()

virtual int MMacDACAP::getTotalDeferTimes ( )
inlineprotectedvirtual
Returns
number of defers occured

References defer_times_no.

Referenced by command().

◆ getUpLayersDataPktsRx()

int MMacDACAP::getUpLayersDataPktsRx ( )
inlineprotected

Referenced by command().

◆ getWrnPktsRx()

virtual int MMacDACAP::getWrnPktsRx ( )
inlineprotectedvirtual
Returns
number of WRN packets received

References wrn_pkts_rx.

Referenced by command().

◆ getWrnPktsTx()

virtual int MMacDACAP::getWrnPktsTx ( )
inlineprotectedvirtual
Returns
number of WRN packets transmitted

References wrn_pkts_tx.

Referenced by command().

◆ incrCtsPktsRx()

virtual void MMacDACAP::incrCtsPktsRx ( )
inlineprotectedvirtual

Increases the counter of CTS packets received

References cts_pkts_rx.

Referenced by rxStateWaitCTS().

◆ incrCtsPktsTx()

virtual void MMacDACAP::incrCtsPktsTx ( )
inlineprotectedvirtual

Increases the counter of CTS packets transmitted

References cts_pkts_tx.

Referenced by txCts().

◆ incrRtsPktsRx()

virtual void MMacDACAP::incrRtsPktsRx ( )
inlineprotectedvirtual

Increases the counter of RTS packets received

References rts_pkts_rx.

Referenced by rxStateBackoff(), rxStateIdle(), rxStateRecontendWindow(), rxStateSendWarning(), and rxStateWaitData().

◆ incrRtsPktsTx()

virtual void MMacDACAP::incrRtsPktsTx ( )
inlineprotectedvirtual

Increases the counter of RTS packets transmitted

References rts_pkts_tx.

Referenced by txRts().

◆ incrTotalDeferTimes()

virtual void MMacDACAP::incrTotalDeferTimes ( )
inlineprotectedvirtual

Increases the number of times a transmission is deferred

References defer_times_no.

Referenced by stateDeferData().

◆ incrWrnPktsRx()

virtual void MMacDACAP::incrWrnPktsRx ( )
inlineprotectedvirtual

Increases the counter of WRN packets received

References wrn_pkts_rx.

Referenced by rxStateWaitWarning().

◆ incrWrnPktsTx()

virtual void MMacDACAP::incrWrnPktsTx ( )
inlineprotectedvirtual

Increases the counter of WRN packets transmitted

References wrn_pkts_tx.

Referenced by txWrn().

◆ initInfo()

◆ initPkt()

void MMacDACAP::initPkt ( Packet *  p,
int  pkt_type 
)
protectedvirtual

Initializes the packet with the correct MAC source address and destination address, the correct type and size

Parameters
Pointerto the packet that we have to initialize
typeof the packet that we are going to initialize

References ACK_PKT, CTS_PKT, CTS_size, curr_data_pkt, curr_dest_addr, hdr_dacap::dacap_type, DATA_PKT, hdr_dacap::data_sn, HDR_size, hdr_dacap::orig_type, PT_DACAP, RTS_PKT, RTS_size, hdr_dacap::sn, hdr_dacap::ts, hdr_dacap::tx_tries, txsn, u_data_id, u_pkt_id, WRN_PKT, and WRN_size.

Referenced by recvFromUpperLayers(), txAck(), txCts(), txRts(), and txWrn().

◆ Phy2MacEndRx()

void MMacDACAP::Phy2MacEndRx ( Packet *  p)
protectedvirtual

◆ Phy2MacEndTx()

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

Method called when the PHY layer finish to transmit the packet.

Parameters
Packet*Pointer to an object of type Packet that rapresent the Packet transmitted

References ACK_MODE, backoff_pending, curr_state, info, last_reason, multihop_mode, NO_ACK_MODE, op_mode, Q, REASON_ACK_SENT, REASON_BACKOFF_PENDING, REASON_CTS_SENT, REASON_DATA_SENT, REASON_RTS_SENT, STATE_BACKOFF, STATE_IDLE, STATE_SEND_ACK, STATE_SEND_CTS, STATE_SEND_DATA, STATE_SEND_RTS, STATE_SEND_WRN, STATE_WAIT_ACK, STATE_WAIT_CTS, STATE_WAIT_DATA, stateBackoff(), stateIdle(), stateRecontendWindow(), stateSendWarning(), stateWaitACK(), stateWaitCTS(), and TxActive.

Here is the call graph for this function:

◆ Phy2MacStartRx()

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

Method called when the Phy Layer start to receive a Packet

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

References RxActive.

◆ printStateInfo()

void MMacDACAP::printStateInfo ( double  delay = 0)
protectedvirtual

◆ queuePop()

virtual void MMacDACAP::queuePop ( bool  flag = true)
inlineprotectedvirtual

Pop the first element of the queue

References Q.

Referenced by rxStateWaitACK(), stateIdle(), and txData().

◆ recvFromUpperLayers()

void MMacDACAP::recvFromUpperLayers ( Packet *  p)
protectedvirtual

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

Parameters
Packet*pointer to the packet received

References buffer_pkts, curr_state, DATA_PKT, has_buffer_queue, initPkt(), last_reason, Q, REASON_DATA_PENDING, RxActive, session_active, STATE_IDLE, and stateSendRTS().

Here is the call graph for this function:

◆ refreshState()

virtual void MMacDACAP::refreshState ( int  state)
inlineprotectedvirtual

◆ resetStats()

virtual void MMacDACAP::resetStats ( )
inlineprotectedvirtual

Resets all the stats counters

References defer_times_no, wrn_pkts_rx, and wrn_pkts_tx.

◆ rxStateBackoff()

void MMacDACAP::rxStateBackoff ( Packet *  p)
protectedvirtual

◆ rxStateIdle()

void MMacDACAP::rxStateIdle ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in IDLE state is handled

Parameters
Packet*pointer to the packet is reception

References CTS_PKT, curr_dest_addr, hdr_dacap::dacap_type, DATA_PKT, hdr_dacap::data_sn, incrRtsPktsRx(), info, last_data_id_rx, last_reason, REASON_RTS_RECEIVED, REASON_XCTS_RX, REASON_XDATA_RX, REASON_XRTS_RX, RTS_PKT, RxActive, session_active, session_distance, setBackoffNodes(), STATE_SEND_CTS, stateSendCTS(), stateWaitXAck(), stateWaitXCts(), and stateWaitXWarning().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateRecontendWindow()

void MMacDACAP::rxStateRecontendWindow ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in RecontendWindow state is handled

Parameters
Packet*pointer to the packet is reception

References CTS_PKT, curr_dest_addr, hdr_dacap::dacap_type, DATA_PKT, hdr_dacap::data_sn, incrRtsPktsRx(), info, last_data_id_rx, last_reason, REASON_RTS_RECEIVED, REASON_XCTS_RX, REASON_XDATA_RX, REASON_XRTS_RX, RTS_PKT, RxActive, session_active, session_distance, setBackoffNodes(), STATE_SEND_CTS, STATE_WAIT_XACK, STATE_WAIT_XCTS, STATE_WAIT_XWRN, stateSendCTS(), stateWaitXAck(), stateWaitXCts(), and stateWaitXWarning().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateSendWarning()

void MMacDACAP::rxStateSendWarning ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in SendWarning state is handled

Parameters
Packet*pointer to the packet is reception

References ACK_MODE, CTS_PKT, curr_dest_addr, curr_state, hdr_dacap::dacap_type, DATA_PKT, hdr_dacap::data_sn, incrRtsPktsRx(), info, last_data_id_rx, last_reason, max_prop_delay, op_mode, REASON_DATA_RECEIVED, REASON_SAME_RTS_RECEIVED, RTS_PKT, RxActive, session_active, session_distance, stateDataReceived(), stateSendCTS(), t_min, T_W_min, txWrn(), and waitForUser().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateWaitACK()

void MMacDACAP::rxStateWaitACK ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in WaitACK state is handled

Parameters
Packet*pointer to the packet is reception

References ACK_PKT, backoff_pending, curr_dest_addr, hdr_dacap::dacap_type, hdr_dacap::data_sn, info, last_reason, multihop_mode, Q, queuePop(), REASON_ACK_RECEIVED, REASON_BACKOFF_PENDING, RxActive, STATE_BACKOFF, STATE_IDLE, stateBackoff(), stateIdle(), and stateRecontendWindow().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateWaitCTS()

void MMacDACAP::rxStateWaitCTS ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in WaitCTS state is handled

Parameters
Packet*pointer to the packet is reception

References ACK_MODE, CTS_PKT, curr_dest_addr, hdr_dacap::dacap_type, hdr_dacap::data_sn, defer_data, incrCtsPktsRx(), info, last_reason, max_prop_delay, NO_ACK_MODE, op_mode, REASON_CTS_RECEIVED, RTS_PKT, RxActive, session_distance, STATE_WAIT_WRN, stateWaitWarning(), t_min, and T_W_min.

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateWaitData()

void MMacDACAP::rxStateWaitData ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in WaitDATA state is handled

Parameters
Packet*pointer to the packet is reception

References curr_dest_addr, hdr_dacap::dacap_type, DATA_PKT, hdr_dacap::data_sn, incrRtsPktsRx(), info, last_data_id_rx, last_reason, REASON_DATA_RECEIVED, REASON_SAME_RTS_RECEIVED, RTS_PKT, RxActive, session_active, session_distance, STATE_DATA_RECEIVED, stateDataReceived(), and stateSendCTS().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateWaitWarning()

void MMacDACAP::rxStateWaitWarning ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in WaitWarning state is handled

Parameters
Packet*pointer to the packet is reception

References ACK_MODE, CTS_PKT, curr_dest_addr, hdr_dacap::dacap_type, hdr_dacap::data_sn, defer_data, incrWrnPktsRx(), max_prop_delay, NO_ACK_MODE, op_mode, RTS_PKT, RxActive, t_min, T_W_min, and WRN_PKT.

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateWaitXAck()

void MMacDACAP::rxStateWaitXAck ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in WaitXAck state is handled

Parameters
Packet*pointer to the packet is reception

References ACK_MODE, ACK_PKT, hdr_dacap::dacap_type, DATA_PKT, hdr_dacap::data_sn, exitSleep(), info, last_reason, NO_ACK_MODE, op_mode, REASON_TX_ENDED, RxActive, sleep_node_1, sleep_node_2, STATE_IDLE, and stateIdle().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateWaitXCts()

void MMacDACAP::rxStateWaitXCts ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in WaitXCts state is handled

Parameters
Packet*pointer to the packet is reception

References ACK_MODE, ACK_PKT, CTS_PKT, hdr_dacap::dacap_type, DATA_PKT, hdr_dacap::data_sn, exitSleep(), info, last_reason, NO_ACK_MODE, op_mode, REASON_TX_ENDED, REASON_XCTS_RX, REASON_XDATA_RX, RxActive, sleep_node_1, sleep_node_2, STATE_IDLE, STATE_WAIT_XACK, STATE_WAIT_XWRN, stateIdle(), stateWaitXAck(), and stateWaitXWarning().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateWaitXData()

void MMacDACAP::rxStateWaitXData ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in WaitXData state is handled

Parameters
Packet*pointer to the packet is reception

References ACK_MODE, ACK_PKT, hdr_dacap::dacap_type, DATA_PKT, hdr_dacap::data_sn, exitSleep(), info, last_reason, NO_ACK_MODE, op_mode, REASON_TX_ENDED, REASON_XDATA_RX, RxActive, sleep_node_1, sleep_node_2, STATE_IDLE, STATE_WAIT_XACK, stateIdle(), and stateWaitXAck().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ rxStateWaitXWarning()

void MMacDACAP::rxStateWaitXWarning ( Packet *  p)
protectedvirtual

The case of reception while the protocol is in WaitXWarning state is handled

Parameters
Packet*pointer to the packet is reception

References ACK_MODE, ACK_PKT, hdr_dacap::dacap_type, DATA_PKT, hdr_dacap::data_sn, exitSleep(), info, last_reason, NO_ACK_MODE, op_mode, REASON_TX_ENDED, REASON_XDATA_RX, RxActive, sleep_node_1, sleep_node_2, STATE_IDLE, STATE_WAIT_XACK, stateIdle(), and stateWaitXAck().

Referenced by Phy2MacEndRx().

Here is the call graph for this function:

◆ setBackoffNodes()

void MMacDACAP::setBackoffNodes ( double  node,
double  node_b 
)
protectedvirtual

Saves the MAC address of another couple of nodes that is the handshake procedure in order to access the channel

References info, NOT_SET, sleep_node_1, sleep_node_2, and STATE_BACKOFF.

Referenced by rxStateBackoff(), rxStateIdle(), and rxStateRecontendWindow().

◆ stateBackoff()

void MMacDACAP::stateBackoff ( )
protectedvirtual

The protocol is in Backoff state. The node hasn't received the ACK packet and the backoff timer is set up for the re-transmission of the DATA packet

References backoff_counter, backoff_duration, backoff_freeze_mode, backoff_pending, backoff_remaining, backoff_start_time, backoff_timer, backoffStartTime(), defer_data, getBackoffTime(), NOT_SET, prev_state, printStateInfo(), refreshState(), STATE_BACKOFF, STATE_WAIT_ACK, STATE_WAIT_CTS, timer, and warning_sent.

Referenced by Phy2MacEndTx(), and rxStateWaitACK().

Here is the call graph for this function:

◆ stateCTSReceived()

void MMacDACAP::stateCTSReceived ( )
protectedvirtual

The protocol is in the CTSReceived state

References defer_data, printStateInfo(), refreshState(), STATE_CTS_RECEIVED, stateDeferData(), stateSendData(), and timer.

Here is the call graph for this function:

◆ stateDataReceived()

void MMacDACAP::stateDataReceived ( Packet *  data_pkt)
protectedvirtual

The protocol is in the DataReceived state. a Data Packet is received

Parameters
Packet*pointer to the data packet received

References ACK_MODE, HDR_size, op_mode, hdr_dacap::orig_type, printStateInfo(), refreshState(), STATE_DATA_RECEIVED, stateIdle(), stateSendAck(), and timer.

Referenced by rxStateSendWarning(), and rxStateWaitData().

Here is the call graph for this function:

◆ stateDeferData()

void MMacDACAP::stateDeferData ( )
protectedvirtual

The protocol is in the DeferData state. The node has received a WRN packet or has received a CTS packet coming from other nodes. The scheduled transmission is deferred

References computeWaitTime(), deferEndTime(), incrTotalDeferTimes(), op_mode, printStateInfo(), refreshState(), session_distance, STATE_DEFER_DATA, and timer.

Referenced by stateCTSReceived().

Here is the call graph for this function:

◆ stateIdle()

◆ stateRecontendWindow()

void MMacDACAP::stateRecontendWindow ( )
protectedvirtual

The protocol is in RecontendWindow state. In multi-hop scenario after a transmission the node enter in a recontention window before return in IDLE state

References getRecontendTime(), printStateInfo(), refreshState(), STATE_RECONTEND_WINDOW, and timer.

Referenced by Phy2MacEndTx(), and rxStateWaitACK().

Here is the call graph for this function:

◆ stateSendAck()

void MMacDACAP::stateSendAck ( )
protectedvirtual

The protocol is in SendAck state. The node is sending an ACK after the reception of a data packet (if the acknowledgement is active)

References printStateInfo(), refreshState(), STATE_SEND_ACK, timer, and txAck().

Referenced by stateDataReceived().

Here is the call graph for this function:

◆ stateSendCTS()

void MMacDACAP::stateSendCTS ( )
protectedvirtual

The protocol is in SendCTS state. The node is sending CTS afeter the reception of a RTS packet

References printStateInfo(), refreshState(), STATE_SEND_CTS, timer, and txCts().

Referenced by rxStateBackoff(), rxStateIdle(), rxStateRecontendWindow(), rxStateSendWarning(), and rxStateWaitData().

Here is the call graph for this function:

◆ stateSendData()

void MMacDACAP::stateSendData ( )
protectedvirtual

The protocol is in the SendData state. The handshaking phase is done. The node transmit his data packet

References defer_data, printStateInfo(), refreshState(), STATE_SEND_DATA, timer, and txData().

Referenced by stateCTSReceived().

Here is the call graph for this function:

◆ stateSendRTS()

void MMacDACAP::stateSendRTS ( )
protectedvirtual

The protocol is in SendRTS state. A RTS packet is prepared to be transmitted

References curr_data_pkt, printStateInfo(), Q, refreshState(), session_active, STATE_SEND_RTS, timer, and txRts().

Referenced by recvFromUpperLayers(), and stateIdle().

Here is the call graph for this function:

◆ stateSendWarning()

void MMacDACAP::stateSendWarning ( )
protectedvirtual

The protocol is in the SendWarning state. The node has received a CTS or RTS packet from a third node not involved in the transmission. The node is sending the WRN packet to the sender to warning the possibility of a collision is the transmission is occuring

References ACK_MODE, max_prop_delay, op_mode, printStateInfo(), refreshState(), STATE_SEND_WRN, t_min, T_W_min, timer, and wait_costant.

Referenced by Phy2MacEndTx().

Here is the call graph for this function:

◆ stateWaitACK()

void MMacDACAP::stateWaitACK ( )
protectedvirtual

The protocol is in the WaitACK state.

References ACK_PKT, computeTxTime(), DATA_PKT, max_prop_delay, printStateInfo(), refreshState(), STATE_WAIT_ACK, timer, and wait_costant.

Referenced by Phy2MacEndTx().

Here is the call graph for this function:

◆ stateWaitCTS()

void MMacDACAP::stateWaitCTS ( )
protectedvirtual

The protocol is in the WaitCTS state. The node has just sent a RTS packet and now he's waiting for the answer with a CTS packet

References computeTxTime(), CTS_PKT, max_prop_delay, printStateInfo(), refreshState(), RTS_PKT, STATE_WAIT_CTS, timer, and wait_costant.

Referenced by Phy2MacEndTx().

Here is the call graph for this function:

◆ stateWaitData()

void MMacDACAP::stateWaitData ( )
protectedvirtual

The protocol is in the WaitData state. The exchanging of RTS/CTS packets is done. Now the node is waiting for the data packet

References computeTxTime(), computeWaitTime(), DATA_PKT, max_prop_delay, op_mode, printStateInfo(), refreshState(), STATE_WAIT_DATA, timer, and wait_costant.

Here is the call graph for this function:

◆ stateWaitWarning()

void MMacDACAP::stateWaitWarning ( )
protectedvirtual

The protocol is in WaitWarning state. The node has received a CTS or RTS packet from a third node not involved in the transmission. The node is waiting the WRN packet from the receiver

References ACK_MODE, computeTxTime(), max_prop_delay, op_mode, printStateInfo(), refreshState(), STATE_WAIT_WRN, t_min, T_W_min, timer, wait_costant, and WRN_PKT.

Referenced by rxStateWaitCTS().

Here is the call graph for this function:

◆ stateWaitXAck()

void MMacDACAP::stateWaitXAck ( )
protectedvirtual

The protocol is in WaitXAck state. The node has received a data packet coming from a third node that is not involved in the transmission. Now the node is waiting for the ACK packet coming from the destinatay of the data packet (if the acknowledgement is active)

References ACK_PKT, computeTxTime(), max_prop_delay, printStateInfo(), refreshState(), STATE_WAIT_XACK, and timer.

Referenced by rxStateBackoff(), rxStateIdle(), rxStateRecontendWindow(), rxStateWaitXCts(), rxStateWaitXData(), and rxStateWaitXWarning().

Here is the call graph for this function:

◆ stateWaitXCts()

void MMacDACAP::stateWaitXCts ( )
protectedvirtual

The protocol is in WaitXCts state. The node has received a RTS packet coming from a third node that is not involved in the transmission. Now the node is waiting for the CTS coming from the node destinatary of the RTS

References computeTxTime(), CTS_PKT, max_prop_delay, printStateInfo(), refreshState(), STATE_WAIT_XCTS, and timer.

Referenced by rxStateBackoff(), rxStateIdle(), and rxStateRecontendWindow().

Here is the call graph for this function:

◆ stateWaitXData()

void MMacDACAP::stateWaitXData ( )
protectedvirtual

The protocol is in WaitXData state. The node has received a CTS packet coming from a third node that is not involved in the transmission. Now the node is waiting for the data packet coming from the node destinatary of the CTS

References computeTxTime(), computeWaitTime(), DATA_PKT, max_prop_delay, op_mode, printStateInfo(), refreshState(), STATE_WAIT_XDATA, and timer.

Here is the call graph for this function:

◆ stateWaitXWarning()

void MMacDACAP::stateWaitXWarning ( )
protectedvirtual

The protocol is in WaitXWarning state. The node is waiting for a Warning coming from a third node not involved in the transmission

References ACK_MODE, computeTxTime(), max_prop_delay, op_mode, printStateInfo(), refreshState(), RTS_PKT, STATE_WAIT_XWRN, t_min, T_W_min, timer, wait_costant, and WRN_PKT.

Referenced by rxStateBackoff(), rxStateIdle(), rxStateRecontendWindow(), and rxStateWaitXCts().

Here is the call graph for this function:

◆ txAck()

void MMacDACAP::txAck ( )
protectedvirtual

Pass an ACK packet to transmit to the PHY layer

References ACK_PKT, initPkt(), and TxActive.

Referenced by stateSendAck().

Here is the call graph for this function:

◆ txCts()

void MMacDACAP::txCts ( )
protectedvirtual

Pass a CTS packet to transmit to the PHY layer

References CTS_PKT, incrCtsPktsTx(), initPkt(), and TxActive.

Referenced by stateSendCTS().

Here is the call graph for this function:

◆ txData()

void MMacDACAP::txData ( )
protectedvirtual

Pass a DATA packet to transmit to the PHYl layer

References NO_ACK_MODE, op_mode, Q, queuePop(), and TxActive.

Referenced by stateSendData().

Here is the call graph for this function:

◆ txRts()

void MMacDACAP::txRts ( )
protectedvirtual

Pass a RTS packet to transmit to the PHY layer

References curr_data_pkt, curr_dest_addr, incrRtsPktsTx(), initPkt(), RTS_PKT, start_tx_time, and TxActive.

Referenced by stateSendRTS().

Here is the call graph for this function:

◆ txWrn()

void MMacDACAP::txWrn ( )
protectedvirtual

Pass a WRN packet to transmit to the PHY layer

References incrWrnPktsTx(), initPkt(), TxActive, warning_sent, and WRN_PKT.

Referenced by rxStateSendWarning().

Here is the call graph for this function:

◆ waitForUser()

void MMacDACAP::waitForUser ( )
inlineprotectedvirtual

Used for debug purposes. (Permit to have a "step by step" behaviour of the protocol)

Referenced by rxStateSendWarning().

Friends And Related Symbol Documentation

◆ DACAPBTimer

friend class DACAPBTimer
friend

DACAP Backoff timer

◆ DACAPTimer

friend class DACAPTimer
friend

DACAP ACK timer

Member Data Documentation

◆ ACK_size

int MMacDACAP::ACK_size
protected

Size (in bytes) of the ACK packet

Referenced by computeTxTime(), and MMacDACAP().

◆ alpha_

double MMacDACAP::alpha_
protected

smoothing factor used for statistics using first order IIR filter

Referenced by MMacDACAP().

◆ backoff_counter

int MMacDACAP::backoff_counter
protected

Number of times a backoff timer is set up

Referenced by getBackoffTime(), printStateInfo(), stateBackoff(), and stateIdle().

◆ backoff_duration

double MMacDACAP::backoff_duration
protected

Backoff duration

Referenced by exitBackoff(), freezeBackoff(), and stateBackoff().

◆ backoff_first_start

double MMacDACAP::backoff_first_start
protected

Timestamp at which the backoff timer is started for the first time (if the timer has been freezed many times

Referenced by backoffEndTime(), backoffStartTime(), and exitBackoff().

◆ backoff_freeze_mode

bool MMacDACAP::backoff_freeze_mode
protected

true if the backoff-timer is freezed

Referenced by command(), exitBackoff(), rxStateBackoff(), and stateBackoff().

◆ backoff_pending

bool MMacDACAP::backoff_pending
protected

true if the backoff-timer is active (i.e. there's a backoff process)

Referenced by exitBackoff(), freezeBackoff(), Phy2MacEndTx(), rxStateWaitACK(), and stateBackoff().

◆ backoff_remaining

double MMacDACAP::backoff_remaining
protected

Backoff time remaining (if the timer is freezed)

Referenced by exitBackoff(), freezeBackoff(), and stateBackoff().

◆ backoff_start_time

double MMacDACAP::backoff_start_time
protected

Backoff starting time

Referenced by exitBackoff(), freezeBackoff(), and stateBackoff().

◆ backoff_timer

DACAPBTimer MMacDACAP::backoff_timer
protected

backoff timer

Referenced by exitBackoff(), and stateBackoff().

◆ backoff_tuner

double MMacDACAP::backoff_tuner
protected

Multiplicative factor in the calculation of backoff

Referenced by getBackoffTime(), and MMacDACAP().

◆ buffer_pkts

int MMacDACAP::buffer_pkts
protected

Dimension (in packets) of the buffer queue

Referenced by MMacDACAP(), and recvFromUpperLayers().

◆ cts_pkts_rx

int MMacDACAP::cts_pkts_rx
protected

Counter of CTS packets RX

Referenced by getCtsPktsRx(), and incrCtsPktsRx().

◆ cts_pkts_tx

int MMacDACAP::cts_pkts_tx
protected

Counter of CTS packets TX

Referenced by getCtsPktsTx(), and incrCtsPktsTx().

◆ CTS_size

int MMacDACAP::CTS_size
protected

Size (in bytes) of the CTS packet

Referenced by computeTxTime(), initPkt(), and MMacDACAP().

◆ curr_data_pkt

Packet* MMacDACAP::curr_data_pkt
protected

Pointer to the current data packet

Referenced by initPkt(), stateSendRTS(), and txRts().

◆ curr_dest_addr

int MMacDACAP::curr_dest_addr
protected

◆ curr_state

int MMacDACAP::curr_state
protected

◆ defer_data

bool MMacDACAP::defer_data
protected

true if a node has to defer the transmission of a data packet

Referenced by rxStateWaitCTS(), rxStateWaitWarning(), stateBackoff(), stateCTSReceived(), stateIdle(), and stateSendData().

◆ defer_times_no

double MMacDACAP::defer_times_no
protected

Counter of defer times

Referenced by getMeanDeferTime(), getTotalDeferTimes(), incrTotalDeferTimes(), and resetStats().

◆ delta_D

double MMacDACAP::delta_D
protected

Value (in m) that indicates how far we want the CTS propagates over the sender before initiate the data transmission process (it determines the T_w value)

Referenced by computeWaitTime(), and MMacDACAP().

◆ delta_data

double MMacDACAP::delta_data
protected

Dimension difference (in bytes) among data packets ( 0 if the packets have always the same dimension)

Referenced by computeWaitTime(), and MMacDACAP().

◆ fout

ofstream MMacDACAP::fout
protected

Object that handle the file where the state transitions is written (if the print_transitions option is active)

Referenced by command(), and printStateInfo().

◆ has_buffer_queue

bool MMacDACAP::has_buffer_queue
protected

true if the node has a buffer queue to store data packets

Referenced by MMacDACAP(), and recvFromUpperLayers().

◆ HDR_size

int MMacDACAP::HDR_size
protected

Size (in bytes) of the header added by DACAP

Referenced by computeTxTime(), initPkt(), MMacDACAP(), and stateDataReceived().

◆ info

◆ last_data_id_rx

int MMacDACAP::last_data_id_rx
protected

Unique ID of the last data packet received

Referenced by rxStateBackoff(), rxStateIdle(), rxStateRecontendWindow(), rxStateSendWarning(), and rxStateWaitData().

◆ last_data_id_tx

int MMacDACAP::last_data_id_tx
protected

Unique ID of the last data packet transmitted

Referenced by stateIdle().

◆ last_reason

◆ max_backoff_counter

double MMacDACAP::max_backoff_counter
protected

Number of times a backoff is calculated

Referenced by getBackoffTime(), and MMacDACAP().

◆ max_payload

int MMacDACAP::max_payload
protected

Dimension of the maximum allowed data paylaod in bytes

Referenced by computeTxTime(), and MMacDACAP().

◆ max_prop_delay

◆ max_tx_tries

double MMacDACAP::max_tx_tries
protected

Maximum transmission tries for one packet before discarding the packet

Referenced by MMacDACAP(), and stateIdle().

◆ multihop_mode

bool MMacDACAP::multihop_mode
protected

true if the multihop mode is active to simulate a multihop scenario with routing

Referenced by command(), Phy2MacEndTx(), and rxStateWaitACK().

◆ op_mode

◆ prev_state

int MMacDACAP::prev_state
protected

Previous state of the protocol

Referenced by printStateInfo(), refreshState(), and stateBackoff().

◆ print_transitions

bool MMacDACAP::print_transitions
protected

true if the state-transitions of the protocol is printed on a file

Referenced by command(), initInfo(), and printStateInfo().

◆ Q

std::queue<Packet *> MMacDACAP::Q
protected

◆ rts_pkts_rx

int MMacDACAP::rts_pkts_rx
protected

Counter of RTS packets RX

Referenced by getRtsPktsRx(), and incrRtsPktsRx().

◆ rts_pkts_tx

int MMacDACAP::rts_pkts_tx
protected

Counter of RTS packets TX

Referenced by getRtsPktsTx(), and incrRtsPktsTx().

◆ RTS_sent_time

double MMacDACAP::RTS_sent_time
protected

Timestamp at which the RTS packet is sent

◆ RTS_size

int MMacDACAP::RTS_size
protected

Size (in bytes) of the RTS packet

Referenced by computeTxTime(), initPkt(), and MMacDACAP().

◆ rttsamples

int MMacDACAP::rttsamples
protected

num of RTT samples

◆ RxActive

◆ session_active

bool MMacDACAP::session_active
protected

true if a session is active (i.e. an hand-shaking process is occurring

Referenced by recvFromUpperLayers(), rxStateBackoff(), rxStateIdle(), rxStateRecontendWindow(), rxStateSendWarning(), rxStateWaitData(), stateIdle(), and stateSendRTS().

◆ session_distance

double MMacDACAP::session_distance
protected

Distance between sender and receiver in the current session

Referenced by rxStateBackoff(), rxStateIdle(), rxStateRecontendWindow(), rxStateSendWarning(), rxStateWaitCTS(), rxStateWaitData(), stateDeferData(), and stateIdle().

◆ sleep_node_1

int MMacDACAP::sleep_node_1
protected

◆ sleep_node_2

int MMacDACAP::sleep_node_2
protected

◆ srtt

double MMacDACAP::srtt
protected

Smoothed Round Trip Time, calculated as for TCP

◆ start_tx_time

double MMacDACAP::start_tx_time
protected

Timestamp at which a packet is transmitted

Referenced by txRts().

◆ sum_defer_time

double MMacDACAP::sum_defer_time
protected

Sum of the defer timers

Referenced by deferEndTime(), and getMeanDeferTime().

◆ sumrtt

double MMacDACAP::sumrtt
protected

sum of RTT samples

◆ sumrtt2

double MMacDACAP::sumrtt2
protected

sum of (RTT^2)

◆ t_min

double MMacDACAP::t_min
protected

◆ T_W_min

double MMacDACAP::T_W_min
protected

◆ timer

◆ TxActive

bool MMacDACAP::TxActive
protected

true if a transmission process is occuring

Referenced by Phy2MacEndTx(), txAck(), txCts(), txData(), txRts(), and txWrn().

◆ txsn

int MMacDACAP::txsn
protected

serial number of the DATA packet transmitted

Referenced by initPkt().

◆ u_data_id

int MMacDACAP::u_data_id
protected

simulation-unique DATA packet ID

Referenced by initPkt().

◆ u_pkt_id

int MMacDACAP::u_pkt_id
staticprotected

simulation-unique packet ID

Referenced by initPkt(), and MMacDACAP().

◆ wait_costant

double MMacDACAP::wait_costant
protected

◆ warning_sent

bool MMacDACAP::warning_sent
protected

true if a WRN packet has been just sent

Referenced by stateBackoff(), stateIdle(), and txWrn().

◆ wrn_pkts_rx

int MMacDACAP::wrn_pkts_rx
protected

Counter of WRN packets RX

Referenced by getWrnPktsRx(), incrWrnPktsRx(), and resetStats().

◆ wrn_pkts_tx

int MMacDACAP::wrn_pkts_tx
protected

Counter of WRN packets TX

Referenced by getWrnPktsTx(), incrWrnPktsTx(), and resetStats().

◆ WRN_size

int MMacDACAP::WRN_size
protected

Size (in bytes) of the WRN packet

Referenced by computeTxTime(), initPkt(), and MMacDACAP().


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