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

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

Inheritance diagram for UwCsmaAloha_Trigger_NODE:
Collaboration diagram for UwCsmaAloha_Trigger_NODE:

Classes

class  Csma_Aloha_Triggered_Timer
 
class  ListenTimer
 
class  TransmissionTimer
 

Public Member Functions

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

Protected Types

enum  UW_CS_ALOHA_TRIG_NODE_STATUS {
  UW_CS_ALOHA_TRIG_NODE_STATE_IDLE = 1 , UW_CS_ALOHA_TRIG_NODE_STATE_TX_DATA , UW_CS_ALOHA_TRIG_NODE_STATE_DATA_RX , UW_CS_ALOHA_TRIG_NODE_STATE_NOT_SET ,
  UW_CS_ALOHA_TRIG_NODE_STATE_LISTEN , UW_CS_ALOHA_TRIG_NODE_STATE_CHK_LISTEN_TIMEOUT , UW_CS_ALOHA_TRIG_NODE_STATE_RX_IDLE , UW_CS_ALOHA_TRIG_NODE_STATE_RX_LISTEN ,
  UW_CS_ALOHA_TRIG_NODE_STATE_WRONG_PKT_RX , UW_CS_ALOHA_TRIG_NODE_STATE_RX_TRIGGER
}
 
enum  UW_CS_ALOHA_TRIG_NODE_REASON_STATUS {
  UW_CS_ALOHA_TRIG_NODE_REASON_DATA_PENDING , UW_CS_ALOHA_TRIG_NODE_REASON_DATA_RX , UW_CS_ALOHA_TRIG_NODE_REASON_DATA_TX , UW_CS_ALOHA_TRIG_NODE_REASON_DATA_EMPTY ,
  UW_CS_ALOHA_TRIG_NODE_REASON_NOT_SET , UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN , UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_TIMEOUT , UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_PENDING ,
  UW_CS_ALOHA_TRIG_NODE_REASON_START_RX , UW_CS_ALOHA_TRIG_NODE_REASON_PKT_NOT_FOR_ME , UW_CS_ALOHA_TRIG_NODE_REASON_PKT_ERROR , UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_AFTER_TRIGGER ,
  UW_CS_ALOHA_TRIG_NODE_REASON_TRIGGER_RX
}
 
enum  UW_CS_ALOHA_TRIG_NODE_TIMER_STATUS { UW_CS_ALOHA_TRIG_NODE_IDLE = 1 , UW_CS_ALOHA_TRIG_NODE_RUNNING , UW_CS_ALOHA_TRIG_NODE_FROZEN , UW_CS_ALOHA_TRIG_NODE_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)
 
virtual void txData ()
 
virtual void stateIdle ()
 
virtual void stateRxIdle ()
 
virtual void stateTxData ()
 
virtual void stateListen ()
 
virtual void stateRxListen ()
 
virtual void stateRxTrigger (Packet *p)
 
virtual void stateCheckListenExpired ()
 
virtual void stateCheckTxTimerExpired ()
 
virtual void stateRxData (Packet *p)
 
virtual void stateRxPacketNotForMe (Packet *p)
 
virtual void initInfo ()
 
virtual void refreshState (UW_CS_ALOHA_TRIG_NODE_STATUS state)
 
virtual void refreshReason (UW_CS_ALOHA_TRIG_NODE_REASON_STATUS reason)
 
virtual void updateLastDataIdRx (int id)
 
virtual void queuePop (bool flag=true)
 
virtual void waitForUser ()
 
virtual int getRemainingPkts ()
 
virtual void incrUpperDataRx ()
 

Protected Attributes

ListenTimer listen_timer
 
TransmissionTimer tx_timer
 
double wait_costant
 
int max_payload
 
int HDR_size
 
int buffer_pkts
 
double listen_time
 
int tx_timer_duration
 
std::queue< Packet * > Q
 
std::queue< int > data_sn_queue
 
int u_data_id
 
int last_sent_data_id
 
Packet * curr_data_pkt
 
int last_data_id_rx
 
bool has_buffer_queue
 
bool can_transmit
 
UW_CS_ALOHA_TRIG_NODE_STATUS curr_state
 
UW_CS_ALOHA_TRIG_NODE_STATUS prev_state
 
