DESERT 3.5.1
Loading...
Searching...
No Matches
MMacUWSR Class Reference

#include <uwsr.h>

Inheritance diagram for MMacUWSR:
Collaboration diagram for MMacUWSR:

Classes

class  AckTimer
 
class  BackOffTimer
 
class  ListenTimer
 
class  UWSRTimer
 
class  WaitTxTimer
 

Public Member Functions

 MMacUWSR ()
 
virtual ~MMacUWSR ()
 
virtual int command (int argc, const char *const *argv)
 

Protected Types

enum  UWSR_STATUS {
  UWSR_STATE_IDLE = 1 , UWSR_STATE_BACKOFF , UWSR_STATE_TX_DATA , UWSR_STATE_TX_ACK ,
  UWSR_STATE_WAIT_ACK , UWSR_STATE_DATA_RX , UWSR_STATE_ACK_RX , UWSR_STATE_NOT_SET ,
  UWSR_STATE_LISTEN , UWSR_STATE_CHK_ACK_TIMEOUT , UWSR_STATE_CHK_LISTEN_TIMEOUT , UWSR_STATE_CHK_BACKOFF_TIMEOUT ,
  UWSR_STATE_RX_IDLE , UWSR_STATE_RX_LISTEN , UWSR_STATE_RX_BACKOFF , UWSR_STATE_RX_WAIT_ACK ,
  UWSR_STATE_WRONG_PKT_RX , UWSR_STATE_WAIT_TX , UWSR_STATE_CHK_WAIT_TX_TIMEOUT , UWSR_STATE_WAIT_ACK_WAIT_TX ,
  UWSR_STATE_RX_DATA_TX_DATA , UWSR_STATE_PRE_TX_DATA , UWSR_STATE_RX_IN_PRE_TX_DATA
}
 
enum  UWSR_REASON_STATUS {
  UWSR_REASON_DATA_PENDING , UWSR_REASON_DATA_RX , UWSR_REASON_DATA_TX , UWSR_REASON_ACK_TX ,
  UWSR_REASON_ACK_RX , UWSR_REASON_BACKOFF_TIMEOUT , UWSR_REASON_ACK_TIMEOUT , UWSR_REASON_DATA_EMPTY ,
  UWSR_REASON_NOT_SET , UWSR_REASON_MAX_TX_TRIES , UWSR_REASON_BACKOFF_PENDING , UWSR_REASON_LISTEN ,
  UWSR_REASON_LISTEN_TIMEOUT , UWSR_REASON_LISTEN_PENDING , UWSR_REASON_START_RX , UWSR_REASON_PKT_NOT_FOR_ME ,
  UWSR_REASON_WAIT_ACK_PENDING , UWSR_REASON_PKT_ERROR , UWSR_REASON_WAIT_TX , UWSR_REASON_WAIT_TX_PENDING ,
  UWSR_REASON_WAIT_TX_TIMEOUT
}
 
enum  UWSR_PKT_TYPE { UWSR_ACK_PKT = 1 , UWSR_DATA_PKT , UWSR_DATAMAX_PKT }
 
enum  UWSR_TIMER_STATUS { UWSR_IDLE = 1 , UWSR_RUNNING , UWSR_FROZEN , UWSR_EXPIRED }
 
enum  CHECK_ACK_TIMER { CHECK_ACTIVE = 1 , CHECK_EXPIRED , CHECK_IDLE }
 

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 double computeTxTime (UWSR_PKT_TYPE type)
 
virtual void initPkt (Packet *p, UWSR_PKT_TYPE pkt_type, int dest_addr=0)
 
virtual double getBackoffTime ()
 
void setBackoffCount ()
 
int getBackoffCount ()
 
virtual void statePreTxData ()
 
virtual void txAck (int dest_addr)
 
virtual void stateIdle ()
 
virtual void stateRxIdle ()
 
virtual void stateTxData ()
 
virtual void stateTxAck (int dest_addr)
 
virtual void stateBackoff ()
 
virtual void stateRxBackoff ()
 
virtual void stateWaitAck ()
 
virtual void stateRxinPreTxData ()
 
virtual void stateRxWaitAck ()
 
virtual void stateListen ()
 
virtual void stateRxListen ()
 
virtual void stateCheckListenExpired ()
 
virtual void stateCheckAckExpired ()
 
virtual void stateCheckBackoffExpired ()
 
virtual void stateCheckWaitTxExpired ()
 
virtual void stateRxData (Packet *p)
 
virtual void stateRxAck (Packet *p)
 
virtual void stateRxPacketNotForMe (Packet *p)
 
virtual void printStateInfo (double delay=0)
 
virtual void initInfo ()
 
virtual void refreshState (UWSR_STATUS state)
 
virtual void refreshReason (UWSR_REASON_STATUS reason)
 
virtual void exitBackoff ()
 
virtual double getRTT ()
 
virtual void updateLastDataIdRx (int id)
 
virtual void waitForUser ()
 
virtual int getRemainingPkts ()
 
virtual void incrUpperDataRx ()
 
virtual int getPktSeqNum (Packet *p)
 
virtual int getMacAddress (Packet *p)
 
bool chkItemInmapTxRounds (int mac_addr, int seq_num)
 
void setCurrTxRounds (int mac_addr, int seq_num)
 
void incrCurrTxRounds (int mac_addr, int seq_num)
 
int getCurrTxRounds (int mac_addr, int seq_num)
 
void eraseItemFromTxRounds (int mac_addr, int seq_num)
 
void putPktInQueue (Packet *p)
 
void eraseItemFromPktQueue (int mac_addr, int seq_num)
 
