38#ifndef UWUFETCH_NODE_H_
39#define UWUFETCH_NODE_H_
55#define UWFETCH_NODE_DROP_REASON_UNKNOWN_TYPE \
57#define UWFETCH_NODE_DROP_REASON_WRONG_RECEIVER \
59#define UWFETCH_NODE_DROP_REASON_CBEACON_AND_DATA_ALREADY_TX \
62#define UWFETCH_NODE_DROP_REASON_ERROR \
64#define UWUFETCH_NODE_DROP_REASON_BUFFER_FULL \
66#define UWUFETCH_NODE_DROP_REASON_NOT_ENABLE \
69#define UWUFETCH_NODE_DROP_REASON_NOT_MY_TURN \
71#define UWUFETCH_NODE_DROP_CAN_NOT_RX_THIS_PCK \
158 virtual int command(
int argc,
const char *
const *argv);
472 virtual void expire(Event *e);
509 virtual void expire(Event *e);
542 virtual void expire(Event *e);
578 virtual void expire(Event *e);
612 virtual void expire(Event *e);
647 virtual void expire(Event *e);
682 virtual void expire(Event *e);
717 virtual void expire(Event *e);
2578 map<UWUFETCH_NODE_STATUS, std::string>
2581 static std::map<UWUFETCH_NODE_STATUS_CHANGE, std::string>
2584 static std::map<UWUFETCH_NODE_PACKET_TYPE, std::string>
2587 static std::map<UWUFETCH_TIMER_STATUS, std::string>
Timer associated to the HN.
virtual ~uwUFetch_BEACON_timer()
virtual void expire(Event *e)
Method called when the timer expire.
uwUFetch_BEACON_timer(uwUFetch_NODE *m)
Constructor of uwUFetch_BEACON_timer class.
Class (inherited from uwUFetch_NODE_Timer) used to handle the time of back-off of the node before tra...
virtual void expire(Event *e)
Method called when the timer expire.
virtual ~uwUFetch_BackOffTimer()
Destructor of uwUFetch_BackOffTimer class.
uwUFetch_BackOffTimer(uwUFetch_NODE *m)
Constructor of uwUFetch_BackOffTimer class.
Class inherited the method and variable of uwUFetch_NODE_timer that handle the timer of CBEACON packe...
virtual void expire(Event *e)
Method called when the timer expire.
uwUFetch_CBeacon_timer(uwUFetch_NODE *m)
Constructor of uwUFetch_CBeacon_timer class.
virtual ~uwUFetch_CBeacon_timer()
Class inherited the method and variable of uwUFetch_NODE_timer that handle the timer of CTS packets.
virtual ~uwUFetch_CTS_timer()
uwUFetch_CTS_timer(uwUFetch_NODE *m)
Constructor of uwUFetch_CTS_timer class.
virtual void expire(Event *e)
Method called when the timer expire.
Class inherited the method and variable of uwUFetch_NODE_timer that handle the timer of DATA packets.
virtual void expire(Event *e)
Method called when the timer expire.
virtual ~uwUFetch_DATA_BEFORE_TX_timer()
uwUFetch_DATA_BEFORE_TX_timer(uwUFetch_NODE *m)
Constructor of uwUFetch_DATA_BEFORE_TX_timer class.
Class inherited the method and variable of uwUFetch_NODE_timer that handle the timer of DATA packets.
uwUFetch_DATA_timer(uwUFetch_NODE *m)
Constructor of uwUFetch_DATA_timer class.
virtual void expire(Event *e)
Method called when the timer expire.
virtual ~uwUFetch_DATA_timer()
Class that handle the timers of SN or HN.
int getCounter()
value of the counter
virtual void freeze()
Freeze the timer.
int counter
Counter of the timer.
double left_duration
Left duration of the timer
void resetCounter()
reset the counter that scan the timer
virtual ~uwUFetch_NODE_timer()
Destructor of the class uwUFetch_NODE_timer.
virtual void stop()
Stop the timer.
double getDuration()
left duration of the timer
virtual void unFreeze()
unFreeze are used after a freezing of the timer.
uwUFetch_NODE *UWUFETCH_TIMER_STATUS timer_status
< Pointer to an object of type uwUFetch_NODE
void incrCounter()
increment the counter by one value
bool isActive()
verify if the timer is ACTIVE
bool isRunning()
verify if the timer is RUNNING
bool isExpired()
verify whether the timer is EXPIRED
bool isIdle()
verify whether the timer is IDLE
virtual void schedule(double val)
schedule a timer
double start_time
Time to start the timer.
uwUFetch_NODE_timer(uwUFetch_NODE *m)
Constructor of the class uwUFetch_NODE_timer.
bool isFroozen()
verify if the timer is FROZEN
Class inherited the method and variable of uwUFetch_NODE_timer that handle the timer of POLL packets.
virtual void expire(Event *e)
Method called when the timer expire.
virtual ~uwUFetch_POLL_timer()
uwUFetch_POLL_timer(uwUFetch_NODE *m)
Constructor of uwUFetch_POLL_timer class.
Class inherited the method and variable of uwUFetch_NODE_timer that handle the timer of PROBE packets...
virtual void expire(Event *e)
Method called when the timer expire.
virtual ~uwUFetch_PROBE_timer()
uwUFetch_PROBE_timer(uwUFetch_NODE *m)
Constructor of uwUFetch_PROBE_timer class.
Class inherited the method and variable of uwUFetch_NODE_timer that handle the timer of TRIGGER packe...
uwUFetch_TRIGGER_timer(uwUFetch_NODE *m)
Constructor of uwUFetch_TRIGGER_time class.
virtual ~uwUFetch_TRIGGER_timer()
virtual void expire(Event *e)
Method called when the timer expire.
Packet * curr_PROBE_NODE_pck_tx
Pointer to the PROBE packet that is being transmitted by SN.
int N_RUN
Indicate the number of the run in execution.
void incrTotalCBeaconPckRx_corrupted_by_NODE()
Increase the total number of corrupted CBEACON packets received by SN during an entire duration of si...
std::queue< double > Q_probbed_backoff_time
Queue that stored the backoff time choice by the single nodes before to transmit the PROBE packet to ...
double rx_POLL_finish_time
Indicates when SN finished the reception of POLL packet from HN.
double rx_BEACON_finish_time
Indicates when SN finished the reception of BEACON packet from HN.
int getCBeaconPckRx_by_NODE()
Number of CBEACON packets received by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of ...
uwUFetch_NODE()
Constructor of uwUFetch_NODE class.
bool rxCBEACONEnabled
true if SN is enabled to receive a CBEACON packet from the HN
uwUFetch_CBeacon_timer CBEACON_timer
int getTotalBeaconPckRx_by_NODE()
Total number of BEACON packets received correctly or not by SN during an entire duration of simulatio...
double data_timeout
Interval time in which the HN want to receive all DATA packets from the node that have polled.
double tx_POLL_finish_HN_time
Indicates when HN finished the transmission of POLL packet to a specific SN.
int n_POLL_pck_rx_by_NODE
Number of POLL received by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of the simulat...
int n_tot_PROBE_pck_rx_by_HN
Total number of PROBE packets correctly or not received by the HN during an entire simulation.
void incrTotalDataPckRx_by_HN()
Increase total number of DATA packets correctly or not received by the HN during an entire simulation...
void incrBeaconPckRx_by_NODE()
Increase the number of BEACON packets received by the SN during a single cycle BEACON-PROBE-POLL-DATA...
virtual void state_BEACON_tx()
HN initialize the BEACON packet that will be forwarded in broadcast at all SNs of the network.
UWUFETCH_NODE_STATUS_CHANGE last_reason
Last reason because the SN or HN change its state.
virtual void state_DATA_HN_finish_tx()
HN has finished to transmit the sequence of DATA packets promises to the AUV with the exchange of pre...
int getTotalPollPckTx_by_HN()
Total number of POLL packets transmitted by the HN during an entire simulation.
double T_max_bck_DATA
Upper bound time interval from which the HN choice its backoff timer before to transmit a DATA packet...
int getTotalCtsPckRx_corrupted_HN()
Total number of corrupted CTS packets received by the HN during an entire simulation.
virtual void state_DATA_NODE_finish_tx()
SN has finished to transmit the last DATA packet promises with a PROBE packet to a specif HN.
void incrTotalBeaconPckRx_corrupted_by_NODE()
Increase the total number of corrupted BEACON packets received by SN during an entire duration of sim...
double T_MIN_BACKOFF_PROBE
Lower bound timer interval of back-off value used by the SN to choice its back-off time before to tra...
int n_BEACON_pck_tx_by_HN
Number of BEACON packet transmitted by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of...
double bck_before_tx_RTS
Time value choice by the HN and used for transmit a RTS packet to the AUV.
virtual void state_DATA_HN_first_tx_without()
HN initialize the FIRST DATA packet that will be forwarded to the AUV node.
virtual void DataBeforeTxTOExpired_HN()
Backoff timeout is expired.
bool CTSrx
true HN has received a CTS packet after the transmission of RTS
virtual void CBEACON_tx()
HN transmit the BEACON packet.
virtual void BEACON_rx()
SN received a BEACON packet.
void incrCBeaconPckRx_by_NODE()
Increase the number of CBEACON packets received by the SN during a single cycle BEACON-PROBE-POLL-DAT...
UWUFETCH_NODE_STATUS prev_state
Previous state in which the SN or HN it was located.
virtual bool burstDATA()
Indicate whether the transmission of DATA packets to the AUV take place with or without burst data.
double T_GUARD
Guard interval used for successive transmission of DATA packets.
int getTotalTriggerPckRx_corrupted_HN()
Total number of corrupted TRIGGER packets received by the HN during an entire simulation.
virtual void state_DATA_HN_finish_tx_without()
HN has finished to transmit the sequence of DATA packets to the AUV.
void incrDataPckTx_by_NODE()
Increase the number of DATA packets transmitted by the SN during a single cycle BEACON-PROBE-POLL-DAT...
int n_tot_CTS_pck_rx_corr_by_HN
Total number of corrupted CTS packets received by the HN during an entire simulation.
virtual void Phy2MacEndTx_HN(const Packet *p)
Handle the end-of-PHY-transmission event for HEAD NODE.
int n_DATA_pck_tx_by_NODE
Number of DATA transmitted by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of the simu...
int n_tot_DATA_pck_tx_by_HN
Total number of DATA packets transmitted by the HN during an entire simulation.
Packet * curr_RTS_HN_pck_tx
Pointer to the RTS packet that is being transmitted by HN.
int MAX_POLLED_NODE
Maximum number of PROBE packets that the HN can receive from the SN after the transmission of a BEACO...
virtual void Phy2MacStartRx_HN(const Packet *p)
Handle the detected-start-of-PHY-reception event for HEAD NODE.
bool txDATAEnabledHN
true if HN is enabled to transmit a DATA packet to the AUV
virtual double choiceBackOffTimer_HN()
Choose the backoff timeout used by HN before to transmit a RTS packet.
int getBeaconPckRx_by_NODE()
Number of BEACON packets received by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of t...
int getDataPckRx_by_HN()
Number of DATA packets transmitted by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of ...
int getTotalProbePckRx_corrupted_HN()
Total number of corrupted PROBE packets received by the HN during an entire simulation.
int n_tot_PROBE_pck_tx_by_NODE
Total number of PROBE packets transmitted by SN during an entire duration of simulation.
double T_POLL
Interval time in which the SN wait a POLL packet from the HN.
void incrProbePckRx_HN()
Increase number of PROBE packets received by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEA...
double bck_before_tx_data
Time value chosen by the HN and used by It for transmit a DATA packet to the AUV.
virtual void stateIdle_HN()
Idle state for HN.
double tx_DATA_finish_HN_time
Indicates when HN finished the transmission of DATA packet to the AUV.
double T_PROBE
Interval time in which HN is enabled to received PROBE packets from SNs after the transmission of TRI...
@ UWUFETCH_TIMER_STATUS_FROZEN
@ UWUFETCH_TIMER_STATUS_IDLE
@ UWUFETCH_TIMER_STATUS_RUNNING
@ UWUFETCH_TIMER_STATUS_EXPIRED
static std::map< UWUFETCH_TIMER_STATUS, std::string > statusTimer
Map the UWUFETCH_TIMER_STATUS to the description of the timers.
virtual void BeaconTxTOExpire()
BEACON timeout is expired.
uwUFetch_BackOffTimer BCK_timer_data
Interval time before that the HN transmit his DATA packet to the AUV.
virtual void state_wait_CTS()
HN start to wait a CTS packet for a pre-established time interval.
bool txDATAEnabled
true if SN is enabled to transmit a DATA packet to the HN
double tx_CBEACON_start_HN_time
Indicates when HN started the transmission of CBEACON packet to the SNs.
int num_pck_to_tx_by_NODE
Number of DATA packets that the SN at the instant time of BEACON reception has available to transmit ...
double tx_POLL_start_HN_time
Indicates when HN started the transmission of POLL packet to a specific SN.
virtual int crLayCommand(ClMessage *m)
Cross-Layer messages interpreter.
int MAX_ALLOWED_CBEACON_TX
bool rxCTSEnabled
true if HN is enabled to receive a CTS packet from the AUV
Packet * curr_CBEACON_HN_pck_tx
Pointer to the CBEACON packet that is being transmitted by HN.
double Trts
Time needed to transmit a RTS packet.
virtual void state_DATA_HN_first_tx()
HN initialize the FIRST DATA packet that will be forwarded to the AUV node.
virtual void DATA_rx()
HN has received a BEACON packet from SN.
virtual void BCKTOExpired_HN()
Backoff timeout is expired.
int getBeaconTx_by_HN()
Number of BEACON packet transmitted by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of...
virtual void computeTxTime_HN(UWUFETCH_NODE_PACKET_TYPE tp)
Compute the transmission time for the packets transmitted by the HNs.
virtual void BCKTOExpired()
Handle the.
virtual void printStateInfo(double delay=0)
Prints a file with every state change for debug purposes.
virtual void ProbeTOExpired()
Probe timeout is expired.
std::ofstream out_file_logging
Variable that handle the file in which the protocol write the statistics.
virtual void Phy2MacEndRx_HN(Packet *p)
Handle the end-of-PHY-reception event for HEAD NODE.
double tx_RTS_finish_HN_time
Indicates when HN finished the transmission of RTS packet to the AUV.
double T_max_bck_probe_node
Upper bound timer interval used by the SN to choice the interval time before to transmit a PROBE pack...
virtual void Phy2MacEndRx_HN_without(Packet *p)
Handle the end-of-PHY-reception event for HEAD NODE in the case that the communication don't use RTS-...
double rx_TRIGGER_start_HN_time
Indicates when HN started the reception of TRIGGER packet from the AUV.
double TIME_BETWEEN_2_TX_DATA_NODE_HN
Interval time used by the SN before to transmit the next DATA packet to the HN.
int n_CBEACON_pck_tx_by_HN
Number of CBEACON packet transmitted by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON o...
virtual void state_wait_other_PROBE()
HN start to wait the second or successive PROBE packet from some SNs.
int n_tot_DATA_pck_rx_corr_by_HN
Total number of corrupted DATA packets received by the HN during an entire simulation.
virtual void BCKTOExpired_HN_without()
Backoff timeout is expired.
double TIME_BETWEEN_2_TX_DATA_HN_AUV
Interval time used by HN before to transmit the next DATA packet to the AUV.
virtual void updateListProbbedNode()
Update the list of the SN from which HN has received the PROBE packets.
int getTriggerPckRx_HN()
Number of TRIGGER packets received by the HN during a single cycle TRIGGER-RTS-CTS-DATA of the simula...
int mac_addr_HN_in_beacon
HN MAC address from which the SN has received PROBE packet.
virtual void DATA_HN_tx_without()
HN transmit a DATA packet to the AUV.
static bool initialized
Indicate if the protocol has been initialized or not.
double rx_DATA_finish_HN_time
Indicates when HN finished the reception of DATA packet from the SNs.
int getTotalDataPckRx_by_HN()
Total number of DATA packets correctly or not received by the HN during an entire simulation.
double T_max_bck_RTS
Upper bound interval time from which the HN choice his backoff timer before to transmit a RTS packet ...
int n_tot_POLL_pck_tx_by_HN
Total number of POLL packets transmitted by the HN during an entire simulation.
int getTotalPollPckRx_by_NODE()
Total number of POLL packets received correctly or not by SN during an entire duration of simulation.
void incrPollPckTx_by_HN()
Increase the number of POLL packets transmitted by the HN during a single cycle BEACON-PROBE-POLL-DAT...
double T_min_bck_RTS
Lower bound interval time from which the HN choice its backoff timer before to transmit a RTS packet ...
void incrTotalTriggerPckRx_HN()
Increase the total number of TRIGGER packets correctly or not received by the HN during an entire sim...
int debugMio_
Used if we want to create the logging file.
int n_tot_RTS_pck_tx_by_HN
Total number of RTS packets transmitted by the HN during an entire simulation.
void incrTotalDataPckRx_corrupted_by_HN()
Increase total number of corrupted DATA packets received by the HN during an entire simulation.
virtual void Mac2PhyStartTx_HN(Packet *p)
This method must be called by the HN-MAC to instruct the PHY to start the transmission of a packet.
bool txRTSEnabled
true if HN is enabled to transmit a RTS packet to the AUV
virtual double getDataTimerValue()
Compute the interval time within HN want to receive all DATA packets from a specific SN.
void incrBeaconPckTx_by_HN()
Increase the number of BEACON packet transmitted by the HN during a single cycle BEACON-PROBE-POLL-DA...
int n_tot_POLL_pck_rx_corr_by_NODE
Total number of POLL packets received corrupted by SN during an entire duration of simulation.
int getTotalCBeaconPckTx_by_HN()
Total number of CBEACON packets transmitted by the HN during an entire simulation.
int getTotalDataPckTx_by_NODE()
Total number of DATA packets transmitted by SN during an entire duration of simulation.
bool sectionCBeacon
true HN has started the transmission of RTS packet when It was in the CBEACON section.
int number_data_pck_HN_rx_exact
Exact number of DATA packets that the HN want to receive from the SN that have polled.
int getTotalTriggerPckRx_HN()
Total number of TRIGGER packets correctly or not received by the HN during an entire simulation.
virtual void refreshReason(UWUFETCH_NODE_STATUS_CHANGE reason)
Refresh the reason for the changing of the state.
int getTotalDataPckRx_corrupted_by_HN()
Total number of corrupted DATA packets received by the HN during an entire simulation.
int n_tot_POLL_pck_rx_by_NODE
Total number of POLL packets received correctly or not by SN during an entire duration of simulation.
Packet * curr_TRIGGER_HN_pck_rx
Pointer to the TRIGGER packet that is being received by HN.
int mac_addr_HN_in_cbeacon
HN MAC address from which the SN has received the CBEACON packet.
Packet * curr_POLL_NODE_pck_rx
Pointer to the POLL packet that is being received by SN.
int HEADNODE
Indicate if the node work as HEAD NODE or SENSOR NODE.
int MODE_COMM_HN_AUV
Indicate the type of communication between HN and AUV, 0 = communication with RTS-CTS,...
int getTotalProbePckRx_HN()
Total number of PROBE packets correctly or not received by the HN during an entire simulation.
double rx_PROBE_start_HN_time
Indicates when HN started the reception of PROBE packet from the SNs.
bool txBEACONEnabled
true if HN is enabled to transmit a BEACON packet to the SN
int mac_addr_AUV_in_trigger
AUV-MAC address contained in the TRIGGER packet received by the HN.
int getTotalBeaconPckRx_corrupted_by_NODE()
Total number of corrupted BEACON packets received by SN during an entire duration of simulation.
int getPollPckTx_by_HN()
Number of POLL packet transmitted by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of t...
Packet * curr_BEACON_HN_pck_tx
Pointer to the BEACON packet that is being transmitted by HN.
virtual void Phy2MacEndRx(Packet *p)
Handle the end-of-PHY-reception event.
void incrDataPckTx_by_HN()
Increase the number of DATA packets transmitted by the HN during a single cycle TRIGGER-RTS-CTS-DATA ...
bool rxPROBEEnabled
true if HN is enabled to receive a PROBE packet from the SN
bool txPROBEEnabled
true if SN is enabled to transmit a PROBE packet to the HN
std::queue< Packet * > Q_data_HN
Queue of DATA packets stored by the HNs and received from SN.
void incrTotalPollPckRx_corrupted_by_NODE()
Increase the total number of corrupted POLL packets received by SN during an entire duration of simul...
virtual void state_DATA_HN_tx()
HN initialize the second and successive DATA packets that will be forwarded to the AUV node.
virtual void BEACON_tx()
HN transmit the BEACON packet.
int getDataPckTx_by_NODE()
Number of DATA packets transmitted by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of ...
Packet * curr_DATA_NODE_pck_tx_HN
Pointer to the DATA packet that is being transmitted by HN.
int getTotalBeaconTx_by_HN()
Total number of BEACON packets transmitted by the HN during an entire simulation.
double tx_DATA_start_time
Indicates when SN start a transmission of DATA packet to the HN.
int MAXIMUM_BUFFER_DATA_PCK_NODE
Maximum number of DATA packets that the SN can store in Its queue.
virtual void DATA_NODE_tx()
SN transmit a DATA packet to a specific HN.
std::ofstream fout
Variable that handle the file in which the protocol write the state transition for debug purposes.
int n_tot_DATA_pck_rx_by_HN
Total number of DATA packets correctly or not received by the HN during an entire simulation.
double T_MAX_BACKOFF_PROBE
Upper bound timer interval of back-off value used by the SN to choice its back-off time before to tra...
void incrTotalPollPckTx_by_HN()
Increase the total number of POLL packets transmitted by the HN during an entire simulation.
int n_BEACON_pck_rx_by_NODE
Number of BEACON receive by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of the simula...
double tx_BEACON_start_HN_time
Indicates when HN started the transmission of BEACON packet to the SNs.
double rx_CTS_start_HN_time
Indicates when HN started the reception of CTS packet from the AUV.
void incrDataPckRx_by_HN()
Increase the number of DATA packets transmitted by the HN during a single cycle BEACON-PROBE-POLL-DAT...
bool txPOLLEnabled
true if HN is enabled to transmit a POLL packet to the SN
virtual void initInfo()
Initialize the protocol at the beginning of the simulation.
virtual void state_wait_PROBE()
HN start to wait the FIRST PROBE packet from some SNs.
double rx_CBEACON_start_time
Indicates when SN started the reception of CBEACON packet from HN.
int pck_number_id
Unique identifier of the DATA packet received.
virtual void Mac2PhyStartTx(Packet *p)
This method must be called by the SN-MAC to instruct the PHY to start the transmission of a packet.
std::queue< int > Q_probbed_mac_HN
Queue that store the MAC address of the SN from which the HN has received correctly the PROBE packets...
virtual void CBeaconTOExpired()
CBEACON timeout is expired.
bool rxTRIGGEREnabled
true if HN is enabled to receive a TRIGGER packet from the AUV
int num_cbeacon_at_now_HN_tx
NUmber of CBEACON packets transmitted by the HN during the single cycle BEACON-PROBE-POLL-DATA-CBEACO...
int getTotalCBeaconPckRx_by_NODE()
Total number of CBEACON packets received correctly or not by SN during an entire duration of simulati...
void incrTotalBeaconPckTx_by_HN()
Increase the total number of BEACON packets transmitted by the HN during an entire simulation.
double rx_DATA_start_HN_time
Indicates when HN started the reception of DATA packet from the SNs.
void incrTotalBeaconPckRx_by_NODE()
Increase the total number of BEACON packets received correctly or not by SN during an entire duration...
double bck_before_tx_probe
Backoff time choiced by SN before to transmit a PROBE packet to the HN.
int n_CBEACON_pck_rx_by_NODE
Number of CBEACON received by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of the simu...
virtual void state_DATA_HN_tx_without()
HN initialize the second and successive DATA packets that will be forwarded to the AUV node.
double tx_RTS_start_HN_time
Indicates when HN started the transmission of RTS packet to the AUV.
double T_min_bck_probe_node
Lower bound timer interval used by the SN to choice the interval time before to transmit a PROBE pack...
virtual double getRTT()
Compute the round trip time.
virtual void state_wait_first_DATA()
HN start to wait the FIRST DATA packet from SN.
void incrTotalTriggerPckRx_corrupted_HN()
Increase the total number of corrupted TRIGGER packets received by the HN during an entire simulation...
void incrRtsPckTx_by_HN()
Increase the number of RTS packets transmitted by the HN during a single cycle TRIGGER-RTS-CTS-DATA o...
UWUFETCH_NODE_STATUS curr_state
Current state in which the SN or HN is located.
static std::map< UWUFETCH_NODE_PACKET_TYPE, std::string > packetType
Map the UWUFETCH_NODE_PACKET_TYPE to the description of packet type.
void incrTotalPollPckRx_by_NODE()
Increase the total number of POLL packets received correctly or not by SN during an entire duration o...
int n_POLL_pck_tx_by_HN
Number of POLL packet transmitted by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of t...
void incrTotalDataPckTx_by_HN()
Increase the total number of DATA packets transmitted by the HN during an entire simulation.
int mac_addr_HN_in_poll
HN MAC address from which the SN has received the POLL packet.
virtual void CTS_rx()
HN has received a CTS packet from AUV.
int getDataPckTx_by_HN()
Number of DATA packets transmitted by the HN during a single cycle TRIGGER-RTS-CTS-DATA of the simula...
double T_min_bck_DATA
Lower bound time interval from which the HN choice its backoff timer before to transmit a DATA packet...
uwUFetch_DATA_timer DATA_timer
Schedule the DATA timeout timer.
int getRtsPckTx_by_HN()
Number of RTS packets transmitted by the HN during a single cycle TRIGGER-RTS-CTS-DATA of the simulat...
int getTotalPollPckRx_corrupted_by_NODE()
Total number of corrupted POLL packets received by SN during an entire duration of simulation.
virtual void computeTxTime(UWUFETCH_NODE_PACKET_TYPE tp)
Compute the transmission time for the packets transmitted by the SNs.
virtual void DataTOExpired()
DATA timeout is expired.
void incrTotalCtsPckRx_HN()
Increase the total number of CTS packets correctly or not received by the HN during an entire simulat...
virtual void DATA_HN_tx()
HN transmit a DATA packet to the AUV.
void incrProbePckTx_by_NODE()
Increase the number of PROBE packets transmitted by the SN during a single cycle BEACON-PROBE-POLL-DA...
int max_pck_HN_can_tx
Maximum number of DATA packets that AUV want to receive from HN.
double Tdata_HN
Time needed to transmit a DATA packet.
int getTotalCBeaconPckRx_corrupted_by_NODE()
Total number of corrupted CBEACON packets received by SN during an entire duration of simulation.
Packet * curr_BEACON_NODE_pck_rx
Pointer to the BEACON packet that is being received by SN.
int n_tot_PROBE_pck_corr_rx_by_HN
Total number of corrupted PROBE packets received by the HN during an entire simulation.
int getTotalCtsPckRx_HN()
Total number of CTS packets correctly or not received by the HN during an entire simulation.
virtual void state_CBEACON_tx()
HN initialize the CBEACON packet that will be forwarded in broadcast at all SNs of the network.
int n_PROBE_pck_rx_by_HN
Number of PROBE packet received by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of the...
uwUFetch_BackOffTimer BCK_timer_probe
Interval time in which HN is enabled to receive PROBE packets from SNs.
int n_tot_CBEACON_pck_rx_by_NODE
Total number of CBEACON packets received correctly or not by SN during an entire duration of simulati...
double tx_DATA_finish_time
Indicates when SN finished a transmission of DATA packet to the HN.
int getTotalDataPckTx_by_HN()
Total number of DATA packets transmitted by the HN during an entire simulation.
void incrTriggerPckRx_HN()
Increase the number of TRIGGER packets received by the HN during a single cycle TRIGGER-RTS-CTS-DATA ...
double Tbeacon
Time needed to transmit a BEACON packet.
virtual void PROBE_rx()
HN has received a PROBE packet from SN.
uwUFetch_BackOffTimer BCK_timer_rts
Schedule the backoff timeout timer.
uwUFetch_DATA_BEFORE_TX_timer DATA_BEFORE_TX_timer
virtual void CBEACON_rx()
SN has received a CBEACON packet from HN.
void incrCBeaconPckTx_by_HN()
Increase the number of CBEACON packets transmitted by the HN during a single cycle BEACON-PROBE-POLL-...
double rx_POLL_start_time
Indicates when SN started the reception of POLL packet from HN.
int n_CTS_pck_rx_by_HN
Number of CTS packet received by the HN during a single cycle TRIGGER-RTS-CTS-DATA of the simulation.
virtual void state_PROBE_tx()
SN initialize the PROBE packet that will be forwarded to a specific HN.
virtual void state_wait_other_DATA()
HN start to wait the second or successive DATA packet from SN.
bool rxPOLLEnabled
true if SN is enabled to receive a POLL packet from the HN
virtual bool typeCommunication()
Indicate if the communiation between HN and AUV take place with or without RTS and CTS packets.
int n_tot_CBEACON_pck_tx_by_HN
Total number of CBEACON packets transmitted by the HN during an entire simulation.
double rx_BEACON_start_time
Indicates when SN started the reception of BEACON packet from HN.
virtual void recvFromUpperLayers_HN(Packet *p)
Handle a packet coming from upper layers of HN.
int n_tot_DATA_pck_tx_by_NODE
Total number of DATA packets transmitted by the SN during an entire duration of simulation.
int n_TRIGGER_pck_rx_by_HN
Number of TRIGGER packet received by the HN during a single cycle TRIGGER-RTS-CTS-DATA of the simulat...
void incrTotalProbePckRx_HN()
Increase total number of PROBE packets correctly or not received by the HN during an entire simulatio...
virtual void TRIGGER_rx_without()
HN has received a TRIGGER packet from AUV.
int MAX_PAYLOAD
Maximum size of payload DATA packet.
virtual void PollTOExpired()
POLL timeout is expired.
virtual void recvFromUpperLayers(Packet *p)
Handle a packet coming from upper layers of SN.
double tx_PROBE_start_time
Indicates when SN start a transmission of PROBE packet.
double Tdata_NODE_pck
Time duration need for SN for transmit a DATA packet to the HN.
double Tdata_NODE
Time duration needed for SN to transmit a DATA packet to the HN.
int n_tot_BEACON_pck_rx_by_NODE
Total number of BEACON packets received correctly or not by SN during an entire duration of simulatio...
void incrTotalCBeaconPckRx_by_NODE()
Increase the total number of CBEACON packets received correctly or not by SN during an entire duratio...
double tx_BEACON_finish_HN_time
Indicates when HN finished the transmission of BEACON packet to the SNs.
virtual void state_wait_CBEACON()
SN wait a CBEACON packet for a pre-established interval time.
int mac_addr_NODE_polled
SN-MAC address of the node that the HN is going to be poll and from which It want to receive DATA pac...
virtual bool isHeadNode()
Indicate if the node created work as head node or sensor node.
uwUFetch_BEACON_timer BeaconBeforeTx_timer
Schedule the BEACON timeout timer.
double tx_PROBE_finish_time
Indicates when SN finished a transmission of PROBE packet.
UWUFETCH_NODE_PACKET_TYPE
@ UWUFETCH_NODE_PACKET_TYPE_CTS
@ UWUFETCH_NODE_PACKET_TYPE_PROBE
@ UWUFETCH_NODE_PACKET_TYPE_BEACON
@ UWUFETCH_NODE_PACKET_TYPE_RTS
@ UWUFETCH_NODE_PACKET_TYPE_DATA
@ UWUFETCH_NODE_PACKET_TYPE_POLL
@ UWUFETCH_NODE_PACKET_TYPE_TRIGGER
virtual double choiceBackOffTimer()
Choose the backoff timeout used by SN before to transmit a PROBE packet.
int MODE_BURST_DATA
Indicate if it's used or not the burst data.
virtual void POLL_tx()
HN transmit POLL packet to a specific SN of th network.
void incrTotalDataPckTx_by_NODE()
Increase the total number of DATA packets transmitted by SN during an entire duration of simulation.
int n_DATA_pck_rx_by_HN
Number of DATA packet received by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of the ...
virtual void TRIGGER_rx()
HN has received a TRIGGER packet from AUV.
virtual void stateIdle_NODE()
Idle state for SN.
bool txRTSbeforeCBEACON
true HN block the transmission of CBEACON because It try to communicate with the AUV.
double tx_DATA_start_HN_time
Indicates when HN started the transmission of DATA packet to the AUV.
virtual void Phy2MacStartRx(const Packet *p)
Handle the detected-start-of-PHY-reception event for SENSOR NODE.
virtual ~uwUFetch_NODE()
Destructor of uwUFetch_NODE class.
Packet * curr_PROBE_HN_pck_rx
Pointer to the PROBE packet that is being received by HN.
uwUFetch_PROBE_timer PROBE_timer
Schedule the PROBE timeout timer.
UWUFETCH_NODE_STATUS_CHANGE
@ UWUFETCH_NODE_STATUS_CHANGE_DATA_MAX_ALLOWED_PCK_RX_0_NODE_TO_POLL_NO_OTHER_CBEACON
@ UWUFETCH_NODE_STATUS_CHANGE_DATA_PCK_TX
@ UWUFETCH_NODE_STATUS_CHANGE_MAX_DATA_PCK_TX
@ UWUFETCH_NODE_STATUS_CHANGE_DATA_MAX_ALLOWED_PCK_RX_0_NODE_TO_POLL_YES_OTHER_CBEACON
@ UWUFETCH_NODE_STATUS_CHANGE_TRIGGER_RX
@ UWUFETCH_NODE_STATUS_CHANGE_DATA_RX
@ UWUFETCH_NODE_STATUS_CHANGE_PROBE_TX
@ UWFETCH_NODE_STATUS_CHANGE_CBEACON_RX_DATA_ALREADY_TX
@ UWUFETCH_NODE_STATUS_CHANGE_DATA_TO_EXPIRED_ANOTHER_NODE_TO_POLL
@ UWUFETCH_NODE_STATUS_CHANGE_TO_WAIT_POLL_EXPIRED
@ UWUFETCH_NODE_STATUS_CHANGE_CBEACON_ALLOWED_TX_0_PROBE_RX
@ UWUFETCH_NODE_STATUS_CHANGE_DATA_TO_EXPIRED_0_NODE_TO_POLL_YES_OTHER_CBEACON
@ UWUFETCH_NODE_STATUS_CHANGE_CBEACON_TX
@ UWUFETCH_NODE_STATUS_CHANGE_CBEACON_MAX_ALLOWED_TX
@ UWUFETCH_NODE_STATUS_CHANGE_HN_RX_TRIGGER_FROM_AUV_CORRUPTED
@ UWUFETCH_NODE_STATUS_CHANGE_RTS_TX
@ UWFETCH_NODE_STATUS_CHANGE_PACKET_UNKNOWN_TYPE
@ UWUFETCH_NODE_STATUS_CHANGE_PROBE_RX
@ UWUFETCH_NODE_STATUS_CHANGE_LAST_DATA_PCK_RX
@ UWUFETCH_NODE_STATUS_CHANGE_DATA_TO_EXPIRED
@ UWFETCH_NODE_STATUS_CHANGE_STATE_IDLE
@ UWUFETCH_NODE_STATUS_CHANGE_DATA_TO_EXPIRED_0_NODE_TO_POLL_NO_OTHER_CBEACON
@ UWUFETCH_NODE_STATUS_CHANGE_CBEACON_MAX_ALLOWED_TX_0_PROBE_RX
@ UWUFETCH_NODE_STATUS_CHANGE_POLL_TX
@ UWUFETCH_NODE_STATUS_CHANGE_POLL_RX
@ UWUFETCH_NODE_STATUS_CHANGE_DATA_MAX_ALLOWED_PCK_RX_YES_NODE_TO_POLL
@ UWUFETCH_NODE_STATUS_CHANGE_CTS_RX
@ UWUFETCH_NODE_STATUS_CHANGE_BEACON_RX
@ UWUFETCH_NODE_STATUS_CHANGE_BEACON_TO_EXPIRED
@ UWUFETCH_NODE_STATUS_CHANGE_TO_WAIT_CTS_EXPIRED
@ UWUFETCH_NODE_STATUS_CHANGE_TO_EXPIRED_AT_LEAST_1_PROBE_RX
@ UWUFETCH_NODE_STATUS_CHANGE_TRIGGER_RX_BUT_HN_NO_DATA_TO_TX
@ UWFETCH_NODE_STATUS_CHANGE_PACKET_FOR_ANOTHER_NODE
@ UWFETCH_NODE_STATUS_CHANGE_PACKET_ERROR
@ UWUFETCH_NODE_STATUS_CHANGE_BEACON_TX
@ UWUFETCH_NODE_STATUS_CHANGE_HN_FINISH_TX_DATA_PCK_TO_AUV_RETURN_CBEACON_TX
@ UWUFETCH_NODE_STATUS_CHANGE_HN_TX_ALL_DATA_TO_AUV
@ UWUFETCH_NODE_STATUS_CHANGE_MAX_PROBE_RX_PROBE_TO_NOT_EXPIRED
Packet * curr_CBEACON_NODE_pck_rx
Pointer to the CBEACON packet that is being received by SN
double Tpoll
Time needed to transmit a POLL packet.
int getProbePckRx_HN()
Number of PROBE packets received by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of th...
double rx_CBEACON_finish_time
Indicates when SN finished the reception of BEACON packet from HN.
bool rxBEACONEnabled
true if SN is enabled to receive a BEACON packet from the HN
bool dataAlreadyTransmitted
Indicate whether the SN has transmit at least one DATA packets during the cycle BEACON-PROBE-POLL-DAT...
int getTotalRtsPckTx_by_HN()
Total number of RTS packets transmitted by the HN during an entire simulation.
double rx_TRIGGER_finish_HN_time
Indicates when HN finished the reception of TRIGGER packet from the AUV.
double Tprobe
Time duration needed for SN to transmit a PROBE packet to the HN.
int MAX_PCK_HN_WANT_RX_FROM_NODE
int getTotalProbePckTx_by_NODE()
Total number of PROBE packets transmitted by SN during an entire duration of simulation.
bool txCBEACONEnabled
true if HN is enabled to transmit a CBEACON packet to the SN
double RTT
Round trip time value.
Packet * curr_POLL_HN_pck_tx
Pointer to the POLL packet that is being transmitted by HN.
int getCtsPckRx_HN()
Number of CTS packets received by the HN during a single cycle TRIGGER-RTS-CTS-DATA of the simulation...
static std::map< UWUFETCH_NODE_STATUS_CHANGE, std::string > statusChange
Map the UWUFETCH_NODE_STATUS_CHANGE to the description the reason of changing state.
static std::map< UWUFETCH_NODE_STATUS, std::string > statusInfo
Map the UWUFETCH_NODE_STATUS to the description of each state.
int n_tot_CBEACON_pck_rx_corr_by_NODE
Total number of CBEACON packets received corrupted by the SN during an entire duration of simulation.
int mac_addr_AUV_in_CTS
AUV-MAC address contained int the CTS packet received by HN.
int PRINT_TRANSITIONS_INT
0 reason because the SN or HN is passed from a state to another state is not logged in a file
virtual void state_DATA_NODE_first_tx()
SN initialize the FIRST DATA packet that will be forwarded to a specific HN.
void incrTotalProbePckRx_corrupted_HN()
Increase the total number of corrupted PROBE packets received by the HN during an entire simulation.
void incrTotalProbePckTx_by_NODE()
Increase the total number of PROBE packets transmitted by SN during an entire duration of simulation.
virtual void state_POLL_tx()
HN initialize the POLL packet that will be forwarded to a specific SN of the network.
Packet * curr_DATA_HN_pck_tx
Pointer to the DATA packet that is being transmitted by HN to the AUV.
int getPollPckRx_by_NODE()
Number of POLL packets received by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of the...
double T_START_PROCEDURE_HN_NODE
Time within HN is enabled to received a TRIGGER packet from AUV.
int n_tot_CTS_pck_rx_by_HN
Total number of CTS packets correctly or not received by the HN during an entire simulation.
std::queue< int > Q_data_source_SN
Queue that contain the MAC address from which the HN has received the DATA packet.
virtual void state_wait_POLL()
SN wait a POLL packet from a specific HN.
std::queue< Packet * > Q_data
Queue of DATA packets stored by the SN.
virtual void CtsTOExpired()
CTS timeout is expired.
virtual void state_RTS_tx()
HN initialize the RTS packet that will be forwarded to the AUV.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
int max_data_HN_can_tx
Maximum number of DATA packets that the HN must transmit to the AUV.
uwUFetch_POLL_timer POLL_timer
Interval time in which SN is enabled to receive POLL packet from the specific HN.
int n_PROBE_pck_tx_by_NODE
Number of PROBE transmitted by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of the sim...
int n_tot_TRIGGER_pck_rx_by_HN
Total number of TRIGGER packets correctly or not received by the HN during an entire simulation.
virtual void PROBE_tx()
Transmission of PROBE packet by SN to the specific HN.
int mac_addr_NODE_in_data
Mac address of the node from which the HN has received a DATA packet.
double Tdata_HN_pck
Time to transmit a DATA packet by the HN.
int n_DATA_pck_tx_by_HN
Number of DATA packet transmitted by the HN during a single cycle TRIGGER-RTS-CTS-DATA of the simulat...
void incrTotalRtsPckTx_by_HN()
Increase the total number of RTS packets transmitted by the HN during an entire simulation.
uwUFetch_CTS_timer CTS_timer
Schedule the CTS timeout timer.
void incrPollPckRx_by_NODE()
Increase the number of POLL packets received by the SN during a single cycle BEACON-PROBE-POLL-DATA-C...
double rx_CTS_finish_HN_time
Indicates when HN finished the reception of CTS packet from the SNs.
int n_tot_TRIGGER_pck_rx_corr_by_HN
Total number of corrupted TRIGGER packets received by the HN during an entire simulation.
std::queue< int > Q_probbed_n_pcks_NODE_want_tx_HN
Queue that store the number of DATA packets that the single SN want to tx to the HN.
virtual void RTS_tx()
HN transmit a RTS packet to the AUV.
double rx_PROBE_finish_HN_time
Indicates when HN finished the reception of PROBE packet from the SNs.
Packet * curr_DATA_HN_pck_rx
Pointer to the DATA packet that is being received by HN from SN.
double tx_CBEACON_finish_HN_time
Indicates when HN finished the transmission of CBEACON packet to the SNs.
int n_RTS_pck_tx_by_HN
Number of RTS packet transmitted by the HN during a single cycle TRIGGER-RTS-CTS-DATA of the simulati...
virtual void waitForUser()
Method used for debug.
void incrTotalCtsPckRx_corrupted_HN()
Increase the total number of corrupted CTS packets received by the HN during an entire simulation.
Packet * curr_CTS_HN_pck_rx
Pointer to the CTS packet that is being received by HN.
Packet * curr_DATA_NODE_pck_tx
Pointer to the DATA packet that is being transmitted by SN.
virtual void state_DATA_NODE_tx()
SN initialize the second or successive DATA packet that will be forwarded to a specific HN.
void incrTotalCBeaconPckTx_by_HN()
Increase the total number of CBEACON packets transmitted by the HN during an entire simulation.
int getCBeaconPckTx_by_HN()
Number of CBEACON packets transmitted by the HN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON ...
virtual void POLL_rx()
SN has received a POLL packet from a specific HN.
bool rxDATAEnabled
true if HN is enabled to receive a DATA packet from teh SN
bool print_transitions
true if the writing of state transitions in the file is enabled.
int getProbePckTx_by_NODE()
Number of PROBE packets transmitted by the SN during a single cycle BEACON-PROBE-POLL-DATA-CBEACON of...
virtual void refreshState(UWUFETCH_NODE_STATUS state)
int n_tot_BEACON_pck_tx_by_HN
Total number of BEACON packets transmitted by the HN during an entire simulation.
virtual void Phy2MacEndTx(const Packet *p)
Handle the end-of-PHY-transmission event.
virtual void DataBeforeTxTOExpired()
Data timeout.
UWUFETCH_NODE_STATUS
< States in which SN or HN may be during Its execution
@ UWUFETCH_NODE_STATUS_PROBE_RX
@ UWUFETCH_NODE_STATUS_WAIT_CBEACON_PACKET
@ UWUFETCH_NODE_STATUS_POLL_TX
@ UWUFETCH_NODE_STATUS_WAIT_CTS_PACKET
@ UWUFETCH_NODE_STATUS_CBEACON_RECEIVE
@ UWUFETCH_NODE_STATUS_TRIGGER_RECEIVE
@ UWUFETCH_NODE_STATUS_POLL_RECEIVE
@ UWUFETCH_NODE_STATUS_BEACON_RECEIVE
@ UWUFETCH_NODE_STATUS_CTS_RECEIVE
@ UWUFETCH_NODE_STATUS_WAIT_DATA_NODE
@ UWUFETCH_NODE_STATUS_WAIT_POLL_PACKET
@ UWUFETCH_NODE_STATUS_TRANSMIT_PROBE
@ UWUFETCH_NODE_STATUS_WAIT_PROBE_PACKET
@ UWUFETCH_NODE_STATUS_DATA_RX
@ UWUFETCH_NODE_STATUS_TRANSMIT_DATA
@ UWUFETCH_NODE_STATUS_TRANSMIT_BEACON
@ UWUFETCH_NODE_STATUS_IDLE
@ UWUFETCH_NODE_STATUS_RTS_TRANSMIT
void incrCtsPckRx_HN()
Increase the number of CTS packets received by the HN during a single cycle TRIGGER-RTS-CTS-DATA of t...
int num_cbeacon_node_rx
Number of CBEACON that the node have received from the specific HN before to receive an another BEACO...
int n_tot_BEACON_pck_rx_corr_by_NODE
Total number of BEACON packets received corrupted by SN during an entire duration of simulation.
Internal structure where the AUV store the informations about the node to POLL.
int & n_pcks_NODE_want_tx()
Reference to the n_pcks_NODE_want_tx_ variable.
uint & Id_node()
Reference to the id_node variable.
int & mac_address()
Reference to the mac_address variable.
double & backoff_time()
Reference to the back-off_time_ variable.
packet_t PT_POLL_UFETCH
POLL packet type for UFetch protocol.
packet_t PT_CBEACON_UFETCH
CBEACON packet type for UFetch protocol.
packet_t PT_CTS_UFETCH
CTS packet type for UFetch protocol.
packet_t PT_TRIGGER_UFETCH
TRIGGER packet type for UFetch protocol.
packet_t PT_BEACON_UFETCH
BEACON packet type for UFetch protocol.
packet_t PT_PROBE_UFETCH
PROBE packet type for UFetch protocol.
packet_t PT_RTS_UFETCH
RTS packet type for UFetch protocol.
std::pair< int, int > counter
counter of collisions