UW_CS_ALOHA_TRIG_NODE_STATUS prev_prev_state
 
UW_CS_ALOHA_TRIG_NODE_REASON_STATUS last_reason
 
ofstream fout
 

Static Protected Attributes

static const double prop_speed = 1500.0
 
static bool initialized = false
 
static int u_pkt_id
 
static map< UW_CS_ALOHA_TRIG_NODE_STATUS, string > status_info
 
static map< UW_CS_ALOHA_TRIG_NODE_REASON_STATUS, string > reason_info
 

Detailed Description

Class that describes a CsmaAloha_TRIGGERED module of the node.

Definition at line 65 of file uw-csma-aloha-trigger-node.h.

Member Enumeration Documentation

◆ UW_CS_ALOHA_TRIG_NODE_REASON_STATUS

Enumerator
UW_CS_ALOHA_TRIG_NODE_REASON_DATA_PENDING 
UW_CS_ALOHA_TRIG_NODE_REASON_DATA_RX 
UW_CS_ALOHA_TRIG_NODE_REASON_DATA_TX 
UW_CS_ALOHA_TRIG_NODE_REASON_DATA_EMPTY 
UW_CS_ALOHA_TRIG_NODE_REASON_NOT_SET 
UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN 
UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_TIMEOUT 
UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_PENDING 
UW_CS_ALOHA_TRIG_NODE_REASON_START_RX 
UW_CS_ALOHA_TRIG_NODE_REASON_PKT_NOT_FOR_ME 
UW_CS_ALOHA_TRIG_NODE_REASON_PKT_ERROR 
UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_AFTER_TRIGGER 
UW_CS_ALOHA_TRIG_NODE_REASON_TRIGGER_RX 

Definition at line 115 of file uw-csma-aloha-trigger-node.h.

◆ UW_CS_ALOHA_TRIG_NODE_STATUS

Enumerator
UW_CS_ALOHA_TRIG_NODE_STATE_IDLE 
UW_CS_ALOHA_TRIG_NODE_STATE_TX_DATA 
UW_CS_ALOHA_TRIG_NODE_STATE_DATA_RX 
UW_CS_ALOHA_TRIG_NODE_STATE_NOT_SET 
UW_CS_ALOHA_TRIG_NODE_STATE_LISTEN 
UW_CS_ALOHA_TRIG_NODE_STATE_CHK_LISTEN_TIMEOUT 
UW_CS_ALOHA_TRIG_NODE_STATE_RX_IDLE 
UW_CS_ALOHA_TRIG_NODE_STATE_RX_LISTEN 
UW_CS_ALOHA_TRIG_NODE_STATE_WRONG_PKT_RX 
UW_CS_ALOHA_TRIG_NODE_STATE_RX_TRIGGER 

Definition at line 101 of file uw-csma-aloha-trigger-node.h.

◆ UW_CS_ALOHA_TRIG_NODE_TIMER_STATUS

Enumerator
UW_CS_ALOHA_TRIG_NODE_IDLE 
UW_CS_ALOHA_TRIG_NODE_RUNNING 
UW_CS_ALOHA_TRIG_NODE_FROZEN 
UW_CS_ALOHA_TRIG_NODE_EXPIRED 

Definition at line 132 of file uw-csma-aloha-trigger-node.h.

Constructor & Destructor Documentation

◆ UwCsmaAloha_Trigger_NODE()

UwCsmaAloha_Trigger_NODE::UwCsmaAloha_Trigger_NODE ( )

Constructor of the UwCsmaAloha_Trigger_NODE class.

Definition at line 107 of file uw-csma-aloha-trigger-node.cpp.

◆ ~UwCsmaAloha_Trigger_NODE()

UwCsmaAloha_Trigger_NODE::~UwCsmaAloha_Trigger_NODE ( )
virtual

Destructor of the UwCsmaAloha_Trigger_NODE class.

Definition at line 137 of file uw-csma-aloha-trigger-node.cpp.

Member Function Documentation

◆ command()

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

Definition at line 144 of file uw-csma-aloha-trigger-node.cpp.

◆ crLayCommand()

int UwCsmaAloha_Trigger_NODE::crLayCommand ( ClMessage *  m)
virtual

Cross-Layer messages interpreter.

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

Definition at line 160 of file uw-csma-aloha-trigger-node.cpp.