void putAckTimerInMap (int mac_addr, int seq_num)
 
void eraseItemFrommapAckTimer (int mac_addr, int seq_num)
 
void putStartTxTimeInMap (int mac_addr, int seq_num, double start_tx_time)
 
void eraseItemFrommapCalcAck (int mac_addr, int seq_num)
 
virtual int checkAckTimer (CHECK_ACK_TIMER type)
 
virtual void eraseExpiredItemsFrommapAckandCalc ()
 
virtual bool checkMultipleTx (int rcv_mac_addr)
 
virtual int getPktsCanSendIn1RTT (int mac_addr)
 
virtual void putRTTInMap (int mac_addr, double rtt)
 
double getRTTInMap (int mac_addr)
 
void incrPktsSentIn1RTT ()
 
void rstPktsSentIn1RTT ()
 
int getPktsSentIn1RTT ()
 
void incrAcksRcvIn1RTT ()
 
void rstAcksRcvIn1RTT ()
 
int getAcksRcvIn1RTT ()
 
void incrPktsLostCount ()
 
void rstPktsLostCount ()
 
int getPktsLostCount ()
 
virtual bool prepBeforeTx (int mac_addr, int seq_num)
 
virtual double calcWaitTxTime (int mac_addr)
 
void updateTxStatus (macAddress mac_addr, int rcv_acks)
 
virtual int calWindowSize (macAddress mac_addr)
 
void calTotalPktsTx ()
 
double getAvgPktsTxIn1RTT ()
 

Protected Attributes

int max_tx_tries
 
double backoff_tuner
 
double wait_constant
 
int max_payload
 
int HDR_size
 
int ACK_size
 
double ACK_timeout
 
int buffer_pkts
 
double alpha_
 
double max_backoff_counter
 
double listen_time
 
double guard_time
 
double node_speed
 
double var_k
 
int uwsr_debug
 
int last_sent_data_id
 
bool print_transitions
 
bool has_buffer_queue
 
double start_tx_time
 
double srtt
 
double sumrtt
 
double sumrtt2
 
int rttsamples
 
int curr_tx_rounds
 
int last_data_id_rx
 
int recv_data_id
 
int backoff_count
 
int pkt_tx_count
 
Packet * curr_data_pkt
 
double round_trip_time
 
double wait_tx_time
 
double sumwtt
 
int wttsamples
 
int pkts_sent_1RTT
 
int acks_rcv_1RTT
 
int pkts_lost_counter
 
int window_size
 
int txsn
 
double latest_ack_timeout
 
int prv_mac_addr
 
int hit_count
 
int total_pkts_tx
 
AckTimer ack_timer
 
BackOffTimer backoff_timer
 
ListenTimer listen_timer
 
WaitTxTimer wait_tx_timer
 
UWSR_REASON_STATUS last_reason
 
UWSR_STATUS curr_state
 
UWSR_STATUS prev_state
 
UWSR_STATUS prev_prev_state
 
map< usrPair, Packet * > mapPacket
 
map< usrPair, txRoundsmapTxRounds
 
map< usrPair, AckTimermapAckTimer
 
map< usrPair, txStartTimemapCalcAck
 
map< macAddress, rttPairmapRTT
 
map< macAddress, txStatusPairmapTxStatus
 
ofstream fout
 

Static Protected Attributes

static bool initialized = false
 
static const double prop_speed = 1500.0
 
static map< UWSR_STATUS, string > status_info
 
static map< UWSR_REASON_STATUS, string > reason_info
 
static map< UWSR_PKT_TYPE, string > pkt_type_info
 

Detailed Description

This is the base class of MMacUWSR protocol, which is a derived class of MMac.

Definition at line 84 of file uwsr.h.

Member Enumeration Documentation

◆ CHECK_ACK_TIMER

enum MMacUWSR::CHECK_ACK_TIMER
protected

This enumeration class is employed to know the current acknowledgement timer status.

First enumerator is given value 1.

Enumerator
CHECK_ACTIVE 
CHECK_EXPIRED 
CHECK_IDLE 

Definition at line 187 of file uwsr.h.

◆ UWSR_PKT_TYPE

enum MMacUWSR::UWSR_PKT_TYPE
protected

Enumeration class of packet type.

First enumerator is given value 1. Three kinds of packets are supported by MMacUWSR protocol.

Enumerator
UWSR_ACK_PKT 
UWSR_DATA_PKT 
UWSR_DATAMAX_PKT 

Definition at line 170 of file uwsr.h.

◆ UWSR_REASON_STATUS

Enumeration class which tells the nodes the reason why it is in this state.

First enumerator is given value 1.

Enumerator
UWSR_REASON_DATA_PENDING 
UWSR_REASON_DATA_RX 
UWSR_REASON_DATA_TX 
UWSR_REASON_ACK_TX 
UWSR_REASON_ACK_RX 
UWSR_REASON_BACKOFF_TIMEOUT 
UWSR_REASON_ACK_TIMEOUT 
UWSR_REASON_DATA_EMPTY 
UWSR_REASON_NOT_SET 
UWSR_REASON_MAX_TX_TRIES 
UWSR_REASON_BACKOFF_PENDING 
UWSR_REASON_LISTEN 
UWSR_REASON_LISTEN_TIMEOUT 
UWSR_REASON_LISTEN_PENDING 
UWSR_REASON_START_RX 
UWSR_REASON_PKT_NOT_FOR_ME 
UWSR_REASON_WAIT_ACK_PENDING 
UWSR_REASON_PKT_ERROR 
UWSR_REASON_WAIT_TX 
UWSR_REASON_WAIT_TX_PENDING 
UWSR_REASON_WAIT_TX_TIMEOUT 