◆ getRemainingPkts()

virtual int UwCsmaAloha_Trigger_NODE::getRemainingPkts ( )
inlineprotectedvirtual

Return the number of packets not transmitted (remained in the protocol queue) at the end of the simulation.

Returns
the size of the queue at the end of the simulation

Definition at line 535 of file uw-csma-aloha-trigger-node.h.

◆ incrUpperDataRx()

virtual void UwCsmaAloha_Trigger_NODE::incrUpperDataRx ( )
inlineprotectedvirtual

Increase the number of Data packet Received from the Upper layers.

Definition at line 544 of file uw-csma-aloha-trigger-node.h.

◆ initInfo()

void UwCsmaAloha_Trigger_NODE::initInfo ( )
protectedvirtual

Initializes the protocol at the beginning of the simulation.

This method is called by a command in tcl.

Parameters
doubledelay
See also
command method

Definition at line 170 of file uw-csma-aloha-trigger-node.cpp.

◆ initPkt()

void UwCsmaAloha_Trigger_NODE::initPkt ( Packet *  p)
protectedvirtual

Init the packet with the MAC address of the receiver and the sender, the size of the packet and the type.

Parameters
UWPOLLING_PKT_TYPEthe type of the packet

Definition at line 235 of file uw-csma-aloha-trigger-node.cpp.

◆ Mac2PhyStartTx()

void UwCsmaAloha_Trigger_NODE::Mac2PhyStartTx ( Packet *  p)
protectedvirtual

Pass the packet to the PHY layer.

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

Definition at line 246 of file uw-csma-aloha-trigger-node.cpp.

◆ Phy2MacEndRx()

void UwCsmaAloha_Trigger_NODE::Phy2MacEndRx ( Packet *  p)
protectedvirtual

Method called when the Phy Layer finish to receive a Packet.

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

Definition at line 314 of file uw-csma-aloha-trigger-node.cpp.

◆ Phy2MacEndTx()

void UwCsmaAloha_Trigger_NODE::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

Definition at line 256 of file uw-csma-aloha-trigger-node.cpp.

◆ Phy2MacStartRx()

void UwCsmaAloha_Trigger_NODE::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

Definition at line 286 of file uw-csma-aloha-trigger-node.cpp.

◆ queuePop()

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

Pop the first element of the data packet queue.

Definition at line 513 of file uw-csma-aloha-trigger-node.h.

◆ recvFromUpperLayers()

void UwCsmaAloha_Trigger_NODE::recvFromUpperLayers ( Packet *  p)
protectedvirtual

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

IP)

Parameters
Packet*pointer to the packet received

Definition at line 211 of file uw-csma-aloha-trigger-node.cpp.

◆ refreshReason()

virtual void UwCsmaAloha_Trigger_NODE::refreshReason ( UW_CS_ALOHA_TRIG_NODE_REASON_STATUS  reason)
inlineprotectedvirtual

Refresh the reason for the change of state.

Definition at line 494 of file uw-csma-aloha-trigger-node.h.

◆ refreshState()

virtual void UwCsmaAloha_Trigger_NODE::refreshState ( UW_CS_ALOHA_TRIG_NODE_STATUS  state)
inlineprotectedvirtual

Refresh the State of the protocol.

Definition at line 483 of file uw-csma-aloha-trigger-node.h.

◆ stateCheckListenExpired()

void UwCsmaAloha_Trigger_NODE::stateCheckListenExpired ( )
protectedvirtual

Checks if the Listen period is expired.

Definition at line 430 of file uw-csma-aloha-trigger-node.cpp.

◆ stateCheckTxTimerExpired()

void UwCsmaAloha_Trigger_NODE::stateCheckTxTimerExpired ( )
protectedvirtual

Checks if the Time period is expired.

Definition at line 457 of file uw-csma-aloha-trigger-node.cpp.

◆ stateIdle()

void UwCsmaAloha_Trigger_NODE::stateIdle ( )
protectedvirtual

IDLE state.

Each variable is resetted

Definition at line 462 of file uw-csma-aloha-trigger-node.cpp.

◆ stateListen()

void UwCsmaAloha_Trigger_NODE::stateListen ( )
protectedvirtual

State in which the node is listening the channel.

Definition at line 488 of file uw-csma-aloha-trigger-node.cpp.

◆ stateRxData()

void UwCsmaAloha_Trigger_NODE::stateRxData ( Packet *  p)
protectedvirtual

State in which a DATA packet is received.

Parameters
ppointer to the Packet received

Definition at line 536 of file uw-csma-aloha-trigger-node.cpp.

◆ stateRxIdle()

void UwCsmaAloha_Trigger_NODE::stateRxIdle ( )
protectedvirtual

A reception is occuring while the protocol is in IDLE state.

Definition at line 482 of file uw-csma-aloha-trigger-node.cpp.

◆ stateRxListen()

void UwCsmaAloha_Trigger_NODE::stateRxListen ( )
protectedvirtual

State in which a reception is occuring while the node is listening the channel.

Definition at line 506 of file uw-csma-aloha-trigger-node.cpp.

◆ stateRxPacketNotForMe()

void UwCsmaAloha_Trigger_NODE::stateRxPacketNotForMe ( Packet *  p)
protectedvirtual

state in which a wrong Packet is received

Definition at line 397 of file uw-csma-aloha-trigger-node.cpp.

◆ stateRxTrigger()

void UwCsmaAloha_Trigger_NODE::stateRxTrigger ( Packet *  p)
protectedvirtual

State of the protocol in which a TRIGGER packet is received.

Parameters
pPointer to the Packet received

Definition at line 365 of file uw-csma-aloha-trigger-node.cpp.

◆ stateTxData()

void UwCsmaAloha_Trigger_NODE::stateTxData ( )
protectedvirtual

State in which the protocol allows the node to transmit a data packet.

Definition at line 512 of file uw-csma-aloha-trigger-node.cpp.

◆ txData()

void UwCsmaAloha_Trigger_NODE::txData ( )
protectedvirtual

Transmits the DATA packet (calling Mac2PhyStartTx) and increment the counter of transmitted data packets.

Definition at line 387 of file uw-csma-aloha-trigger-node.cpp.

◆ updateLastDataIdRx()

virtual void UwCsmaAloha_Trigger_NODE::updateLastDataIdRx ( int  id)
inlineprotectedvirtual

Updates the ID of the last DATA packet received.

Parameters
idID of the packet

Definition at line 504 of file uw-csma-aloha-trigger-node.h.

◆ waitForUser()

void UwCsmaAloha_Trigger_NODE::waitForUser ( )
protectedvirtual

Used for debug purposes.

(Permit to have a "step by step" behavior of the protocol)

Definition at line 573 of file uw-csma-aloha-trigger-node.cpp.

Member Data Documentation

◆ buffer_pkts

int UwCsmaAloha_Trigger_NODE::buffer_pkts
protected

Length of the data buffer in number of packets.

Definition at line 558 of file uw-csma-aloha-trigger-node.h.

◆ can_transmit

bool UwCsmaAloha_Trigger_NODE::can_transmit
protected

Flag that indicates if the node can transmit data packets to the sink.

Definition at line 581 of file uw-csma-aloha-trigger-node.h.

◆ curr_data_pkt

Packet* UwCsmaAloha_Trigger_NODE::curr_data_pkt
protected

Pointer to the current data packet.

Definition at line 574 of file uw-csma-aloha-trigger-node.h.

◆ curr_state

UW_CS_ALOHA_TRIG_NODE_STATUS UwCsmaAloha_Trigger_NODE::curr_state
protected

Current state of the protocol.

Definition at line 591 of file uw-csma-aloha-trigger-node.h.

◆ data_sn_queue

std::queue<int> UwCsmaAloha_Trigger_NODE::data_sn_queue
protected

Queue of the sequence number of the packets.

Definition at line 566 of file uw-csma-aloha-trigger-node.h.

◆ fout

ofstream UwCsmaAloha_Trigger_NODE::fout
protected

Object that handles the output file where the protocol writes the state transistions.

Definition at line 599 of file uw-csma-aloha-trigger-node.h.

◆ has_buffer_queue

bool UwCsmaAloha_Trigger_NODE::has_buffer_queue
protected

flag that indicates if a node has a buffer where store DATA packets

Definition at line 579 of file uw-csma-aloha-trigger-node.h.

◆ HDR_size

int UwCsmaAloha_Trigger_NODE::HDR_size
protected