Definition at line 142 of file uwsr.h.

◆ UWSR_STATUS

enum MMacUWSR::UWSR_STATUS
protected

Enumeration class of MMacUWSR status.

First enumerator is given value 1.

Enumerator
UWSR_STATE_IDLE 
UWSR_STATE_BACKOFF 
UWSR_STATE_TX_DATA 
UWSR_STATE_TX_ACK 
UWSR_STATE_WAIT_ACK 
UWSR_STATE_DATA_RX 
UWSR_STATE_ACK_RX 
UWSR_STATE_NOT_SET 
UWSR_STATE_LISTEN 
UWSR_STATE_CHK_ACK_TIMEOUT 
UWSR_STATE_CHK_LISTEN_TIMEOUT 
UWSR_STATE_CHK_BACKOFF_TIMEOUT 
UWSR_STATE_RX_IDLE 
UWSR_STATE_RX_LISTEN 
UWSR_STATE_RX_BACKOFF 
UWSR_STATE_RX_WAIT_ACK 
UWSR_STATE_WRONG_PKT_RX 
UWSR_STATE_WAIT_TX 
UWSR_STATE_CHK_WAIT_TX_TIMEOUT 
UWSR_STATE_WAIT_ACK_WAIT_TX 
UWSR_STATE_RX_DATA_TX_DATA 
UWSR_STATE_PRE_TX_DATA 
UWSR_STATE_RX_IN_PRE_TX_DATA 

Definition at line 112 of file uwsr.h.

◆ UWSR_TIMER_STATUS

Enumeration class of MMacUWSR timer status.

First enumerator is given value

  1. It is employed to know the current status of a timer.
Enumerator
UWSR_IDLE 
UWSR_RUNNING 
UWSR_FROZEN 
UWSR_EXPIRED 

Definition at line 176 of file uwsr.h.

Constructor & Destructor Documentation

◆ MMacUWSR()

MMacUWSR::MMacUWSR ( )

Constructor of MMacUWSR Class.

Definition at line 173 of file uwsr.cpp.

◆ ~MMacUWSR()

MMacUWSR::~MMacUWSR ( )
virtual

Destructor of MMacUWSR Class.

Definition at line 239 of file uwsr.cpp.

Member Function Documentation

◆ calcWaitTxTime()

double MMacUWSR::calcWaitTxTime ( int  mac_addr)
protectedvirtual

Calcultes the time a node has to wait before transmitting another packet in a single RTT.

Parameters
macaddress of the receiving node.
Returns
waiting time (double)

Definition at line 459 of file uwsr.cpp.

◆ calTotalPktsTx()

void MMacUWSR::calTotalPktsTx ( )
inlineprotected

Total number of packets transmitted by a node.

Definition at line 1132 of file uwsr.h.

◆ calWindowSize()

int MMacUWSR::calWindowSize ( macAddress  mac_addr)
protectedvirtual

Number of packets a node can transmits to a receving node in a single RTT.

Returns
maximum number of packets a node can transmits to a receiving node (integer).

Definition at line 361 of file uwsr.cpp.

◆ checkAckTimer()

int MMacUWSR::checkAckTimer ( CHECK_ACK_TIMER  type)
protectedvirtual

It checks whether any acknowledgement timer expire.

Since, in UWSR, we are transmitting multiple packet in a single RTT, we have to check AckTimer container whether any acknowledgement timer expire or not.

Parameters
typewhich is a CHECK_ACK_TIMER data type.
Returns
number of acknowledgements expire in the container.

Definition at line 541 of file uwsr.cpp.

◆ checkMultipleTx()

bool MMacUWSR::checkMultipleTx ( int  rcv_mac_addr)
protectedvirtual

This method checks whether the node is capable of sending multiple packets in a single RTT.

Parameters
macaddress of the receiving node.
Returns
Returns TRUE if multiple packet transmission is possible, FALSE otherwise.

Definition at line 495 of file uwsr.cpp.

◆ chkItemInmapTxRounds()

bool MMacUWSR::chkItemInmapTxRounds ( int  mac_addr,
int  seq_num 
)
inlineprotected

handling transmission round

It checks whether the same packet is transmitted before.

Parameters
macaddress of the node
sequencenumber of the packet.
Returns
boolean data type. Returns TRUE when this packet was not transmitted before and FALSE when it was transmitted.

Definition at line 445 of file uwsr.cpp.

◆ command()

int MMacUWSR::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 succesfully or not

Definition at line 245 of file uwsr.cpp.

◆ computeTxTime()

double MMacUWSR::computeTxTime ( UWSR_PKT_TYPE  type)
protectedvirtual

Compute the transmission time of a packet.

It uses a cross-layer message to calculate the duration of that packet.

Parameters
typeis a UWSR_PKT_TYPE
Returns
tranmission time of a packet which is a double data type.

Definition at line 634 of file uwsr.cpp.

◆ eraseExpiredItemsFrommapAckandCalc()

void MMacUWSR::eraseExpiredItemsFrommapAckandCalc ( )
protectedvirtual

Erases those items whose acknowledgement timer expire from AckTimer containter and also from start trasmit time contaioner.

Definition at line 606 of file uwsr.cpp.

◆ eraseItemFrommapAckTimer()

void MMacUWSR::eraseItemFrommapAckTimer ( int  mac_addr,
int  seq_num 
)
inlineprotected

If a node receives an ACK for its transmitted packet, it erases the related AckTimer object of that packet.

Parameters
macaddress of the node
sequencenumber of the packet.

Definition at line 920 of file uwsr.h.

◆ eraseItemFrommapCalcAck()

void MMacUWSR::eraseItemFrommapCalcAck ( int  mac_addr,
int  seq_num 
)
inlineprotected

Erases the transmission start time of a packet when an ACK is received correctly.

Parameters
macaddress of the node
sequencenumber of the packet.

Definition at line 946 of file uwsr.h.

◆ eraseItemFromPktQueue()

void MMacUWSR::eraseItemFromPktQueue ( int  mac_addr,
int  seq_num 
)
inlineprotected

Erase the packet which is delivered to the destination correctly or other reasons.

Definition at line 892 of file uwsr.h.

◆ eraseItemFromTxRounds()

void MMacUWSR::eraseItemFromTxRounds ( int  mac_addr,
int  seq_num 
)
inlineprotected

Erase an Item form the container where transmission round of various transmit packet are stored.

Parameters
macaddress of the node
sequencenumber of the packet.

Definition at line 868 of file uwsr.h.

◆ exitBackoff()

void MMacUWSR::exitBackoff ( )
protectedvirtual

It stops the backoff timer.

Definition at line 663 of file uwsr.cpp.

◆ getAcksRcvIn1RTT()

int MMacUWSR::getAcksRcvIn1RTT ( )
inlineprotected

Returns number of ACK packets receive by a node in single RTT.

Returns
number of ACK receive in single RTT.

Definition at line 1059 of file uwsr.h.

◆ getAvgPktsTxIn1RTT()

double MMacUWSR::getAvgPktsTxIn1RTT ( )
inlineprotected

Average number of packets transmitted in a single RTT.

Definition at line 1142 of file uwsr.h.

◆ getBackoffCount()

int MMacUWSR::getBackoffCount ( )
inlineprotected

It returns the number of time backoff counter is run in the whole communication period.

Returns
backoff_count which is an integer data type.

Definition at line 577 of file uwsr.h.

◆ getBackoffTime()

double MMacUWSR::getBackoffTime ( )
protectedvirtual

This function calculates the backoff duration and return the backoff time.It employs the exponential backoff algorithm.

Returns
backoff duration which is a double data type.

Definition at line 669 of file uwsr.cpp.

◆ getCurrTxRounds()

int MMacUWSR::getCurrTxRounds ( int  mac_addr,
int  seq_num 
)
inlineprotected

Returns the current transmission round of a Data packet.

Parameters
macaddress of the node
sequencenumber of the packet.
Returns
an integer data type.

Definition at line 854 of file uwsr.h.

◆ getMacAddress()

virtual int MMacUWSR::getMacAddress ( Packet *  p)
inlineprotectedvirtual

This method returns the destination mac address of the node which transmits the packet.

Parameters
packetpointer
Returns
it returns the mac address of the node

Definition at line 805 of file uwsr.h.

◆ getPktsCanSendIn1RTT()

int MMacUWSR::getPktsCanSendIn1RTT ( int  mac_addr)
protectedvirtual

Number of packets a node can transmits to a receiving node in a single RTT.

Parameters
macaddress of the receiving node.
Returns
number of packets can transmit in a single RTT (integer).

Definition at line 406 of file uwsr.cpp.

◆ getPktSeqNum()

virtual int MMacUWSR::getPktSeqNum ( Packet *  p)
inlineprotectedvirtual

This method is used to get the sequence number from a packet.

Parameters
packetpointer
Returns
it returns sequence number which is an integer data type.

Definition at line 792 of file uwsr.h.

◆ getPktsLostCount()

int MMacUWSR::getPktsLostCount ( )
inlineprotected

Returns number of packets lost in single RTT.

Returns
number of packets lost in single RTT (integer).

Definition at line 1087 of file uwsr.h.

◆ getPktsSentIn1RTT()

int MMacUWSR::getPktsSentIn1RTT ( )
inlineprotected

Returns number of Data packets transmit in single RTT.

Returns
packets sent in single RTT (integer).

Definition at line 1030 of file uwsr.h.

◆ getRemainingPkts()

virtual int MMacUWSR::getRemainingPkts ( )
inlineprotectedvirtual

Number of packets which MAC layer receives form upper layer(s) but were not transmitted.

Returns
an integer value.

Definition at line 772 of file uwsr.h.

◆ getRTT()

virtual double MMacUWSR::getRTT ( )
inlineprotectedvirtual

This method is used to get the average RTT over all the receives RTT.

Returns
average RTT time which is a double data type.

Definition at line 749 of file uwsr.h.

◆ getRTTInMap()

double MMacUWSR::getRTTInMap ( int  mac_addr)
inlineprotected

Returns the RTT between a sender-receiver pair.

Parameters
macaddress of the receiving node.
Returns
RTT which is a double data type.

Definition at line 1000 of file uwsr.h.

◆ incrAcksRcvIn1RTT()

void MMacUWSR::incrAcksRcvIn1RTT ( )
inlineprotected

Increments the number of ACK packets receive by a node in single RTT.

Definition at line 1040 of file uwsr.h.

◆ incrCurrTxRounds()

void MMacUWSR::incrCurrTxRounds ( int  mac_addr,
int  seq_num 
)
inlineprotected

Increment the number of times a packet is transmitted.

Parameters
macaddress of the node
sequencenumber of the packet.

Definition at line 840 of file uwsr.h.

◆ incrPktsLostCount()

void MMacUWSR::incrPktsLostCount ( )
inlineprotected

Increments the number of packets lost in a single RTT.