Size (in bytes) of the header added by the protocol.

Definition at line 557 of file uw-csma-aloha-trigger-node.h.

◆ initialized

bool UwCsmaAloha_Trigger_NODE::initialized = false
staticprotected

true if the protocol is initialized

Definition at line 568 of file uw-csma-aloha-trigger-node.h.

◆ last_data_id_rx

int UwCsmaAloha_Trigger_NODE::last_data_id_rx
protected

ID of the last DATA packet received.

Definition at line 576 of file uw-csma-aloha-trigger-node.h.

◆ last_reason

UW_CS_ALOHA_TRIG_NODE_REASON_STATUS UwCsmaAloha_Trigger_NODE::last_reason
protected

Reason for the state transitions.

Definition at line 597 of file uw-csma-aloha-trigger-node.h.

◆ last_sent_data_id

int UwCsmaAloha_Trigger_NODE::last_sent_data_id
protected

ID of the last sent packet.

Definition at line 572 of file uw-csma-aloha-trigger-node.h.

◆ listen_time

double UwCsmaAloha_Trigger_NODE::listen_time
protected

Time in which the node sense the channel.

Definition at line 559 of file uw-csma-aloha-trigger-node.h.

◆ listen_timer

ListenTimer UwCsmaAloha_Trigger_NODE::listen_timer
protected

Definition at line 549 of file uw-csma-aloha-trigger-node.h.

◆ max_payload

int UwCsmaAloha_Trigger_NODE::max_payload
protected

Maximum dimension of the data payload in bytes.

Definition at line 556 of file uw-csma-aloha-trigger-node.h.

◆ prev_prev_state

UW_CS_ALOHA_TRIG_NODE_STATUS UwCsmaAloha_Trigger_NODE::prev_prev_state
protected

Previous previous state of the protocol.

Definition at line 595 of file uw-csma-aloha-trigger-node.h.

◆ prev_state

UW_CS_ALOHA_TRIG_NODE_STATUS UwCsmaAloha_Trigger_NODE::prev_state
protected

Previous state of the protocol.

Definition at line 593 of file uw-csma-aloha-trigger-node.h.

◆ prop_speed

const double UwCsmaAloha_Trigger_NODE::prop_speed = 1500.0
staticprotected

Typical sound propagation speed in underwater enviroment.

Variable that rapresent the status of the protocol machine state

Definition at line 97 of file uw-csma-aloha-trigger-node.h.

◆ Q

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

Packet queue.

Definition at line 564 of file uw-csma-aloha-trigger-node.h.

◆ reason_info

map< UwCsmaAloha_Trigger_NODE::UW_CS_ALOHA_TRIG_NODE_REASON_STATUS, string > UwCsmaAloha_Trigger_NODE::reason_info
staticprotected

Textual description of the protocol reason for the change of the state.

Definition at line 587 of file uw-csma-aloha-trigger-node.h.

◆ status_info

map< UwCsmaAloha_Trigger_NODE::UW_CS_ALOHA_TRIG_NODE_STATUS, string > UwCsmaAloha_Trigger_NODE::status_info
staticprotected

Textual description of the protocol states.

Definition at line 585 of file uw-csma-aloha-trigger-node.h.

◆ tx_timer

TransmissionTimer UwCsmaAloha_Trigger_NODE::tx_timer
protected

Definition at line 551 of file uw-csma-aloha-trigger-node.h.

◆ tx_timer_duration

int UwCsmaAloha_Trigger_NODE::tx_timer_duration
protected

Duration of the time in which the node is allowed to transmit.

Definition at line 560 of file uw-csma-aloha-trigger-node.h.

◆ u_data_id

int UwCsmaAloha_Trigger_NODE::u_data_id
protected

DATA packete ID.

Definition at line 571 of file uw-csma-aloha-trigger-node.h.

◆ u_pkt_id

int UwCsmaAloha_Trigger_NODE::u_pkt_id
staticprotected

simulation-unique packet ID

Definition at line 570 of file uw-csma-aloha-trigger-node.h.

◆ wait_costant

double UwCsmaAloha_Trigger_NODE::wait_costant
protected

Adding factor in the calculation of the listen time.

Definition at line 554 of file uw-csma-aloha-trigger-node.h.


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