Definition at line 1068 of file uwsr.h.

◆ incrPktsSentIn1RTT()

void MMacUWSR::incrPktsSentIn1RTT ( )
inlineprotected

Increments the number of Data packets sent in single RTT.

Definition at line 1011 of file uwsr.h.

◆ incrUpperDataRx()

virtual void MMacUWSR::incrUpperDataRx ( )
inlineprotectedvirtual

Increment the number of Data packet receive for the upper layer.

Definition at line 781 of file uwsr.h.

◆ initInfo()

void MMacUWSR::initInfo ( )
protectedvirtual

This function is used to initialize the UWAloha protocol.

Definition at line 282 of file uwsr.cpp.

◆ initPkt()

void MMacUWSR::initPkt ( Packet *  p,
UWSR_PKT_TYPE  pkt_type,
int  dest_addr = 0 
)
protectedvirtual

This method, initialize the packet.

If the packet is received from the upper layer, it adds the header (if any). It also sets the fields of ACK packet.

Parameters
Packetpointer P. The packet can be Data packet or ACK packet.
pkt_typeis an UWSR_PKT_TYPE. Packet can be either Data packet or ACK packet.
dest_addris a integer data type. It is initialized as 0.

Definition at line 713 of file uwsr.cpp.

◆ Mac2PhyStartTx()

void MMacUWSR::Mac2PhyStartTx ( Packet *  p)
protectedvirtual

It informs that a packet transmission started.

Parameters
Packetpointer

Definition at line 738 of file uwsr.cpp.

◆ Phy2MacEndRx()

void MMacUWSR::Phy2MacEndRx ( Packet *  p)
protectedvirtual

PHY layer informs the MAC layer that the reception of the packet is over.

Parameters
Packetpointer.

Definition at line 935 of file uwsr.cpp.

◆ Phy2MacEndTx()

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

It infroms that a packet transmission end.

Parameters
Packetpointer (constant)

Definition at line 749 of file uwsr.cpp.

◆ Phy2MacStartRx()

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

PHY layer informs the MAC layer that it is receiving a packet.

@Param Packet pointer (constant)

Definition at line 896 of file uwsr.cpp.

◆ prepBeforeTx()

bool MMacUWSR::prepBeforeTx ( int  mac_addr,
int  seq_num 
)
protectedvirtual

It checks how many times a packet is transmitted.

If it reaches the threshold of retransmission, the packet is deleted from the all containers.

Parameters
macaddress of the node
sequencenumber of the packet.
Returns
whether this packet can be transmitted or not. TRUE means its retransmission does not exit the threshold and FALSE otherwise.

Definition at line 1323 of file uwsr.cpp.

◆ printStateInfo()

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

This methods print the state information of the nodes.

Parameters
delayis a double data type.

Definition at line 1584 of file uwsr.cpp.

◆ putAckTimerInMap()

void MMacUWSR::putAckTimerInMap ( int  mac_addr,
int  seq_num 
)
inlineprotected

managing ack

Put AckTimer Object in the container. For every transmitted packet an AckTimer object is created.

Parameters
macaddress of the node
sequencenumber of the packet.

Definition at line 908 of file uwsr.h.

◆ putPktInQueue()

void MMacUWSR::putPktInQueue ( Packet *  p)
inlineprotected

handling packets

Store the packet in a container.

Parameters
packetpointer

Definition at line 881 of file uwsr.h.

◆ putRTTInMap()

void MMacUWSR::putRTTInMap ( int  mac_addr,
double  rtt 
)
protectedvirtual

Put RTT of all the nodes which are whithin the transmission range of a node.

Whever a node receives a packet from another node, it put the RTT information of that node in a container.

Parameters
macaddress of the node which transmits the packet
RTTof the sender and receiver.

Definition at line 381 of file uwsr.cpp.

◆ putStartTxTimeInMap()

void MMacUWSR::putStartTxTimeInMap ( int  mac_addr,
int  seq_num,
double  start_tx_time 
)
inlineprotected

It stores the initial transmission start time in a container.

Parameters
macaddress of the node
sequencenumber of the packet.

Definition at line 933 of file uwsr.h.

◆ recvFromUpperLayers()

void MMacUWSR::recvFromUpperLayers ( Packet *  p)
protectedvirtual

This function receives the packet from upper layer and save it in the queue.

Parameters
Packetpointer

Definition at line 693 of file uwsr.cpp.

◆ refreshReason()

virtual void MMacUWSR::refreshReason ( UWSR_REASON_STATUS  reason)
inlineprotectedvirtual

To know the reason why a node in this current state.

Parameters
reasonis an UWSR_REASON_STATUS type.

Definition at line 734 of file uwsr.h.

◆ refreshState()

virtual void MMacUWSR::refreshState ( UWSR_STATUS  state)
inlineprotectedvirtual

Refreshes the states of the node.

The node save the information of three states, they are: previous to previous state, previous state and current state of the node.

Parameters
statewhich is an UWSR_STATUS type.

Definition at line 722 of file uwsr.h.

◆ rstAcksRcvIn1RTT()

void MMacUWSR::rstAcksRcvIn1RTT ( )
inlineprotected

Resets the number of ACK packets receive by a node in single RTT.

Definition at line 1049 of file uwsr.h.

◆ rstPktsLostCount()

void MMacUWSR::rstPktsLostCount ( )
inlineprotected

Resets the number of packets lost in single RTT.

Definition at line 1077 of file uwsr.h.

◆ rstPktsSentIn1RTT()

void MMacUWSR::rstPktsSentIn1RTT ( )
inlineprotected

Resets the number of Data packets sent in single RTT.

Definition at line 1020 of file uwsr.h.

◆ setBackoffCount()

void MMacUWSR::setBackoffCount ( )
inlineprotected

It sets the number of times backoff cpounter is run.

Definition at line 566 of file uwsr.h.

◆ setCurrTxRounds()

void MMacUWSR::setCurrTxRounds ( int  mac_addr,
int  seq_num 
)
inlineprotected

It sets the current tranmission round of a packet.

Parameters
macaddress of the node
sequencenumber of the packet.

Definition at line 827 of file uwsr.h.

◆ stateBackoff()

void MMacUWSR::stateBackoff ( )
protectedvirtual

If ACK packet is not received within the acknowledgement expire time.

Definition at line 1287 of file uwsr.cpp.

◆ stateCheckAckExpired()

void MMacUWSR::stateCheckAckExpired ( )
protectedvirtual

It checks whether the ack timer is already expired while it was busy with other activities.

Definition at line 1106 of file uwsr.cpp.

◆ stateCheckBackoffExpired()

void MMacUWSR::stateCheckBackoffExpired ( )
protectedvirtual

It checks whether the backoff timer is already expired while it was busy with other activities.

Definition at line 1135 of file uwsr.cpp.

◆ stateCheckListenExpired()

void MMacUWSR::stateCheckListenExpired ( )
protectedvirtual

It checks whether the listen timer is already expired while it was busy with other activities.

Definition at line 1075 of file uwsr.cpp.

◆ stateCheckWaitTxExpired()

void MMacUWSR::stateCheckWaitTxExpired ( )
protectedvirtual

It checks whether the wait transmit timer is already expired while it was busy with other activities.

Definition at line 1161 of file uwsr.cpp.

◆ stateIdle()

void MMacUWSR::stateIdle ( )
protectedvirtual

Node is in Idle state.

It only changes its state if it has packet(s) to transmit or it receives a packet.

Definition at line 1222 of file uwsr.cpp.

◆ stateListen()

void MMacUWSR::stateListen ( )
protectedvirtual

A short time which is used to sense the channel condision.

Definition at line 1257 of file uwsr.cpp.

◆ statePreTxData()

void MMacUWSR::statePreTxData ( )
protectedvirtual

This method finds out whether there is any packet to be transmitted to the destination.

Definition at line 1361 of file uwsr.cpp.

◆ stateRxAck()

void MMacUWSR::stateRxAck ( Packet *  p)
protectedvirtual

The node comes to this state if it receives an ACK packet.

After receiving an ACK packet it changes it states according to the previously stored status information.

Definition at line 1513 of file uwsr.cpp.

◆ stateRxBackoff()

void MMacUWSR::stateRxBackoff ( )
protectedvirtual

If a node starts receiving a packet when it is in backoff state.

The node first freeze (or another word, hold) the backoff timer and start receiving the packet.

Definition at line 1313 of file uwsr.cpp.

◆ stateRxData()

void MMacUWSR::stateRxData ( Packet *  p)
protectedvirtual

It process the packet which is received.

After receiving a packet it changes it states according to the previously stored status information.

Parameters
<i>Data</i>packet pointer

Definition at line 1493 of file uwsr.cpp.

◆ stateRxIdle()

void MMacUWSR::stateRxIdle ( )
protectedvirtual

If a node starts receiving a packet in Idle state.

Definition at line 1248 of file uwsr.cpp.

◆ stateRxinPreTxData()

void MMacUWSR::stateRxinPreTxData ( )
protectedvirtual

If a node starts receiving a packet when it was waiting for transmitting another packet in a singlet RTT.

Definition at line 1469 of file uwsr.cpp.

◆ stateRxListen()

void MMacUWSR::stateRxListen ( )
protectedvirtual

If a node starts receiving a packet when it was listening the channel.

Definition at line 1278 of file uwsr.cpp.

◆ stateRxPacketNotForMe()

void MMacUWSR::stateRxPacketNotForMe ( Packet *  p)
protectedvirtual

The receive packet is not intended for this node.

The node returns back to its own state.

Parameters
packetpointer

Definition at line 1030 of file uwsr.cpp.

◆ stateRxWaitAck()

void MMacUWSR::stateRxWaitAck ( )
protectedvirtual

If a node receives any packet while it was waiting for ACK packet, it moves to this state.

The packet it is receiving can be a Data packet from another node or ACK packet.

Definition at line 1460 of file uwsr.cpp.

◆ stateTxAck()

void MMacUWSR::stateTxAck ( int  dest_addr)
protectedvirtual

After receiving a Data packet the node sends an ACK packet.

Definition at line 1478 of file uwsr.cpp.

◆ stateTxData()

void MMacUWSR::stateTxData ( )
protectedvirtual

If a node has packet to transmits.

In such case, it moves from Idle state to data transmits state.

Definition at line 997 of file uwsr.cpp.

◆ stateWaitAck()

void MMacUWSR::stateWaitAck ( )
protectedvirtual

After transmitting a Data packet, a node waits for the ACK packet.

Definition at line 1448 of file uwsr.cpp.

◆ txAck()

void MMacUWSR::txAck ( int  dest_addr)
protectedvirtual

This methods transmits ACK packet from MAC layer to PHY layer.

Parameters
dest_addrwhich is an integer data type.

Definition at line 1020 of file uwsr.cpp.

◆ updateLastDataIdRx()

virtual void MMacUWSR::updateLastDataIdRx ( int  id)
inlineprotectedvirtual

It updates the sequence number of the last data packet rx.

Parameters
idis an integer data type.

Definition at line 759 of file uwsr.h.

◆ updateTxStatus()

void MMacUWSR::updateTxStatus ( macAddress  mac_addr,
int  rcv_acks 
)
inlineprotected

How many acknowledgements receive for the transmitting packets in a single RTT.

It stores this information to calculte the next window size (i.e. number of packets can be exchanged between a sender-receiver pair.

Parameters
macaddress of the receiving node.
numberof receive acknowledgement packets in a single RTT

Definition at line 344 of file uwsr.cpp.

◆ waitForUser()

void MMacUWSR::waitForUser ( )
protectedvirtual

Definition at line 1609 of file uwsr.cpp.

Member Data Documentation

◆ ACK_size

int MMacUWSR::ACK_size
protected

Size of the ACK.

Definition at line 1155 of file uwsr.h.

◆ ACK_timeout

double MMacUWSR::ACK_timeout
protected

ACK timeout for the initial packet.

Definition at line 1156 of file uwsr.h.

◆ ack_timer

AckTimer MMacUWSR::ack_timer
protected

An object of the AckTimer class.

Definition at line 1225 of file uwsr.h.

◆ acks_rcv_1RTT

int MMacUWSR::acks_rcv_1RTT
protected

Number of ACK packets receive in single RTT.

Definition at line 1207 of file uwsr.h.

◆ alpha_

double MMacUWSR::alpha_
protected

This variable is used to tune the RTT.

Definition at line 1158 of file uwsr.h.

◆ backoff_count

int MMacUWSR::backoff_count
protected

This variable counts how many times a node move to the backoff state.

Definition at line 1193 of file uwsr.h.

◆ backoff_timer

BackOffTimer MMacUWSR::backoff_timer
protected

An object of the BackOffTimer class.

Definition at line 1226 of file uwsr.h.

◆ backoff_tuner

double MMacUWSR::backoff_tuner
protected

Tunes the backoff duration.

Definition at line 1150 of file uwsr.h.

◆ buffer_pkts

int MMacUWSR::buffer_pkts
protected

Number of packets a node can store in the container.

Definition at line 1157 of file uwsr.h.

◆ curr_data_pkt

Packet* MMacUWSR::curr_data_pkt
protected

Pointer of the latest selected data packet.

Definition at line 1197 of file uwsr.h.

◆ curr_state

UWSR_STATUS MMacUWSR::curr_state
protected

Enum variable.

It stores the current state of a node

Definition at line 1233 of file uwsr.h.

◆ curr_tx_rounds

int MMacUWSR::curr_tx_rounds
protected

How many times the same packet is (re)transmitted.

Definition at line 1188 of file uwsr.h.

◆ fout

ofstream MMacUWSR::fout
protected

An object of ofstream class.

Definition at line 1268 of file uwsr.h.

◆ guard_time

double MMacUWSR::guard_time
protected

A time which is used to componsate variating in timing.

Definition at line 1163 of file uwsr.h.

◆ has_buffer_queue

bool MMacUWSR::has_buffer_queue
protected

Whether the node has buffer to store data or not.

Definition at line 1179 of file uwsr.h.

◆ HDR_size

int MMacUWSR::HDR_size
protected

Size of the HDR if any.

Definition at line 1154 of file uwsr.h.

◆ hit_count

int MMacUWSR::hit_count
protected

This is a counter which is employed to calculate average number of packets transmit in a sigle RTT.

Definition at line 1221 of file uwsr.h.

◆ initialized

bool MMacUWSR::initialized = false
staticprotected

It checks whether MMacUWSR protocol is initialized or not.

If FALSE means, not initialized and if TRUE means it is initialized

Definition at line 1170 of file uwsr.h.

◆ last_data_id_rx

int MMacUWSR::last_data_id_rx
protected

The sequence number of last received packet.

Definition at line 1190 of file uwsr.h.

◆ last_reason

UWSR_REASON_STATUS MMacUWSR::last_reason
protected

Enum variable which stores the last reason why a node changes its state.

Definition at line 1230 of file uwsr.h.

◆ last_sent_data_id

int MMacUWSR::last_sent_data_id
protected

sequence number of the latest sent packet

Definition at line 1175 of file uwsr.h.

◆ latest_ack_timeout

double MMacUWSR::latest_ack_timeout
protected

Latest timeout of an acknowledgement packet.

Definition at line 1216 of file uwsr.h.

◆ listen_time

double MMacUWSR::listen_time
protected

A short channel sensing time.

Definition at line 1162 of file uwsr.h.

◆ listen_timer

ListenTimer MMacUWSR::listen_timer
protected

An object of the ListenTimer class.

Definition at line 1227 of file uwsr.h.

◆ mapAckTimer

map<usrPair, AckTimer> MMacUWSR::mapAckTimer
protected

Container where AckTimer objects for variuous packets are stored.

Definition at line 1256 of file uwsr.h.

◆ mapCalcAck

map<usrPair, txStartTime> MMacUWSR::mapCalcAck
protected

Container where starting transmission time of various packets are stored.

Definition at line 1258 of file uwsr.h.

◆ mapPacket

map<usrPair, Packet *> MMacUWSR::mapPacket
protected

Container where Data packets are stored.

Definition at line 1252 of file uwsr.h.

◆ mapRTT

map<macAddress, rttPair> MMacUWSR::mapRTT
protected

Container where RTT between various sender-receiver pairs are stored.

Definition at line 1261 of file uwsr.h.

◆ mapTxRounds

map<usrPair, txRounds> MMacUWSR::mapTxRounds
protected

Container where retransmission information of various packets are stored.

Definition at line 1253 of file uwsr.h.

◆ mapTxStatus

map<macAddress, txStatusPair> MMacUWSR::mapTxStatus
protected

Container which stores the number of packets transmitted in a single RTT to a receiving node and number of acknowledgement receive among them.

Definition at line 1263 of file uwsr.h.

◆ max_backoff_counter

double MMacUWSR::max_backoff_counter
protected

Maximum number of backoff it will consider while it increases the backoff exponentially.

Definition at line 1159 of file uwsr.h.

◆ max_payload

int MMacUWSR::max_payload
protected

Maximum number of payload in a packet.

Definition at line 1153 of file uwsr.h.

◆ max_tx_tries

int MMacUWSR::max_tx_tries
protected

Maximum number of retransmissions attempt.

Definition at line 1149 of file uwsr.h.

◆ node_speed

double MMacUWSR::node_speed
protected

Speed of the mobile node [m/s].

Definition at line 1165 of file uwsr.h.

◆ pkt_tx_count

int MMacUWSR::pkt_tx_count
protected

Number of packets transmitted.

Definition at line 1195 of file uwsr.h.

◆ pkt_type_info

map< MMacUWSR::UWSR_PKT_TYPE, string > MMacUWSR::pkt_type_info
staticprotected

Container which stores all the packet type information of MMacUWSR.

Definition at line 1248 of file uwsr.h.

◆ pkts_lost_counter

int MMacUWSR::pkts_lost_counter
protected

Number of packets lost in a single RTT.

Definition at line 1209 of file uwsr.h.

◆ pkts_sent_1RTT

int MMacUWSR::pkts_sent_1RTT
protected

Packets already sent in single RTT.

Definition at line 1205 of file uwsr.h.

◆ prev_prev_state

UWSR_STATUS MMacUWSR::prev_prev_state
protected

Enum variable.

It stores the previous to previous state of a node

Definition at line 1238 of file uwsr.h.

◆ prev_state

UWSR_STATUS MMacUWSR::prev_state
protected

Enum variable.

It stores the previous state of a node

Definition at line 1236 of file uwsr.h.

◆ print_transitions

bool MMacUWSR::print_transitions
protected

Whether to print the state of the nodes.

Definition at line 1177 of file uwsr.h.

◆ prop_speed

const double MMacUWSR::prop_speed = 1500.0
staticprotected

Speed of the sound signal.

Definition at line 1174 of file uwsr.h.

◆ prv_mac_addr

int MMacUWSR::prv_mac_addr
protected

Previous mac address.

Definition at line 1218 of file uwsr.h.

◆ reason_info

map< MMacUWSR::UWSR_REASON_STATUS, string > MMacUWSR::reason_info
staticprotected

Container which stores all the reason information.

Definition at line 1245 of file uwsr.h.

◆ recv_data_id

int MMacUWSR::recv_data_id
protected

The sequence number of the packet which is received.

Definition at line 1191 of file uwsr.h.

◆ round_trip_time

double MMacUWSR::round_trip_time
protected

RTT time.

Definition at line 1199 of file uwsr.h.

◆ rttsamples

int MMacUWSR::rttsamples
protected

Number of RTT samples.

Definition at line 1186 of file uwsr.h.

◆ srtt

double MMacUWSR::srtt
protected

Smoothed Round Trip Time, calculated as for TCP.

Definition at line 1183 of file uwsr.h.

◆ start_tx_time

double MMacUWSR::start_tx_time
protected

Time when a packet start transmitting.

Definition at line 1182 of file uwsr.h.

◆ status_info

map< MMacUWSR::UWSR_STATUS, string > MMacUWSR::status_info
staticprotected

Container which stores all the status information.

Definition at line 1242 of file uwsr.h.

◆ sumrtt

double MMacUWSR::sumrtt
protected

Sum of RTT samples.

Definition at line 1184 of file uwsr.h.

◆ sumrtt2

double MMacUWSR::sumrtt2
protected

Sum of (RTT^2)

Definition at line 1185 of file uwsr.h.

◆ sumwtt

double MMacUWSR::sumwtt
protected

Summation of total waiting time.

Definition at line 1202 of file uwsr.h.

◆ total_pkts_tx

int MMacUWSR::total_pkts_tx
protected

Total number of packets transmit.

Definition at line 1223 of file uwsr.h.

◆ txsn

int MMacUWSR::txsn
protected

Sequence number of the transmitted packet.

Definition at line 1213 of file uwsr.h.

◆ uwsr_debug

int MMacUWSR::uwsr_debug
protected

Debuging flag.

Definition at line 1167 of file uwsr.h.

◆ var_k

double MMacUWSR::var_k
protected

It is employed to decrease the window size.

Definition at line 1166 of file uwsr.h.

◆ wait_constant

double MMacUWSR::wait_constant
protected

This fixed time is employed to componsate different time variations.

Definition at line 1151 of file uwsr.h.

◆ wait_tx_time

double MMacUWSR::wait_tx_time
protected

Waiting time before transmitting a packet in a single RTT.

Definition at line 1200 of file uwsr.h.

◆ wait_tx_timer

WaitTxTimer MMacUWSR::wait_tx_timer
protected

An object of the WaitTxTimer class.

Definition at line 1228 of file uwsr.h.

◆ window_size

int MMacUWSR::window_size
protected

Maximum number of packets a node can transmit in a single RTT.

Definition at line 1210 of file uwsr.h.

◆ wttsamples

int MMacUWSR::wttsamples
protected

Number of waiting time samples.

Definition at line 1203 of file uwsr.h.


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